route-graphics 1.17.3 → 1.17.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ Deprecated since v${r}`):(i=i.split(`
3
3
  `).splice(t).join(`
4
4
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e}
5
5
  Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e}
6
- Deprecated since v${r}`),console.warn(i))),u0[e]=!0}var u0,ne,h0,Xe=v(()=>{"use strict";u0={},ne="8.0.0",h0="8.3.4"});var Cs,Bm=v(()=>{"use strict";Cs=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;t<e;t++)this._pool[this._index++]=new this._classType;this._count+=e}get(e){let t;return this._index>0?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 km,le,Wt=v(()=>{Bm();km=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 Cs(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}},le=new km});var d0,f0=v(()=>{Xe();d0={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){Y("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(r)}}});function lh(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<o;++s)r[s]=r[s+t];r.length=o}var Fm=v(()=>{"use strict"});var p0,m0=v(()=>{Fm();Xe();p0={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)}lh(this.children,r,t);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this)}return s.length>0&&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||Y(ne,"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 g0,x0=v(()=>{"use strict";g0={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<s;o++)i[o].collectRenderables(r,e,t)},collectRenderablesWithEffects(r,e,t){let{renderPipes:i}=e;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];i[o.pipe].push(o,this,r)}this.collectRenderablesSimple(r,e,t);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];i[o.pipe].pop(o,this,r)}}}});var bi,ch=v(()=>{"use strict";bi=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let e=0;e<this.filters.length;e++)this.filters[e].destroy();this.filters=null,this.filterArea=null}}});var Om,uh,y0=v(()=>{L();Wt();Om=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<this._tests.length;t++){let i=this._tests[t];if(i.test(e))return le.get(i.maskClass,e)}return e}returnMaskEffect(e){le.return(e)}},uh=new Om;$.handleByList(w.MaskEffect,uh._effectClasses)});var _0,b0=v(()=>{ch();y0();_0={_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),uh.returnMaskEffect(e),this._maskEffect=null),r!=null&&(this._maskEffect=uh.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 bi);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 bi),this._filterEffect.filterArea=r},get filterArea(){return this._filterEffect?.filterArea}}});var v0,T0=v(()=>{Xe();v0={label:null,get name(){return Y(ne,"Container.name property has been removed, use Container.label instead"),this.label},set name(r){Y(ne,"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<t.length;i++){let s=t[i];if(s.label===r||r instanceof RegExp&&r.test(s.label))return s}if(e)for(let i=0;i<t.length;i++){let o=t[i].getChildByLabel(r,!0);if(o)return o}return null},getChildrenByLabel(r,e=!1,t=[]){let i=this.children;for(let s=0;s<i.length;s++){let o=i[s];(o.label===r||r instanceof RegExp&&r.test(o.label))&&t.push(o)}if(e)for(let s=0;s<i.length;s++)i[s].getChildrenByLabel(r,!0,t);return t}}});var hh,ee,mt=v(()=>{Tr();hh=[new ge,new ge,new ge,new ge],ee=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.x+this.width&&t>=this.y&&t<this.y+this.height}strokeContains(e,t,i,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return!1;let a=this.x,l=this.y,c=i*(1-s),u=i-c,h=a-c,d=a+o+c,f=l-c,m=l+n+c,g=a+u,x=a+o-u,y=l+u,T=l+n-u;return e>=h&&e<=d&&t>=f&&t<=m&&!(e>g&&e<x&&t>y&&t<T)}intersects(e,t){if(!t){let C=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=C)return!1;let M=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>M}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=hh[0].set(e.left,e.top),l=hh[1].set(e.left,e.bottom),c=hh[2].set(e.right,e.top),u=hh[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),m=d*i+f*o,g=d*s+f*o,x=d*i+f*n,y=d*s+f*n;if(Math.max(m,g,x,y)<=d*a.x+f*a.y||Math.min(m,g,x,y)>=d*u.x+f*u.y)return!1;let T=h*(a.y-c.y),p=h*(c.x-a.x),b=T*i+p*o,_=T*s+p*o,S=T*i+p*n,E=T*s+p*n;return!(Math.max(b,_,S,E)<=T*a.x+p*a.y||Math.min(b,_,S,E)>=T*u.x+p*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.x+this.width&&i>=this.y&&i<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}});var S0,Be,Zt=v(()=>{ve();mt();S0=new V,Be=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=S0,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 ee);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=S0,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,m=this.maxX,g=this.maxY,x=n*e+l*t+u,y=a*e+c*t+h;x<d&&(d=x),y<f&&(f=y),x>m&&(m=x),y>g&&(g=y),x=n*i+l*t+u,y=a*i+c*t+h,x<d&&(d=x),y<f&&(f=y),x>m&&(m=x),y>g&&(g=y),x=n*e+l*s+u,y=a*e+c*s+h,x<d&&(d=x),y<f&&(f=y),x>m&&(m=x),y>g&&(g=y),x=n*i+l*s+u,y=a*i+c*s+h,x<d&&(d=x),y<f&&(f=y),x>m&&(m=x),y>g&&(g=y),this.minX=d,this.minY=f,this.maxX=m,this.maxY=g}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.maxX<e.maxX?this.maxX:e.maxX,this.maxY=this.maxY<e.maxY?this.maxY:e.maxY}applyMatrix(e){let t=this.minX,i=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:l,d:c,tx:u,ty:h}=e,d=n*t+l*i+u,f=a*t+c*i+h;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+l*i+u,f=a*s+c*i+h,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.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=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.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=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(e){return this.minX<e.left&&(this.minX=e.left),this.maxX>e.right&&(this.maxX=e.right),this.minY<e.top&&(this.minY=e.top),this.maxY>e.bottom&&(this.maxY=e.bottom),this}fitBounds(e,t,i,s){return this.minX<e&&(this.minX=e),this.maxX>t&&(this.maxX=t),this.minY<i&&(this.minY=i),this.maxY>s&&(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,m=s.ty;for(let g=t;g<i;g+=2){let x=e[g],y=e[g+1],T=c*x+h*y+f,p=u*x+d*y+m;o=T<o?T:o,n=p<n?p:n,a=T>a?T:a,l=p>l?p: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 ct,cr,Ps=v(()=>{ve();Bm();Zt();ct=new Cs(V),cr=new Cs(Be)});var gU,w0,E0=v(()=>{ve();Zt();Ps();gU=new V,w0={getFastGlobalBounds(r,e){e||(e=new Be),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=cr.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<o.length;n++)o[n]._getGlobalBoundsRecursive(r,i,t)}if(s){let o=!1,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=!0,i.applyMatrix(n.worldTransform)),this.effects[a].addBounds(i,!0));o&&(i.applyMatrix(n.worldTransform.copyTo(gU).invert()),e.addBounds(i,this.relativeGroupTransform)),e.addBounds(i),cr.return(i)}else this.renderGroup&&(e.addBounds(i,this.relativeGroupTransform),cr.return(i))}}});function Fo(r,e,t){t.clear();let i,s;return r.parent?e?i=r.parent.worldTransform:(s=ct.get().identity(),i=dh(r,s)):i=V.IDENTITY,A0(r,t,i,e),s&&ct.return(s),t.isValid||t.set(0,0,0,0),t}function A0(r,e,t,i){if(!r.visible||!r.measurable)return;let s;i?s=r.worldTransform:(r.updateLocalTransform(),s=ct.get(),s.appendFrom(r.localTransform,t));let o=e,n=!!r.effects.length;if(n&&(e=cr.get().clear()),r.boundsArea)e.addRect(r.boundsArea,s);else{r.bounds&&(e.matrix=s,e.addBounds(r.bounds));for(let a=0;a<r.children.length;a++)A0(r.children[a],e,s,i)}if(n){for(let a=0;a<r.effects.length;a++)r.effects[a].addBounds?.(e);o.addBounds(e,V.IDENTITY),cr.return(e)}i||ct.return(s)}function dh(r,e){let t=r.parent;return t&&(dh(t,e),t.updateLocalTransform(),e.append(t.localTransform)),e}var $a=v(()=>{ve();Ps()});function fh(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 Um=v(()=>{"use strict"});function Oo(r,e){return r===C0?e:e===C0?r:fh(r,e)}var C0,Lm=v(()=>{Um();C0=16777215});function Xa(r){return((r&255)<<16)+(r&65280)+(r>>16&255)}var P0,M0=v(()=>{$a();Ps();Lm();P0={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=dh(this,ct.get().identity());return r.appendFrom(this.localTransform,t),ct.return(t),r},getGlobalTint(r){if(r)return this.renderGroup?Xa(this.renderGroup.worldColor):this.parentRenderGroup?Xa(Oo(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,t=this.parent;for(;t;)e=Oo(e,t.localColor),t=t.parent;return Xa(e)}}});function X(...r){Gm!==R0&&(Gm++,Gm===R0?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}var Gm,R0,ke=v(()=>{"use strict";Gm=0,R0=500});function Uo(r,e,t){return e.clear(),t||(t=V.IDENTITY),I0(r,e,t,r,!0),e.isValid||e.set(0,0,0,0),e}function I0(r,e,t,i,s){let o;if(s)o=ct.get(),o=t.copyTo(o);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();let l=r.localTransform;o=ct.get(),o.appendFrom(l,t)}let n=e,a=!!r.effects.length;if(a&&(e=cr.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<l.length;c++)I0(l[c],e,o,i,!1)}if(a){for(let l=0;l<r.effects.length;l++)r.effects[l].addLocalBounds?.(e,i);n.addBounds(e,V.IDENTITY),cr.return(e)}ct.return(o)}var ph=v(()=>{ve();Ps()});function Dm(r,e){let t=r.children;for(let i=0;i<t.length;i++){let s=t[i],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=e.index;(e.data[a]!==o||e.data[a+1]!==n)&&(e.data[e.index]=o,e.data[e.index+1]=n,e.didChange=!0),e.index=a+2,s.children.length&&Dm(s,e)}return e.didChange}var B0=v(()=>{"use strict"});var xU,k0,F0=v(()=>{ve();Zt();$a();ph();B0();xU=new V,k0={_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 Be});let r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),Dm(this,r),r.didChange&&Uo(this,r.localBounds,xU),r.localBounds},getBounds(r,e){return Fo(this,r,e||new Be)}}});var O0,U0=v(()=>{"use strict";O0={_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 yU(r,e){return r._zIndex-e._zIndex}var L0,G0=v(()=>{"use strict";L0={_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(yU))}}});var D0,N0=v(()=>{Tr();Ps();D0={getGlobalPosition(r=new ge,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(ct.get(),t);return e=i.apply(r,e),ct.return(i),e},toLocal(r,e,t,i){e&&(r=e.toGlobal(r,t,i));let s=this.getGlobalTransform(ct.get(),i);return t=s.applyInverse(r,t),ct.return(s),t}}});var Lo,Nm=v(()=>{Pt();Lo=class{constructor(){this.uid=me("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 vi(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 Vm(r){return!(r&r-1)&&!!r}var ja=v(()=>{"use strict"});function mh(r){let e={};for(let t in r)r[t]!==void 0&&(e[t]=r[t]);return e}var Hm=v(()=>{"use strict"});function _U(r){let e=V0[r];return e===void 0&&(V0[r]=me("resource")),e}var V0,H0,gh,Wm=v(()=>{Ft();Pt();Xe();V0=Object.create(null);H0=class W0 extends Ue{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...W0.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){Y(ne,"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=_U(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};H0.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};gh=H0});var z0,Me,Qt=v(()=>{Ft();ja();Hm();Pt();Wm();z0=class $0 extends Ue{constructor(e={}){super(),this.options=e,this.uid=me("textureSource"),this._resourceType="textureSource",this._resourceId=me("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={...$0.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 gh(mh(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=me("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=me("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=Vm(this.pixelWidth)&&Vm(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};z0.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};Me=z0});function bU(){for(let r=0;r<16;r++){let e=[];zm.push(e);for(let t=0;t<16;t++){let i=xh(Ms[r]*Ms[t]+Is[r]*Rs[t]),s=xh(Rs[r]*Ms[t]+Bs[r]*Rs[t]),o=xh(Ms[r]*Is[t]+Is[r]*Bs[t]),n=xh(Rs[r]*Is[t]+Bs[r]*Bs[t]);for(let a=0;a<16;a++)if(Ms[a]===i&&Rs[a]===s&&Is[a]===o&&Bs[a]===n){e.push(a);break}}}for(let r=0;r<16;r++){let e=new V;e.set(Ms[r],Rs[r],Is[r],Bs[r],0,0),X0.push(e)}}var Ms,Rs,Is,Bs,zm,X0,xh,je,j0=v(()=>{ve();Ms=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Rs=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Is=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Bs=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],zm=[],X0=[],xh=Math.sign;bU();je={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=>Ms[r],uY:r=>Rs[r],vX:r=>Is[r],vY:r=>Bs[r],inv:r=>r&8?r&15:-r&7,add:(r,e)=>zm[r][e],sub:(r,e)=>zm[r][je.inv(e)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,e)=>Math.abs(r)*2<=Math.abs(e)?e>=0?je.S:je.N:Math.abs(e)*2<=Math.abs(r)?r>0?je.E:je.W:e>0?r>0?je.SE:je.SW:r>0?je.NE:je.NW,matrixAppendRotationInv:(r,e,t=0,i=0)=>{let s=X0[je.inv(e)];s.tx=t,s.ty=i,r.append(s)}}});var $m,Y0=v(()=>{"use strict";$m=()=>{}});var ks,Xm=v(()=>{L();Qt();ks=class extends Me{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}};ks.extension=w.TextureSource});var q0,Go,jm=v(()=>{ve();q0=new V,Go=class{constructor(e,t){this.mapCoord=new V,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<e.length;s+=2){let o=e[s],n=e[s+1];t[s]=o*i.a+n*i.c+i.tx,t[s+1]=o*i.b+n*i.d+i.ty}return t}update(){let e=this._texture;this._updateID++;let t=e.uvs;this.mapCoord.set(t.x1-t.x0,t.y1-t.y0,t.x3-t.x0,t.y3-t.y0,t.x0,t.y0);let i=e.orig,s=e.trim;s&&(q0.set(i.width/s.width,0,0,i.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(q0));let o=e.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,l=this.clampOffset/o._resolution;return n[0]=(e.frame.x+a+l)/o.width,n[1]=(e.frame.y+a+l)/o.height,n[2]=(e.frame.x+e.frame.width-a+l)/o.width,n[3]=(e.frame.y+e.frame.height-a+l)/o.height,this.uClampOffset[0]=this.clampOffset/o.pixelWidth,this.uClampOffset[1]=this.clampOffset/o.pixelHeight,this.isSimple=e.frame.width===o.width&&e.frame.height===o.height&&e.rotate===0,!0}}});var k,Ce=v(()=>{Ft();j0();mt();Pt();Xe();Y0();Xm();Qt();jm();k=class extends Ue{constructor({source:e,label:t,frame:i,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:l,dynamic:c}={}){if(super(),this.uid=me("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new ee,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=t,this.source=e?.source??new Me,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 Go(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=je.add(c,je.NW),e.x0=d+u*je.uX(c),e.y0=f+h*je.uY(c),c=je.add(c,2),e.x1=d+u*je.uX(c),e.y1=f+h*je.uY(c),c=je.add(c,2),e.x2=d+u*je.uX(c),e.y2=f+h*je.uY(c),c=je.add(c,2),e.x3=d+u*je.uX(c),e.y3=f+h*je.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 Y(ne,"Texture.baseTexture is now Texture.source"),this._source}};k.EMPTY=new k({label:"EMPTY",source:new Me({label:"EMPTY"})});k.EMPTY.destroy=$m;k.WHITE=new k({source:new ks({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});k.WHITE.destroy=$m});var vU,Ym,Fe,qr=v(()=>{ja();Qt();Ce();vU=0,Ym=class{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1}createTexture(e,t,i){let s=new Me({...this.textureOptions,width:e,height:t,resolution:1,antialias:i,autoGarbageCollect:!1});return new k({source:s,label:`texturePool_${vU++}`})}getOptimalTexture(e,t,i=1,s){let o=Math.ceil(e*i-1e-6),n=Math.ceil(t*i-1e-6);o=vi(o),n=vi(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<i.length;s++)i[s].destroy(!0)}this._texturePool={}}},Fe=new Ym});var yh,K0=v(()=>{ve();Nm();qr();yh=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new V,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 Lo,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<t.length;i++){let s=t[i];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(e={}){this.textureOptions=e,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Fe.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(let e in this.childrenToUpdate){let t=this.childrenToUpdate[e];t.list.fill(null),t.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(e){e.renderGroupParent&&e.renderGroupParent._removeRenderGroupChild(e),e.renderGroupParent=this,this.renderGroupChildren.push(e)}_removeRenderGroupChild(e){let t=this.renderGroupChildren.indexOf(e);t>-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;i<t.length;i++)this.addChild(t[i])}removeChild(e){if(this.structureDidChange=!0,e._onRender&&(e.renderGroup||this.removeOnRender(e)),e.parentRenderGroup=null,e.renderGroup){this._removeRenderGroupChild(e.renderGroup);return}let t=e.children;for(let i=0;i<t.length;i++)this.removeChild(t[i])}removeChildren(e){for(let t=0;t<e.length;t++)this.removeChild(e[t])}onChildUpdate(e){let t=this.childrenToUpdate[e.relativeRenderGroupDepth];t||(t=this.childrenToUpdate[e.relativeRenderGroupDepth]={index:0,list:[]}),t.list[t.index++]=e}updateRenderable(e){e.globalDisplayStatus<7||(this.instructionSet.renderPipes[e.renderPipeId].updateRenderable(e),e.didViewUpdate=!1)}onChildViewUpdate(e){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=e}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(e){this._onRenderContainers.push(e)}removeOnRender(e){this._onRenderContainers.splice(this._onRenderContainers.indexOf(e),1)}runOnRender(e){for(let t=0;t<this._onRenderContainers.length;t++)this._onRenderContainers[t]._onRender(e)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(e=[]){let t=this.root.children;for(let i=0;i<t.length;i++)this._getChildren(t[i],e);return e}_getChildren(e,t=[]){if(t.push(e),e.renderGroup)return t;let i=e.children;for(let s=0;s<i.length;s++)this._getChildren(i[s],t);return t}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new V),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new V),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;let e=this._parentCacheAsTextureRenderGroup;return e?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new V),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(e.inverseWorldTransform).translate(-e._textureBounds.x,-e._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}});function Z0(r,e,t={}){for(let i in e)!t[i]&&e[i]!==void 0&&(r[i]=e[i])}var Q0=v(()=>{"use strict"});var qm,Km,Zm,Do,Ya,Fs,ie,Or=v(()=>{Ft();At();n0();L();ve();Mm();ah();Pt();Xe();Wt();f0();m0();x0();b0();T0();E0();M0();F0();U0();G0();N0();K0();Q0();qm=new Ct(null),Km=new Ct(null),Zm=new Ct(null,1,1),Do=1,Ya=2,Fs=4,ie=class r extends Ue{constructor(e={}){super(),this.uid=me("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 V,this.relativeGroupTransform=new V,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Ct(this,0,0),this._scale=Zm,this._pivot=Km,this._skew=qm,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=[],Z0(this,e,{children:!0,parent:!0,effects:!0}),e.children?.forEach(t=>this.addChild(t)),e.parent?.addChild(this)}static mixin(e){Y("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),$.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||Y(ne,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let s=0;s<e.length;s++)this.addChild(e[s]);return e[0]}let t=e[0],i=this.renderGroup||this.parentRenderGroup;return t.parent===this?(this.children.splice(this.children.indexOf(t),1),this.children.push(t),i&&(i.structureDidChange=!0),t):(t.parent&&t.parent.removeChild(t),this.children.push(t),this.sortableChildren&&(this.sortDirty=!0),t.parent=this,t.didChange=!0,t._updateFlags=15,i&&i.addChild(t),this.emit("childAdded",t,this,this.children.length-1),t.emit("added",this),this._didViewChangeTick++,t._zIndex!==0&&t.depthOfChildModified(),t)}removeChild(...e){if(e.length>1){for(let s=0;s<e.length;s++)this.removeChild(e[s]);return e[0]}let t=e[0],i=this.children.indexOf(t);return i>-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=le.get(yh,this),this.groupTransform=V.IDENTITY,e?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),le.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 V),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*l0}set angle(e){this.rotation=e*c0}get pivot(){return this._pivot===Km&&(this._pivot=new Ct(this,0,0)),this._pivot}set pivot(e){this._pivot===Km&&(this._pivot=new Ct(this,0,0)),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===qm&&(this._skew=new Ct(this,0,0)),this._skew}set skew(e){this._skew===qm&&(this._skew=new Ct(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===Zm&&(this._scale=new Ct(this,1,1)),this._scale}set scale(e){this._scale===Zm&&(this._scale=new Ct(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|=Do,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){let i=ce.shared.setValue(e??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=Do,this._onUpdate())}get tint(){return Xa(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Ya,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|=Fs,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|=Fs,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|=Fs,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<t.length;++s)t[s].destroy(e);this.renderGroup?.destroy(),this.renderGroup=null}};$.mixin(ie,p0,w0,D0,O0,k0,_0,v0,L0,o0,d0,P0,g0)});var Xi,_h=v(()=>{Tr();Xi=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 ge,this.page=new ge,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 TU(r){return function(e){return e.test(r)}}function ji(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=TU(t),o={apple:{phone:s(Qm)&&!s(Ti),ipod:s(J0),tablet:!s(Qm)&&(s(eT)||cT(e))&&!s(Ti),universal:s(tT),device:(s(Qm)||s(J0)||s(eT)||s(tT)||cT(e))&&!s(Ti)},amazon:{phone:s(No),tablet:!s(No)&&s(bh),device:s(No)||s(bh)},android:{phone:!s(Ti)&&s(No)||!s(Ti)&&s(Jm),tablet:!s(Ti)&&!s(No)&&!s(Jm)&&(s(bh)||s(rT)),device:!s(Ti)&&(s(No)||s(bh)||s(Jm)||s(rT))||s(/\bokhttp\b/i)},windows:{phone:s(Ti),tablet:s(iT),device:s(Ti)||s(iT)},other:{blackberry:s(sT),blackberry10:s(oT),opera:s(nT),firefox:s(lT),chrome:s(aT),device:s(sT)||s(oT)||s(nT)||s(lT)||s(aT)},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 Qm,J0,eT,tT,Jm,rT,No,bh,Ti,iT,sT,oT,nT,aT,lT,cT,eg=v(()=>{Qm=/iPhone/i,J0=/iPod/i,eT=/iPad/i,tT=/\biOS-universal(?:.+)Mac\b/i,Jm=/\bAndroid(?:.+)Mobile\b/i,rT=/Android/i,No=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,bh=/Silk/i,Ti=/Windows Phone/i,iT=/\bWindows(?:.+)ARM\b/i,sT=/BlackBerry/i,oT=/BB10/i,nT=/Opera Mini/i,aT=/\b(CriOS|Chrome)(?:.+)Mobile/i,lT=/Mobile(?:.+)Firefox\b/i,cT=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"}});var tg=v(()=>{eg();eg()});var SU,uT,hT=v(()=>{tg();SU=ji.default??ji,uT=SU(globalThis.navigator)});var wU,vh,EU,AU,dT,fT,CU,PU,MU,rg,mT,gT=v(()=>{_h();L();hT();Fm();wU=9,vh=100,EU=0,AU=0,dT=2,fT=1,CU=-1e3,PU=-1e3,MU=2,rg=class pT{constructor(e,t=uT){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=`${fT}px`,e.style.height=`${fT}px`,e.style.position="absolute",e.style.top=`${CU}px`,e.style.left=`${PU}px`,e.style.zIndex=MU.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=`${vh}px`,this._div.style.height=`${vh}px`,this._div.style.position="absolute",this._div.style.top=`${EU}px`,this._div.style.left=`${AU}px`,this._div.style.zIndex=dT.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<t.length;i++)this._updateAccessibleObjects(t[i])}init(e){let i={accessibilityOptions:{...pT.defaultOptions,...e?.accessibilityOptions||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.accessibilityOptions.enabledByDefault?this._activate():this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._renderer.runners.postrender.remove(this)}postrender(){let e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let i of this._children)i._renderId===this._renderId&&t.add(this._children.indexOf(i))}for(let i=this._children.length-1;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,lh(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<this._children.length;i++){let s=this._children[i];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,l=this._renderer.resolution,c=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*l}px`,o.style.top=`${(a.ty+n.y*a.d)*c}px`,o.style.width=`${n.width*a.a*l}px`,o.style.height=`${n.height*a.d*c}px`}else{this._capHitArea(n);let a=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*l}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*l}px`}}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> 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=`
6
+ Deprecated since v${r}`),console.warn(i))),u0[e]=!0}var u0,ne,h0,Xe=v(()=>{"use strict";u0={},ne="8.0.0",h0="8.3.4"});var Cs,Bm=v(()=>{"use strict";Cs=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;t<e;t++)this._pool[this._index++]=new this._classType;this._count+=e}get(e){let t;return this._index>0?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 km,le,Wt=v(()=>{Bm();km=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 Cs(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}},le=new km});var d0,f0=v(()=>{Xe();d0={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){Y("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(r)}}});function lh(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<o;++s)r[s]=r[s+t];r.length=o}var Fm=v(()=>{"use strict"});var p0,m0=v(()=>{Fm();Xe();p0={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)}lh(this.children,r,t);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this)}return s.length>0&&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||Y(ne,"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 g0,x0=v(()=>{"use strict";g0={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<s;o++)i[o].collectRenderables(r,e,t)},collectRenderablesWithEffects(r,e,t){let{renderPipes:i}=e;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];i[o.pipe].push(o,this,r)}this.collectRenderablesSimple(r,e,t);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];i[o.pipe].pop(o,this,r)}}}});var bi,ch=v(()=>{"use strict";bi=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let e=0;e<this.filters.length;e++)this.filters[e].destroy();this.filters=null,this.filterArea=null}}});var Om,uh,y0=v(()=>{L();Wt();Om=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<this._tests.length;t++){let i=this._tests[t];if(i.test(e))return le.get(i.maskClass,e)}return e}returnMaskEffect(e){le.return(e)}},uh=new Om;$.handleByList(w.MaskEffect,uh._effectClasses)});var _0,b0=v(()=>{ch();y0();_0={_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),uh.returnMaskEffect(e),this._maskEffect=null),r!=null&&(this._maskEffect=uh.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 bi);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 bi),this._filterEffect.filterArea=r},get filterArea(){return this._filterEffect?.filterArea}}});var v0,T0=v(()=>{Xe();v0={label:null,get name(){return Y(ne,"Container.name property has been removed, use Container.label instead"),this.label},set name(r){Y(ne,"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<t.length;i++){let s=t[i];if(s.label===r||r instanceof RegExp&&r.test(s.label))return s}if(e)for(let i=0;i<t.length;i++){let o=t[i].getChildByLabel(r,!0);if(o)return o}return null},getChildrenByLabel(r,e=!1,t=[]){let i=this.children;for(let s=0;s<i.length;s++){let o=i[s];(o.label===r||r instanceof RegExp&&r.test(o.label))&&t.push(o)}if(e)for(let s=0;s<i.length;s++)i[s].getChildrenByLabel(r,!0,t);return t}}});var hh,ee,mt=v(()=>{Tr();hh=[new ge,new ge,new ge,new ge],ee=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.x+this.width&&t>=this.y&&t<this.y+this.height}strokeContains(e,t,i,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return!1;let a=this.x,l=this.y,c=i*(1-s),u=i-c,h=a-c,d=a+o+c,f=l-c,m=l+n+c,g=a+u,x=a+o-u,y=l+u,T=l+n-u;return e>=h&&e<=d&&t>=f&&t<=m&&!(e>g&&e<x&&t>y&&t<T)}intersects(e,t){if(!t){let C=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=C)return!1;let R=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>R}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=hh[0].set(e.left,e.top),l=hh[1].set(e.left,e.bottom),c=hh[2].set(e.right,e.top),u=hh[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),m=d*i+f*o,g=d*s+f*o,x=d*i+f*n,y=d*s+f*n;if(Math.max(m,g,x,y)<=d*a.x+f*a.y||Math.min(m,g,x,y)>=d*u.x+f*u.y)return!1;let T=h*(a.y-c.y),p=h*(c.x-a.x),b=T*i+p*o,_=T*s+p*o,S=T*i+p*n,E=T*s+p*n;return!(Math.max(b,_,S,E)<=T*a.x+p*a.y||Math.min(b,_,S,E)>=T*u.x+p*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.x+this.width&&i>=this.y&&i<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}});var S0,Be,Zt=v(()=>{ve();mt();S0=new V,Be=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=S0,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 ee);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=S0,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,m=this.maxX,g=this.maxY,x=n*e+l*t+u,y=a*e+c*t+h;x<d&&(d=x),y<f&&(f=y),x>m&&(m=x),y>g&&(g=y),x=n*i+l*t+u,y=a*i+c*t+h,x<d&&(d=x),y<f&&(f=y),x>m&&(m=x),y>g&&(g=y),x=n*e+l*s+u,y=a*e+c*s+h,x<d&&(d=x),y<f&&(f=y),x>m&&(m=x),y>g&&(g=y),x=n*i+l*s+u,y=a*i+c*s+h,x<d&&(d=x),y<f&&(f=y),x>m&&(m=x),y>g&&(g=y),this.minX=d,this.minY=f,this.maxX=m,this.maxY=g}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.maxX<e.maxX?this.maxX:e.maxX,this.maxY=this.maxY<e.maxY?this.maxY:e.maxY}applyMatrix(e){let t=this.minX,i=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:l,d:c,tx:u,ty:h}=e,d=n*t+l*i+u,f=a*t+c*i+h;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+l*i+u,f=a*s+c*i+h,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.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=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.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=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(e){return this.minX<e.left&&(this.minX=e.left),this.maxX>e.right&&(this.maxX=e.right),this.minY<e.top&&(this.minY=e.top),this.maxY>e.bottom&&(this.maxY=e.bottom),this}fitBounds(e,t,i,s){return this.minX<e&&(this.minX=e),this.maxX>t&&(this.maxX=t),this.minY<i&&(this.minY=i),this.maxY>s&&(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,m=s.ty;for(let g=t;g<i;g+=2){let x=e[g],y=e[g+1],T=c*x+h*y+f,p=u*x+d*y+m;o=T<o?T:o,n=p<n?p:n,a=T>a?T:a,l=p>l?p: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 ct,cr,Ps=v(()=>{ve();Bm();Zt();ct=new Cs(V),cr=new Cs(Be)});var gU,w0,E0=v(()=>{ve();Zt();Ps();gU=new V,w0={getFastGlobalBounds(r,e){e||(e=new Be),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=cr.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<o.length;n++)o[n]._getGlobalBoundsRecursive(r,i,t)}if(s){let o=!1,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=!0,i.applyMatrix(n.worldTransform)),this.effects[a].addBounds(i,!0));o&&(i.applyMatrix(n.worldTransform.copyTo(gU).invert()),e.addBounds(i,this.relativeGroupTransform)),e.addBounds(i),cr.return(i)}else this.renderGroup&&(e.addBounds(i,this.relativeGroupTransform),cr.return(i))}}});function Fo(r,e,t){t.clear();let i,s;return r.parent?e?i=r.parent.worldTransform:(s=ct.get().identity(),i=dh(r,s)):i=V.IDENTITY,A0(r,t,i,e),s&&ct.return(s),t.isValid||t.set(0,0,0,0),t}function A0(r,e,t,i){if(!r.visible||!r.measurable)return;let s;i?s=r.worldTransform:(r.updateLocalTransform(),s=ct.get(),s.appendFrom(r.localTransform,t));let o=e,n=!!r.effects.length;if(n&&(e=cr.get().clear()),r.boundsArea)e.addRect(r.boundsArea,s);else{r.bounds&&(e.matrix=s,e.addBounds(r.bounds));for(let a=0;a<r.children.length;a++)A0(r.children[a],e,s,i)}if(n){for(let a=0;a<r.effects.length;a++)r.effects[a].addBounds?.(e);o.addBounds(e,V.IDENTITY),cr.return(e)}i||ct.return(s)}function dh(r,e){let t=r.parent;return t&&(dh(t,e),t.updateLocalTransform(),e.append(t.localTransform)),e}var $a=v(()=>{ve();Ps()});function fh(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 Um=v(()=>{"use strict"});function Oo(r,e){return r===C0?e:e===C0?r:fh(r,e)}var C0,Lm=v(()=>{Um();C0=16777215});function Xa(r){return((r&255)<<16)+(r&65280)+(r>>16&255)}var P0,M0=v(()=>{$a();Ps();Lm();P0={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=dh(this,ct.get().identity());return r.appendFrom(this.localTransform,t),ct.return(t),r},getGlobalTint(r){if(r)return this.renderGroup?Xa(this.renderGroup.worldColor):this.parentRenderGroup?Xa(Oo(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,t=this.parent;for(;t;)e=Oo(e,t.localColor),t=t.parent;return Xa(e)}}});function X(...r){Gm!==R0&&(Gm++,Gm===R0?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}var Gm,R0,ke=v(()=>{"use strict";Gm=0,R0=500});function Uo(r,e,t){return e.clear(),t||(t=V.IDENTITY),I0(r,e,t,r,!0),e.isValid||e.set(0,0,0,0),e}function I0(r,e,t,i,s){let o;if(s)o=ct.get(),o=t.copyTo(o);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();let l=r.localTransform;o=ct.get(),o.appendFrom(l,t)}let n=e,a=!!r.effects.length;if(a&&(e=cr.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<l.length;c++)I0(l[c],e,o,i,!1)}if(a){for(let l=0;l<r.effects.length;l++)r.effects[l].addLocalBounds?.(e,i);n.addBounds(e,V.IDENTITY),cr.return(e)}ct.return(o)}var ph=v(()=>{ve();Ps()});function Dm(r,e){let t=r.children;for(let i=0;i<t.length;i++){let s=t[i],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=e.index;(e.data[a]!==o||e.data[a+1]!==n)&&(e.data[e.index]=o,e.data[e.index+1]=n,e.didChange=!0),e.index=a+2,s.children.length&&Dm(s,e)}return e.didChange}var B0=v(()=>{"use strict"});var xU,k0,F0=v(()=>{ve();Zt();$a();ph();B0();xU=new V,k0={_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 Be});let r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),Dm(this,r),r.didChange&&Uo(this,r.localBounds,xU),r.localBounds},getBounds(r,e){return Fo(this,r,e||new Be)}}});var O0,U0=v(()=>{"use strict";O0={_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 yU(r,e){return r._zIndex-e._zIndex}var L0,G0=v(()=>{"use strict";L0={_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(yU))}}});var D0,N0=v(()=>{Tr();Ps();D0={getGlobalPosition(r=new ge,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(ct.get(),t);return e=i.apply(r,e),ct.return(i),e},toLocal(r,e,t,i){e&&(r=e.toGlobal(r,t,i));let s=this.getGlobalTransform(ct.get(),i);return t=s.applyInverse(r,t),ct.return(s),t}}});var Lo,Nm=v(()=>{Pt();Lo=class{constructor(){this.uid=me("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 vi(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 Vm(r){return!(r&r-1)&&!!r}var ja=v(()=>{"use strict"});function mh(r){let e={};for(let t in r)r[t]!==void 0&&(e[t]=r[t]);return e}var Hm=v(()=>{"use strict"});function _U(r){let e=V0[r];return e===void 0&&(V0[r]=me("resource")),e}var V0,H0,gh,Wm=v(()=>{Ft();Pt();Xe();V0=Object.create(null);H0=class W0 extends Ue{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...W0.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){Y(ne,"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=_U(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};H0.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};gh=H0});var z0,Me,Qt=v(()=>{Ft();ja();Hm();Pt();Wm();z0=class $0 extends Ue{constructor(e={}){super(),this.options=e,this.uid=me("textureSource"),this._resourceType="textureSource",this._resourceId=me("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={...$0.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 gh(mh(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=me("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=me("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=Vm(this.pixelWidth)&&Vm(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};z0.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};Me=z0});function bU(){for(let r=0;r<16;r++){let e=[];zm.push(e);for(let t=0;t<16;t++){let i=xh(Ms[r]*Ms[t]+Is[r]*Rs[t]),s=xh(Rs[r]*Ms[t]+Bs[r]*Rs[t]),o=xh(Ms[r]*Is[t]+Is[r]*Bs[t]),n=xh(Rs[r]*Is[t]+Bs[r]*Bs[t]);for(let a=0;a<16;a++)if(Ms[a]===i&&Rs[a]===s&&Is[a]===o&&Bs[a]===n){e.push(a);break}}}for(let r=0;r<16;r++){let e=new V;e.set(Ms[r],Rs[r],Is[r],Bs[r],0,0),X0.push(e)}}var Ms,Rs,Is,Bs,zm,X0,xh,je,j0=v(()=>{ve();Ms=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Rs=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Is=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Bs=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],zm=[],X0=[],xh=Math.sign;bU();je={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=>Ms[r],uY:r=>Rs[r],vX:r=>Is[r],vY:r=>Bs[r],inv:r=>r&8?r&15:-r&7,add:(r,e)=>zm[r][e],sub:(r,e)=>zm[r][je.inv(e)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,e)=>Math.abs(r)*2<=Math.abs(e)?e>=0?je.S:je.N:Math.abs(e)*2<=Math.abs(r)?r>0?je.E:je.W:e>0?r>0?je.SE:je.SW:r>0?je.NE:je.NW,matrixAppendRotationInv:(r,e,t=0,i=0)=>{let s=X0[je.inv(e)];s.tx=t,s.ty=i,r.append(s)}}});var $m,Y0=v(()=>{"use strict";$m=()=>{}});var ks,Xm=v(()=>{L();Qt();ks=class extends Me{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}};ks.extension=w.TextureSource});var q0,Go,jm=v(()=>{ve();q0=new V,Go=class{constructor(e,t){this.mapCoord=new V,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<e.length;s+=2){let o=e[s],n=e[s+1];t[s]=o*i.a+n*i.c+i.tx,t[s+1]=o*i.b+n*i.d+i.ty}return t}update(){let e=this._texture;this._updateID++;let t=e.uvs;this.mapCoord.set(t.x1-t.x0,t.y1-t.y0,t.x3-t.x0,t.y3-t.y0,t.x0,t.y0);let i=e.orig,s=e.trim;s&&(q0.set(i.width/s.width,0,0,i.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(q0));let o=e.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,l=this.clampOffset/o._resolution;return n[0]=(e.frame.x+a+l)/o.width,n[1]=(e.frame.y+a+l)/o.height,n[2]=(e.frame.x+e.frame.width-a+l)/o.width,n[3]=(e.frame.y+e.frame.height-a+l)/o.height,this.uClampOffset[0]=this.clampOffset/o.pixelWidth,this.uClampOffset[1]=this.clampOffset/o.pixelHeight,this.isSimple=e.frame.width===o.width&&e.frame.height===o.height&&e.rotate===0,!0}}});var k,Ce=v(()=>{Ft();j0();mt();Pt();Xe();Y0();Xm();Qt();jm();k=class extends Ue{constructor({source:e,label:t,frame:i,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:l,dynamic:c}={}){if(super(),this.uid=me("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new ee,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=t,this.source=e?.source??new Me,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 Go(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=je.add(c,je.NW),e.x0=d+u*je.uX(c),e.y0=f+h*je.uY(c),c=je.add(c,2),e.x1=d+u*je.uX(c),e.y1=f+h*je.uY(c),c=je.add(c,2),e.x2=d+u*je.uX(c),e.y2=f+h*je.uY(c),c=je.add(c,2),e.x3=d+u*je.uX(c),e.y3=f+h*je.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 Y(ne,"Texture.baseTexture is now Texture.source"),this._source}};k.EMPTY=new k({label:"EMPTY",source:new Me({label:"EMPTY"})});k.EMPTY.destroy=$m;k.WHITE=new k({source:new ks({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});k.WHITE.destroy=$m});var vU,Ym,Fe,qr=v(()=>{ja();Qt();Ce();vU=0,Ym=class{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1}createTexture(e,t,i){let s=new Me({...this.textureOptions,width:e,height:t,resolution:1,antialias:i,autoGarbageCollect:!1});return new k({source:s,label:`texturePool_${vU++}`})}getOptimalTexture(e,t,i=1,s){let o=Math.ceil(e*i-1e-6),n=Math.ceil(t*i-1e-6);o=vi(o),n=vi(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<i.length;s++)i[s].destroy(!0)}this._texturePool={}}},Fe=new Ym});var yh,K0=v(()=>{ve();Nm();qr();yh=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new V,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 Lo,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<t.length;i++){let s=t[i];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(e={}){this.textureOptions=e,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Fe.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(let e in this.childrenToUpdate){let t=this.childrenToUpdate[e];t.list.fill(null),t.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(e){e.renderGroupParent&&e.renderGroupParent._removeRenderGroupChild(e),e.renderGroupParent=this,this.renderGroupChildren.push(e)}_removeRenderGroupChild(e){let t=this.renderGroupChildren.indexOf(e);t>-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;i<t.length;i++)this.addChild(t[i])}removeChild(e){if(this.structureDidChange=!0,e._onRender&&(e.renderGroup||this.removeOnRender(e)),e.parentRenderGroup=null,e.renderGroup){this._removeRenderGroupChild(e.renderGroup);return}let t=e.children;for(let i=0;i<t.length;i++)this.removeChild(t[i])}removeChildren(e){for(let t=0;t<e.length;t++)this.removeChild(e[t])}onChildUpdate(e){let t=this.childrenToUpdate[e.relativeRenderGroupDepth];t||(t=this.childrenToUpdate[e.relativeRenderGroupDepth]={index:0,list:[]}),t.list[t.index++]=e}updateRenderable(e){e.globalDisplayStatus<7||(this.instructionSet.renderPipes[e.renderPipeId].updateRenderable(e),e.didViewUpdate=!1)}onChildViewUpdate(e){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=e}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(e){this._onRenderContainers.push(e)}removeOnRender(e){this._onRenderContainers.splice(this._onRenderContainers.indexOf(e),1)}runOnRender(e){for(let t=0;t<this._onRenderContainers.length;t++)this._onRenderContainers[t]._onRender(e)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(e=[]){let t=this.root.children;for(let i=0;i<t.length;i++)this._getChildren(t[i],e);return e}_getChildren(e,t=[]){if(t.push(e),e.renderGroup)return t;let i=e.children;for(let s=0;s<i.length;s++)this._getChildren(i[s],t);return t}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new V),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new V),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;let e=this._parentCacheAsTextureRenderGroup;return e?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new V),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(e.inverseWorldTransform).translate(-e._textureBounds.x,-e._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}});function Z0(r,e,t={}){for(let i in e)!t[i]&&e[i]!==void 0&&(r[i]=e[i])}var Q0=v(()=>{"use strict"});var qm,Km,Zm,Do,Ya,Fs,ie,Or=v(()=>{Ft();At();n0();L();ve();Mm();ah();Pt();Xe();Wt();f0();m0();x0();b0();T0();E0();M0();F0();U0();G0();N0();K0();Q0();qm=new Ct(null),Km=new Ct(null),Zm=new Ct(null,1,1),Do=1,Ya=2,Fs=4,ie=class r extends Ue{constructor(e={}){super(),this.uid=me("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 V,this.relativeGroupTransform=new V,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Ct(this,0,0),this._scale=Zm,this._pivot=Km,this._skew=qm,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=[],Z0(this,e,{children:!0,parent:!0,effects:!0}),e.children?.forEach(t=>this.addChild(t)),e.parent?.addChild(this)}static mixin(e){Y("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),$.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||Y(ne,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let s=0;s<e.length;s++)this.addChild(e[s]);return e[0]}let t=e[0],i=this.renderGroup||this.parentRenderGroup;return t.parent===this?(this.children.splice(this.children.indexOf(t),1),this.children.push(t),i&&(i.structureDidChange=!0),t):(t.parent&&t.parent.removeChild(t),this.children.push(t),this.sortableChildren&&(this.sortDirty=!0),t.parent=this,t.didChange=!0,t._updateFlags=15,i&&i.addChild(t),this.emit("childAdded",t,this,this.children.length-1),t.emit("added",this),this._didViewChangeTick++,t._zIndex!==0&&t.depthOfChildModified(),t)}removeChild(...e){if(e.length>1){for(let s=0;s<e.length;s++)this.removeChild(e[s]);return e[0]}let t=e[0],i=this.children.indexOf(t);return i>-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=le.get(yh,this),this.groupTransform=V.IDENTITY,e?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),le.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 V),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*l0}set angle(e){this.rotation=e*c0}get pivot(){return this._pivot===Km&&(this._pivot=new Ct(this,0,0)),this._pivot}set pivot(e){this._pivot===Km&&(this._pivot=new Ct(this,0,0)),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===qm&&(this._skew=new Ct(this,0,0)),this._skew}set skew(e){this._skew===qm&&(this._skew=new Ct(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===Zm&&(this._scale=new Ct(this,1,1)),this._scale}set scale(e){this._scale===Zm&&(this._scale=new Ct(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|=Do,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){let i=ce.shared.setValue(e??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=Do,this._onUpdate())}get tint(){return Xa(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Ya,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|=Fs,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|=Fs,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|=Fs,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<t.length;++s)t[s].destroy(e);this.renderGroup?.destroy(),this.renderGroup=null}};$.mixin(ie,p0,w0,D0,O0,k0,_0,v0,L0,o0,d0,P0,g0)});var Xi,_h=v(()=>{Tr();Xi=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 ge,this.page=new ge,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 TU(r){return function(e){return e.test(r)}}function ji(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=TU(t),o={apple:{phone:s(Qm)&&!s(Ti),ipod:s(J0),tablet:!s(Qm)&&(s(eT)||cT(e))&&!s(Ti),universal:s(tT),device:(s(Qm)||s(J0)||s(eT)||s(tT)||cT(e))&&!s(Ti)},amazon:{phone:s(No),tablet:!s(No)&&s(bh),device:s(No)||s(bh)},android:{phone:!s(Ti)&&s(No)||!s(Ti)&&s(Jm),tablet:!s(Ti)&&!s(No)&&!s(Jm)&&(s(bh)||s(rT)),device:!s(Ti)&&(s(No)||s(bh)||s(Jm)||s(rT))||s(/\bokhttp\b/i)},windows:{phone:s(Ti),tablet:s(iT),device:s(Ti)||s(iT)},other:{blackberry:s(sT),blackberry10:s(oT),opera:s(nT),firefox:s(lT),chrome:s(aT),device:s(sT)||s(oT)||s(nT)||s(lT)||s(aT)},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 Qm,J0,eT,tT,Jm,rT,No,bh,Ti,iT,sT,oT,nT,aT,lT,cT,eg=v(()=>{Qm=/iPhone/i,J0=/iPod/i,eT=/iPad/i,tT=/\biOS-universal(?:.+)Mac\b/i,Jm=/\bAndroid(?:.+)Mobile\b/i,rT=/Android/i,No=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,bh=/Silk/i,Ti=/Windows Phone/i,iT=/\bWindows(?:.+)ARM\b/i,sT=/BlackBerry/i,oT=/BB10/i,nT=/Opera Mini/i,aT=/\b(CriOS|Chrome)(?:.+)Mobile/i,lT=/Mobile(?:.+)Firefox\b/i,cT=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"}});var tg=v(()=>{eg();eg()});var SU,uT,hT=v(()=>{tg();SU=ji.default??ji,uT=SU(globalThis.navigator)});var wU,vh,EU,AU,dT,fT,CU,PU,MU,rg,mT,gT=v(()=>{_h();L();hT();Fm();wU=9,vh=100,EU=0,AU=0,dT=2,fT=1,CU=-1e3,PU=-1e3,MU=2,rg=class pT{constructor(e,t=uT){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=`${fT}px`,e.style.height=`${fT}px`,e.style.position="absolute",e.style.top=`${CU}px`,e.style.left=`${PU}px`,e.style.zIndex=MU.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=`${vh}px`,this._div.style.height=`${vh}px`,this._div.style.position="absolute",this._div.style.top=`${EU}px`,this._div.style.left=`${AU}px`,this._div.style.zIndex=dT.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<t.length;i++)this._updateAccessibleObjects(t[i])}init(e){let i={accessibilityOptions:{...pT.defaultOptions,...e?.accessibilityOptions||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.accessibilityOptions.enabledByDefault?this._activate():this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._renderer.runners.postrender.remove(this)}postrender(){let e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let i of this._children)i._renderId===this._renderId&&t.add(this._children.indexOf(i))}for(let i=this._children.length-1;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,lh(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<this._children.length;i++){let s=this._children[i];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,l=this._renderer.resolution,c=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*l}px`,o.style.top=`${(a.ty+n.y*a.d)*c}px`,o.style.width=`${n.width*a.a*l}px`,o.style.height=`${n.height*a.d*c}px`}else{this._capHitArea(n);let a=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*l}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*l}px`}}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> 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=`
7
7
  color: transparent;
8
8
  pointer-events: none;
9
9
  padding: 0;
@@ -250,7 +250,7 @@ ${s.join(`
250
250
  {
251
251
  return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
252
252
  }
253
- `}}});var Vg,tw,rw=v(()=>{"use strict";Vg=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],tw=Vg.reduce((r,e)=>(r[e]=!0,r),{})});function iw(r,e){switch(r){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*e);case"vec3<f32>":return new Float32Array(3*e);case"vec4<f32>":return new Float32Array(4*e);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var sw=v(()=>{"use strict"});var ow,Ae,Ut=v(()=>{Pt();hl();rw();sw();ow=class nw{constructor(e,t){this._touched=0,this.uid=me("uniform"),this._resourceType="uniformGroup",this._resourceId=me("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,t={...nw.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,!tw[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${Vg.join(", ")}`);o.value??(o.value=iw(o.type,o.size)),i[s]=o.value}this.uniforms=i,this._dirtyId=1,this.ubo=t.ubo,this.isStatic=t.isStatic,this._signature=Ai(Object.keys(i).map(s=>`${s}-${e[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};ow.defaultOptions={ubo:!1,isStatic:!1};Ae=ow});function tn(r){let e=aw[r];if(e)return e;let t=new Int32Array(r);for(let i=0;i<r;i++)t[i]=i;return e=aw[r]=new Ae({uTextures:{value:t,type:"i32",size:r}},{isStatic:!0}),e}var aw,Hh=v(()=>{Ut();aw={}});var Ye,Er=v(()=>{"use strict";Ye=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(Ye||{})});var et,Lr=v(()=>{Ft();Pt();es();Qi();Ns();Er();Ut();et=class r extends Ue{constructor(e){super(),this.uid=me("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|=Ye.WEBGPU),i&&(n|=Ye.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 Tt,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 Ae(d));let f=l[h];f&&(s[f.group]||(s[f.group]=new Tt,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 Tt,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=rr.from(t)),i&&(n=er.from(i)),new r({gpuProgram:o,glProgram:n,...s})}}});var Wh,lw=v(()=>{rs();dl();fl();is();Hh();Lr();Wh=class extends et{constructor(e){let t=ti({name:"batch",bits:[Qo,en(e),ii]}),i=ei({name:"batch",bits:[Zo,Jo(e),ri]});super({glProgram:t,gpuProgram:i,resources:{batchSamplers:tn(e)}})}}});var cw,uw,pl,Hg=v(()=>{L();sS();lS();lw();cw=null,uw=class hw extends iS{constructor(){super(...arguments),this.geometry=new Dh,this.shader=cw||(cw=new Wh(this.maxTextures)),this.name=hw.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:m,uvs:g}=e,x=e.color,y=e.attributeOffset,T=y+e.attributeSize;for(let p=y;p<T;p++){let b=p*2,_=m[b],S=m[b+1];t[s++]=l*_+u*S+d,t[s++]=h*S+c*_+f,t[s++]=g[b],t[s++]=g[b+1],i[s++]=x,i[s++]=n}}packQuadAttributes(e,t,i,s,o){let n=e.texture,a=e.transform,l=a.a,c=a.b,u=a.c,h=a.d,d=a.tx,f=a.ty,m=e.bounds,g=m.maxX,x=m.minX,y=m.maxY,T=m.minY,p=n.uvs,b=e.color,_=o<<16|e.roundPixels&65535;t[s+0]=l*x+u*T+d,t[s+1]=h*T+c*x+f,t[s+2]=p.x0,t[s+3]=p.y0,i[s+4]=b,i[s+5]=_,t[s+6]=l*g+u*T+d,t[s+7]=h*T+c*g+f,t[s+8]=p.x1,t[s+9]=p.y1,i[s+10]=b,i[s+11]=_,t[s+12]=l*g+u*y+d,t[s+13]=h*y+c*g+f,t[s+14]=p.x2,t[s+15]=p.y2,i[s+16]=b,i[s+17]=_,t[s+18]=l*x+u*y+d,t[s+19]=h*y+c*x+f,t[s+20]=p.x3,t[s+21]=p.y3,i[s+22]=b,i[s+23]=_}};uw.extension={type:[w.Batcher],name:"default"};pl=uw});function dw(r,e,t,i,s,o,n,a=null){let l=0;t*=e,s*=o;let c=a.a,u=a.b,h=a.c,d=a.d,f=a.tx,m=a.ty;for(;l<n;){let g=r[t],x=r[t+1];i[s]=c*g+h*x+f,i[s+1]=u*g+d*x+m,s+=o,t+=e,l++}}function fw(r,e,t,i){let s=0;for(e*=t;s<i;)r[e]=0,r[e+1]=0,e+=t,s++}var pw=v(()=>{"use strict"});function Wg(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<s;d++){let f=r[h],m=r[h+1];r[h]=o*f+a*m+c,r[h+1]=n*f+l*m+u,h+=i}}var mw=v(()=>{"use strict"});var iL,Vs,zg=v(()=>{ve();Um();iL=new V,Vs=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?fh(t,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):t+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||iL}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 rn,gw,xw,yw=v(()=>{L();rn={extension:{type:w.ShapeBuilder,name:"circle"},build(r,e){let t,i,s,o,n,a;if(r.type==="circle"){let b=r;t=b.x,i=b.y,n=a=b.radius,s=o=0}else if(r.type==="ellipse"){let b=r;t=b.x,i=b.y,n=b.halfWidth,a=b.halfHeight,s=o=0}else{let b=r,_=b.width/2,S=b.height/2;t=b.x+_,i=b.y+S,n=a=Math.max(0,Math.min(b.radius,Math.min(_,S))),s=_-n,o=S-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,m=s+n,g=o,x=t+m,y=t-m,T=i+g;if(e[u++]=x,e[u++]=T,e[--h]=T,e[--h]=y,o){let b=i-g;e[d++]=y,e[d++]=b,e[--f]=b,e[--f]=x}for(let b=1;b<l;b++){let _=Math.PI/2*(b/l),S=s+Math.cos(_)*n,E=o+Math.sin(_)*a,C=t+S,P=t-S,M=i+E,I=i-E;e[u++]=C,e[u++]=M,e[--h]=M,e[--h]=P,e[d++]=P,e[d++]=I,e[--f]=I,e[--f]=C}m=s,g=o+a,x=t+m,y=t-m,T=i+g;let p=i-g;return e[u++]=x,e[u++]=T,e[--f]=p,e[--f]=x,s&&(e[u++]=y,e[u++]=T,e[--f]=p,e[--f]=y),e},triangulate(r,e,t,i,s,o){if(r.length===0)return;let n=0,a=0;for(let u=0;u<r.length;u+=2)n+=r[u],a+=r[u+1];n/=r.length/2,a/=r.length/2;let l=i;e[l*t]=n,e[l*t+1]=a;let c=l++;for(let u=0;u<r.length;u+=2)e[l*t]=r[u],e[l*t+1]=r[u+1],u>0&&(s[o++]=l,s[o++]=c,s[o++]=l-1),l++;s[o++]=c+1,s[o++]=c,s[o++]=l-1}},gw={...rn,extension:{...rn.extension,name:"ellipse"}},xw={...rn,extension:{...rn.extension,name:"roundedRectangle"}}});function _w(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<e;i+=2){let n=r[i],a=r[i+1];t+=(n-s)*(a+o),s=n,o=a}return t<0?-1:1}var bw=v(()=>{"use strict"});function vw(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 m=l+d,g=c+f,x=u+d,y=h+f;return a.push(m,g),a.push(x,y),2}function Hs(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&&u<h?u+=Math.PI*2:!a&&u>h&&(h+=Math.PI*2);let d=u,f=h-u,m=Math.abs(f),g=Math.sqrt(l*l+c*c),x=(15*m*Math.sqrt(g)/Math.PI>>0)+1,y=f/x;if(d+=y,a){n.push(r,e),n.push(t,i);for(let T=1,p=d;T<x;T++,p+=y)n.push(r,e),n.push(r+Math.sin(p)*g,e+Math.cos(p)*g);n.push(r,e),n.push(s,o)}else{n.push(t,i),n.push(r,e);for(let T=1,p=d;T<x;T++,p+=y)n.push(r+Math.sin(p)*g,e+Math.cos(p)*g),n.push(r,e);n.push(s,o),n.push(r,e)}return x*2}function Tw(r,e,t,i,s,o){let n=1e-4;if(r.length===0)return;let a=e,l=a.alignment;if(e.alignment!==.5){let N=_w(r);t&&(N*=-1),l=(l-.5)*N+.5}let c=new ge(r[0],r[1]),u=new ge(r[r.length-2],r[r.length-1]),h=i,d=Math.abs(c.x-u.x)<n&&Math.abs(c.y-u.y)<n;if(h){r=r.slice(),d&&(r.pop(),r.pop(),u.set(r[r.length-2],r[r.length-1]));let N=(c.x+u.x)*.5,W=(u.y+c.y)*.5;r.unshift(N,W),r.push(N,W)}let f=s,m=r.length/2,g=r.length,x=f.length/2,y=a.width/2,T=y*y,p=a.miterLimit*a.miterLimit,b=r[0],_=r[1],S=r[2],E=r[3],C=0,P=0,M=-(_-E),I=b-S,U=0,A=0,O=Math.sqrt(M*M+I*I);M/=O,I/=O,M*=y,I*=y;let F=l,R=(1-F)*2,D=F*2;h||(a.cap==="round"?g+=Hs(b-M*(R-D)*.5,_-I*(R-D)*.5,b-M*R,_-I*R,b+M*D,_+I*D,f,!0)+2:a.cap==="square"&&(g+=vw(b,_,M,I,R,D,!0,f))),f.push(b-M*R,_-I*R),f.push(b+M*D,_+I*D);for(let N=1;N<m-1;++N){b=r[(N-1)*2],_=r[(N-1)*2+1],S=r[N*2],E=r[N*2+1],C=r[(N+1)*2],P=r[(N+1)*2+1],M=-(_-E),I=b-S,O=Math.sqrt(M*M+I*I),M/=O,I/=O,M*=y,I*=y,U=-(E-P),A=S-C,O=Math.sqrt(U*U+A*A),U/=O,A/=O,U*=y,A*=y;let W=S-b,se=_-E,fe=S-C,Ee=P-E,ye=W*fe+se*Ee,B=se*fe-Ee*W,H=B<0;if(Math.abs(B)<.001*Math.abs(ye)){f.push(S-M*R,E-I*R),f.push(S+M*D,E+I*D),ye>=0&&(a.join==="round"?g+=Hs(S,E,S-M*R,E-I*R,S-U*R,E-A*R,f,!1)+4:g+=2,f.push(S-U*D,E-A*D),f.push(S+U*R,E+A*R));continue}let q=(-M+b)*(-I+E)-(-M+S)*(-I+_),be=(-U+C)*(-A+E)-(-U+S)*(-A+P),Ge=(W*be-fe*q)/B,nt=(Ee*q-se*be)/B,Et=(Ge-S)*(Ge-S)+(nt-E)*(nt-E),at=S+(Ge-S)*R,lt=E+(nt-E)*R,ar=S-(Ge-S)*D,Fr=E-(nt-E)*D,Na=Math.min(W*W+se*se,fe*fe+Ee*Ee),Va=H?R:D,ym=Na+Va*Va*T;Et<=ym?a.join==="bevel"||Et/T>p?(H?(f.push(at,lt),f.push(S+M*D,E+I*D),f.push(at,lt),f.push(S+U*D,E+A*D)):(f.push(S-M*R,E-I*R),f.push(ar,Fr),f.push(S-U*R,E-A*R),f.push(ar,Fr)),g+=2):a.join==="round"?H?(f.push(at,lt),f.push(S+M*D,E+I*D),g+=Hs(S,E,S+M*D,E+I*D,S+U*D,E+A*D,f,!0)+4,f.push(at,lt),f.push(S+U*D,E+A*D)):(f.push(S-M*R,E-I*R),f.push(ar,Fr),g+=Hs(S,E,S-M*R,E-I*R,S-U*R,E-A*R,f,!1)+4,f.push(S-U*R,E-A*R),f.push(ar,Fr)):(f.push(at,lt),f.push(ar,Fr)):(f.push(S-M*R,E-I*R),f.push(S+M*D,E+I*D),a.join==="round"?H?g+=Hs(S,E,S+M*D,E+I*D,S+U*D,E+A*D,f,!0)+2:g+=Hs(S,E,S-M*R,E-I*R,S-U*R,E-A*R,f,!1)+2:a.join==="miter"&&Et/T<=p&&(H?(f.push(ar,Fr),f.push(ar,Fr)):(f.push(at,lt),f.push(at,lt)),g+=2),f.push(S-U*R,E-A*R),f.push(S+U*D,E+A*D),g+=2)}b=r[(m-2)*2],_=r[(m-2)*2+1],S=r[(m-1)*2],E=r[(m-1)*2+1],M=-(_-E),I=b-S,O=Math.sqrt(M*M+I*I),M/=O,I/=O,M*=y,I*=y,f.push(S-M*R,E-I*R),f.push(S+M*D,E+I*D),h||(a.cap==="round"?g+=Hs(S-M*(R-D)*.5,E-I*(R-D)*.5,S-M*R,E-I*R,S+M*D,E+I*D,f,!1)+2:a.cap==="square"&&(g+=vw(S,E,M,I,R,D,!1,f)));let G=1e-4*1e-4;for(let N=x;N<g+x-2;++N)b=f[N*2],_=f[N*2+1],S=f[(N+1)*2],E=f[(N+1)*2+1],C=f[(N+2)*2],P=f[(N+2)*2+1],!(Math.abs(b*(E-P)+S*(P-_)+C*(_-E))<G)&&o.push(N,N+1,N+2)}var Sw=v(()=>{Tr();bw()});function ww(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)<s&&Math.abs(n-l)<s,u=t,h=r.length/2,d=u.length/2;for(let f=0;f<h;f++)u.push(r[f*2]),u.push(r[f*2+1]);for(let f=0;f<h-1;f++)i.push(d+f,d+f+1);c&&i.push(d+h-1,d)}var Ew=v(()=>{});var Yh=oe((CK,Yg)=>{"use strict";Yg.exports=Xh;Yg.exports.default=Xh;function Xh(r,e,t){t=t||2;var i=e&&e.length,s=i?e[0]*t:r.length,o=Cw(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=uL(r,e,o,t)),r.length>80*t){a=c=r[0],l=u=r[1];for(var m=t;m<s;m+=t)h=r[m],d=r[m+1],h<a&&(a=h),d<l&&(l=d),h>c&&(c=h),d>u&&(u=d);f=Math.max(c-a,u-l),f=f!==0?32767/f:0}return ml(o,n,t,a,l,f,0),n}function Cw(r,e,t,i,s){var o,n;if(s===jg(r,e,t,i)>0)for(o=e;o<t;o+=i)n=Aw(o,r[o],r[o+1],n);else for(o=t-i;o>=e;o-=i)n=Aw(o,r[o],r[o+1],n);return n&&jh(n,n.next)&&(xl(n),n=n.next),n}function Ws(r,e){if(!r)return r;e||(e=r);var t=r,i;do if(i=!1,!t.steiner&&(jh(t,t.next)||Ze(t.prev,t,t.next)===0)){if(xl(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function ml(r,e,t,i,s,o,n){if(r){!n&&o&&mL(r,i,s,o);for(var a=r,l,c;r.prev!==r.next;){if(l=r.prev,c=r.next,o?aL(r,i,s,o):nL(r)){e.push(l.i/t|0),e.push(r.i/t|0),e.push(c.i/t|0),xl(r),r=c.next,a=c.next;continue}if(r=c,r===a){n?n===1?(r=lL(Ws(r),e,t),ml(r,e,t,i,s,o,2)):n===2&&cL(r,e,t,i,s,o):ml(Ws(r),e,t,i,s,o,1);break}}}}function nL(r){var e=r.prev,t=r,i=r.next;if(Ze(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=s<o?s<n?s:n:o<n?o:n,h=a<l?a<c?a:c:l<c?l:c,d=s>o?s>n?s:n:o>n?o:n,f=a>l?a>c?a:c:l>c?l:c,m=i.next;m!==e;){if(m.x>=u&&m.x<=d&&m.y>=h&&m.y<=f&&sn(s,a,o,l,n,c,m.x,m.y)&&Ze(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function aL(r,e,t,i){var s=r.prev,o=r,n=r.next;if(Ze(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=a<l?a<c?a:c:l<c?l:c,m=u<h?u<d?u:d:h<d?h:d,g=a>l?a>c?a:c:l>c?l:c,x=u>h?u>d?u:d:h>d?h:d,y=$g(f,m,e,t,i),T=$g(g,x,e,t,i),p=r.prevZ,b=r.nextZ;p&&p.z>=y&&b&&b.z<=T;){if(p.x>=f&&p.x<=g&&p.y>=m&&p.y<=x&&p!==s&&p!==n&&sn(a,u,l,h,c,d,p.x,p.y)&&Ze(p.prev,p,p.next)>=0||(p=p.prevZ,b.x>=f&&b.x<=g&&b.y>=m&&b.y<=x&&b!==s&&b!==n&&sn(a,u,l,h,c,d,b.x,b.y)&&Ze(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;p&&p.z>=y;){if(p.x>=f&&p.x<=g&&p.y>=m&&p.y<=x&&p!==s&&p!==n&&sn(a,u,l,h,c,d,p.x,p.y)&&Ze(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;b&&b.z<=T;){if(b.x>=f&&b.x<=g&&b.y>=m&&b.y<=x&&b!==s&&b!==n&&sn(a,u,l,h,c,d,b.x,b.y)&&Ze(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function lL(r,e,t){var i=r;do{var s=i.prev,o=i.next.next;!jh(s,o)&&Pw(s,i,i.next,o)&&gl(s,o)&&gl(o,s)&&(e.push(s.i/t|0),e.push(i.i/t|0),e.push(o.i/t|0),xl(i),xl(i.next),i=r=o),i=i.next}while(i!==r);return Ws(i)}function cL(r,e,t,i,s,o){var n=r;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&yL(n,a)){var l=Mw(n,a);n=Ws(n,n.next),l=Ws(l,l.next),ml(n,e,t,i,s,o,0),ml(l,e,t,i,s,o,0);return}a=a.next}n=n.next}while(n!==r)}function uL(r,e,t,i){var s=[],o,n,a,l,c;for(o=0,n=e.length;o<n;o++)a=e[o]*i,l=o<n-1?e[o+1]*i:r.length,c=Cw(r,a,l,i,!1),c===c.next&&(c.steiner=!0),s.push(xL(c));for(s.sort(hL),o=0;o<s.length;o++)t=dL(s[o],t);return t}function hL(r,e){return r.x-e.x}function dL(r,e){var t=fL(r,e);if(!t)return e;var i=Mw(t,r);return Ws(i,i.next),Ws(t,t.next)}function fL(r,e){var t=e,i=r.x,s=r.y,o=-1/0,n;do{if(s<=t.y&&s>=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.next.x?t:t.next,a===i))return n}t=t.next}while(t!==e);if(!n)return null;var l=n,c=n.x,u=n.y,h=1/0,d;t=n;do i>=t.x&&t.x>=c&&i!==t.x&&sn(s<u?i:o,s,c,u,s<u?o:i,s,t.x,t.y)&&(d=Math.abs(s-t.y)/(i-t.x),gl(t,r)&&(d<h||d===h&&(t.x>n.x||t.x===n.x&&pL(n,t)))&&(n=t,h=d)),t=t.next;while(t!==l);return n}function pL(r,e){return Ze(r.prev,r,e.prev)<0&&Ze(e.next,r,r.next)<0}function mL(r,e,t,i){var s=r;do s.z===0&&(s.z=$g(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,gL(s)}function gL(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;e<c&&(a++,i=i.nextZ,!!i);e++);for(l=c;a>0||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 $g(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 xL(r){var e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function sn(r,e,t,i,s,o,n,a){return(s-n)*(e-a)>=(r-n)*(o-a)&&(r-n)*(i-a)>=(t-n)*(e-a)&&(t-n)*(o-a)>=(s-n)*(i-a)}function yL(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!_L(r,e)&&(gl(r,e)&&gl(e,r)&&bL(r,e)&&(Ze(r.prev,r,e.prev)||Ze(r,e.prev,e))||jh(r,e)&&Ze(r.prev,r,r.next)>0&&Ze(e.prev,e,e.next)>0)}function Ze(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function jh(r,e){return r.x===e.x&&r.y===e.y}function Pw(r,e,t,i){var s=$h(Ze(r,e,t)),o=$h(Ze(r,e,i)),n=$h(Ze(t,i,r)),a=$h(Ze(t,i,e));return!!(s!==o&&n!==a||s===0&&zh(r,t,e)||o===0&&zh(r,i,e)||n===0&&zh(t,r,i)||a===0&&zh(t,e,i))}function zh(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 $h(r){return r>0?1:r<0?-1:0}function _L(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&&Pw(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function gl(r,e){return Ze(r.prev,r,r.next)<0?Ze(r,e,r.next)>=0&&Ze(r,r.prev,e)>=0:Ze(r,e,r.prev)<0||Ze(r,r.next,e)<0}function bL(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 Mw(r,e){var t=new Xg(r.i,r.x,r.y),i=new Xg(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 Aw(r,e,t,i){var s=new Xg(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 xl(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 Xg(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}Xh.deviation=function(r,e,t,i){var s=e&&e.length,o=s?e[0]*t:r.length,n=Math.abs(jg(r,0,o,t));if(s)for(var a=0,l=e.length;a<l;a++){var c=e[a]*t,u=a<l-1?e[a+1]*t:r.length;n-=Math.abs(jg(r,c,u,t))}var h=0;for(a=0;a<i.length;a+=3){var d=i[a]*t,f=i[a+1]*t,m=i[a+2]*t;h+=Math.abs((r[d]-r[m])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[m+1]-r[d+1]))}return n===0&&h===0?0:Math.abs((h-n)/n)};function jg(r,e,t,i){for(var s=0,o=e,n=t-i;o<t;o+=i)s+=(r[n]-r[o])*(r[o+1]+r[n+1]),n=o;return s}Xh.flatten=function(r){for(var e=r[0][0].length,t={vertices:[],holes:[],dimensions:e},i=0,s=0;s<r.length;s++){for(var o=0;o<r[s].length;o++)for(var n=0;n<e;n++)t.vertices.push(r[s][o][n]);s>0&&(i+=r[s-1].length,t.holes.push(i))}return t}});function qh(r,e,t,i,s,o,n){let a=(0,Rw.default)(r,e,2);if(!a)return;for(let c=0;c<a.length;c+=3)o[n++]=a[c]+s,o[n++]=a[c+1]+s,o[n++]=a[c+2]+s;let l=s*i;for(let c=0;c<r.length;c+=2)t[l]=r[c],t[l+1]=r[c+1],l+=i}var Rw,qg=v(()=>{Rw=As(Yh(),1)});var vL,Iw,Bw=v(()=>{L();qg();vL=[],Iw={extension:{type:w.ShapeBuilder,name:"polygon"},build(r,e){for(let t=0;t<r.points.length;t++)e[t]=r.points[t];return e},triangulate(r,e,t,i,s,o){qh(r,vL,e,t,i,s,o)}}});var kw,Fw=v(()=>{L();kw={extension:{type:w.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 Ow,Uw=v(()=>{L();Ow={extension:{type:w.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 Gw(r,e){for(let t=0;t<e.length;t++){let i=e[t];r.addColorStop(i.offset,i.color)}}function Dw(r,e){let t=Z.get().createCanvas(r,e),i=t.getContext("2d");return{canvas:t,context:i}}function TL(r){let e=r[0]??{};return(typeof e=="number"||r[1])&&(Y("8.5.2","use options object instead"),e={type:"linear",start:{x:r[0],y:r[1]},end:{x:r[2],y:r[3]},textureSpace:r[4],textureSize:r[5]??ir.defaultLinearOptions.textureSize}),e}var Lw,Zg,ir,on=v(()=>{At();De();ve();$o();Ce();Pt();Xe();Hm();Lw=[{offset:0,color:"white"},{offset:1,color:"black"}],Zg=class Kg{constructor(...e){this.uid=me("fillGradient"),this.type="linear",this.colorStops=[];let t=TL(e);t={...t.type==="radial"?Kg.defaultRadialOptions:Kg.defaultLinearOptions,...mh(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:ce.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 x=e;e=i,i=x,o*=-1}if(n<0){let x=t;t=s,s=x,n*=-1}}let l=this.colorStops.length?this.colorStops:Lw,c=this._textureSize,{canvas:u,context:h}=Dw(c,1),d=a?h.createLinearGradient(this._textureSize,0,0,0):h.createLinearGradient(0,0,this._textureSize,0);Gw(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),m=Math.atan2(n,o),g=new V;g.scale(f/c,1),g.rotate(m),g.translate(e,t),this.textureSpace==="local"&&g.scale(c,c),this.transform=g}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let e=this.colorStops.length?this.colorStops:Lw,t=this._textureSize,{canvas:i,context:s}=Dw(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),m=(o-h)*f,g=(n-d)*f,x=s.createRadialGradient(m,g,c*f,(a-h)*f,(l-d)*f,u*f);Gw(x,e),s.fillStyle=e[e.length-1].color,s.fillRect(0,0,t,t),s.fillStyle=x,s.translate(m,g),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-m,-g),s.fillRect(0,0,t,t),this.texture=new k({source:new Jt({resource:i,addressMode:this._wrapMode})});let y=new V;y.scale(1/f,1/f),y.translate(h,d),this.textureSpace==="local"&&y.scale(t,t),this.transform=y}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};Zg.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Zg.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};ir=Zg});function Nw(r,e,t,i){let s=e.matrix?r.copyFrom(e.matrix).invert():r.identity();if(e.textureSpace==="local"){let n=t.getBounds(wL);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,m=s.b,g=s.c,x=s.d;s.a*=c,s.b*=c,s.c*=u,s.d*=u,s.tx=h*f+d*g+s.tx,s.ty=h*m+d*x+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 ir)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),i&&s.append(SL.copyFrom(i).invert()),s}var SL,wL,Vw=v(()=>{ve();mt();on();SL=new V,wL=new ee});function Ww(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<r.instructions.length;s++){let o=r.instructions[s];if(o.action==="texture")CL(o.data,i,t);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,l=o.data.style,c=o.data.hole;n&&c&&Hw(c.shapePath,l,!0,i,t),c&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=c.shapePath.shapePrimitives),Hw(a,l,n,i,t)}}}function CL(r,e,t){let{vertices:i,uvs:s,indices:o}=t,n=o.length,a=i.length/2,l=[],c=Kh.rectangle,u=EL,h=r.image;u.x=r.dx,u.y=r.dy,u.width=r.dw,u.height=r.dh;let d=r.transform;c.build(u,l),d&&Wg(l,d),c.triangulate(l,i,2,a,o,n);let f=h.uvs;s.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let m=le.get(Vs);m.indexOffset=n,m.indexSize=o.length-n,m.attributeOffset=a,m.attributeSize=i.length/2-a,m.baseColor=r.style,m.alpha=r.alpha,m.texture=h,m.geometryData=t,e.push(m)}function Hw(r,e,t,i,s){let{vertices:o,uvs:n,indices:a}=s;r.shapePrimitives.forEach(({shape:l,transform:c,holes:u})=>{let h=a.length,d=o.length/2,f=[],m=Kh[l.type],g="triangle-list";if(m.build(l,f),c&&Wg(f,c),t){let p=l.closePath??!0,b=e;b.pixelLine?(ww(f,p,o,a),g="line-list"):Tw(f,b,!1,p,o,a)}else if(u){let p=[],b=f.slice();PL(u).forEach(S=>{p.push(b.length/2),b.push(...S)}),qh(b,p,o,2,d,a,h)}else m.triangulate(f,o,2,d,a,h);let x=n.length/2,y=e.texture;if(y!==k.WHITE){let p=Nw(AL,e,l,c);dw(o,2,d,n,x,2,o.length/2-d,p)}else fw(n,x,2,o.length/2-d);let T=le.get(Vs);T.indexOffset=h,T.indexSize=a.length-h,T.attributeOffset=d,T.attributeSize=o.length/2-d,T.baseColor=e.color,T.alpha=e.alpha,T.texture=y,T.geometryData=s,T.topology=g,i.push(T)})}function PL(r){let e=[];for(let t=0;t<r.length;t++){let i=r[t].shape,s=[];Kh[i.type].build(i,s),e.push(s)}return e}var Kh,EL,AL,zw=v(()=>{L();ve();mt();pw();mw();Ce();Wt();zg();yw();Sw();Ew();Bw();Fw();Uw();Vw();qg();Kh={};$.handleByMap(w.ShapeBuilder,Kh);$.add(kw,Iw,Ow,rn,gw,xw);EL=new ee,AL=new V});var Qg,Jg,tx,nn,Zh=v(()=>{L();Uh();Hg();Nm();Xe();Wt();zw();Qg=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Jg=class{constructor(){this.batcher=new pl,this.instructions=new Lo}init(){this.instructions.reset()}get geometry(){return Y(h0,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},tx=class ex{constructor(e){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),e.renderableGC.addManagedHash(this,"_gpuContextHash"),e.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(e){ex.defaultOptions.bezierSmoothness=e?.bezierSmoothness??ex.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),Ww(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=le.get(Jg),{batches:i,geometryData:s}=this._gpuContextHash[e.uid],o=s.vertices.length,n=s.indices.length;for(let u=0;u<i.length;u++)i[u].applyTransform=!1;let a=t.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let u=0;u<i.length;u++){let h=i[u];a.add(h)}a.finish(t.instructions);let l=a.geometry;l.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),l.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);let c=a.batches;for(let u=0;u<c.length;u++){let h=c[u];h.bindGroup=Yo(h.textures.textures,h.textures.count)}return this._graphicsDataContextHash[e.uid]=t,t}_initContext(e){let t=new Qg;return t.context=e,this._gpuContextHash[e.uid]=t,e.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[e.uid]}onGraphicsContextDestroy(e){this._cleanGraphicsContextData(e),e.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[e.uid]=null}_cleanGraphicsContextData(e){let t=this._gpuContextHash[e.uid];t.isBatchable||this._graphicsDataContextHash[e.uid]&&(le.return(this.getContextRenderData(e)),this._graphicsDataContextHash[e.uid]=null),t.batches&&t.batches.forEach(i=>{le.return(i)})}destroy(){for(let e in this._gpuContextHash)this._gpuContextHash[e]&&this.onGraphicsContextDestroy(this._gpuContextHash[e].context)}};tx.extension={type:[w.WebGLSystem,w.WebGPUSystem,w.CanvasSystem],name:"graphicsContext"};tx.defaultOptions={bezierSmoothness:.5};nn=tx});var ML,rx,ix,sx,ox,nx,ax,lx,rt,Gr=v(()=>{"use strict";ML={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},rx=0,ix=1,sx=2,ox=3,nx=4,ax=5,lx=class $w{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<rx)}set blend(e){!!(this.data&1<<rx)!==e&&(this.data^=1<<rx)}get offsets(){return!!(this.data&1<<ix)}set offsets(e){!!(this.data&1<<ix)!==e&&(this.data^=1<<ix)}set cullMode(e){if(e==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=e==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<sx)}set culling(e){!!(this.data&1<<sx)!==e&&(this.data^=1<<sx)}get depthTest(){return!!(this.data&1<<ox)}set depthTest(e){!!(this.data&1<<ox)!==e&&(this.data^=1<<ox)}get depthMask(){return!!(this.data&1<<ax)}set depthMask(e){!!(this.data&1<<ax)!==e&&(this.data^=1<<ax)}get clockwiseFrontFace(){return!!(this.data&1<<nx)}set clockwiseFrontFace(e){!!(this.data&1<<nx)!==e&&(this.data^=1<<nx)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!=="none",this._blendMode=e,this._blendModeId=ML[e]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let e=new $w;return e.depthTest=!1,e.blend=!0,e}};lx.default2d=lx.for2d();rt=lx});function si(r,e,t){let i=(r>>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 an=v(()=>{"use strict"});var yl,Xw=v(()=>{L();Gr();Wt();an();zg();yl=class{constructor(e,t){this.state=rt.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<t.length;i++){let s=t[i];s._batcher.updateElement(s)}}destroyRenderable(e){this._graphicsBatchesHash[e.uid]&&this._removeBatchForRenderable(e.uid),e.off("destroyed",this._destroyRenderableBound)}execute(e){if(!e.isRenderable)return;let t=this.renderer,i=e.context;if(!t.graphicsContext.getGpuContext(i).batches.length)return;let o=i.customShader||this._adaptor.shader;this.state.blendMode=e.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=e.groupTransform,n.uRound=t._roundPixels|e._roundPixels,si(e.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,e)}_rebuild(e){let t=!!this._graphicsBatchesHash[e.uid],i=this.renderer.graphicsContext.updateGpuContext(e.context);t&&this._removeBatchForRenderable(e.uid),i.isBatchable&&this._initBatchesForRenderable(e),e.batched=i.isBatchable}_addToBatcher(e,t){let i=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(e);for(let o=0;o<s.length;o++){let n=s[o];i.addToBatch(n,t)}}_getBatchesForRenderable(e){return this._graphicsBatchesHash[e.uid]||this._initBatchesForRenderable(e)}_initBatchesForRenderable(e){let t=e.context,i=this.renderer.graphicsContext.getGpuContext(t),s=this.renderer._roundPixels|e._roundPixels,o=i.batches.map(n=>{let a=le.get(Vs);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=>{le.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}};yl.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"graphics"}});var cx=v(()=>{L();Zh();Xw();$.add(yl);$.add(nn)});var ss,Qh=v(()=>{"use strict";ss=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<i.length)&&(s=this._transformedUvs=new Float32Array(i.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=t._updateID,o.multiplyUvs(i,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}});var _l,jw=v(()=>{L();ve();Qi();Ut();cl();Wt();an();Qh();_l=class{constructor(e,t){this.localUniforms=new Ae({uTransformMatrix:{value:new V,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Tt({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&&(le.return(t),this._gpuBatchableMeshHash[e.uid]=null),e.off("destroyed",this._destroyRenderableBound)}execute(e){if(!e.isRenderable)return;e.state.blendMode=wi(e.groupBlendMode,e.texture._source);let t=this.localUniforms;t.uniforms.uTransformMatrix=e.groupTransform,t.uniforms.uRound=this.renderer._roundPixels|e._roundPixels,t.update(),si(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=le.get(ss);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]&&le.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}};_l.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"mesh"}});var ux=v(()=>{L();jw();$.add(_l)});var Jh,Yw=v(()=>{"use strict";Jh=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 hx(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<t;i+=6,s+=4)e[i+0]=s+0,e[i+1]=s+1,e[i+2]=s+2,e[i+3]=s+0,e[i+4]=s+2,e[i+5]=s+3;return e}var qw=v(()=>{"use strict"});function Zw(r){return{dynamicUpdate:Kw(r,!0),staticUpdate:Kw(r,!1)}}function Kw(r,e){let t=[];t.push(`
253
+ `}}});var Vg,tw,rw=v(()=>{"use strict";Vg=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],tw=Vg.reduce((r,e)=>(r[e]=!0,r),{})});function iw(r,e){switch(r){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*e);case"vec3<f32>":return new Float32Array(3*e);case"vec4<f32>":return new Float32Array(4*e);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var sw=v(()=>{"use strict"});var ow,Ae,Ut=v(()=>{Pt();hl();rw();sw();ow=class nw{constructor(e,t){this._touched=0,this.uid=me("uniform"),this._resourceType="uniformGroup",this._resourceId=me("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,t={...nw.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,!tw[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${Vg.join(", ")}`);o.value??(o.value=iw(o.type,o.size)),i[s]=o.value}this.uniforms=i,this._dirtyId=1,this.ubo=t.ubo,this.isStatic=t.isStatic,this._signature=Ai(Object.keys(i).map(s=>`${s}-${e[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};ow.defaultOptions={ubo:!1,isStatic:!1};Ae=ow});function tn(r){let e=aw[r];if(e)return e;let t=new Int32Array(r);for(let i=0;i<r;i++)t[i]=i;return e=aw[r]=new Ae({uTextures:{value:t,type:"i32",size:r}},{isStatic:!0}),e}var aw,Hh=v(()=>{Ut();aw={}});var Ye,Er=v(()=>{"use strict";Ye=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(Ye||{})});var et,Lr=v(()=>{Ft();Pt();es();Qi();Ns();Er();Ut();et=class r extends Ue{constructor(e){super(),this.uid=me("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|=Ye.WEBGPU),i&&(n|=Ye.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 Tt,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 Ae(d));let f=l[h];f&&(s[f.group]||(s[f.group]=new Tt,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 Tt,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=rr.from(t)),i&&(n=er.from(i)),new r({gpuProgram:o,glProgram:n,...s})}}});var Wh,lw=v(()=>{rs();dl();fl();is();Hh();Lr();Wh=class extends et{constructor(e){let t=ti({name:"batch",bits:[Qo,en(e),ii]}),i=ei({name:"batch",bits:[Zo,Jo(e),ri]});super({glProgram:t,gpuProgram:i,resources:{batchSamplers:tn(e)}})}}});var cw,uw,pl,Hg=v(()=>{L();sS();lS();lw();cw=null,uw=class hw extends iS{constructor(){super(...arguments),this.geometry=new Dh,this.shader=cw||(cw=new Wh(this.maxTextures)),this.name=hw.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:m,uvs:g}=e,x=e.color,y=e.attributeOffset,T=y+e.attributeSize;for(let p=y;p<T;p++){let b=p*2,_=m[b],S=m[b+1];t[s++]=l*_+u*S+d,t[s++]=h*S+c*_+f,t[s++]=g[b],t[s++]=g[b+1],i[s++]=x,i[s++]=n}}packQuadAttributes(e,t,i,s,o){let n=e.texture,a=e.transform,l=a.a,c=a.b,u=a.c,h=a.d,d=a.tx,f=a.ty,m=e.bounds,g=m.maxX,x=m.minX,y=m.maxY,T=m.minY,p=n.uvs,b=e.color,_=o<<16|e.roundPixels&65535;t[s+0]=l*x+u*T+d,t[s+1]=h*T+c*x+f,t[s+2]=p.x0,t[s+3]=p.y0,i[s+4]=b,i[s+5]=_,t[s+6]=l*g+u*T+d,t[s+7]=h*T+c*g+f,t[s+8]=p.x1,t[s+9]=p.y1,i[s+10]=b,i[s+11]=_,t[s+12]=l*g+u*y+d,t[s+13]=h*y+c*g+f,t[s+14]=p.x2,t[s+15]=p.y2,i[s+16]=b,i[s+17]=_,t[s+18]=l*x+u*y+d,t[s+19]=h*y+c*x+f,t[s+20]=p.x3,t[s+21]=p.y3,i[s+22]=b,i[s+23]=_}};uw.extension={type:[w.Batcher],name:"default"};pl=uw});function dw(r,e,t,i,s,o,n,a=null){let l=0;t*=e,s*=o;let c=a.a,u=a.b,h=a.c,d=a.d,f=a.tx,m=a.ty;for(;l<n;){let g=r[t],x=r[t+1];i[s]=c*g+h*x+f,i[s+1]=u*g+d*x+m,s+=o,t+=e,l++}}function fw(r,e,t,i){let s=0;for(e*=t;s<i;)r[e]=0,r[e+1]=0,e+=t,s++}var pw=v(()=>{"use strict"});function Wg(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<s;d++){let f=r[h],m=r[h+1];r[h]=o*f+a*m+c,r[h+1]=n*f+l*m+u,h+=i}}var mw=v(()=>{"use strict"});var iL,Vs,zg=v(()=>{ve();Um();iL=new V,Vs=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?fh(t,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):t+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||iL}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 rn,gw,xw,yw=v(()=>{L();rn={extension:{type:w.ShapeBuilder,name:"circle"},build(r,e){let t,i,s,o,n,a;if(r.type==="circle"){let b=r;t=b.x,i=b.y,n=a=b.radius,s=o=0}else if(r.type==="ellipse"){let b=r;t=b.x,i=b.y,n=b.halfWidth,a=b.halfHeight,s=o=0}else{let b=r,_=b.width/2,S=b.height/2;t=b.x+_,i=b.y+S,n=a=Math.max(0,Math.min(b.radius,Math.min(_,S))),s=_-n,o=S-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,m=s+n,g=o,x=t+m,y=t-m,T=i+g;if(e[u++]=x,e[u++]=T,e[--h]=T,e[--h]=y,o){let b=i-g;e[d++]=y,e[d++]=b,e[--f]=b,e[--f]=x}for(let b=1;b<l;b++){let _=Math.PI/2*(b/l),S=s+Math.cos(_)*n,E=o+Math.sin(_)*a,C=t+S,P=t-S,R=i+E,I=i-E;e[u++]=C,e[u++]=R,e[--h]=R,e[--h]=P,e[d++]=P,e[d++]=I,e[--f]=I,e[--f]=C}m=s,g=o+a,x=t+m,y=t-m,T=i+g;let p=i-g;return e[u++]=x,e[u++]=T,e[--f]=p,e[--f]=x,s&&(e[u++]=y,e[u++]=T,e[--f]=p,e[--f]=y),e},triangulate(r,e,t,i,s,o){if(r.length===0)return;let n=0,a=0;for(let u=0;u<r.length;u+=2)n+=r[u],a+=r[u+1];n/=r.length/2,a/=r.length/2;let l=i;e[l*t]=n,e[l*t+1]=a;let c=l++;for(let u=0;u<r.length;u+=2)e[l*t]=r[u],e[l*t+1]=r[u+1],u>0&&(s[o++]=l,s[o++]=c,s[o++]=l-1),l++;s[o++]=c+1,s[o++]=c,s[o++]=l-1}},gw={...rn,extension:{...rn.extension,name:"ellipse"}},xw={...rn,extension:{...rn.extension,name:"roundedRectangle"}}});function _w(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<e;i+=2){let n=r[i],a=r[i+1];t+=(n-s)*(a+o),s=n,o=a}return t<0?-1:1}var bw=v(()=>{"use strict"});function vw(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 m=l+d,g=c+f,x=u+d,y=h+f;return a.push(m,g),a.push(x,y),2}function Hs(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&&u<h?u+=Math.PI*2:!a&&u>h&&(h+=Math.PI*2);let d=u,f=h-u,m=Math.abs(f),g=Math.sqrt(l*l+c*c),x=(15*m*Math.sqrt(g)/Math.PI>>0)+1,y=f/x;if(d+=y,a){n.push(r,e),n.push(t,i);for(let T=1,p=d;T<x;T++,p+=y)n.push(r,e),n.push(r+Math.sin(p)*g,e+Math.cos(p)*g);n.push(r,e),n.push(s,o)}else{n.push(t,i),n.push(r,e);for(let T=1,p=d;T<x;T++,p+=y)n.push(r+Math.sin(p)*g,e+Math.cos(p)*g),n.push(r,e);n.push(s,o),n.push(r,e)}return x*2}function Tw(r,e,t,i,s,o){let n=1e-4;if(r.length===0)return;let a=e,l=a.alignment;if(e.alignment!==.5){let N=_w(r);t&&(N*=-1),l=(l-.5)*N+.5}let c=new ge(r[0],r[1]),u=new ge(r[r.length-2],r[r.length-1]),h=i,d=Math.abs(c.x-u.x)<n&&Math.abs(c.y-u.y)<n;if(h){r=r.slice(),d&&(r.pop(),r.pop(),u.set(r[r.length-2],r[r.length-1]));let N=(c.x+u.x)*.5,W=(u.y+c.y)*.5;r.unshift(N,W),r.push(N,W)}let f=s,m=r.length/2,g=r.length,x=f.length/2,y=a.width/2,T=y*y,p=a.miterLimit*a.miterLimit,b=r[0],_=r[1],S=r[2],E=r[3],C=0,P=0,R=-(_-E),I=b-S,U=0,A=0,O=Math.sqrt(R*R+I*I);R/=O,I/=O,R*=y,I*=y;let F=l,M=(1-F)*2,D=F*2;h||(a.cap==="round"?g+=Hs(b-R*(M-D)*.5,_-I*(M-D)*.5,b-R*M,_-I*M,b+R*D,_+I*D,f,!0)+2:a.cap==="square"&&(g+=vw(b,_,R,I,M,D,!0,f))),f.push(b-R*M,_-I*M),f.push(b+R*D,_+I*D);for(let N=1;N<m-1;++N){b=r[(N-1)*2],_=r[(N-1)*2+1],S=r[N*2],E=r[N*2+1],C=r[(N+1)*2],P=r[(N+1)*2+1],R=-(_-E),I=b-S,O=Math.sqrt(R*R+I*I),R/=O,I/=O,R*=y,I*=y,U=-(E-P),A=S-C,O=Math.sqrt(U*U+A*A),U/=O,A/=O,U*=y,A*=y;let W=S-b,se=_-E,fe=S-C,Ee=P-E,ye=W*fe+se*Ee,B=se*fe-Ee*W,H=B<0;if(Math.abs(B)<.001*Math.abs(ye)){f.push(S-R*M,E-I*M),f.push(S+R*D,E+I*D),ye>=0&&(a.join==="round"?g+=Hs(S,E,S-R*M,E-I*M,S-U*M,E-A*M,f,!1)+4:g+=2,f.push(S-U*D,E-A*D),f.push(S+U*M,E+A*M));continue}let q=(-R+b)*(-I+E)-(-R+S)*(-I+_),be=(-U+C)*(-A+E)-(-U+S)*(-A+P),Ge=(W*be-fe*q)/B,nt=(Ee*q-se*be)/B,Et=(Ge-S)*(Ge-S)+(nt-E)*(nt-E),at=S+(Ge-S)*M,lt=E+(nt-E)*M,ar=S-(Ge-S)*D,Fr=E-(nt-E)*D,Na=Math.min(W*W+se*se,fe*fe+Ee*Ee),Va=H?M:D,ym=Na+Va*Va*T;Et<=ym?a.join==="bevel"||Et/T>p?(H?(f.push(at,lt),f.push(S+R*D,E+I*D),f.push(at,lt),f.push(S+U*D,E+A*D)):(f.push(S-R*M,E-I*M),f.push(ar,Fr),f.push(S-U*M,E-A*M),f.push(ar,Fr)),g+=2):a.join==="round"?H?(f.push(at,lt),f.push(S+R*D,E+I*D),g+=Hs(S,E,S+R*D,E+I*D,S+U*D,E+A*D,f,!0)+4,f.push(at,lt),f.push(S+U*D,E+A*D)):(f.push(S-R*M,E-I*M),f.push(ar,Fr),g+=Hs(S,E,S-R*M,E-I*M,S-U*M,E-A*M,f,!1)+4,f.push(S-U*M,E-A*M),f.push(ar,Fr)):(f.push(at,lt),f.push(ar,Fr)):(f.push(S-R*M,E-I*M),f.push(S+R*D,E+I*D),a.join==="round"?H?g+=Hs(S,E,S+R*D,E+I*D,S+U*D,E+A*D,f,!0)+2:g+=Hs(S,E,S-R*M,E-I*M,S-U*M,E-A*M,f,!1)+2:a.join==="miter"&&Et/T<=p&&(H?(f.push(ar,Fr),f.push(ar,Fr)):(f.push(at,lt),f.push(at,lt)),g+=2),f.push(S-U*M,E-A*M),f.push(S+U*D,E+A*D),g+=2)}b=r[(m-2)*2],_=r[(m-2)*2+1],S=r[(m-1)*2],E=r[(m-1)*2+1],R=-(_-E),I=b-S,O=Math.sqrt(R*R+I*I),R/=O,I/=O,R*=y,I*=y,f.push(S-R*M,E-I*M),f.push(S+R*D,E+I*D),h||(a.cap==="round"?g+=Hs(S-R*(M-D)*.5,E-I*(M-D)*.5,S-R*M,E-I*M,S+R*D,E+I*D,f,!1)+2:a.cap==="square"&&(g+=vw(S,E,R,I,M,D,!1,f)));let G=1e-4*1e-4;for(let N=x;N<g+x-2;++N)b=f[N*2],_=f[N*2+1],S=f[(N+1)*2],E=f[(N+1)*2+1],C=f[(N+2)*2],P=f[(N+2)*2+1],!(Math.abs(b*(E-P)+S*(P-_)+C*(_-E))<G)&&o.push(N,N+1,N+2)}var Sw=v(()=>{Tr();bw()});function ww(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)<s&&Math.abs(n-l)<s,u=t,h=r.length/2,d=u.length/2;for(let f=0;f<h;f++)u.push(r[f*2]),u.push(r[f*2+1]);for(let f=0;f<h-1;f++)i.push(d+f,d+f+1);c&&i.push(d+h-1,d)}var Ew=v(()=>{});var Yh=oe((CK,Yg)=>{"use strict";Yg.exports=Xh;Yg.exports.default=Xh;function Xh(r,e,t){t=t||2;var i=e&&e.length,s=i?e[0]*t:r.length,o=Cw(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=uL(r,e,o,t)),r.length>80*t){a=c=r[0],l=u=r[1];for(var m=t;m<s;m+=t)h=r[m],d=r[m+1],h<a&&(a=h),d<l&&(l=d),h>c&&(c=h),d>u&&(u=d);f=Math.max(c-a,u-l),f=f!==0?32767/f:0}return ml(o,n,t,a,l,f,0),n}function Cw(r,e,t,i,s){var o,n;if(s===jg(r,e,t,i)>0)for(o=e;o<t;o+=i)n=Aw(o,r[o],r[o+1],n);else for(o=t-i;o>=e;o-=i)n=Aw(o,r[o],r[o+1],n);return n&&jh(n,n.next)&&(xl(n),n=n.next),n}function Ws(r,e){if(!r)return r;e||(e=r);var t=r,i;do if(i=!1,!t.steiner&&(jh(t,t.next)||Ze(t.prev,t,t.next)===0)){if(xl(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function ml(r,e,t,i,s,o,n){if(r){!n&&o&&mL(r,i,s,o);for(var a=r,l,c;r.prev!==r.next;){if(l=r.prev,c=r.next,o?aL(r,i,s,o):nL(r)){e.push(l.i/t|0),e.push(r.i/t|0),e.push(c.i/t|0),xl(r),r=c.next,a=c.next;continue}if(r=c,r===a){n?n===1?(r=lL(Ws(r),e,t),ml(r,e,t,i,s,o,2)):n===2&&cL(r,e,t,i,s,o):ml(Ws(r),e,t,i,s,o,1);break}}}}function nL(r){var e=r.prev,t=r,i=r.next;if(Ze(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=s<o?s<n?s:n:o<n?o:n,h=a<l?a<c?a:c:l<c?l:c,d=s>o?s>n?s:n:o>n?o:n,f=a>l?a>c?a:c:l>c?l:c,m=i.next;m!==e;){if(m.x>=u&&m.x<=d&&m.y>=h&&m.y<=f&&sn(s,a,o,l,n,c,m.x,m.y)&&Ze(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function aL(r,e,t,i){var s=r.prev,o=r,n=r.next;if(Ze(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=a<l?a<c?a:c:l<c?l:c,m=u<h?u<d?u:d:h<d?h:d,g=a>l?a>c?a:c:l>c?l:c,x=u>h?u>d?u:d:h>d?h:d,y=$g(f,m,e,t,i),T=$g(g,x,e,t,i),p=r.prevZ,b=r.nextZ;p&&p.z>=y&&b&&b.z<=T;){if(p.x>=f&&p.x<=g&&p.y>=m&&p.y<=x&&p!==s&&p!==n&&sn(a,u,l,h,c,d,p.x,p.y)&&Ze(p.prev,p,p.next)>=0||(p=p.prevZ,b.x>=f&&b.x<=g&&b.y>=m&&b.y<=x&&b!==s&&b!==n&&sn(a,u,l,h,c,d,b.x,b.y)&&Ze(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;p&&p.z>=y;){if(p.x>=f&&p.x<=g&&p.y>=m&&p.y<=x&&p!==s&&p!==n&&sn(a,u,l,h,c,d,p.x,p.y)&&Ze(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;b&&b.z<=T;){if(b.x>=f&&b.x<=g&&b.y>=m&&b.y<=x&&b!==s&&b!==n&&sn(a,u,l,h,c,d,b.x,b.y)&&Ze(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function lL(r,e,t){var i=r;do{var s=i.prev,o=i.next.next;!jh(s,o)&&Pw(s,i,i.next,o)&&gl(s,o)&&gl(o,s)&&(e.push(s.i/t|0),e.push(i.i/t|0),e.push(o.i/t|0),xl(i),xl(i.next),i=r=o),i=i.next}while(i!==r);return Ws(i)}function cL(r,e,t,i,s,o){var n=r;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&yL(n,a)){var l=Mw(n,a);n=Ws(n,n.next),l=Ws(l,l.next),ml(n,e,t,i,s,o,0),ml(l,e,t,i,s,o,0);return}a=a.next}n=n.next}while(n!==r)}function uL(r,e,t,i){var s=[],o,n,a,l,c;for(o=0,n=e.length;o<n;o++)a=e[o]*i,l=o<n-1?e[o+1]*i:r.length,c=Cw(r,a,l,i,!1),c===c.next&&(c.steiner=!0),s.push(xL(c));for(s.sort(hL),o=0;o<s.length;o++)t=dL(s[o],t);return t}function hL(r,e){return r.x-e.x}function dL(r,e){var t=fL(r,e);if(!t)return e;var i=Mw(t,r);return Ws(i,i.next),Ws(t,t.next)}function fL(r,e){var t=e,i=r.x,s=r.y,o=-1/0,n;do{if(s<=t.y&&s>=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.next.x?t:t.next,a===i))return n}t=t.next}while(t!==e);if(!n)return null;var l=n,c=n.x,u=n.y,h=1/0,d;t=n;do i>=t.x&&t.x>=c&&i!==t.x&&sn(s<u?i:o,s,c,u,s<u?o:i,s,t.x,t.y)&&(d=Math.abs(s-t.y)/(i-t.x),gl(t,r)&&(d<h||d===h&&(t.x>n.x||t.x===n.x&&pL(n,t)))&&(n=t,h=d)),t=t.next;while(t!==l);return n}function pL(r,e){return Ze(r.prev,r,e.prev)<0&&Ze(e.next,r,r.next)<0}function mL(r,e,t,i){var s=r;do s.z===0&&(s.z=$g(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,gL(s)}function gL(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;e<c&&(a++,i=i.nextZ,!!i);e++);for(l=c;a>0||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 $g(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 xL(r){var e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function sn(r,e,t,i,s,o,n,a){return(s-n)*(e-a)>=(r-n)*(o-a)&&(r-n)*(i-a)>=(t-n)*(e-a)&&(t-n)*(o-a)>=(s-n)*(i-a)}function yL(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!_L(r,e)&&(gl(r,e)&&gl(e,r)&&bL(r,e)&&(Ze(r.prev,r,e.prev)||Ze(r,e.prev,e))||jh(r,e)&&Ze(r.prev,r,r.next)>0&&Ze(e.prev,e,e.next)>0)}function Ze(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function jh(r,e){return r.x===e.x&&r.y===e.y}function Pw(r,e,t,i){var s=$h(Ze(r,e,t)),o=$h(Ze(r,e,i)),n=$h(Ze(t,i,r)),a=$h(Ze(t,i,e));return!!(s!==o&&n!==a||s===0&&zh(r,t,e)||o===0&&zh(r,i,e)||n===0&&zh(t,r,i)||a===0&&zh(t,e,i))}function zh(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 $h(r){return r>0?1:r<0?-1:0}function _L(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&&Pw(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function gl(r,e){return Ze(r.prev,r,r.next)<0?Ze(r,e,r.next)>=0&&Ze(r,r.prev,e)>=0:Ze(r,e,r.prev)<0||Ze(r,r.next,e)<0}function bL(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 Mw(r,e){var t=new Xg(r.i,r.x,r.y),i=new Xg(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 Aw(r,e,t,i){var s=new Xg(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 xl(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 Xg(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}Xh.deviation=function(r,e,t,i){var s=e&&e.length,o=s?e[0]*t:r.length,n=Math.abs(jg(r,0,o,t));if(s)for(var a=0,l=e.length;a<l;a++){var c=e[a]*t,u=a<l-1?e[a+1]*t:r.length;n-=Math.abs(jg(r,c,u,t))}var h=0;for(a=0;a<i.length;a+=3){var d=i[a]*t,f=i[a+1]*t,m=i[a+2]*t;h+=Math.abs((r[d]-r[m])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[m+1]-r[d+1]))}return n===0&&h===0?0:Math.abs((h-n)/n)};function jg(r,e,t,i){for(var s=0,o=e,n=t-i;o<t;o+=i)s+=(r[n]-r[o])*(r[o+1]+r[n+1]),n=o;return s}Xh.flatten=function(r){for(var e=r[0][0].length,t={vertices:[],holes:[],dimensions:e},i=0,s=0;s<r.length;s++){for(var o=0;o<r[s].length;o++)for(var n=0;n<e;n++)t.vertices.push(r[s][o][n]);s>0&&(i+=r[s-1].length,t.holes.push(i))}return t}});function qh(r,e,t,i,s,o,n){let a=(0,Rw.default)(r,e,2);if(!a)return;for(let c=0;c<a.length;c+=3)o[n++]=a[c]+s,o[n++]=a[c+1]+s,o[n++]=a[c+2]+s;let l=s*i;for(let c=0;c<r.length;c+=2)t[l]=r[c],t[l+1]=r[c+1],l+=i}var Rw,qg=v(()=>{Rw=As(Yh(),1)});var vL,Iw,Bw=v(()=>{L();qg();vL=[],Iw={extension:{type:w.ShapeBuilder,name:"polygon"},build(r,e){for(let t=0;t<r.points.length;t++)e[t]=r.points[t];return e},triangulate(r,e,t,i,s,o){qh(r,vL,e,t,i,s,o)}}});var kw,Fw=v(()=>{L();kw={extension:{type:w.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 Ow,Uw=v(()=>{L();Ow={extension:{type:w.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 Gw(r,e){for(let t=0;t<e.length;t++){let i=e[t];r.addColorStop(i.offset,i.color)}}function Dw(r,e){let t=Z.get().createCanvas(r,e),i=t.getContext("2d");return{canvas:t,context:i}}function TL(r){let e=r[0]??{};return(typeof e=="number"||r[1])&&(Y("8.5.2","use options object instead"),e={type:"linear",start:{x:r[0],y:r[1]},end:{x:r[2],y:r[3]},textureSpace:r[4],textureSize:r[5]??ir.defaultLinearOptions.textureSize}),e}var Lw,Zg,ir,on=v(()=>{At();De();ve();$o();Ce();Pt();Xe();Hm();Lw=[{offset:0,color:"white"},{offset:1,color:"black"}],Zg=class Kg{constructor(...e){this.uid=me("fillGradient"),this.type="linear",this.colorStops=[];let t=TL(e);t={...t.type==="radial"?Kg.defaultRadialOptions:Kg.defaultLinearOptions,...mh(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:ce.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 x=e;e=i,i=x,o*=-1}if(n<0){let x=t;t=s,s=x,n*=-1}}let l=this.colorStops.length?this.colorStops:Lw,c=this._textureSize,{canvas:u,context:h}=Dw(c,1),d=a?h.createLinearGradient(this._textureSize,0,0,0):h.createLinearGradient(0,0,this._textureSize,0);Gw(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),m=Math.atan2(n,o),g=new V;g.scale(f/c,1),g.rotate(m),g.translate(e,t),this.textureSpace==="local"&&g.scale(c,c),this.transform=g}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let e=this.colorStops.length?this.colorStops:Lw,t=this._textureSize,{canvas:i,context:s}=Dw(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),m=(o-h)*f,g=(n-d)*f,x=s.createRadialGradient(m,g,c*f,(a-h)*f,(l-d)*f,u*f);Gw(x,e),s.fillStyle=e[e.length-1].color,s.fillRect(0,0,t,t),s.fillStyle=x,s.translate(m,g),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-m,-g),s.fillRect(0,0,t,t),this.texture=new k({source:new Jt({resource:i,addressMode:this._wrapMode})});let y=new V;y.scale(1/f,1/f),y.translate(h,d),this.textureSpace==="local"&&y.scale(t,t),this.transform=y}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};Zg.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Zg.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};ir=Zg});function Nw(r,e,t,i){let s=e.matrix?r.copyFrom(e.matrix).invert():r.identity();if(e.textureSpace==="local"){let n=t.getBounds(wL);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,m=s.b,g=s.c,x=s.d;s.a*=c,s.b*=c,s.c*=u,s.d*=u,s.tx=h*f+d*g+s.tx,s.ty=h*m+d*x+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 ir)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),i&&s.append(SL.copyFrom(i).invert()),s}var SL,wL,Vw=v(()=>{ve();mt();on();SL=new V,wL=new ee});function Ww(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<r.instructions.length;s++){let o=r.instructions[s];if(o.action==="texture")CL(o.data,i,t);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,l=o.data.style,c=o.data.hole;n&&c&&Hw(c.shapePath,l,!0,i,t),c&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=c.shapePath.shapePrimitives),Hw(a,l,n,i,t)}}}function CL(r,e,t){let{vertices:i,uvs:s,indices:o}=t,n=o.length,a=i.length/2,l=[],c=Kh.rectangle,u=EL,h=r.image;u.x=r.dx,u.y=r.dy,u.width=r.dw,u.height=r.dh;let d=r.transform;c.build(u,l),d&&Wg(l,d),c.triangulate(l,i,2,a,o,n);let f=h.uvs;s.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let m=le.get(Vs);m.indexOffset=n,m.indexSize=o.length-n,m.attributeOffset=a,m.attributeSize=i.length/2-a,m.baseColor=r.style,m.alpha=r.alpha,m.texture=h,m.geometryData=t,e.push(m)}function Hw(r,e,t,i,s){let{vertices:o,uvs:n,indices:a}=s;r.shapePrimitives.forEach(({shape:l,transform:c,holes:u})=>{let h=a.length,d=o.length/2,f=[],m=Kh[l.type],g="triangle-list";if(m.build(l,f),c&&Wg(f,c),t){let p=l.closePath??!0,b=e;b.pixelLine?(ww(f,p,o,a),g="line-list"):Tw(f,b,!1,p,o,a)}else if(u){let p=[],b=f.slice();PL(u).forEach(S=>{p.push(b.length/2),b.push(...S)}),qh(b,p,o,2,d,a,h)}else m.triangulate(f,o,2,d,a,h);let x=n.length/2,y=e.texture;if(y!==k.WHITE){let p=Nw(AL,e,l,c);dw(o,2,d,n,x,2,o.length/2-d,p)}else fw(n,x,2,o.length/2-d);let T=le.get(Vs);T.indexOffset=h,T.indexSize=a.length-h,T.attributeOffset=d,T.attributeSize=o.length/2-d,T.baseColor=e.color,T.alpha=e.alpha,T.texture=y,T.geometryData=s,T.topology=g,i.push(T)})}function PL(r){let e=[];for(let t=0;t<r.length;t++){let i=r[t].shape,s=[];Kh[i.type].build(i,s),e.push(s)}return e}var Kh,EL,AL,zw=v(()=>{L();ve();mt();pw();mw();Ce();Wt();zg();yw();Sw();Ew();Bw();Fw();Uw();Vw();qg();Kh={};$.handleByMap(w.ShapeBuilder,Kh);$.add(kw,Iw,Ow,rn,gw,xw);EL=new ee,AL=new V});var Qg,Jg,tx,nn,Zh=v(()=>{L();Uh();Hg();Nm();Xe();Wt();zw();Qg=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Jg=class{constructor(){this.batcher=new pl,this.instructions=new Lo}init(){this.instructions.reset()}get geometry(){return Y(h0,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},tx=class ex{constructor(e){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),e.renderableGC.addManagedHash(this,"_gpuContextHash"),e.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(e){ex.defaultOptions.bezierSmoothness=e?.bezierSmoothness??ex.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),Ww(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=le.get(Jg),{batches:i,geometryData:s}=this._gpuContextHash[e.uid],o=s.vertices.length,n=s.indices.length;for(let u=0;u<i.length;u++)i[u].applyTransform=!1;let a=t.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let u=0;u<i.length;u++){let h=i[u];a.add(h)}a.finish(t.instructions);let l=a.geometry;l.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),l.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);let c=a.batches;for(let u=0;u<c.length;u++){let h=c[u];h.bindGroup=Yo(h.textures.textures,h.textures.count)}return this._graphicsDataContextHash[e.uid]=t,t}_initContext(e){let t=new Qg;return t.context=e,this._gpuContextHash[e.uid]=t,e.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[e.uid]}onGraphicsContextDestroy(e){this._cleanGraphicsContextData(e),e.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[e.uid]=null}_cleanGraphicsContextData(e){let t=this._gpuContextHash[e.uid];t.isBatchable||this._graphicsDataContextHash[e.uid]&&(le.return(this.getContextRenderData(e)),this._graphicsDataContextHash[e.uid]=null),t.batches&&t.batches.forEach(i=>{le.return(i)})}destroy(){for(let e in this._gpuContextHash)this._gpuContextHash[e]&&this.onGraphicsContextDestroy(this._gpuContextHash[e].context)}};tx.extension={type:[w.WebGLSystem,w.WebGPUSystem,w.CanvasSystem],name:"graphicsContext"};tx.defaultOptions={bezierSmoothness:.5};nn=tx});var ML,rx,ix,sx,ox,nx,ax,lx,rt,Gr=v(()=>{"use strict";ML={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},rx=0,ix=1,sx=2,ox=3,nx=4,ax=5,lx=class $w{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<rx)}set blend(e){!!(this.data&1<<rx)!==e&&(this.data^=1<<rx)}get offsets(){return!!(this.data&1<<ix)}set offsets(e){!!(this.data&1<<ix)!==e&&(this.data^=1<<ix)}set cullMode(e){if(e==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=e==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<sx)}set culling(e){!!(this.data&1<<sx)!==e&&(this.data^=1<<sx)}get depthTest(){return!!(this.data&1<<ox)}set depthTest(e){!!(this.data&1<<ox)!==e&&(this.data^=1<<ox)}get depthMask(){return!!(this.data&1<<ax)}set depthMask(e){!!(this.data&1<<ax)!==e&&(this.data^=1<<ax)}get clockwiseFrontFace(){return!!(this.data&1<<nx)}set clockwiseFrontFace(e){!!(this.data&1<<nx)!==e&&(this.data^=1<<nx)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!=="none",this._blendMode=e,this._blendModeId=ML[e]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let e=new $w;return e.depthTest=!1,e.blend=!0,e}};lx.default2d=lx.for2d();rt=lx});function si(r,e,t){let i=(r>>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 an=v(()=>{"use strict"});var yl,Xw=v(()=>{L();Gr();Wt();an();zg();yl=class{constructor(e,t){this.state=rt.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<t.length;i++){let s=t[i];s._batcher.updateElement(s)}}destroyRenderable(e){this._graphicsBatchesHash[e.uid]&&this._removeBatchForRenderable(e.uid),e.off("destroyed",this._destroyRenderableBound)}execute(e){if(!e.isRenderable)return;let t=this.renderer,i=e.context;if(!t.graphicsContext.getGpuContext(i).batches.length)return;let o=i.customShader||this._adaptor.shader;this.state.blendMode=e.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=e.groupTransform,n.uRound=t._roundPixels|e._roundPixels,si(e.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,e)}_rebuild(e){let t=!!this._graphicsBatchesHash[e.uid],i=this.renderer.graphicsContext.updateGpuContext(e.context);t&&this._removeBatchForRenderable(e.uid),i.isBatchable&&this._initBatchesForRenderable(e),e.batched=i.isBatchable}_addToBatcher(e,t){let i=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(e);for(let o=0;o<s.length;o++){let n=s[o];i.addToBatch(n,t)}}_getBatchesForRenderable(e){return this._graphicsBatchesHash[e.uid]||this._initBatchesForRenderable(e)}_initBatchesForRenderable(e){let t=e.context,i=this.renderer.graphicsContext.getGpuContext(t),s=this.renderer._roundPixels|e._roundPixels,o=i.batches.map(n=>{let a=le.get(Vs);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=>{le.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}};yl.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"graphics"}});var cx=v(()=>{L();Zh();Xw();$.add(yl);$.add(nn)});var ss,Qh=v(()=>{"use strict";ss=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<i.length)&&(s=this._transformedUvs=new Float32Array(i.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=t._updateID,o.multiplyUvs(i,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}});var _l,jw=v(()=>{L();ve();Qi();Ut();cl();Wt();an();Qh();_l=class{constructor(e,t){this.localUniforms=new Ae({uTransformMatrix:{value:new V,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Tt({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&&(le.return(t),this._gpuBatchableMeshHash[e.uid]=null),e.off("destroyed",this._destroyRenderableBound)}execute(e){if(!e.isRenderable)return;e.state.blendMode=wi(e.groupBlendMode,e.texture._source);let t=this.localUniforms;t.uniforms.uTransformMatrix=e.groupTransform,t.uniforms.uRound=this.renderer._roundPixels|e._roundPixels,t.update(),si(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=le.get(ss);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]&&le.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}};_l.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"mesh"}});var ux=v(()=>{L();jw();$.add(_l)});var Jh,Yw=v(()=>{"use strict";Jh=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 hx(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<t;i+=6,s+=4)e[i+0]=s+0,e[i+1]=s+1,e[i+2]=s+2,e[i+3]=s+0,e[i+4]=s+2,e[i+5]=s+3;return e}var qw=v(()=>{"use strict"});function Zw(r){return{dynamicUpdate:Kw(r,!0),staticUpdate:Kw(r,!1)}}function Kw(r,e){let t=[];t.push(`
254
254
 
255
255
  var index = 0;
256
256
 
@@ -364,8 +364,8 @@ fn mainFragment(
364
364
  var sample = textureSample(uTexture, uSampler, uv) * color;
365
365
 
366
366
  return sample;
367
- }`});var td,oE=v(()=>{At();ve();es();Ns();Lr();Ce();Wm();tE();iE();sE();td=class extends et{constructor(){let e=er.from({vertex:rE,fragment:eE}),t=rr.from({fragment:{source:dx,entryPoint:"mainFragment"},vertex:{source:dx,entryPoint:"mainVertex"}});super({glProgram:e,gpuProgram:t,resources:{uTexture:k.WHITE.source,uSampler:new gh({}),uniforms:{uTranslationMatrix:{value:new V,type:"mat3x3<f32>"},uColor:{value:new ce(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var ln,fx=v(()=>{ve();Ut();cl();Gr();an();Jw();oE();ln=class{constructor(e,t){this.state=rt.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new Ae({uTranslationMatrix:{value:new V,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=e,this.adaptor=t,this.defaultShader=new td,this.state=rt.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 ed({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=wi(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,si(e.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,e)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var bl,nE=v(()=>{L();Yw();fx();bl=class extends ln{constructor(e){super(e,new Jh)}};bl.extension={type:[w.WebGLPipes],name:"particle"}});var rd,aE=v(()=>{"use strict";rd=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 vl,lE=v(()=>{L();aE();fx();vl=class extends ln{constructor(e){super(e,new rd)}};vl.extension={type:[w.WebGPUPipes],name:"particle"}});var px=v(()=>{L();nE();lE();$.add(bl);$.add(vl)});var oi,Tl=v(()=>{"use strict";oi=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 Sl(r,e){let{texture:t,bounds:i}=r;Ph(i,e._anchor,t);let s=e._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s}var mx=v(()=>{fg()});var wl,cE=v(()=>{L();Wt();Tl();mx();wl=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),le.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,Sl(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:le.get(oi)};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}};wl.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"text"}});var gx,sr,cn=v(()=>{De();ja();gx=class{constructor(e){this._canvasPool=Object.create(null),this.canvasOptions=e||{},this.enableFullScreen=!1}_createCanvasAndContext(e,t){let i=Z.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=vi(e),t=vi(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={}}},sr=new gx});function uE(r,e,t){for(let i=0,s=4*t*e;i<e;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function hE(r,e,t,i,s){let o=4*e;for(let n=i,a=i*o+4*t;n<=s;++n,a+=o)if(r[a+3]!==0)return!1;return!0}function dE(r,e=1){let{width:t,height:i}=r,s=r.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,t,i).data,a=0,l=0,c=t-1,u=i-1;for(;l<i&&uE(n,t,l);)++l;if(l===i)return ee.EMPTY;for(;uE(n,t,u);)--u;for(;hE(n,t,a,l,u);)++a;for(;hE(n,t,c,l,u);)--c;return++c,++u,new ee(a/e,l/e,(c-a)/e,(u-l)/e)}var fE=v(()=>{mt()});var pE,Ci,id=v(()=>{ve();Pt();pE={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"}},Ci=class{constructor(e,t){this.uid=me("fillPattern"),this.transform=new V,this._styleKey=null,this.texture=e,this.transform.scale(1/e.frame.width,1/e.frame.height),t&&(e.source.style.addressModeU=pE[t].addressModeU,e.source.style.addressModeV=pE[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 gE=oe((Z9,mE)=>{mE.exports=BL;var xx={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},IL=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function BL(r){var e=[];return r.replace(IL,function(t,i,s){var o=i.toLowerCase();for(s=FL(s),o=="m"&&s.length>2&&(e.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==xx[o])return s.unshift(i),e.push(s);if(s.length<xx[o])throw new Error("malformed path data");e.push([i].concat(s.splice(0,xx[o])))}}),e}var kL=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function FL(r){var e=r.match(kL);return e?e.map(Number):[]}});function yE(r,e){let t=(0,xE.default)(r),i=[],s=null,o=0,n=0;for(let a=0;a<t.length;a++){let l=t[a],c=l[0],u=l;switch(c){case"M":o=u[1],n=u[2],e.moveTo(o,n);break;case"m":o+=u[1],n+=u[2],e.moveTo(o,n);break;case"H":o=u[1],e.lineTo(o,n);break;case"h":o+=u[1],e.lineTo(o,n);break;case"V":n=u[1],e.lineTo(o,n);break;case"v":n+=u[1],e.lineTo(o,n);break;case"L":o=u[1],n=u[2],e.lineTo(o,n);break;case"l":o+=u[1],n+=u[2],e.lineTo(o,n);break;case"C":o=u[5],n=u[6],e.bezierCurveTo(u[1],u[2],u[3],u[4],o,n);break;case"c":e.bezierCurveTo(o+u[1],n+u[2],o+u[3],n+u[4],o+u[5],n+u[6]),o+=u[5],n+=u[6];break;case"S":o=u[3],n=u[4],e.bezierCurveToShort(u[1],u[2],o,n);break;case"s":e.bezierCurveToShort(o+u[1],n+u[2],o+u[3],n+u[4]),o+=u[3],n+=u[4];break;case"Q":o=u[3],n=u[4],e.quadraticCurveTo(u[1],u[2],o,n);break;case"q":e.quadraticCurveTo(o+u[1],n+u[2],o+u[3],n+u[4]),o+=u[3],n+=u[4];break;case"T":o=u[1],n=u[2],e.quadraticCurveToShort(o,n);break;case"t":o+=u[1],n+=u[2],e.quadraticCurveToShort(o,n);break;case"A":o=u[6],n=u[7],e.arcToSvg(u[1],u[2],u[3],u[4],u[5],o,n);break;case"a":o+=u[6],n+=u[7],e.arcToSvg(u[1],u[2],u[3],u[4],u[5],o,n);break;case"Z":case"z":e.closePath(),i.length>0&&(s=i.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:X(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s))}return e}var xE,_E=v(()=>{xE=As(gE(),1);ke()});var sd,bE=v(()=>{mt();sd=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 ee),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 od,vE=v(()=>{mt();od=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,m=t-this.y,g=f*f/(c*c)+m*m/(u*u),x=f*f/(h*h)+m*m/(d*d);return g>1&&x<=1}getBounds(e){return e||(e=new ee),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 TE(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,m;d<0?(f=t,m=i):d>1?(f=s,m=o):(f=t+d*l,m=i+d*c);let g=r-f,x=e-m;return g*g+x*x}var SE=v(()=>{"use strict"});var OL,UL,un,wE=v(()=>{SE();mt();un=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;s<o;s++)i.push(t[s].x,t[s].y);t=i}this.points=t,this.closePath=!0}isClockwise(){let e=0,t=this.points,i=t.length;for(let s=0;s<i;s+=2){let o=t[s],n=t[s+1],a=t[(s+2)%i],l=t[(s+3)%i];e+=(a-o)*(l+n)}return e<0}containsPolygon(e){let t=this.getBounds(OL),i=e.getBounds(UL);if(!t.containsRect(i))return!1;let s=e.points;for(let o=0;o<s.length;o+=2){let n=s[o],a=s[o+1];if(!this.contains(n,a))return!1}return!0}clone(){let e=this.points.slice(),t=new r(e);return t.closePath=this.closePath,t}contains(e,t){let i=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],l=this.points[o*2+1],c=this.points[n*2],u=this.points[n*2+1];l>t!=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;u<c;u+=2){let h=l[u],d=l[u+1],f=l[(u+2)%l.length],m=l[(u+3)%l.length],g=TE(e,t,h,d,f,m),x=Math.sign((f-h)*(t-d)-(m-d)*(e-h));if(g<=(x<0?a:n))return!0}return!1}getBounds(e){e||(e=new ee);let t=this.points,i=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,l=t.length;a<l;a+=2){let c=t[a],u=t[a+1];i=c<i?c:i,s=c>s?c:s,o=u<o?u:o,n=u>n?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 nd,ad,EE=v(()=>{mt();nd=(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},ad=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 ee),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,m=a-c*2,g=l-c*2,x=o+a,y=n+l;return(e>=o-u&&e<=o+h||e>=x-h&&e<=x+u)&&t>=f&&t<=f+g||(t>=n-u&&t<=n+h||t>=y-h&&t<=y+u)&&e>=d&&e<=d+m?!0:e<d&&t<f&&nd(e,t,d,f,c,h,u)||e>x-c&&t<f&&nd(e,t,x-c,f,c,h,u)||e>x-c&&t>y-c&&nd(e,t,x-c,y-c,c,h,u)||e<d&&t>y-c&&nd(e,t,d,y-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 cd(r,e,t,i,s,o,n,a,l,c){let h=Math.min(.99,Math.max(0,c??nn.defaultOptions.bezierSmoothness)),d=(GL-h)/1;return d*=d,DL(e,t,i,s,o,n,a,l,r,d),r}function DL(r,e,t,i,s,o,n,a,l,c){_x(r,e,t,i,s,o,n,a,l,c,0),l.push(n,a)}function _x(r,e,t,i,s,o,n,a,l,c,u){if(u>LL)return;let h=Math.PI,d=(r+t)/2,f=(e+i)/2,m=(t+s)/2,g=(i+o)/2,x=(s+n)/2,y=(o+a)/2,T=(d+m)/2,p=(f+g)/2,b=(m+x)/2,_=(g+y)/2,S=(T+b)/2,E=(p+_)/2;if(u>0){let C=n-r,P=a-e,M=Math.abs((t-n)*P-(i-a)*C),I=Math.abs((s-n)*P-(o-a)*C),U,A;if(M>ld&&I>ld){if((M+I)*(M+I)<=c*(C*C+P*P)){if(hn<yx){l.push(S,E);return}let O=Math.atan2(o-i,s-t);if(U=Math.abs(O-Math.atan2(i-e,t-r)),A=Math.abs(Math.atan2(a-o,n-s)-O),U>=h&&(U=2*h-U),A>=h&&(A=2*h-A),U+A<hn){l.push(S,E);return}if(zs!==0){if(U>zs){l.push(t,i);return}if(A>zs){l.push(s,o);return}}}}else if(M>ld){if(M*M<=c*(C*C+P*P)){if(hn<yx){l.push(S,E);return}if(U=Math.abs(Math.atan2(o-i,s-t)-Math.atan2(i-e,t-r)),U>=h&&(U=2*h-U),U<hn){l.push(t,i),l.push(s,o);return}if(zs!==0&&U>zs){l.push(t,i);return}}}else if(I>ld){if(I*I<=c*(C*C+P*P)){if(hn<yx){l.push(S,E);return}if(U=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-i,s-t)),U>=h&&(U=2*h-U),U<hn){l.push(t,i),l.push(s,o);return}if(zs!==0&&U>zs){l.push(s,o);return}}}else if(C=S-(r+n)/2,P=E-(e+a)/2,C*C+P*P<=c){l.push(S,E);return}}_x(r,e,d,f,T,p,S,E,l,c,u+1),_x(S,E,b,_,x,y,n,a,l,c,u+1)}var LL,ld,GL,yx,hn,zs,bx=v(()=>{Zh();LL=8,ld=11920929e-14,GL=1,yx=.01,hn=0,zs=0});function CE(r,e,t,i,s,o,n,a){let c=Math.min(.99,Math.max(0,a??nn.defaultOptions.bezierSmoothness)),u=(HL-c)/1;return u*=u,zL(e,t,i,s,o,n,r,u),r}function zL(r,e,t,i,s,o,n,a){vx(n,r,e,t,i,s,o,a,0),n.push(s,o)}function vx(r,e,t,i,s,o,n,a,l){if(l>NL)return;let c=Math.PI,u=(e+i)/2,h=(t+s)/2,d=(i+o)/2,f=(s+n)/2,m=(u+d)/2,g=(h+f)/2,x=o-e,y=n-t,T=Math.abs((i-o)*y-(s-n)*x);if(T>VL){if(T*T<=a*(x*x+y*y)){if(AE<WL){r.push(m,g);return}let p=Math.abs(Math.atan2(n-s,o-i)-Math.atan2(s-t,i-e));if(p>=c&&(p=2*c-p),p<AE){r.push(m,g);return}}}else if(x=m-(e+o)/2,y=g-(t+n)/2,x*x+y*y<=a){r.push(m,g);return}vx(r,e,t,u,h,m,g,a,l+1),vx(r,m,g,d,f,o,n,a,l+1)}var NL,VL,HL,WL,AE,PE=v(()=>{Zh();NL=8,VL=11920929e-14,HL=1,WL=.01,AE=0});function ud(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<a+1;h++){let d=Math.cos(u),f=Math.sin(u),m=e+d*i,g=t+f*i;r.push(m,g),u+=c}}var Tx=v(()=>{"use strict"});function ME(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,m=u*u+h*h,g=l*u+c*h,x=o*Math.sqrt(f)/d,y=o*Math.sqrt(m)/d,T=x*g/f,p=y*g/m,b=x*h+y*c,_=x*u+y*l,S=c*(y+T),E=l*(y+T),C=h*(x+p),P=u*(x+p),M=Math.atan2(E-_,S-b),I=Math.atan2(P-_,C-b);ud(r,b+e,_+t,o,M,I,c*u>h*l)}var RE=v(()=>{Tx()});function $L(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 BE(r,e,t,i,s,o,n,a=0,l=0,c=0){if(o===0||n===0)return;let u=Math.sin(a*El/360),h=Math.cos(a*El/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 m=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);m>1&&(o*=Math.sqrt(m),n*=Math.sqrt(m)),XL(e,t,i,s,o,n,l,c,u,h,d,f,Sx);let{ang1:g,ang2:x}=Sx,{centerX:y,centerY:T}=Sx,p=Math.abs(x)/(El/4);Math.abs(1-p)<1e-7&&(p=1);let b=Math.max(Math.ceil(p),1);x/=b;let _=r[r.length-2],S=r[r.length-1],E={x:0,y:0};for(let C=0;C<b;C++){let P=$L(g,x),{x:M,y:I}=wx(P[0],o,n,h,u,y,T,E),{x:U,y:A}=wx(P[1],o,n,h,u,y,T,E),{x:O,y:F}=wx(P[2],o,n,h,u,y,T,E);cd(r,_,S,M,I,U,A,O,F),_=O,S=F,g+=x}}var El,Sx,wx,IE,XL,kE=v(()=>{bx();El=Math.PI*2,Sx={centerX:0,centerY:0,ang1:0,ang2:0},wx=({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};IE=(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)},XL=(r,e,t,i,s,o,n,a,l,c,u,h,d)=>{let f=Math.pow(s,2),m=Math.pow(o,2),g=Math.pow(u,2),x=Math.pow(h,2),y=f*m-f*x-m*g;y<0&&(y=0),y/=f*x+m*g,y=Math.sqrt(y)*(n===a?-1:1);let T=y*s/o*h,p=y*-o/s*u,b=c*T-l*p+(r+t)/2,_=l*T+c*p+(e+i)/2,S=(u-T)/s,E=(h-p)/o,C=(-u-T)/s,P=(-h-p)/o,M=IE(1,0,S,E),I=IE(S,E,C,P);a===0&&I>0&&(I-=El),a===1&&I<0&&(I+=El),d.centerX=b,d.centerY=_,d.ang1=M,d.ang2=I}});function FE(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;n<e.length;n++){let a=e[n%e.length],l=a.radius??t;if(l<=0){s(n,a),o=a;continue}let c=e[(n+1)%e.length],u=i(a,o),h=i(a,c);if(u.len<1e-4||h.len<1e-4){s(n,a),o=a;continue}let d=Math.asin(u.nx*h.ny-u.ny*h.nx),f=1,m=!1;u.nx*h.nx-u.ny*-h.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,m=!0):d>0&&(f=-1,m=!0);let g=d/2,x,y=Math.abs(Math.cos(g)*l/Math.sin(g));y>Math.min(u.len/2,h.len/2)?(y=Math.min(u.len/2,h.len/2),x=Math.abs(y*Math.sin(g)/Math.cos(g))):x=l;let T=a.x+h.nx*y+-h.ny*x*f,p=a.y+h.ny*y+h.nx*x*f,b=Math.atan2(u.ny,u.nx)+Math.PI/2*f,_=Math.atan2(h.ny,h.nx)-Math.PI/2*f;n===0&&r.moveTo(T+Math.cos(b)*x,p+Math.sin(b)*x),r.arc(T,p,x,b,_,m),o=a}}function OE(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<n;a++){let l=e[(a+1)%n],c=l.radius??t;if(c<=0){a===0?r.moveTo(l.x,l.y):r.lineTo(l.x,l.y);continue}let u=e[a],h=e[(a+2)%n],d=s(u,l),f;if(d<1e-4)f=l;else{let x=Math.min(d/2,c);f=o(l,u,x/d)}let m=s(h,l),g;if(m<1e-4)g=l;else{let x=Math.min(m/2,c);g=o(l,h,x/m)}a===0?r.moveTo(f.x,f.y):r.lineTo(f.x,f.y),r.quadraticCurveTo(l.x,l.y,g.x,g.y,i)}}var UE=v(()=>{"use strict"});var jL,hd,LE=v(()=>{bE();vE();wE();mt();EE();Zt();bx();PE();Tx();RE();kE();UE();jL=new ee,hd=class{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Be,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 ud(a,e,t,i,s,o,n),this}arcTo(e,t,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return ME(n,e,t,i,s,o),this}arcToSvg(e,t,i,s,o,n,a){let l=this._currentPoly.points;return BE(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 cd(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 CE(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;o<e.instructions.length;o++){let n=e.instructions[o];this[n.action](...n.data)}if(e.checkForHoles&&i.length-s>1){let o=null;for(let n=s;n<i.length;n++){let a=i[n];if(a.shape.type==="polygon"){let l=a.shape,c=o?.shape;c&&c.containsPolygon(l)?(o.holes||(o.holes=[]),o.holes.push(a),i.copyWithin(n,n+1),i.length--,n--):o=a}}}return this}finish(e=!1){this.endPoly(e)}rect(e,t,i,s,o){return this.drawShape(new ee(e,t,i,s),o),this}circle(e,t,i,s){return this.drawShape(new sd(e,t,i),s),this}poly(e,t,i){let s=new un(e);return s.closePath=t,this.drawShape(s,i),this}regularPoly(e,t,i,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,l=Math.PI*2/s,c=[];for(let u=0;u<s;u++){let h=a-u*l;c.push(e+i*Math.cos(h),t+i*Math.sin(h))}return this.poly(c,!0,n),this}roundPoly(e,t,i,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(e,t,i,s,n);let l=i*Math.sin(Math.PI/s)-.001;o=Math.min(o,l);let c=-1*Math.PI/2+n,u=Math.PI*2/s,h=(s-2)*Math.PI/s/2;for(let d=0;d<s;d++){let f=d*u+c,m=e+i*Math.cos(f),g=t+i*Math.sin(f),x=f+Math.PI+h,y=f-Math.PI-h,T=m+o*Math.cos(x),p=g+o*Math.sin(x),b=m+o*Math.cos(y),_=g+o*Math.sin(y);d===0?this.moveTo(T,p):this.lineTo(T,p),this.quadraticCurveTo(m,g,b,_,a)}return this.closePath()}roundShape(e,t,i=!1,s){return e.length<3?this:(i?OE(this,e,t,s):FE(this,e,t),this.closePath())}filletRect(e,t,i,s,o){if(o===0)return this.rect(e,t,i,s);let n=Math.min(i,s)/2,a=Math.min(n,Math.max(-n,o)),l=e+i,c=t+s,u=a<0?-a:0,h=Math.abs(a);return this.moveTo(e,t+h).arcTo(e+u,t+u,e+h,t,h).lineTo(l-h,t).arcTo(l-u,t+u,l,t+h,h).lineTo(l,c-h).arcTo(l-u,c-u,e+i-h,c,h).lineTo(e+h,c).arcTo(e+u,c-u,e,c-h,h).closePath()}chamferRect(e,t,i,s,o,n){if(o<=0)return this.rect(e,t,i,s);let a=Math.min(o,Math.min(i,s)/2),l=e+i,c=t+s,u=[e+a,t,l-a,t,l,t+a,l,c-a,l-a,c,e+a,c,e,c-a,e,t+a];for(let h=u.length-1;h>=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 od(e,t,i,s),o),this}roundRect(e,t,i,s,o,n){return this.drawShape(new ad(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 un,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 un,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<e.instructions.length;t++){let i=e.instructions[t];this[i.action](...i.data)}this.finish()}get bounds(){let e=this._bounds;e.clear();let t=this.shapePrimitives;for(let i=0;i<t.length;i++){let s=t[i],o=s.shape.getBounds(jL);s.transform?e.addRect(o,s.transform):e.addRect(o)}return e}}});function Al(r,e){return r?r.prepend(e):e.clone()}var os,Ex=v(()=>{Tr();Pt();ke();_E();LE();os=class r{constructor(e,t=!1){this.instructions=[],this.uid=me("graphicsPath"),this._dirty=!0,this.checkForHoles=t,typeof e=="string"?yE(e,this):this.instructions=e?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new hd(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(ge.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(ge.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<c;d++){let f=d%2?o:s,m=d*u+l;h.push(e+f*Math.cos(m),t+f*Math.sin(m))}return this.poly(h,!0,a),this}clone(e=!1){let t=new r;if(t.checkForHoles=this.checkForHoles,!e)t.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){let s=this.instructions[i];t.instructions.push({action:s.action,data:s.data.slice()})}return t}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(e){if(e.isIdentity())return this;let t=e.a,i=e.b,s=e.c,o=e.d,n=e.tx,a=e.ty,l=0,c=0,u=0,h=0,d=0,f=0,m=0,g=0;for(let x=0;x<this.instructions.length;x++){let y=this.instructions[x],T=y.data;switch(y.action){case"moveTo":case"lineTo":l=T[0],c=T[1],T[0]=t*l+s*c+n,T[1]=i*l+o*c+a;break;case"bezierCurveTo":u=T[0],h=T[1],d=T[2],f=T[3],l=T[4],c=T[5],T[0]=t*u+s*h+n,T[1]=i*u+o*h+a,T[2]=t*d+s*f+n,T[3]=i*d+o*f+a,T[4]=t*l+s*c+n,T[5]=i*l+o*c+a;break;case"quadraticCurveTo":u=T[0],h=T[1],l=T[2],c=T[3],T[0]=t*u+s*h+n,T[1]=i*u+o*h+a,T[2]=t*l+s*c+n,T[3]=i*l+o*c+a;break;case"arcToSvg":l=T[5],c=T[6],m=T[0],g=T[1],T[0]=t*m+s*g,T[1]=i*m+o*g,T[5]=t*l+s*c+n,T[6]=i*l+o*c+a;break;case"circle":T[4]=Al(T[3],e);break;case"rect":T[4]=Al(T[4],e);break;case"ellipse":T[8]=Al(T[8],e);break;case"roundRect":T[5]=Al(T[5],e);break;case"addPath":T[0].transform(e);break;case"poly":T[2]=Al(T[2],e);break;default:X("unknown transform action",y.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(e){let t=this.instructions.length-1,i=this.instructions[t];if(!i)return e.x=0,e.y=0,e;for(;i.action==="closePath";){if(t--,t<0)return e.x=0,e.y=0,e;i=this.instructions[t]}switch(i.action){case"moveTo":case"lineTo":e.x=i.data[0],e.y=i.data[1];break;case"quadraticCurveTo":e.x=i.data[2],e.y=i.data[3];break;case"bezierCurveTo":e.x=i.data[4],e.y=i.data[5];break;case"arc":case"arcToSvg":e.x=i.data[5],e.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(e);break}return e}}});function qe(r,e,t){let i=r.getAttribute(e);return i?Number(i):t}var Ax=v(()=>{"use strict"});function GE(r,e){let t=r.querySelectorAll("defs");for(let i=0;i<t.length;i++){let s=t[i];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":e.defs[n.id]=YL(n);break;case"radialgradient":e.defs[n.id]=qL(n);break;default:break}}}}function YL(r){let e=qe(r,"x1",0),t=qe(r,"y1",0),i=qe(r,"x2",1),s=qe(r,"y2",0),o=r.getAttribute("gradientUnits")||"objectBoundingBox",n=new ir(e,t,i,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<r.children.length;a++){let l=r.children[a],c=qe(l,"offset",0),u=ce.shared.setValue(l.getAttribute("stop-color")).toNumber();n.addColorStop(c,u)}return n}function qL(r){return X("[SVG Parser] Radial gradients are not yet supported"),new ir(0,0,1,0)}var DE=v(()=>{At();ke();on();Ax()});function Cx(r){let e=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}var NE=v(()=>{"use strict"});function Px(r,e){let t=r.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:!1,useStroke:!1};for(let n in VE){let a=r.getAttribute(n);a&&HE(e,o,n,a.trim())}if(t){let n=t.split(";");for(let a=0;a<n.length;a++){let l=n[a].trim(),[c,u]=l.split(":");VE[c]&&HE(e,o,c,u.trim())}}return{strokeStyle:o.useStroke?i:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function HE(r,e,t,i){switch(t){case"stroke":if(i!=="none"){if(i.startsWith("url(")){let s=Cx(i);e.strokeStyle.fill=r.defs[s]}else e.strokeStyle.color=ce.shared.setValue(i).toNumber();e.useStroke=!0}break;case"stroke-width":e.strokeStyle.width=Number(i);break;case"fill":if(i!=="none"){if(i.startsWith("url(")){let s=Cx(i);e.fillStyle.fill=r.defs[s]}else e.fillStyle.color=ce.shared.setValue(i).toNumber();e.useFill=!0}break;case"fill-opacity":e.fillStyle.alpha=Number(i);break;case"stroke-opacity":e.strokeStyle.alpha=Number(i);break;case"opacity":e.fillStyle.alpha=Number(i),e.strokeStyle.alpha=Number(i);break}}var VE,WE=v(()=>{At();NE();VE={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 zE(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 os};GE(r,t);let i=r.children,{fillStyle:s,strokeStyle:o}=Px(r,t);for(let n=0;n<i.length;n++){let a=i[n];a.nodeName.toLowerCase()!=="defs"&&$E(a,t,s,o)}return e}function $E(r,e,t,i){let s=r.children,{fillStyle:o,strokeStyle:n}=Px(r,e);o&&t?t={...t,...o}:o&&(t=o),n&&i?i={...i,...n}:n&&(i=n);let a=!t&&!i;a&&(t={color:0});let l,c,u,h,d,f,m,g,x,y,T,p,b,_,S,E,C;switch(r.nodeName.toLowerCase()){case"path":_=r.getAttribute("d"),r.getAttribute("fill-rule")==="evenodd"&&X("SVG Evenodd fill rule not supported, your svg may render incorrectly"),S=new os(_,!0),e.context.path(S),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"circle":m=qe(r,"cx",0),g=qe(r,"cy",0),x=qe(r,"r",0),e.context.ellipse(m,g,x,x),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"rect":l=qe(r,"x",0),c=qe(r,"y",0),E=qe(r,"width",0),C=qe(r,"height",0),y=qe(r,"rx",0),T=qe(r,"ry",0),y||T?e.context.roundRect(l,c,E,C,y||T):e.context.rect(l,c,E,C),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"ellipse":m=qe(r,"cx",0),g=qe(r,"cy",0),y=qe(r,"rx",0),T=qe(r,"ry",0),e.context.beginPath(),e.context.ellipse(m,g,y,T),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"line":u=qe(r,"x1",0),h=qe(r,"y1",0),d=qe(r,"x2",0),f=qe(r,"y2",0),e.context.beginPath(),e.context.moveTo(u,h),e.context.lineTo(d,f),i&&e.context.stroke(i);break;case"polygon":b=r.getAttribute("points"),p=b.match(/\d+/g).map(P=>parseInt(P,10)),e.context.poly(p,!0),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"polyline":b=r.getAttribute("points"),p=b.match(/\d+/g).map(P=>parseInt(P,10)),e.context.poly(p,!1),i&&e.context.stroke(i);break;case"g":case"svg":break;default:{X(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}a&&(t=null);for(let P=0;P<s.length;P++)$E(s[P],e,t,i)}var XE=v(()=>{ke();Ex();DE();Ax();WE()});function KL(r){return ce.isColorLike(r)}function jE(r){return r instanceof Ci}function YE(r){return r instanceof ir}function ZL(r){return r instanceof k}function QL(r,e,t){let i=ce.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 JL(r,e,t){return r.texture=e,{...t,...r}}function qE(r,e,t){return r.fill=e,r.color=16777215,r.texture=e.texture,r.matrix=e.transform,{...t,...r}}function KE(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 eG(r,e){let t={...e,...r},i=ce.shared.setValue(t.color);return t.alpha*=i.alpha,t.color=i.toNumber(),t}function Pi(r,e){if(r==null)return null;let t={},i=r;return KL(r)?QL(t,r,e):ZL(r)?JL(t,r,e):jE(r)?qE(t,r,e):YE(r)?KE(t,r,e):i.fill&&jE(i.fill)?qE(i,i.fill,e):i.fill&&YE(i.fill)?KE(i,i.fill,e):eG(i,e)}function dn(r,e){let{width:t,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}=e,c=Pi(r,l);return c?{width:t,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...c}:null}var Mx=v(()=>{At();Ce();on();id()});var tG,ZE,Rx,jt,dd=v(()=>{Ft();At();ve();Tr();Ce();Pt();Xe();Zt();Ex();XE();Mx();tG=new ge,ZE=new V,Rx=class ni extends Ue{constructor(){super(...arguments),this.uid=me("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new os,this._transform=new V,this._fillStyle={...ni.defaultFillStyle},this._strokeStyle={...ni.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Be,this._boundsDirty=!0}clone(){let e=new ni;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=Pi(e,ni.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=dn(e,ni.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=Pi(e,ni.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=Pi(e,ni.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?ce.shared.setValue(t).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new os,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"&&(Y(ne,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:t}),this._fillStyle=Pi(e,ni.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(ge.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=dn(e,ni.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++,zE(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 V?(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 V?(this._transform.append(e),this):(ZE.set(e,t,i,s,o,n),this._transform.append(ZE),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<this.instructions.length;t++){let i=this.instructions[t],s=i.action;if(s==="fill"){let o=i.data;e.addBounds(o.path.bounds)}else if(s==="texture"){let o=i.data;e.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform)}if(s==="stroke"){let o=i.data,n=o.style.alignment,a=o.style.width*(1-n),l=o.path.bounds;e.addFrame(l.minX-a,l.minY-a,l.maxX+a,l.maxY+a)}}return e}containsPoint(e){if(!this.bounds.containsPoint(e.x,e.y))return!1;let t=this.instructions,i=!1;for(let s=0;s<t.length;s++){let o=t[s],n=o.data,a=n.path;if(!o.action||!a)continue;let l=n.style,c=a.shapePath.shapePrimitives;for(let u=0;u<c.length;u++){let h=c[u].shape;if(!l||!h)continue;let d=c[u].transform,f=d?d.applyInverse(e,tG):e;if(o.action==="fill")i=h.contains(f.x,f.y);else{let g=l;i=h.strokeContains(f.x,f.y,g.width,g.alignment)}let m=n.hole;if(m){let g=m.shapePath?.shapePrimitives;if(g)for(let x=0;x<g.length;x++)g[x].shape.contains(f.x,f.y)&&(i=!1)}if(i)return!0}}return i}destroy(e=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof e=="boolean"?e:e?.texture){let i=typeof e=="boolean"?e:e?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(i),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(i)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};Rx.defaultFillStyle={color:16777215,alpha:1,texture:k.WHITE,matrix:null,fill:null,textureSpace:"local"};Rx.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:k.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};jt=Rx});function fd(r){let e=[],t=0;for(let i=0;i<QE.length;i++){let s=`_${QE[i]}`;e[t++]=r[s]}return t=JE(r._fill,e,t),t=rG(r._stroke,e,t),t=iG(r.dropShadow,e,t),e.join("-")}function JE(r,e,t){return r&&(e[t++]=r.color,e[t++]=r.alpha,e[t++]=r.fill?.styleKey),t}function rG(r,e,t){return r&&(t=JE(r,e,t),e[t++]=r.width,e[t++]=r.alignment,e[t++]=r.cap,e[t++]=r.join,e[t++]=r.miterLimit),t}function iG(r,e,t){return r&&(e[t++]=r.alpha,e[t++]=r.angle,e[t++]=r.blur,e[t++]=r.distance,e[t++]=ce.shared.setValue(r.color).toNumber()),t}var QE,Ix=v(()=>{At();QE=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function sG(r){let e=r;if(typeof e.dropShadow=="boolean"&&e.dropShadow){let t=Ie.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){Y(ne,"strokeThickness is now a part of stroke");let t=e.stroke,i={};if(ce.isColorLike(t))i.color=t;else if(t instanceof ir||t instanceof Ci)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)){Y(ne,"gradient fill is now a fill pattern: `new FillGradient(...)`");let t;r.fontSize==null?r.fontSize=Ie.defaultTextStyle.fontSize:typeof r.fontSize=="string"?t=parseInt(r.fontSize,10):t=r.fontSize;let i=new ir({start:{x:0,y:0},end:{x:0,y:(t||0)*1.7}}),s=e.fillGradientStops.map(o=>ce.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o)}),r.fill={fill:i}}}var Bx,Ie,$s=v(()=>{Ft();At();Xe();on();id();dd();Mx();Ix();Bx=class fn extends Ue{constructor(e={}){super(),sG(e);let t={...fn.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({...fn.defaultDropShadow,...e}):this._dropShadow=e?this._createProxy({...fn.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({...jt.defaultFillStyle,...e},()=>{this._fill=Pi({...this._originalFill},jt.defaultFillStyle)})),this._fill=Pi(e===0?"black":e,jt.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(e){e!==this._originalStroke&&(this._originalStroke=e,this._isFillStyle(e)&&(this._originalStroke=this._createProxy({...jt.defaultStrokeStyle,...e},()=>{this._stroke=dn({...this._originalStroke},jt.defaultStrokeStyle)})),this._stroke=dn(e,jt.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=fd(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let e=fn.defaultTextStyle;for(let t in e)this[t]=e[t]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new fn({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&&!(ce.isColorLike(e)||e instanceof ir||e instanceof Ci)}};Bx.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};Bx.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};Ie=Bx});function pd(r,e,t,i){let s=oG;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;let o=Fe.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 oG,kx=v(()=>{qr();Zt();oG=new Be});function Xs(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)&&!nG.includes(s)&&(s=`"${s}"`),t[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${e} ${t.join(",")}`}var nG,md=v(()=>{"use strict";nG=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var Fx,Dr,Ne,Cl=v(()=>{De();md();Fx={willReadFrequently:!0},Dr=class Q{static get experimentalLetterSpacingSupported(){let e=Q._experimentalLetterSpacingSupported;if(e!==void 0){let t=Z.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=Xs(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 T=0;T<u.length;T++){let p=Q._measureText(u[T],t.letterSpacing,l);h[T]=p,d=Math.max(d,p)}let f=t._stroke?.width||0,m=d+f;t.dropShadow&&(m+=t.dropShadow.distance);let g=t.lineHeight||a.fontSize,x=Math.max(g,a.fontSize+f)+(u.length-1)*(g+t.leading);return t.dropShadow&&(x+=t.dropShadow.distance),new Q(e,t,m,x,u,h,g+t.leading,d,a)}static _measureText(e,t,i){let s=!1;Q.experimentalLetterSpacingSupported&&(Q.experimentalLetterSpacing?(i.letterSpacing=`${t}px`,i.textLetterSpacing=`${t}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let o=i.measureText(e),n=o.width,a=-o.actualBoundingBoxLeft,c=o.actualBoundingBoxRight-a;if(n>0)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",Fx),o=0,n="",a="",l=Object.create(null),{letterSpacing:c,whiteSpace:u}=t,h=Q._collapseSpaces(u),d=Q._collapseNewlines(u),f=!h,m=t.wordWrapWidth+c,g=Q._tokenize(e);for(let x=0;x<g.length;x++){let y=g[x];if(Q._isNewline(y)){if(!d){a+=Q._addLine(n),f=!h,n="",o=0;continue}y=" "}if(h){let p=Q.isBreakingSpace(y),b=Q.isBreakingSpace(n[n.length-1]);if(p&&b)continue}let T=Q._getFromCache(y,c,l,s);if(T>m)if(n!==""&&(a+=Q._addLine(n),n="",o=0),Q.canBreakWords(y,t.breakWords)){let p=Q.wordWrapSplit(y);for(let b=0;b<p.length;b++){let _=p[b],S=_,E=1;for(;p[b+E];){let P=p[b+E];if(!Q.canBreakChars(S,P,y,b,t.breakWords))_+=P;else break;S=P,E++}b+=E-1;let C=Q._getFromCache(_,c,l,s);C+o>m&&(a+=Q._addLine(n),f=!1,n="",o=0),n+=_,o+=C}}else{n.length>0&&(a+=Q._addLine(n),n="",o=0);let p=x===g.length-1;a+=Q._addLine(y,!p),f=!1,n="",o=0}else T+o>m&&(f=!1,a+=Q._addLine(n),n="",o=0),(n.length>0||!Q.isBreakingSpace(y)||f)&&(n+=y,o+=T)}return a+=Q._addLine(n,!1),a}static _addLine(e,t=!0){return e=Q._trimRight(e),e=t?`${e}
368
- `: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<e.length;s++){let o=e[s],n=e[s+1];if(Q.isBreakingSpace(o,n)||Q._isNewline(o)){i!==""&&(t.push(i),i=""),t.push(o);continue}i+=o}return i!==""&&t.push(i),t}static canBreakWords(e,t){return t}static canBreakChars(e,t,i,s,o){return!0}static wordWrapSplit(e){return Q.graphemeSegmenter(e)}static measureFont(e){if(Q._fonts[e])return Q._fonts[e];let t=Q._context;t.font=e;let i=t.measureText(Q.METRICS_STRING+Q.BASELINE_SYMBOL),s={ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,fontSize:i.actualBoundingBoxAscent+i.actualBoundingBoxDescent};return Q._fonts[e]=s,s}static clearMetrics(e=""){e?delete Q._fonts[e]:Q._fonts={}}static get _canvas(){if(!Q.__canvas){let e;try{let t=new OffscreenCanvas(0,0);if(t.getContext("2d",Fx)?.measureText)return Q.__canvas=t,t;e=Z.get().createCanvas()}catch{e=Z.get().createCanvas()}e.width=e.height=10,Q.__canvas=e}return Q.__canvas}static get _context(){return Q.__context||(Q.__context=Q._canvas.getContext("2d",Fx)),Q.__context}};Dr.METRICS_STRING="|\xC9q\xC5";Dr.BASELINE_SYMBOL="M";Dr.BASELINE_MULTIPLIER=1.4;Dr.HEIGHT_MULTIPLIER=2;Dr.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let r=new Intl.Segmenter;return e=>[...r.segment(e)].map(t=>t.segment)}return r=>[...r]})();Dr.experimentalLetterSpacing=!1;Dr._fonts={};Dr._newlines=[10,13];Dr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];Dr._measurementCache={};Ne=Dr});function pn(r,e,t,i=0){if(r.texture===k.WHITE&&!r.fill)return ce.shared.setValue(r.color).setAlpha(r.alpha??1).toHexa();if(r.fill){if(r.fill instanceof Ci){let s=r.fill,o=e.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(V.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(r.fill instanceof ir){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)<Math.abs((d.y-h.y)*.1)}else{let{center:h,innerRadius:d,outerCenter:f,outerRadius:m}=s;c=e.createRadialGradient(h.x*a,h.y*l,d*a,f.x*a,f.y*l,m*a)}if(u&&n&&t){let h=t.lineHeight/l;for(let d=0;d<t.lines.length;d++){let f=(d*t.lineHeight+i/2)/l;s.colorStops.forEach(m=>{let g=f+m.offset*h;c.addColorStop(Math.floor(g*eA)/eA,ce.shared.setValue(m.color).toHex())})}}else s.colorStops.forEach(h=>{c.addColorStop(h.offset,ce.shared.setValue(h.color).toHex())});return c}}else{let s=e.createPattern(r.texture.source.resource,"repeat"),o=r.matrix.copyTo(V.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),s.setTransform(o),s}return X("FillStyle not recognised",r),"red"}var eA,Ox=v(()=>{At();ve();Ce();ke();on();id();eA=1e5});var Pl,tA=v(()=>{At();L();ja();cn();qr();fE();Xe();$s();kx();Cl();md();Ox();Pl=class{constructor(e){this._activeTextures={},this._renderer=e}getTextureSize(e,t,i){let s=Ne.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=vi(o),n=vi(n),{width:o,height:n}}getTexture(e,t,i,s){typeof e=="string"&&(Y("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),e={text:e,style:i,resolution:t}),e.style instanceof Ie||(e.style=new Ie(e.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(e);return this._renderer.texture.initSource(o._source),sr.returnCanvasAndContext(n),o}createTextureAndCanvas(e){let{text:t,style:i}=e,s=e.resolution??this._renderer.resolution,o=Ne.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=sr.getOptimalCanvasAndContext(n,a),{canvas:c}=l;this.renderTextToCanvas(t,i,s,l);let u=pd(c,n,a,s);if(i.trim){let h=dE(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",Fe.returnTexture(e)}decreaseReferenceCount(e){let t=this._activeTextures[e];t.usageCount--,t.usageCount===0&&(sr.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=Xs(t),l=Ne.measureText(e||" ",t),c=l.lines,u=l.lineHeight,h=l.lineWidths,d=l.maxLineWidth,f=l.fontProperties,m=o.height;if(n.resetTransform(),n.scale(i,i),n.textBaseline=t.textBaseline,t._stroke?.width){let T=t._stroke;n.lineWidth=T.width,n.miterLimit=T.miterLimit,n.lineJoin=T.join,n.lineCap=T.cap}n.font=a;let g,x,y=t.dropShadow?2:1;for(let T=0;T<y;++T){let p=t.dropShadow&&T===0,b=p?Math.ceil(Math.max(1,m)+t.padding*2):0,_=b*i;if(p){n.fillStyle="black",n.strokeStyle="black";let C=t.dropShadow,P=C.color,M=C.alpha;n.shadowColor=ce.shared.setValue(P).setAlpha(M).toRgbaString();let I=C.blur*i,U=C.distance*i;n.shadowBlur=I,n.shadowOffsetX=Math.cos(C.angle)*U,n.shadowOffsetY=Math.sin(C.angle)*U+_}else{if(n.fillStyle=t._fill?pn(t._fill,n,l):null,t._stroke?.width){let C=t._stroke.width*t._stroke.alignment;n.strokeStyle=pn(t._stroke,n,l,C)}n.shadowColor="black"}let S=(u-f.fontSize)/2;u-f.fontSize<0&&(S=0);let E=t._stroke?.width??0;for(let C=0;C<c.length;C++)g=E/2,x=E/2+C*u+f.ascent+S,t.align==="right"?g+=d-h[C]:t.align==="center"&&(g+=(d-h[C])/2),t._stroke?.width&&this._drawLetterSpacing(c[C],t,s,g+t.padding,x+t.padding-b,!0),t._fill!==void 0&&this._drawLetterSpacing(c[C],t,s,g+t.padding,x+t.padding-b)}}_drawLetterSpacing(e,t,i,s,o,n=!1){let{context:a}=i,l=t.letterSpacing,c=!1;if(Ne.experimentalLetterSpacingSupported&&(Ne.experimentalLetterSpacing?(a.letterSpacing=`${l}px`,a.textLetterSpacing=`${l}px`,c=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),l===0||c){n?a.strokeText(e,s,o):a.fillText(e,s,o);return}let u=s,h=Ne.graphemeSegmenter(e),d=a.measureText(e).width,f=0;for(let m=0;m<h.length;++m){let g=h[m];n?a.strokeText(g,u,o):a.fillText(g,u,o);let x="";for(let y=m+1;y<h.length;++y)x+=h[y];f=a.measureText(x).width,u+=d-f+l,d=f}}destroy(){this._activeTextures=null}};Pl.extension={type:[w.WebGLSystem,w.WebGPUSystem,w.CanvasSystem],name:"canvasText"}});var Ux=v(()=>{L();cE();tA();$.add(Pl);$.add(wl)});var We,Lx=v(()=>{Xe();Eh();dd();We=class r extends Yi{constructor(e){e instanceof jt&&(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 jt,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){Y(ne,"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){Y(ne,"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(){Y(ne,"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!==jt.defaultStrokeStyle.width||e.color!==jt.defaultStrokeStyle.color||e.alpha!==jt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return Y(ne,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return Y(ne,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return Y(ne,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return Y(ne,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return Y(ne,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return Y(ne,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}});var rA,iA,sA=v(()=>{"use strict";rA={name:"local-uniform-msdf-bit",vertex:{header:`
367
+ }`});var td,oE=v(()=>{At();ve();es();Ns();Lr();Ce();Wm();tE();iE();sE();td=class extends et{constructor(){let e=er.from({vertex:rE,fragment:eE}),t=rr.from({fragment:{source:dx,entryPoint:"mainFragment"},vertex:{source:dx,entryPoint:"mainVertex"}});super({glProgram:e,gpuProgram:t,resources:{uTexture:k.WHITE.source,uSampler:new gh({}),uniforms:{uTranslationMatrix:{value:new V,type:"mat3x3<f32>"},uColor:{value:new ce(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var ln,fx=v(()=>{ve();Ut();cl();Gr();an();Jw();oE();ln=class{constructor(e,t){this.state=rt.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new Ae({uTranslationMatrix:{value:new V,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=e,this.adaptor=t,this.defaultShader=new td,this.state=rt.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 ed({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=wi(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,si(e.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,e)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var bl,nE=v(()=>{L();Yw();fx();bl=class extends ln{constructor(e){super(e,new Jh)}};bl.extension={type:[w.WebGLPipes],name:"particle"}});var rd,aE=v(()=>{"use strict";rd=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 vl,lE=v(()=>{L();aE();fx();vl=class extends ln{constructor(e){super(e,new rd)}};vl.extension={type:[w.WebGPUPipes],name:"particle"}});var px=v(()=>{L();nE();lE();$.add(bl);$.add(vl)});var oi,Tl=v(()=>{"use strict";oi=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 Sl(r,e){let{texture:t,bounds:i}=r;Ph(i,e._anchor,t);let s=e._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s}var mx=v(()=>{fg()});var wl,cE=v(()=>{L();Wt();Tl();mx();wl=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),le.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,Sl(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:le.get(oi)};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}};wl.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"text"}});var gx,sr,cn=v(()=>{De();ja();gx=class{constructor(e){this._canvasPool=Object.create(null),this.canvasOptions=e||{},this.enableFullScreen=!1}_createCanvasAndContext(e,t){let i=Z.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=vi(e),t=vi(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={}}},sr=new gx});function uE(r,e,t){for(let i=0,s=4*t*e;i<e;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function hE(r,e,t,i,s){let o=4*e;for(let n=i,a=i*o+4*t;n<=s;++n,a+=o)if(r[a+3]!==0)return!1;return!0}function dE(r,e=1){let{width:t,height:i}=r,s=r.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,t,i).data,a=0,l=0,c=t-1,u=i-1;for(;l<i&&uE(n,t,l);)++l;if(l===i)return ee.EMPTY;for(;uE(n,t,u);)--u;for(;hE(n,t,a,l,u);)++a;for(;hE(n,t,c,l,u);)--c;return++c,++u,new ee(a/e,l/e,(c-a)/e,(u-l)/e)}var fE=v(()=>{mt()});var pE,Ci,id=v(()=>{ve();Pt();pE={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"}},Ci=class{constructor(e,t){this.uid=me("fillPattern"),this.transform=new V,this._styleKey=null,this.texture=e,this.transform.scale(1/e.frame.width,1/e.frame.height),t&&(e.source.style.addressModeU=pE[t].addressModeU,e.source.style.addressModeV=pE[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 gE=oe((Z9,mE)=>{mE.exports=BL;var xx={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},IL=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function BL(r){var e=[];return r.replace(IL,function(t,i,s){var o=i.toLowerCase();for(s=FL(s),o=="m"&&s.length>2&&(e.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==xx[o])return s.unshift(i),e.push(s);if(s.length<xx[o])throw new Error("malformed path data");e.push([i].concat(s.splice(0,xx[o])))}}),e}var kL=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function FL(r){var e=r.match(kL);return e?e.map(Number):[]}});function yE(r,e){let t=(0,xE.default)(r),i=[],s=null,o=0,n=0;for(let a=0;a<t.length;a++){let l=t[a],c=l[0],u=l;switch(c){case"M":o=u[1],n=u[2],e.moveTo(o,n);break;case"m":o+=u[1],n+=u[2],e.moveTo(o,n);break;case"H":o=u[1],e.lineTo(o,n);break;case"h":o+=u[1],e.lineTo(o,n);break;case"V":n=u[1],e.lineTo(o,n);break;case"v":n+=u[1],e.lineTo(o,n);break;case"L":o=u[1],n=u[2],e.lineTo(o,n);break;case"l":o+=u[1],n+=u[2],e.lineTo(o,n);break;case"C":o=u[5],n=u[6],e.bezierCurveTo(u[1],u[2],u[3],u[4],o,n);break;case"c":e.bezierCurveTo(o+u[1],n+u[2],o+u[3],n+u[4],o+u[5],n+u[6]),o+=u[5],n+=u[6];break;case"S":o=u[3],n=u[4],e.bezierCurveToShort(u[1],u[2],o,n);break;case"s":e.bezierCurveToShort(o+u[1],n+u[2],o+u[3],n+u[4]),o+=u[3],n+=u[4];break;case"Q":o=u[3],n=u[4],e.quadraticCurveTo(u[1],u[2],o,n);break;case"q":e.quadraticCurveTo(o+u[1],n+u[2],o+u[3],n+u[4]),o+=u[3],n+=u[4];break;case"T":o=u[1],n=u[2],e.quadraticCurveToShort(o,n);break;case"t":o+=u[1],n+=u[2],e.quadraticCurveToShort(o,n);break;case"A":o=u[6],n=u[7],e.arcToSvg(u[1],u[2],u[3],u[4],u[5],o,n);break;case"a":o+=u[6],n+=u[7],e.arcToSvg(u[1],u[2],u[3],u[4],u[5],o,n);break;case"Z":case"z":e.closePath(),i.length>0&&(s=i.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:X(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s))}return e}var xE,_E=v(()=>{xE=As(gE(),1);ke()});var sd,bE=v(()=>{mt();sd=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 ee),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 od,vE=v(()=>{mt();od=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,m=t-this.y,g=f*f/(c*c)+m*m/(u*u),x=f*f/(h*h)+m*m/(d*d);return g>1&&x<=1}getBounds(e){return e||(e=new ee),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 TE(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,m;d<0?(f=t,m=i):d>1?(f=s,m=o):(f=t+d*l,m=i+d*c);let g=r-f,x=e-m;return g*g+x*x}var SE=v(()=>{"use strict"});var OL,UL,un,wE=v(()=>{SE();mt();un=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;s<o;s++)i.push(t[s].x,t[s].y);t=i}this.points=t,this.closePath=!0}isClockwise(){let e=0,t=this.points,i=t.length;for(let s=0;s<i;s+=2){let o=t[s],n=t[s+1],a=t[(s+2)%i],l=t[(s+3)%i];e+=(a-o)*(l+n)}return e<0}containsPolygon(e){let t=this.getBounds(OL),i=e.getBounds(UL);if(!t.containsRect(i))return!1;let s=e.points;for(let o=0;o<s.length;o+=2){let n=s[o],a=s[o+1];if(!this.contains(n,a))return!1}return!0}clone(){let e=this.points.slice(),t=new r(e);return t.closePath=this.closePath,t}contains(e,t){let i=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],l=this.points[o*2+1],c=this.points[n*2],u=this.points[n*2+1];l>t!=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;u<c;u+=2){let h=l[u],d=l[u+1],f=l[(u+2)%l.length],m=l[(u+3)%l.length],g=TE(e,t,h,d,f,m),x=Math.sign((f-h)*(t-d)-(m-d)*(e-h));if(g<=(x<0?a:n))return!0}return!1}getBounds(e){e||(e=new ee);let t=this.points,i=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,l=t.length;a<l;a+=2){let c=t[a],u=t[a+1];i=c<i?c:i,s=c>s?c:s,o=u<o?u:o,n=u>n?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 nd,ad,EE=v(()=>{mt();nd=(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},ad=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 ee),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,m=a-c*2,g=l-c*2,x=o+a,y=n+l;return(e>=o-u&&e<=o+h||e>=x-h&&e<=x+u)&&t>=f&&t<=f+g||(t>=n-u&&t<=n+h||t>=y-h&&t<=y+u)&&e>=d&&e<=d+m?!0:e<d&&t<f&&nd(e,t,d,f,c,h,u)||e>x-c&&t<f&&nd(e,t,x-c,f,c,h,u)||e>x-c&&t>y-c&&nd(e,t,x-c,y-c,c,h,u)||e<d&&t>y-c&&nd(e,t,d,y-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 cd(r,e,t,i,s,o,n,a,l,c){let h=Math.min(.99,Math.max(0,c??nn.defaultOptions.bezierSmoothness)),d=(GL-h)/1;return d*=d,DL(e,t,i,s,o,n,a,l,r,d),r}function DL(r,e,t,i,s,o,n,a,l,c){_x(r,e,t,i,s,o,n,a,l,c,0),l.push(n,a)}function _x(r,e,t,i,s,o,n,a,l,c,u){if(u>LL)return;let h=Math.PI,d=(r+t)/2,f=(e+i)/2,m=(t+s)/2,g=(i+o)/2,x=(s+n)/2,y=(o+a)/2,T=(d+m)/2,p=(f+g)/2,b=(m+x)/2,_=(g+y)/2,S=(T+b)/2,E=(p+_)/2;if(u>0){let C=n-r,P=a-e,R=Math.abs((t-n)*P-(i-a)*C),I=Math.abs((s-n)*P-(o-a)*C),U,A;if(R>ld&&I>ld){if((R+I)*(R+I)<=c*(C*C+P*P)){if(hn<yx){l.push(S,E);return}let O=Math.atan2(o-i,s-t);if(U=Math.abs(O-Math.atan2(i-e,t-r)),A=Math.abs(Math.atan2(a-o,n-s)-O),U>=h&&(U=2*h-U),A>=h&&(A=2*h-A),U+A<hn){l.push(S,E);return}if(zs!==0){if(U>zs){l.push(t,i);return}if(A>zs){l.push(s,o);return}}}}else if(R>ld){if(R*R<=c*(C*C+P*P)){if(hn<yx){l.push(S,E);return}if(U=Math.abs(Math.atan2(o-i,s-t)-Math.atan2(i-e,t-r)),U>=h&&(U=2*h-U),U<hn){l.push(t,i),l.push(s,o);return}if(zs!==0&&U>zs){l.push(t,i);return}}}else if(I>ld){if(I*I<=c*(C*C+P*P)){if(hn<yx){l.push(S,E);return}if(U=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-i,s-t)),U>=h&&(U=2*h-U),U<hn){l.push(t,i),l.push(s,o);return}if(zs!==0&&U>zs){l.push(s,o);return}}}else if(C=S-(r+n)/2,P=E-(e+a)/2,C*C+P*P<=c){l.push(S,E);return}}_x(r,e,d,f,T,p,S,E,l,c,u+1),_x(S,E,b,_,x,y,n,a,l,c,u+1)}var LL,ld,GL,yx,hn,zs,bx=v(()=>{Zh();LL=8,ld=11920929e-14,GL=1,yx=.01,hn=0,zs=0});function CE(r,e,t,i,s,o,n,a){let c=Math.min(.99,Math.max(0,a??nn.defaultOptions.bezierSmoothness)),u=(HL-c)/1;return u*=u,zL(e,t,i,s,o,n,r,u),r}function zL(r,e,t,i,s,o,n,a){vx(n,r,e,t,i,s,o,a,0),n.push(s,o)}function vx(r,e,t,i,s,o,n,a,l){if(l>NL)return;let c=Math.PI,u=(e+i)/2,h=(t+s)/2,d=(i+o)/2,f=(s+n)/2,m=(u+d)/2,g=(h+f)/2,x=o-e,y=n-t,T=Math.abs((i-o)*y-(s-n)*x);if(T>VL){if(T*T<=a*(x*x+y*y)){if(AE<WL){r.push(m,g);return}let p=Math.abs(Math.atan2(n-s,o-i)-Math.atan2(s-t,i-e));if(p>=c&&(p=2*c-p),p<AE){r.push(m,g);return}}}else if(x=m-(e+o)/2,y=g-(t+n)/2,x*x+y*y<=a){r.push(m,g);return}vx(r,e,t,u,h,m,g,a,l+1),vx(r,m,g,d,f,o,n,a,l+1)}var NL,VL,HL,WL,AE,PE=v(()=>{Zh();NL=8,VL=11920929e-14,HL=1,WL=.01,AE=0});function ud(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<a+1;h++){let d=Math.cos(u),f=Math.sin(u),m=e+d*i,g=t+f*i;r.push(m,g),u+=c}}var Tx=v(()=>{"use strict"});function ME(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,m=u*u+h*h,g=l*u+c*h,x=o*Math.sqrt(f)/d,y=o*Math.sqrt(m)/d,T=x*g/f,p=y*g/m,b=x*h+y*c,_=x*u+y*l,S=c*(y+T),E=l*(y+T),C=h*(x+p),P=u*(x+p),R=Math.atan2(E-_,S-b),I=Math.atan2(P-_,C-b);ud(r,b+e,_+t,o,R,I,c*u>h*l)}var RE=v(()=>{Tx()});function $L(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 BE(r,e,t,i,s,o,n,a=0,l=0,c=0){if(o===0||n===0)return;let u=Math.sin(a*El/360),h=Math.cos(a*El/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 m=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);m>1&&(o*=Math.sqrt(m),n*=Math.sqrt(m)),XL(e,t,i,s,o,n,l,c,u,h,d,f,Sx);let{ang1:g,ang2:x}=Sx,{centerX:y,centerY:T}=Sx,p=Math.abs(x)/(El/4);Math.abs(1-p)<1e-7&&(p=1);let b=Math.max(Math.ceil(p),1);x/=b;let _=r[r.length-2],S=r[r.length-1],E={x:0,y:0};for(let C=0;C<b;C++){let P=$L(g,x),{x:R,y:I}=wx(P[0],o,n,h,u,y,T,E),{x:U,y:A}=wx(P[1],o,n,h,u,y,T,E),{x:O,y:F}=wx(P[2],o,n,h,u,y,T,E);cd(r,_,S,R,I,U,A,O,F),_=O,S=F,g+=x}}var El,Sx,wx,IE,XL,kE=v(()=>{bx();El=Math.PI*2,Sx={centerX:0,centerY:0,ang1:0,ang2:0},wx=({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};IE=(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)},XL=(r,e,t,i,s,o,n,a,l,c,u,h,d)=>{let f=Math.pow(s,2),m=Math.pow(o,2),g=Math.pow(u,2),x=Math.pow(h,2),y=f*m-f*x-m*g;y<0&&(y=0),y/=f*x+m*g,y=Math.sqrt(y)*(n===a?-1:1);let T=y*s/o*h,p=y*-o/s*u,b=c*T-l*p+(r+t)/2,_=l*T+c*p+(e+i)/2,S=(u-T)/s,E=(h-p)/o,C=(-u-T)/s,P=(-h-p)/o,R=IE(1,0,S,E),I=IE(S,E,C,P);a===0&&I>0&&(I-=El),a===1&&I<0&&(I+=El),d.centerX=b,d.centerY=_,d.ang1=R,d.ang2=I}});function FE(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;n<e.length;n++){let a=e[n%e.length],l=a.radius??t;if(l<=0){s(n,a),o=a;continue}let c=e[(n+1)%e.length],u=i(a,o),h=i(a,c);if(u.len<1e-4||h.len<1e-4){s(n,a),o=a;continue}let d=Math.asin(u.nx*h.ny-u.ny*h.nx),f=1,m=!1;u.nx*h.nx-u.ny*-h.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,m=!0):d>0&&(f=-1,m=!0);let g=d/2,x,y=Math.abs(Math.cos(g)*l/Math.sin(g));y>Math.min(u.len/2,h.len/2)?(y=Math.min(u.len/2,h.len/2),x=Math.abs(y*Math.sin(g)/Math.cos(g))):x=l;let T=a.x+h.nx*y+-h.ny*x*f,p=a.y+h.ny*y+h.nx*x*f,b=Math.atan2(u.ny,u.nx)+Math.PI/2*f,_=Math.atan2(h.ny,h.nx)-Math.PI/2*f;n===0&&r.moveTo(T+Math.cos(b)*x,p+Math.sin(b)*x),r.arc(T,p,x,b,_,m),o=a}}function OE(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<n;a++){let l=e[(a+1)%n],c=l.radius??t;if(c<=0){a===0?r.moveTo(l.x,l.y):r.lineTo(l.x,l.y);continue}let u=e[a],h=e[(a+2)%n],d=s(u,l),f;if(d<1e-4)f=l;else{let x=Math.min(d/2,c);f=o(l,u,x/d)}let m=s(h,l),g;if(m<1e-4)g=l;else{let x=Math.min(m/2,c);g=o(l,h,x/m)}a===0?r.moveTo(f.x,f.y):r.lineTo(f.x,f.y),r.quadraticCurveTo(l.x,l.y,g.x,g.y,i)}}var UE=v(()=>{"use strict"});var jL,hd,LE=v(()=>{bE();vE();wE();mt();EE();Zt();bx();PE();Tx();RE();kE();UE();jL=new ee,hd=class{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Be,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 ud(a,e,t,i,s,o,n),this}arcTo(e,t,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return ME(n,e,t,i,s,o),this}arcToSvg(e,t,i,s,o,n,a){let l=this._currentPoly.points;return BE(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 cd(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 CE(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;o<e.instructions.length;o++){let n=e.instructions[o];this[n.action](...n.data)}if(e.checkForHoles&&i.length-s>1){let o=null;for(let n=s;n<i.length;n++){let a=i[n];if(a.shape.type==="polygon"){let l=a.shape,c=o?.shape;c&&c.containsPolygon(l)?(o.holes||(o.holes=[]),o.holes.push(a),i.copyWithin(n,n+1),i.length--,n--):o=a}}}return this}finish(e=!1){this.endPoly(e)}rect(e,t,i,s,o){return this.drawShape(new ee(e,t,i,s),o),this}circle(e,t,i,s){return this.drawShape(new sd(e,t,i),s),this}poly(e,t,i){let s=new un(e);return s.closePath=t,this.drawShape(s,i),this}regularPoly(e,t,i,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,l=Math.PI*2/s,c=[];for(let u=0;u<s;u++){let h=a-u*l;c.push(e+i*Math.cos(h),t+i*Math.sin(h))}return this.poly(c,!0,n),this}roundPoly(e,t,i,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(e,t,i,s,n);let l=i*Math.sin(Math.PI/s)-.001;o=Math.min(o,l);let c=-1*Math.PI/2+n,u=Math.PI*2/s,h=(s-2)*Math.PI/s/2;for(let d=0;d<s;d++){let f=d*u+c,m=e+i*Math.cos(f),g=t+i*Math.sin(f),x=f+Math.PI+h,y=f-Math.PI-h,T=m+o*Math.cos(x),p=g+o*Math.sin(x),b=m+o*Math.cos(y),_=g+o*Math.sin(y);d===0?this.moveTo(T,p):this.lineTo(T,p),this.quadraticCurveTo(m,g,b,_,a)}return this.closePath()}roundShape(e,t,i=!1,s){return e.length<3?this:(i?OE(this,e,t,s):FE(this,e,t),this.closePath())}filletRect(e,t,i,s,o){if(o===0)return this.rect(e,t,i,s);let n=Math.min(i,s)/2,a=Math.min(n,Math.max(-n,o)),l=e+i,c=t+s,u=a<0?-a:0,h=Math.abs(a);return this.moveTo(e,t+h).arcTo(e+u,t+u,e+h,t,h).lineTo(l-h,t).arcTo(l-u,t+u,l,t+h,h).lineTo(l,c-h).arcTo(l-u,c-u,e+i-h,c,h).lineTo(e+h,c).arcTo(e+u,c-u,e,c-h,h).closePath()}chamferRect(e,t,i,s,o,n){if(o<=0)return this.rect(e,t,i,s);let a=Math.min(o,Math.min(i,s)/2),l=e+i,c=t+s,u=[e+a,t,l-a,t,l,t+a,l,c-a,l-a,c,e+a,c,e,c-a,e,t+a];for(let h=u.length-1;h>=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 od(e,t,i,s),o),this}roundRect(e,t,i,s,o,n){return this.drawShape(new ad(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 un,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 un,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<e.instructions.length;t++){let i=e.instructions[t];this[i.action](...i.data)}this.finish()}get bounds(){let e=this._bounds;e.clear();let t=this.shapePrimitives;for(let i=0;i<t.length;i++){let s=t[i],o=s.shape.getBounds(jL);s.transform?e.addRect(o,s.transform):e.addRect(o)}return e}}});function Al(r,e){return r?r.prepend(e):e.clone()}var os,Ex=v(()=>{Tr();Pt();ke();_E();LE();os=class r{constructor(e,t=!1){this.instructions=[],this.uid=me("graphicsPath"),this._dirty=!0,this.checkForHoles=t,typeof e=="string"?yE(e,this):this.instructions=e?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new hd(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(ge.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(ge.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<c;d++){let f=d%2?o:s,m=d*u+l;h.push(e+f*Math.cos(m),t+f*Math.sin(m))}return this.poly(h,!0,a),this}clone(e=!1){let t=new r;if(t.checkForHoles=this.checkForHoles,!e)t.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){let s=this.instructions[i];t.instructions.push({action:s.action,data:s.data.slice()})}return t}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(e){if(e.isIdentity())return this;let t=e.a,i=e.b,s=e.c,o=e.d,n=e.tx,a=e.ty,l=0,c=0,u=0,h=0,d=0,f=0,m=0,g=0;for(let x=0;x<this.instructions.length;x++){let y=this.instructions[x],T=y.data;switch(y.action){case"moveTo":case"lineTo":l=T[0],c=T[1],T[0]=t*l+s*c+n,T[1]=i*l+o*c+a;break;case"bezierCurveTo":u=T[0],h=T[1],d=T[2],f=T[3],l=T[4],c=T[5],T[0]=t*u+s*h+n,T[1]=i*u+o*h+a,T[2]=t*d+s*f+n,T[3]=i*d+o*f+a,T[4]=t*l+s*c+n,T[5]=i*l+o*c+a;break;case"quadraticCurveTo":u=T[0],h=T[1],l=T[2],c=T[3],T[0]=t*u+s*h+n,T[1]=i*u+o*h+a,T[2]=t*l+s*c+n,T[3]=i*l+o*c+a;break;case"arcToSvg":l=T[5],c=T[6],m=T[0],g=T[1],T[0]=t*m+s*g,T[1]=i*m+o*g,T[5]=t*l+s*c+n,T[6]=i*l+o*c+a;break;case"circle":T[4]=Al(T[3],e);break;case"rect":T[4]=Al(T[4],e);break;case"ellipse":T[8]=Al(T[8],e);break;case"roundRect":T[5]=Al(T[5],e);break;case"addPath":T[0].transform(e);break;case"poly":T[2]=Al(T[2],e);break;default:X("unknown transform action",y.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(e){let t=this.instructions.length-1,i=this.instructions[t];if(!i)return e.x=0,e.y=0,e;for(;i.action==="closePath";){if(t--,t<0)return e.x=0,e.y=0,e;i=this.instructions[t]}switch(i.action){case"moveTo":case"lineTo":e.x=i.data[0],e.y=i.data[1];break;case"quadraticCurveTo":e.x=i.data[2],e.y=i.data[3];break;case"bezierCurveTo":e.x=i.data[4],e.y=i.data[5];break;case"arc":case"arcToSvg":e.x=i.data[5],e.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(e);break}return e}}});function qe(r,e,t){let i=r.getAttribute(e);return i?Number(i):t}var Ax=v(()=>{"use strict"});function GE(r,e){let t=r.querySelectorAll("defs");for(let i=0;i<t.length;i++){let s=t[i];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":e.defs[n.id]=YL(n);break;case"radialgradient":e.defs[n.id]=qL(n);break;default:break}}}}function YL(r){let e=qe(r,"x1",0),t=qe(r,"y1",0),i=qe(r,"x2",1),s=qe(r,"y2",0),o=r.getAttribute("gradientUnits")||"objectBoundingBox",n=new ir(e,t,i,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<r.children.length;a++){let l=r.children[a],c=qe(l,"offset",0),u=ce.shared.setValue(l.getAttribute("stop-color")).toNumber();n.addColorStop(c,u)}return n}function qL(r){return X("[SVG Parser] Radial gradients are not yet supported"),new ir(0,0,1,0)}var DE=v(()=>{At();ke();on();Ax()});function Cx(r){let e=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}var NE=v(()=>{"use strict"});function Px(r,e){let t=r.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:!1,useStroke:!1};for(let n in VE){let a=r.getAttribute(n);a&&HE(e,o,n,a.trim())}if(t){let n=t.split(";");for(let a=0;a<n.length;a++){let l=n[a].trim(),[c,u]=l.split(":");VE[c]&&HE(e,o,c,u.trim())}}return{strokeStyle:o.useStroke?i:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function HE(r,e,t,i){switch(t){case"stroke":if(i!=="none"){if(i.startsWith("url(")){let s=Cx(i);e.strokeStyle.fill=r.defs[s]}else e.strokeStyle.color=ce.shared.setValue(i).toNumber();e.useStroke=!0}break;case"stroke-width":e.strokeStyle.width=Number(i);break;case"fill":if(i!=="none"){if(i.startsWith("url(")){let s=Cx(i);e.fillStyle.fill=r.defs[s]}else e.fillStyle.color=ce.shared.setValue(i).toNumber();e.useFill=!0}break;case"fill-opacity":e.fillStyle.alpha=Number(i);break;case"stroke-opacity":e.strokeStyle.alpha=Number(i);break;case"opacity":e.fillStyle.alpha=Number(i),e.strokeStyle.alpha=Number(i);break}}var VE,WE=v(()=>{At();NE();VE={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 zE(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 os};GE(r,t);let i=r.children,{fillStyle:s,strokeStyle:o}=Px(r,t);for(let n=0;n<i.length;n++){let a=i[n];a.nodeName.toLowerCase()!=="defs"&&$E(a,t,s,o)}return e}function $E(r,e,t,i){let s=r.children,{fillStyle:o,strokeStyle:n}=Px(r,e);o&&t?t={...t,...o}:o&&(t=o),n&&i?i={...i,...n}:n&&(i=n);let a=!t&&!i;a&&(t={color:0});let l,c,u,h,d,f,m,g,x,y,T,p,b,_,S,E,C;switch(r.nodeName.toLowerCase()){case"path":_=r.getAttribute("d"),r.getAttribute("fill-rule")==="evenodd"&&X("SVG Evenodd fill rule not supported, your svg may render incorrectly"),S=new os(_,!0),e.context.path(S),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"circle":m=qe(r,"cx",0),g=qe(r,"cy",0),x=qe(r,"r",0),e.context.ellipse(m,g,x,x),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"rect":l=qe(r,"x",0),c=qe(r,"y",0),E=qe(r,"width",0),C=qe(r,"height",0),y=qe(r,"rx",0),T=qe(r,"ry",0),y||T?e.context.roundRect(l,c,E,C,y||T):e.context.rect(l,c,E,C),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"ellipse":m=qe(r,"cx",0),g=qe(r,"cy",0),y=qe(r,"rx",0),T=qe(r,"ry",0),e.context.beginPath(),e.context.ellipse(m,g,y,T),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"line":u=qe(r,"x1",0),h=qe(r,"y1",0),d=qe(r,"x2",0),f=qe(r,"y2",0),e.context.beginPath(),e.context.moveTo(u,h),e.context.lineTo(d,f),i&&e.context.stroke(i);break;case"polygon":b=r.getAttribute("points"),p=b.match(/\d+/g).map(P=>parseInt(P,10)),e.context.poly(p,!0),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"polyline":b=r.getAttribute("points"),p=b.match(/\d+/g).map(P=>parseInt(P,10)),e.context.poly(p,!1),i&&e.context.stroke(i);break;case"g":case"svg":break;default:{X(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}a&&(t=null);for(let P=0;P<s.length;P++)$E(s[P],e,t,i)}var XE=v(()=>{ke();Ex();DE();Ax();WE()});function KL(r){return ce.isColorLike(r)}function jE(r){return r instanceof Ci}function YE(r){return r instanceof ir}function ZL(r){return r instanceof k}function QL(r,e,t){let i=ce.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 JL(r,e,t){return r.texture=e,{...t,...r}}function qE(r,e,t){return r.fill=e,r.color=16777215,r.texture=e.texture,r.matrix=e.transform,{...t,...r}}function KE(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 eG(r,e){let t={...e,...r},i=ce.shared.setValue(t.color);return t.alpha*=i.alpha,t.color=i.toNumber(),t}function Pi(r,e){if(r==null)return null;let t={},i=r;return KL(r)?QL(t,r,e):ZL(r)?JL(t,r,e):jE(r)?qE(t,r,e):YE(r)?KE(t,r,e):i.fill&&jE(i.fill)?qE(i,i.fill,e):i.fill&&YE(i.fill)?KE(i,i.fill,e):eG(i,e)}function dn(r,e){let{width:t,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}=e,c=Pi(r,l);return c?{width:t,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...c}:null}var Mx=v(()=>{At();Ce();on();id()});var tG,ZE,Rx,jt,dd=v(()=>{Ft();At();ve();Tr();Ce();Pt();Xe();Zt();Ex();XE();Mx();tG=new ge,ZE=new V,Rx=class ni extends Ue{constructor(){super(...arguments),this.uid=me("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new os,this._transform=new V,this._fillStyle={...ni.defaultFillStyle},this._strokeStyle={...ni.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Be,this._boundsDirty=!0}clone(){let e=new ni;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=Pi(e,ni.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=dn(e,ni.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=Pi(e,ni.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=Pi(e,ni.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?ce.shared.setValue(t).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new os,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"&&(Y(ne,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:t}),this._fillStyle=Pi(e,ni.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(ge.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=dn(e,ni.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++,zE(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 V?(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 V?(this._transform.append(e),this):(ZE.set(e,t,i,s,o,n),this._transform.append(ZE),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<this.instructions.length;t++){let i=this.instructions[t],s=i.action;if(s==="fill"){let o=i.data;e.addBounds(o.path.bounds)}else if(s==="texture"){let o=i.data;e.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform)}if(s==="stroke"){let o=i.data,n=o.style.alignment,a=o.style.width*(1-n),l=o.path.bounds;e.addFrame(l.minX-a,l.minY-a,l.maxX+a,l.maxY+a)}}return e}containsPoint(e){if(!this.bounds.containsPoint(e.x,e.y))return!1;let t=this.instructions,i=!1;for(let s=0;s<t.length;s++){let o=t[s],n=o.data,a=n.path;if(!o.action||!a)continue;let l=n.style,c=a.shapePath.shapePrimitives;for(let u=0;u<c.length;u++){let h=c[u].shape;if(!l||!h)continue;let d=c[u].transform,f=d?d.applyInverse(e,tG):e;if(o.action==="fill")i=h.contains(f.x,f.y);else{let g=l;i=h.strokeContains(f.x,f.y,g.width,g.alignment)}let m=n.hole;if(m){let g=m.shapePath?.shapePrimitives;if(g)for(let x=0;x<g.length;x++)g[x].shape.contains(f.x,f.y)&&(i=!1)}if(i)return!0}}return i}destroy(e=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof e=="boolean"?e:e?.texture){let i=typeof e=="boolean"?e:e?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(i),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(i)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};Rx.defaultFillStyle={color:16777215,alpha:1,texture:k.WHITE,matrix:null,fill:null,textureSpace:"local"};Rx.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:k.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};jt=Rx});function fd(r){let e=[],t=0;for(let i=0;i<QE.length;i++){let s=`_${QE[i]}`;e[t++]=r[s]}return t=JE(r._fill,e,t),t=rG(r._stroke,e,t),t=iG(r.dropShadow,e,t),e.join("-")}function JE(r,e,t){return r&&(e[t++]=r.color,e[t++]=r.alpha,e[t++]=r.fill?.styleKey),t}function rG(r,e,t){return r&&(t=JE(r,e,t),e[t++]=r.width,e[t++]=r.alignment,e[t++]=r.cap,e[t++]=r.join,e[t++]=r.miterLimit),t}function iG(r,e,t){return r&&(e[t++]=r.alpha,e[t++]=r.angle,e[t++]=r.blur,e[t++]=r.distance,e[t++]=ce.shared.setValue(r.color).toNumber()),t}var QE,Ix=v(()=>{At();QE=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function sG(r){let e=r;if(typeof e.dropShadow=="boolean"&&e.dropShadow){let t=Ie.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){Y(ne,"strokeThickness is now a part of stroke");let t=e.stroke,i={};if(ce.isColorLike(t))i.color=t;else if(t instanceof ir||t instanceof Ci)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)){Y(ne,"gradient fill is now a fill pattern: `new FillGradient(...)`");let t;r.fontSize==null?r.fontSize=Ie.defaultTextStyle.fontSize:typeof r.fontSize=="string"?t=parseInt(r.fontSize,10):t=r.fontSize;let i=new ir({start:{x:0,y:0},end:{x:0,y:(t||0)*1.7}}),s=e.fillGradientStops.map(o=>ce.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o)}),r.fill={fill:i}}}var Bx,Ie,$s=v(()=>{Ft();At();Xe();on();id();dd();Mx();Ix();Bx=class fn extends Ue{constructor(e={}){super(),sG(e);let t={...fn.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({...fn.defaultDropShadow,...e}):this._dropShadow=e?this._createProxy({...fn.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({...jt.defaultFillStyle,...e},()=>{this._fill=Pi({...this._originalFill},jt.defaultFillStyle)})),this._fill=Pi(e===0?"black":e,jt.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(e){e!==this._originalStroke&&(this._originalStroke=e,this._isFillStyle(e)&&(this._originalStroke=this._createProxy({...jt.defaultStrokeStyle,...e},()=>{this._stroke=dn({...this._originalStroke},jt.defaultStrokeStyle)})),this._stroke=dn(e,jt.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=fd(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let e=fn.defaultTextStyle;for(let t in e)this[t]=e[t]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new fn({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&&!(ce.isColorLike(e)||e instanceof ir||e instanceof Ci)}};Bx.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};Bx.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};Ie=Bx});function pd(r,e,t,i){let s=oG;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;let o=Fe.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 oG,kx=v(()=>{qr();Zt();oG=new Be});function Xs(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)&&!nG.includes(s)&&(s=`"${s}"`),t[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${e} ${t.join(",")}`}var nG,md=v(()=>{"use strict";nG=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var Fx,Dr,Ne,Cl=v(()=>{De();md();Fx={willReadFrequently:!0},Dr=class Q{static get experimentalLetterSpacingSupported(){let e=Q._experimentalLetterSpacingSupported;if(e!==void 0){let t=Z.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=Xs(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 T=0;T<u.length;T++){let p=Q._measureText(u[T],t.letterSpacing,l);h[T]=p,d=Math.max(d,p)}let f=t._stroke?.width||0,m=d+f;t.dropShadow&&(m+=t.dropShadow.distance);let g=t.lineHeight||a.fontSize,x=Math.max(g,a.fontSize+f)+(u.length-1)*(g+t.leading);return t.dropShadow&&(x+=t.dropShadow.distance),new Q(e,t,m,x,u,h,g+t.leading,d,a)}static _measureText(e,t,i){let s=!1;Q.experimentalLetterSpacingSupported&&(Q.experimentalLetterSpacing?(i.letterSpacing=`${t}px`,i.textLetterSpacing=`${t}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let o=i.measureText(e),n=o.width,a=-o.actualBoundingBoxLeft,c=o.actualBoundingBoxRight-a;if(n>0)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",Fx),o=0,n="",a="",l=Object.create(null),{letterSpacing:c,whiteSpace:u}=t,h=Q._collapseSpaces(u),d=Q._collapseNewlines(u),f=!h,m=t.wordWrapWidth+c,g=Q._tokenize(e);for(let x=0;x<g.length;x++){let y=g[x];if(Q._isNewline(y)){if(!d){a+=Q._addLine(n),f=!h,n="",o=0;continue}y=" "}if(h){let p=Q.isBreakingSpace(y),b=Q.isBreakingSpace(n[n.length-1]);if(p&&b)continue}let T=Q._getFromCache(y,c,l,s);if(T>m)if(n!==""&&(a+=Q._addLine(n),n="",o=0),Q.canBreakWords(y,t.breakWords)){let p=Q.wordWrapSplit(y);for(let b=0;b<p.length;b++){let _=p[b],S=_,E=1;for(;p[b+E];){let P=p[b+E];if(!Q.canBreakChars(S,P,y,b,t.breakWords))_+=P;else break;S=P,E++}b+=E-1;let C=Q._getFromCache(_,c,l,s);C+o>m&&(a+=Q._addLine(n),f=!1,n="",o=0),n+=_,o+=C}}else{n.length>0&&(a+=Q._addLine(n),n="",o=0);let p=x===g.length-1;a+=Q._addLine(y,!p),f=!1,n="",o=0}else T+o>m&&(f=!1,a+=Q._addLine(n),n="",o=0),(n.length>0||!Q.isBreakingSpace(y)||f)&&(n+=y,o+=T)}return a+=Q._addLine(n,!1),a}static _addLine(e,t=!0){return e=Q._trimRight(e),e=t?`${e}
368
+ `: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<e.length;s++){let o=e[s],n=e[s+1];if(Q.isBreakingSpace(o,n)||Q._isNewline(o)){i!==""&&(t.push(i),i=""),t.push(o);continue}i+=o}return i!==""&&t.push(i),t}static canBreakWords(e,t){return t}static canBreakChars(e,t,i,s,o){return!0}static wordWrapSplit(e){return Q.graphemeSegmenter(e)}static measureFont(e){if(Q._fonts[e])return Q._fonts[e];let t=Q._context;t.font=e;let i=t.measureText(Q.METRICS_STRING+Q.BASELINE_SYMBOL),s={ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,fontSize:i.actualBoundingBoxAscent+i.actualBoundingBoxDescent};return Q._fonts[e]=s,s}static clearMetrics(e=""){e?delete Q._fonts[e]:Q._fonts={}}static get _canvas(){if(!Q.__canvas){let e;try{let t=new OffscreenCanvas(0,0);if(t.getContext("2d",Fx)?.measureText)return Q.__canvas=t,t;e=Z.get().createCanvas()}catch{e=Z.get().createCanvas()}e.width=e.height=10,Q.__canvas=e}return Q.__canvas}static get _context(){return Q.__context||(Q.__context=Q._canvas.getContext("2d",Fx)),Q.__context}};Dr.METRICS_STRING="|\xC9q\xC5";Dr.BASELINE_SYMBOL="M";Dr.BASELINE_MULTIPLIER=1.4;Dr.HEIGHT_MULTIPLIER=2;Dr.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let r=new Intl.Segmenter;return e=>[...r.segment(e)].map(t=>t.segment)}return r=>[...r]})();Dr.experimentalLetterSpacing=!1;Dr._fonts={};Dr._newlines=[10,13];Dr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];Dr._measurementCache={};Ne=Dr});function pn(r,e,t,i=0){if(r.texture===k.WHITE&&!r.fill)return ce.shared.setValue(r.color).setAlpha(r.alpha??1).toHexa();if(r.fill){if(r.fill instanceof Ci){let s=r.fill,o=e.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(V.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(r.fill instanceof ir){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)<Math.abs((d.y-h.y)*.1)}else{let{center:h,innerRadius:d,outerCenter:f,outerRadius:m}=s;c=e.createRadialGradient(h.x*a,h.y*l,d*a,f.x*a,f.y*l,m*a)}if(u&&n&&t){let h=t.lineHeight/l;for(let d=0;d<t.lines.length;d++){let f=(d*t.lineHeight+i/2)/l;s.colorStops.forEach(m=>{let g=f+m.offset*h;c.addColorStop(Math.floor(g*eA)/eA,ce.shared.setValue(m.color).toHex())})}}else s.colorStops.forEach(h=>{c.addColorStop(h.offset,ce.shared.setValue(h.color).toHex())});return c}}else{let s=e.createPattern(r.texture.source.resource,"repeat"),o=r.matrix.copyTo(V.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),s.setTransform(o),s}return X("FillStyle not recognised",r),"red"}var eA,Ox=v(()=>{At();ve();Ce();ke();on();id();eA=1e5});var Pl,tA=v(()=>{At();L();ja();cn();qr();fE();Xe();$s();kx();Cl();md();Ox();Pl=class{constructor(e){this._activeTextures={},this._renderer=e}getTextureSize(e,t,i){let s=Ne.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=vi(o),n=vi(n),{width:o,height:n}}getTexture(e,t,i,s){typeof e=="string"&&(Y("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),e={text:e,style:i,resolution:t}),e.style instanceof Ie||(e.style=new Ie(e.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(e);return this._renderer.texture.initSource(o._source),sr.returnCanvasAndContext(n),o}createTextureAndCanvas(e){let{text:t,style:i}=e,s=e.resolution??this._renderer.resolution,o=Ne.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=sr.getOptimalCanvasAndContext(n,a),{canvas:c}=l;this.renderTextToCanvas(t,i,s,l);let u=pd(c,n,a,s);if(i.trim){let h=dE(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",Fe.returnTexture(e)}decreaseReferenceCount(e){let t=this._activeTextures[e];t.usageCount--,t.usageCount===0&&(sr.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=Xs(t),l=Ne.measureText(e||" ",t),c=l.lines,u=l.lineHeight,h=l.lineWidths,d=l.maxLineWidth,f=l.fontProperties,m=o.height;if(n.resetTransform(),n.scale(i,i),n.textBaseline=t.textBaseline,t._stroke?.width){let T=t._stroke;n.lineWidth=T.width,n.miterLimit=T.miterLimit,n.lineJoin=T.join,n.lineCap=T.cap}n.font=a;let g,x,y=t.dropShadow?2:1;for(let T=0;T<y;++T){let p=t.dropShadow&&T===0,b=p?Math.ceil(Math.max(1,m)+t.padding*2):0,_=b*i;if(p){n.fillStyle="black",n.strokeStyle="black";let C=t.dropShadow,P=C.color,R=C.alpha;n.shadowColor=ce.shared.setValue(P).setAlpha(R).toRgbaString();let I=C.blur*i,U=C.distance*i;n.shadowBlur=I,n.shadowOffsetX=Math.cos(C.angle)*U,n.shadowOffsetY=Math.sin(C.angle)*U+_}else{if(n.fillStyle=t._fill?pn(t._fill,n,l):null,t._stroke?.width){let C=t._stroke.width*t._stroke.alignment;n.strokeStyle=pn(t._stroke,n,l,C)}n.shadowColor="black"}let S=(u-f.fontSize)/2;u-f.fontSize<0&&(S=0);let E=t._stroke?.width??0;for(let C=0;C<c.length;C++)g=E/2,x=E/2+C*u+f.ascent+S,t.align==="right"?g+=d-h[C]:t.align==="center"&&(g+=(d-h[C])/2),t._stroke?.width&&this._drawLetterSpacing(c[C],t,s,g+t.padding,x+t.padding-b,!0),t._fill!==void 0&&this._drawLetterSpacing(c[C],t,s,g+t.padding,x+t.padding-b)}}_drawLetterSpacing(e,t,i,s,o,n=!1){let{context:a}=i,l=t.letterSpacing,c=!1;if(Ne.experimentalLetterSpacingSupported&&(Ne.experimentalLetterSpacing?(a.letterSpacing=`${l}px`,a.textLetterSpacing=`${l}px`,c=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),l===0||c){n?a.strokeText(e,s,o):a.fillText(e,s,o);return}let u=s,h=Ne.graphemeSegmenter(e),d=a.measureText(e).width,f=0;for(let m=0;m<h.length;++m){let g=h[m];n?a.strokeText(g,u,o):a.fillText(g,u,o);let x="";for(let y=m+1;y<h.length;++y)x+=h[y];f=a.measureText(x).width,u+=d-f+l,d=f}}destroy(){this._activeTextures=null}};Pl.extension={type:[w.WebGLSystem,w.WebGPUSystem,w.CanvasSystem],name:"canvasText"}});var Ux=v(()=>{L();cE();tA();$.add(Pl);$.add(wl)});var We,Lx=v(()=>{Xe();Eh();dd();We=class r extends Yi{constructor(e){e instanceof jt&&(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 jt,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){Y(ne,"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){Y(ne,"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(){Y(ne,"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!==jt.defaultStrokeStyle.width||e.color!==jt.defaultStrokeStyle.color||e.alpha!==jt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return Y(ne,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return Y(ne,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return Y(ne,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return Y(ne,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return Y(ne,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return Y(ne,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}});var rA,iA,sA=v(()=>{"use strict";rA={name:"local-uniform-msdf-bit",vertex:{header:`
369
369
  struct LocalUniforms {
370
370
  uColor:vec4<f32>,
371
371
  uTransformMatrix:mat3x3<f32>,
@@ -463,7 +463,7 @@ fn mainFragment(
463
463
  return coverage;
464
464
  }
465
465
  `}}});var Gx,Dx,gd,lA=v(()=>{ve();Ls();rs();dl();fl();is();Hh();Lr();Ut();sA();aA();gd=class extends et{constructor(){let e=new Ae({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new V,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),t=Sr();Gx??(Gx=ei({name:"sdf-shader",bits:[Zo,Jo(t),rA,oA,ri]})),Dx??(Dx=ti({name:"sdf-shader",bits:[Qo,en(t),iA,nA,ii]})),super({glProgram:Dx,gpuProgram:Gx,resources:{localUniforms:e,batchSamplers:tn(t)}})}}});var mn,Nx=v(()=>{Ft();Xe();mn=class extends Ue{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 Y(ne,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return Y(ne,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return Y(ne,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return Y(ne,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return Y(ne,"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 xd(r){if(r==="")return[];typeof r=="string"&&(r=[r]);let e=[];for(let t=0,i=r.length;t<i;t++){let s=r[t];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);if(s[0].length===0||s[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");let o=s[0].charCodeAt(0),n=s[1].charCodeAt(0);if(n<o)throw new Error("[BitmapFont]: Invalid character range.");for(let a=o,l=n;a<=l;a++)e.push(String.fromCharCode(a))}else e.push(...Array.from(s))}if(e.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}var Vx=v(()=>{"use strict"});var cA,Hx,hA=v(()=>{At();mt();cn();$o();Ce();Xe();Cl();md();Ox();$s();Nx();Vx();cA=class uA extends mn{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={...uA.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=Xs(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=Ne.measureFont(o),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(e){let t=xd(e).filter(x=>!this._currentChars.includes(x)).filter((x,y,T)=>T.indexOf(x)===y);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,m=s.width/this.resolution,g=s.height/this.resolution;for(let x=0;x<t.length;x++){let y=t[x],T=Ne.measureText(y,a,s,!1);T.lineHeight=T.height;let p=T.width*u,b=Math.ceil((a.fontStyle==="italic"?2:1)*p),_=T.height*u,S=b+h*2,E=_+h*2;if(f=!1,y!==`
466
- `&&y!=="\r"&&y!==" "&&y!==" "&&(f=!0,d=Math.ceil(Math.max(E,d))),l+S>m&&(c+=d,d=E,l=0,c+d>g)){n.update();let P=this._nextPage();s=P.canvasAndContext.canvas,o=P.canvasAndContext.context,n=P.texture.source,c=0}let C=p/u-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[y]={id:y.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:C,kerning:{}},f){this._drawGlyph(o,T,l+h,c+h,u,a);let P=n.width*u,M=n.height*u,I=new ee(l/P*n.width,c/M*n.height,S/P*n.width,E/M*n.height);this.chars[y].texture=new k({source:n,frame:I}),l+=Math.ceil(S)}}n.update(),this._currentX=l,this._currentY=c,this._skipKerning&&this._applyKerning(t,o)}get pageTextures(){return Y(ne,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(e,t){let i=this._measureCache;for(let s=0;s<e.length;s++){let o=e[s];for(let n=0;n<this._currentChars.length;n++){let a=this._currentChars[n],l=i[o];l||(l=i[o]=t.measureText(o).width);let c=i[a];c||(c=i[a]=t.measureText(a).width);let u=t.measureText(o+a).width,h=u-(l+c);h&&(this.chars[o].kerning[a]=h),u=t.measureText(o+a).width,h=u-(l+c),h&&(this.chars[a].kerning[o]=h)}}}_nextPage(){this._currentPageIndex++;let e=this.resolution,t=sr.getOptimalCanvasAndContext(this._textureSize,this._textureSize,e);this._setupContext(t.context,this._style,e);let i=e*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new k({source:new Jt({resource:t.canvas,resolution:i,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),o={canvasAndContext:t,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(e,t,i){t.fontSize=this.baseRenderedFontSize,e.scale(i,i),e.font=Xs(t),t.fontSize=this.baseMeasurementFontSize,e.textBaseline=t.textBaseline;let s=t._stroke,o=s?.width??0;if(s&&(e.lineWidth=o,e.lineJoin=s.join,e.miterLimit=s.miterLimit,e.strokeStyle=pn(s,e)),t._fill&&(e.fillStyle=pn(t._fill,e)),t.dropShadow){let n=t.dropShadow,a=ce.shared.setValue(n.color).toArray(),l=n.blur*i,c=n.distance*i;e.shadowColor=`rgba(${a[0]*255},${a[1]*255},${a[2]*255},${n.alpha})`,e.shadowBlur=l,e.shadowOffsetX=Math.cos(n.angle)*c,e.shadowOffsetY=Math.sin(n.angle)*c}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0}_drawGlyph(e,t,i,s,o,n){let a=t.text,l=t.fontProperties,u=(n._stroke?.width??0)*o,h=i+u/2,d=s-u/2,f=l.descent*o,m=t.lineHeight*o;n.stroke&&u&&e.strokeText(a,h,d+m-f),n._fill&&e.fillText(a,h,d+m-f)}destroy(){super.destroy();for(let e=0;e<this.pages.length;e++){let{canvasAndContext:t,texture:i}=this.pages[e];sr.returnCanvasAndContext(t),i.destroy(!0)}this.pages=null}};cA.defaultOptions={textureSize:512,style:new Ie,mipmap:!0};Hx=cA});function yd(r,e,t,i){let s={width:0,height:0,offsetY:0,scale:e.fontSize/t.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=t.baseLineOffset;let o=s.lines[0],n=null,a=!0,l={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},c=m=>{let g=o.width;for(let x=0;x<l.index;x++){let y=m.positions[x];o.chars.push(m.chars[x]),o.charPositions.push(y+g)}o.width+=m.width,a=!1,l.width=0,l.index=0,l.chars.length=0},u=()=>{let m=o.chars.length-1;if(i){let g=o.chars[m];for(;g===" ";)o.width-=t.chars[g].xAdvance,g=o.chars[--m]}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 m=0;m<r.length+1;m++){let g,x=m===r.length;x||(g=r[m]);let y=t.chars[g]||t.chars[" "];if(/(?:\s)/.test(g)||g==="\r"||g===`
466
+ `&&y!=="\r"&&y!==" "&&y!==" "&&(f=!0,d=Math.ceil(Math.max(E,d))),l+S>m&&(c+=d,d=E,l=0,c+d>g)){n.update();let P=this._nextPage();s=P.canvasAndContext.canvas,o=P.canvasAndContext.context,n=P.texture.source,c=0}let C=p/u-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[y]={id:y.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:C,kerning:{}},f){this._drawGlyph(o,T,l+h,c+h,u,a);let P=n.width*u,R=n.height*u,I=new ee(l/P*n.width,c/R*n.height,S/P*n.width,E/R*n.height);this.chars[y].texture=new k({source:n,frame:I}),l+=Math.ceil(S)}}n.update(),this._currentX=l,this._currentY=c,this._skipKerning&&this._applyKerning(t,o)}get pageTextures(){return Y(ne,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(e,t){let i=this._measureCache;for(let s=0;s<e.length;s++){let o=e[s];for(let n=0;n<this._currentChars.length;n++){let a=this._currentChars[n],l=i[o];l||(l=i[o]=t.measureText(o).width);let c=i[a];c||(c=i[a]=t.measureText(a).width);let u=t.measureText(o+a).width,h=u-(l+c);h&&(this.chars[o].kerning[a]=h),u=t.measureText(o+a).width,h=u-(l+c),h&&(this.chars[a].kerning[o]=h)}}}_nextPage(){this._currentPageIndex++;let e=this.resolution,t=sr.getOptimalCanvasAndContext(this._textureSize,this._textureSize,e);this._setupContext(t.context,this._style,e);let i=e*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new k({source:new Jt({resource:t.canvas,resolution:i,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),o={canvasAndContext:t,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(e,t,i){t.fontSize=this.baseRenderedFontSize,e.scale(i,i),e.font=Xs(t),t.fontSize=this.baseMeasurementFontSize,e.textBaseline=t.textBaseline;let s=t._stroke,o=s?.width??0;if(s&&(e.lineWidth=o,e.lineJoin=s.join,e.miterLimit=s.miterLimit,e.strokeStyle=pn(s,e)),t._fill&&(e.fillStyle=pn(t._fill,e)),t.dropShadow){let n=t.dropShadow,a=ce.shared.setValue(n.color).toArray(),l=n.blur*i,c=n.distance*i;e.shadowColor=`rgba(${a[0]*255},${a[1]*255},${a[2]*255},${n.alpha})`,e.shadowBlur=l,e.shadowOffsetX=Math.cos(n.angle)*c,e.shadowOffsetY=Math.sin(n.angle)*c}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0}_drawGlyph(e,t,i,s,o,n){let a=t.text,l=t.fontProperties,u=(n._stroke?.width??0)*o,h=i+u/2,d=s-u/2,f=l.descent*o,m=t.lineHeight*o;n.stroke&&u&&e.strokeText(a,h,d+m-f),n._fill&&e.fillText(a,h,d+m-f)}destroy(){super.destroy();for(let e=0;e<this.pages.length;e++){let{canvasAndContext:t,texture:i}=this.pages[e];sr.returnCanvasAndContext(t),i.destroy(!0)}this.pages=null}};cA.defaultOptions={textureSize:512,style:new Ie,mipmap:!0};Hx=cA});function yd(r,e,t,i){let s={width:0,height:0,offsetY:0,scale:e.fontSize/t.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=t.baseLineOffset;let o=s.lines[0],n=null,a=!0,l={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},c=m=>{let g=o.width;for(let x=0;x<l.index;x++){let y=m.positions[x];o.chars.push(m.chars[x]),o.charPositions.push(y+g)}o.width+=m.width,a=!1,l.width=0,l.index=0,l.chars.length=0},u=()=>{let m=o.chars.length-1;if(i){let g=o.chars[m];for(;g===" ";)o.width-=t.chars[g].xAdvance,g=o.chars[--m]}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 m=0;m<r.length+1;m++){let g,x=m===r.length;x||(g=r[m]);let y=t.chars[g]||t.chars[" "];if(/(?:\s)/.test(g)||g==="\r"||g===`
467
467
  `||x){if(!a&&e.wordWrap&&o.width+l.width-d>f?(u(),c(l),x||o.charPositions.push(0)):(l.start=o.width,c(l),x||o.charPositions.push(0)),g==="\r"||g===`
468
468
  `)o.width!==0&&u();else if(!x){let _=y.xAdvance+(y.kerning[n]||0)+d;o.width+=_,o.spaceWidth=_,o.spacesIndex.push(o.charPositions.length),o.chars.push(g)}}else{let b=y.kerning[n]||0,_=y.xAdvance+b+d;l.positions[l.index++]=l.width+b,l.chars.push(g),l.width+=_}n=g}return u(),e.align==="center"?aG(s):e.align==="right"?lG(s):e.align==="justify"&&cG(s),s}function aG(r){for(let e=0;e<r.lines.length;e++){let t=r.lines[e],i=r.width/2-t.width/2;for(let s=0;s<t.charPositions.length;s++)t.charPositions[s]+=i}}function lG(r){for(let e=0;e<r.lines.length;e++){let t=r.lines[e],i=r.width-t.width;for(let s=0;s<t.charPositions.length;s++)t.charPositions[s]+=i}}function cG(r){let e=r.width;for(let t=0;t<r.lines.length;t++){let i=r.lines[t],s=0,o=i.spacesIndex[s++],n=0,a=i.spacesIndex.length,c=(e-i.width)/a;for(let u=0;u<i.charPositions.length;u++)u===o&&(o=i.spacesIndex[s++],n+=c),i.charPositions[u]+=n}}var Wx=v(()=>{"use strict"});var _d,zx,Ml,$x=v(()=>{Zi();Xe();ke();$s();hA();Wx();Vx();_d=0,zx=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(!Pe.has(i)){let n=new Hx({style:t,overrideFill:s,overrideSize:!0,...this.defaultOptions});_d++,_d>50&&X("BitmapText",`You have dynamically created ${_d} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{_d--,Pe.remove(i)}),Pe.set(i,n)}let o=Pe.get(i);return o.ensureCharacters?.(e),o}getLayout(e,t,i=!0){let s=this.getFont(e,t);return yd([...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},Y(ne,"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 Ie?s:new Ie(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new Hx({style:o,overrideFill:n,skipKerning:t.skipKerning,padding:t.padding,resolution:t.resolution,overrideSize:!1}),l=xd(t.chars);return a.ensureCharacters(l.join("")),Pe.set(`${i}-bitmap`,a),a.once("destroy",()=>Pe.remove(`${i}-bitmap`)),a}uninstall(e){let t=`${e}-bitmap`,i=Pe.get(t);i&&i.destroy()}},Ml=new zx});function dA(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 Rl,fA=v(()=>{Zi();L();Wt();Lx();lA();$x();Wx();Rl=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);dA(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&&(le.return(t.customShader),t.customShader=null),le.return(this._gpuBitmapText[e]),this._gpuBitmapText[e]=null}updateRenderable(e){let t=this._getGpuBitmapText(e);dA(e,t),this._renderer.renderPipes.graphics.updateRenderable(t),t.context.customShader&&this._updateDistanceField(e)}_updateContext(e,t){let{context:i}=t,s=Ml.getFont(e.text,e._style);i.clear(),s.distanceField.type!=="none"&&(i.customShader||(i.customShader=le.get(gd)));let o=Array.from(e.text),n=e._style,a=s.baseLineOffset,l=yd(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 m=s.applyFillAsTint?n._fill.color:16777215;for(let g=0;g<l.lines.length;g++){let x=l.lines[g];for(let y=0;y<x.charPositions.length;y++){let T=o[c++],p=s.chars[T];p?.texture&&i.texture(p.texture,m||"black",Math.round(x.charPositions[y]+p.xOffset),Math.round(a+p.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(e){return this._gpuBitmapText[e.uid]||this.initGpuText(e)}initGpuText(e){let t=le.get(We);return this._gpuBitmapText[e.uid]=t,this._updateContext(e,t),e.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[e.uid]}_updateDistanceField(e){let t=this._getGpuBitmapText(e).context,i=e._style.fontFamily,s=Pe.get(`${i}-bitmap`),{a:o,b:n,c:a,d:l}=e.groupTransform,c=Math.sqrt(o*o+n*n),u=Math.sqrt(a*a+l*l),h=(Math.abs(c)+Math.abs(u))/2,d=s.baseRenderedFontSize/e._style.fontSize,f=h*s.distanceField.range*(1/d);t.customShader.resources.localUniforms.uniforms.uDistance=f}destroy(){for(let e in this._gpuBitmapText)this._destroyRenderableByUid(e);this._gpuBitmapText=null,this._renderer=null}};Rl.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"bitmapText"}});var Xx=v(()=>{L();fA();$.add(Rl)});var Il,pA=v(()=>{L();Ce();Wt();Tl();mx();Il=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),le.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,Sl(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(),Sl(n,e)}_getGpuText(e){return this._gpuText[e.uid]||this.initGpuText(e)}initGpuText(e){let t={texture:k.EMPTY,currentKey:"--",batchableSprite:le.get(oi),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}};Il.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"htmlText"}});function mA(){let{userAgent:r}=Z.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(r)}var gA=v(()=>{De()});var xA,yA,gn,jx=v(()=>{"use strict";xA="http://www.w3.org/2000/svg",yA="http://www.w3.org/1999/xhtml",gn=class{constructor(){this.svgRoot=document.createElementNS(xA,"svg"),this.foreignObject=document.createElementNS(xA,"foreignObject"),this.domElement=document.createElementNS(yA,"div"),this.styleElement=document.createElementNS(yA,"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 vA(r){let e=r._stroke,t=r._fill,s=[`div { ${[`color: ${ce.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?[SA(e)]:[],...r.dropShadow?[TA(r.dropShadow)]:[],...r.cssOverrides].join(";")} }`];return uG(r.tagStyles,s),s.join(" ")}function TA(r){let e=ce.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 SA(r){return[`-webkit-text-stroke-width: ${r.width}px`,`-webkit-text-stroke-color: ${ce.shared.setValue(r.color).toHex()}`,`text-stroke-width: ${r.width}px`,`text-stroke-color: ${ce.shared.setValue(r.color).toHex()}`,"paint-order: stroke"].join(";")}function uG(r,e){for(let t in r){let i=r[t],s=[];for(let o in i)bA[o]?s.push(bA[o](i[o])):_A[o]&&s.push(_A[o].replace("{{VALUE}}",i[o]));e.push(`${t} { ${s.join(";")} }`)}}var _A,bA,wA=v(()=>{At();_A={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"},bA={fill:r=>`color: ${ce.shared.setValue(r).toHex()}`,breakWords:r=>`word-wrap: ${r?"break-all":"break-word"}`,stroke:SA,dropShadow:TA}});var bd,EA=v(()=>{ke();$s();Ix();wA();bd=class r extends Ie{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=fd(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=vA(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"&&X("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=e}set stroke(e){e&&typeof e!="string"&&typeof e!="number"&&X("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=e}}});function AA(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<t.length;l++)a(t[l]);else a(t);n&&n.forEach(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 CA=v(()=>{"use strict"});async function PA(r){let t=await(await Z.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 MA=v(()=>{De()});async function Yx(r,e){let t=await PA(e);return`@font-face {
469
469
  font-family: "${r.fontFamily}";
@@ -1086,11 +1086,11 @@ fn mainFragment(
1086
1086
  cv = cu.value;
1087
1087
  v = uv["${i}"];
1088
1088
  ${a};`)}}return new Function("ud","uv","renderer","syncData",t.join(`
1089
- `))}var cM=v(()=>{Od();Ut();Ay();aM()});var Ic,uM=v(()=>{L();cM();Ic=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 lM(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}};Ic.extension={type:[w.WebGLSystem],name:"uniformGroup"}});function hM(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 Z.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 dM=v(()=>{De()});var UG,LG,GG,DG,NG,VG,fM,pM,mM=v(()=>{L();Gr();dM();UG=0,LG=1,GG=2,DG=3,NG=4,VG=5,fM=class jy{constructor(e){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[UG]=this.setBlend,this.map[LG]=this.setOffset,this.map[GG]=this.setCullFace,this.map[DG]=this.setDepthTest,this.map[NG]=this.setFrontFace,this.map[VG]=this.setDepthMask,this.checks=[],this.defaultState=rt.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=hM(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<<i)),t>>=1,i++;this.stateId=e.data}for(let t=0;t<this.checks.length;t++)this.checks[t](this,e)}forceState(e){e||(e=this.defaultState);for(let t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(let t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data}setBlend(e){this._updateCheck(jy._checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this._updateCheck(jy._checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this._cullFace=e,this.gl[e?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(e){this._frontFace=e,this._frontFaceDirty=!1;let t=this._invertFrontFace?!e:e;this._glFrontFace!==t&&(this._glFrontFace=t,this.gl.frontFace(this.gl[t?"CW":"CCW"]))}setBlendMode(e){if(this.blendModesMap[e]||(e="normal"),e===this.blendMode)return;this.blendMode=e;let t=this.blendModesMap[e],i=this.gl;t.length===2?i.blendFunc(t[0],t[1]):i.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,i.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(e,t){this.gl.polygonOffset(e,t)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(e,t){let i=this.checks.indexOf(e);t&&i===-1?this.checks.push(e):!t&&i!==-1&&this.checks.splice(i,1)}static _checkBlendMode(e,t){e.setBlendMode(t.blendMode)}static _checkPolygonOffset(e,t){e.setPolygonOffset(1,t.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};fM.extension={type:[w.WebGLSystem],name:"state"};pM=fM});var Kd,gM=v(()=>{Gy();Kd=class{constructor(e){this.target=Ly.TEXTURE_2D,this.texture=e,this.width=-1,this.height=-1,this.type=Se.UNSIGNED_BYTE,this.internalFormat=Wd.RGBA,this.format=Wd.RGBA,this.samplerType=0}}});var xM,yM=v(()=>{"use strict";xM={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 HG,_M,bM=v(()=>{"use strict";HG={"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},_M={id:"compressed",upload(r,e,t){t.pixelStorei(t.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight,o=!!HG[r.format];for(let n=0;n<r.resource.length;n++){let a=r.resource[n];o?t.compressedTexImage2D(t.TEXTURE_2D,n,e.internalFormat,i,s,0,a):t.texImage2D(t.TEXTURE_2D,n,e.internalFormat,i,s,0,e.format,e.type,a),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}}});var Zd,Yy=v(()=>{"use strict";Zd={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<n||c<a?((s!==n||o!==a)&&t.texImage2D(e.target,0,e.internalFormat,n,a,0,e.format,e.type,null),i===2?t.texSubImage2D(t.TEXTURE_2D,0,0,0,l,c,e.format,e.type,r.resource):t.texSubImage2D(t.TEXTURE_2D,0,0,0,e.format,e.type,r.resource)):s===n&&o===a?t.texSubImage2D(t.TEXTURE_2D,0,0,0,e.format,e.type,r.resource):i===2?t.texImage2D(e.target,0,e.internalFormat,n,a,0,e.format,e.type,r.resource):t.texImage2D(e.target,0,e.internalFormat,e.format,e.type,r.resource),e.width=n,e.height=a}}});var vM,TM=v(()=>{Yy();vM={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}Zd.upload(r,e,t,i)}}});var qy,SM,Qd,wM,EM=v(()=>{"use strict";qy={linear:9729,nearest:9728},SM={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Qd={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},wM={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Ky(r,e,t,i,s,o,n,a){let l=o;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){let c=Qd[n?"clamp-to-edge":r.addressModeU],u=Qd[n?"clamp-to-edge":r.addressModeV],h=Qd[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,qy[r.magFilter]),t){if(!a||r.mipmapFilter!=="linear"){let c=SM[r.minFilter][r.mipmapFilter];e[s](l,e.TEXTURE_MIN_FILTER,c)}}else e[s](l,e.TEXTURE_MIN_FILTER,qy[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,wM[r.compare])}var AM=v(()=>{EM()});function CM(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 PM=v(()=>{"use strict"});function MM(r,e){let t={},i=r.RGBA;return r instanceof Z.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 RM=v(()=>{De()});function IM(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 BM=v(()=>{"use strict"});var WG,Bc,kM=v(()=>{De();L();Ce();gM();yM();bM();Yy();TM();AM();PM();RM();BM();WG=4,Bc=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:Zd,buffer:xM,video:vM,compressed:_M},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=MM(e,this._renderer.context.extensions),this._mapFormatToType=IM(e),this._mapFormatToFormat=CM(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;o<i.length;o++)if(i[o]===t){this._activateLocation(o);let n=this.getGlSource(t);s.bindTexture(n.target,null),i[o]=null}}_activateLocation(e){this._activeTextureLocation!==e&&(this._activeTextureLocation=e,this._gl.activeTexture(this._gl.TEXTURE0+e))}_initSource(e){let t=this._gl,i=new Kd(t.createTexture());if(i.type=this._mapFormatToType[e.format],i.internalFormat=this._mapFormatToInternalFormat[e.format],i.format=this._mapFormatToFormat[e.format],e.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||e.isPowerOfTwo)){let s=Math.max(e.width,e.height);e.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[e.uid]=i,this.managedTextures.includes(e)||(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceUpdate,this),e.on("styleChange",this.onStyleChange,this),e.on("destroy",this.onSourceDestroy,this),e.on("unload",this.onSourceUnload,this),e.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(e)),this.onSourceUpdate(e),this.updateStyle(e,!1),i}onStyleChange(e){this.updateStyle(e,!1)}updateStyle(e,t){let i=this._gl,s=this.getGlSource(e);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=e,Ky(e.style,i,e.mipLevelCount>1,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,Ky(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=Z.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(WG*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)}};Bc.extension={type:[w.WebGLSystem],name:"texture"}});var LM={};$v(LM,{WebGLRenderer:()=>Zy});var zG,$G,XG,FM,OM,UM,Zy,GM=v(()=>{L();fP();pP();mP();Gl();Sy();Er();yP();vP();EP();PP();MP();RP();IP();LP();NP();sM();uM();mM();kM();zG=[...Bd,Pc,CP,bP,Sc,Bc,Mc,wc,Ic,Rc,Ac,pM,Cc,Ec],$G=[...kd],XG=[vc,bc,_c],FM=[],OM=[],UM=[];$.handleByNamedList(w.WebGLSystem,FM);$.handleByNamedList(w.WebGLPipes,OM);$.handleByNamedList(w.WebGLPipesAdaptor,UM);$.add(...zG,...$G,...XG);Zy=class extends ns{constructor(){let e={name:"webgl",type:Ye.WEBGL,systems:FM,renderPipes:OM,renderPipeAdaptors:UM};super(e)}}});var lk=oe((gSe,xb)=>{"use strict";var cH=Object.prototype.hasOwnProperty,Kt="~";function su(){}Object.create&&(su.prototype=Object.create(null),new su().__proto__||(Kt=!1));function uH(r,e,t){this.fn=r,this.context=e,this.once=t||!1}function ak(r,e,t,i,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var o=new uH(t,i||r,s),n=Kt?Kt+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 wp(r,e){--r._eventsCount===0?r._events=new su:delete r._events[e]}function Vt(){this._events=new su,this._eventsCount=0}Vt.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)cH.call(t,i)&&e.push(Kt?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};Vt.prototype.listeners=function(e){var t=Kt?Kt+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<o;s++)n[s]=i[s].fn;return n};Vt.prototype.listenerCount=function(e){var t=Kt?Kt+e:e,i=this._events[t];return i?i.fn?1:i.length:0};Vt.prototype.emit=function(e,t,i,s,o,n){var a=Kt?Kt+e:e;if(!this._events[a])return!1;var l=this._events[a],c=arguments.length,u,h;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,i),!0;case 4:return l.fn.call(l.context,t,i,s),!0;case 5:return l.fn.call(l.context,t,i,s,o),!0;case 6:return l.fn.call(l.context,t,i,s,o,n),!0}for(h=1,u=new Array(c-1);h<c;h++)u[h-1]=arguments[h];l.fn.apply(l.context,u)}else{var d=l.length,f;for(h=0;h<d;h++)switch(l[h].once&&this.removeListener(e,l[h].fn,void 0,!0),c){case 1:l[h].fn.call(l[h].context);break;case 2:l[h].fn.call(l[h].context,t);break;case 3:l[h].fn.call(l[h].context,t,i);break;case 4:l[h].fn.call(l[h].context,t,i,s);break;default:if(!u)for(f=1,u=new Array(c-1);f<c;f++)u[f-1]=arguments[f];l[h].fn.apply(l[h].context,u)}}return!0};Vt.prototype.on=function(e,t,i){return ak(this,e,t,i,!1)};Vt.prototype.once=function(e,t,i){return ak(this,e,t,i,!0)};Vt.prototype.removeListener=function(e,t,i,s){var o=Kt?Kt+e:e;if(!this._events[o])return this;if(!t)return wp(this,o),this;var n=this._events[o];if(n.fn)n.fn===t&&(!s||n.once)&&(!i||n.context===i)&&wp(this,o);else{for(var a=0,l=[],c=n.length;a<c;a++)(n[a].fn!==t||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:wp(this,o)}return this};Vt.prototype.removeAllListeners=function(e){var t;return e?(t=Kt?Kt+e:e,this._events[t]&&wp(this,t)):(this._events=new su,this._eventsCount=0),this};Vt.prototype.off=Vt.prototype.removeListener;Vt.prototype.addListener=Vt.prototype.on;Vt.prefixed=Kt;Vt.EventEmitter=Vt;typeof xb<"u"&&(xb.exports=Vt)});var ck=oe((sa,oa)=>{(function(r){var e=typeof sa=="object"&&sa&&!sa.nodeType&&sa,t=typeof oa=="object"&&oa&&!oa.nodeType&&oa,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="-",m=/^xn--/,g=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},T=n-a,p=Math.floor,b=String.fromCharCode,_;function S(G){throw new RangeError(y[G])}function E(G,N){for(var W=G.length,se=[];W--;)se[W]=N(G[W]);return se}function C(G,N){var W=G.split("@"),se="";W.length>1&&(se=W[0]+"@",G=W[1]),G=G.replace(x,".");var fe=G.split("."),Ee=E(fe,N).join(".");return se+Ee}function P(G){for(var N=[],W=0,se=G.length,fe,Ee;W<se;)fe=G.charCodeAt(W++),fe>=55296&&fe<=56319&&W<se?(Ee=G.charCodeAt(W++),(Ee&64512)==56320?N.push(((fe&1023)<<10)+(Ee&1023)+65536):(N.push(fe),W--)):N.push(fe);return N}function M(G){return E(G,function(N){var W="";return N>65535&&(N-=65536,W+=b(N>>>10&1023|55296),N=56320|N&1023),W+=b(N),W}).join("")}function I(G){return G-48<10?G-22:G-65<26?G-65:G-97<26?G-97:n}function U(G,N){return G+22+75*(G<26)-((N!=0)<<5)}function A(G,N,W){var se=0;for(G=W?p(G/u):G>>1,G+=p(G/N);G>T*l>>1;se+=n)G=p(G/T);return p(se+(T+1)*G/(G+c))}function O(G){var N=[],W=G.length,se,fe=0,Ee=d,ye=h,B,H,q,be,Ge,nt,Et,at,lt;for(B=G.lastIndexOf(f),B<0&&(B=0),H=0;H<B;++H)G.charCodeAt(H)>=128&&S("not-basic"),N.push(G.charCodeAt(H));for(q=B>0?B+1:0;q<W;){for(be=fe,Ge=1,nt=n;q>=W&&S("invalid-input"),Et=I(G.charCodeAt(q++)),(Et>=n||Et>p((o-fe)/Ge))&&S("overflow"),fe+=Et*Ge,at=nt<=ye?a:nt>=ye+l?l:nt-ye,!(Et<at);nt+=n)lt=n-at,Ge>p(o/lt)&&S("overflow"),Ge*=lt;se=N.length+1,ye=A(fe-be,se,be==0),p(fe/se)>o-Ee&&S("overflow"),Ee+=p(fe/se),fe%=se,N.splice(fe++,0,Ee)}return M(N)}function F(G){var N,W,se,fe,Ee,ye,B,H,q,be,Ge,nt=[],Et,at,lt,ar;for(G=P(G),Et=G.length,N=d,W=0,Ee=h,ye=0;ye<Et;++ye)Ge=G[ye],Ge<128&&nt.push(b(Ge));for(se=fe=nt.length,fe&&nt.push(f);se<Et;){for(B=o,ye=0;ye<Et;++ye)Ge=G[ye],Ge>=N&&Ge<B&&(B=Ge);for(at=se+1,B-N>p((o-W)/at)&&S("overflow"),W+=(B-N)*at,N=B,ye=0;ye<Et;++ye)if(Ge=G[ye],Ge<N&&++W>o&&S("overflow"),Ge==N){for(H=W,q=n;be=q<=Ee?a:q>=Ee+l?l:q-Ee,!(H<be);q+=n)ar=H-be,lt=n-be,nt.push(b(U(be+ar%lt,0))),H=p(ar/lt);nt.push(b(U(H,0))),Ee=A(W,at,se==fe),W=0,++se}++W,++N}return nt.join("")}function R(G){return C(G,function(N){return m.test(N)?O(N.slice(4).toLowerCase()):N})}function D(G){return C(G,function(N){return g.test(N)?"xn--"+F(N):N})}if(s={version:"1.4.1",ucs2:{decode:P,encode:M},decode:O,encode:F,toASCII:D,toUnicode:R},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(e&&t)if(oa.exports==e)t.exports=s;else for(_ in s)s.hasOwnProperty(_)&&(e[_]=s[_]);else r.punycode=s})(sa)});var co=oe((xSe,uk)=>{"use strict";uk.exports=TypeError});var hk=oe(()=>{});var cu=oe((bSe,Ik)=>{var Cb=typeof Map=="function"&&Map.prototype,yb=Object.getOwnPropertyDescriptor&&Cb?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Ap=Cb&&yb&&typeof yb.get=="function"?yb.get:null,dk=Cb&&Map.prototype.forEach,Pb=typeof Set=="function"&&Set.prototype,_b=Object.getOwnPropertyDescriptor&&Pb?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Cp=Pb&&_b&&typeof _b.get=="function"?_b.get:null,fk=Pb&&Set.prototype.forEach,hH=typeof WeakMap=="function"&&WeakMap.prototype,nu=hH?WeakMap.prototype.has:null,dH=typeof WeakSet=="function"&&WeakSet.prototype,au=dH?WeakSet.prototype.has:null,fH=typeof WeakRef=="function"&&WeakRef.prototype,pk=fH?WeakRef.prototype.deref:null,pH=Boolean.prototype.valueOf,mH=Object.prototype.toString,gH=Function.prototype.toString,xH=String.prototype.match,Mb=String.prototype.slice,bs=String.prototype.replace,yH=String.prototype.toUpperCase,mk=String.prototype.toLowerCase,wk=RegExp.prototype.test,gk=Array.prototype.concat,hi=Array.prototype.join,_H=Array.prototype.slice,xk=Math.floor,Tb=typeof BigInt=="function"?BigInt.prototype.valueOf:null,bb=Object.getOwnPropertySymbols,Sb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,na=typeof Symbol=="function"&&typeof Symbol.iterator=="object",lu=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===na||!0)?Symbol.toStringTag:null,Ek=Object.prototype.propertyIsEnumerable,yk=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function _k(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||wk.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-xk(-r):xk(r);if(i!==r){var s=String(i),o=Mb.call(e,s.length+1);return bs.call(s,t,"$&_")+"."+bs.call(bs.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return bs.call(e,t,"$&_")}var wb=hk(),bk=wb.custom,vk=Pk(bk)?bk:null,Ak={__proto__:null,double:'"',single:"'"},bH={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Ik.exports=function r(e,t,i,s){var o=t||{};if(Oi(o,"quoteStyle")&&!Oi(Ak,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Oi(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=Oi(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(Oi(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(Oi(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 Rk(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return a?_k(e,l):l}if(typeof e=="bigint"){var c=String(e)+"n";return a?_k(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 Eb(e)?"[Array]":"[Object]";var h=GH(o,i);if(typeof s>"u")s=[];else if(Mk(s,e)>=0)return"[Circular]";function d(A,O,F){if(O&&(s=_H.call(s),s.push(O)),F){var R={depth:o.depth};return Oi(o,"quoteStyle")&&(R.quoteStyle=o.quoteStyle),r(A,R,i+1,s)}return r(A,o,i+1,s)}if(typeof e=="function"&&!Tk(e)){var f=MH(e),m=Ep(e,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(m.length>0?" { "+hi.call(m,", ")+" }":"")}if(Pk(e)){var g=na?bs.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Sb.call(e);return typeof e=="object"&&!na?ou(g):g}if(OH(e)){for(var x="<"+mk.call(String(e.nodeName)),y=e.attributes||[],T=0;T<y.length;T++)x+=" "+y[T].name+"="+Ck(vH(y[T].value),"double",o);return x+=">",e.childNodes&&e.childNodes.length&&(x+="..."),x+="</"+mk.call(String(e.nodeName))+">",x}if(Eb(e)){if(e.length===0)return"[]";var p=Ep(e,d);return h&&!LH(p)?"["+Ab(p,h)+"]":"[ "+hi.call(p,", ")+" ]"}if(SH(e)){var b=Ep(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!Ek.call(e,"cause")?"{ ["+String(e)+"] "+hi.call(gk.call("[cause]: "+d(e.cause),b),", ")+" }":b.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+hi.call(b,", ")+" }"}if(typeof e=="object"&&n){if(vk&&typeof e[vk]=="function"&&wb)return wb(e,{depth:u-i});if(n!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(RH(e)){var _=[];return dk&&dk.call(e,function(A,O){_.push(d(O,e,!0)+" => "+d(A,e))}),Sk("Map",Ap.call(e),_,h)}if(kH(e)){var S=[];return fk&&fk.call(e,function(A){S.push(d(A,e))}),Sk("Set",Cp.call(e),S,h)}if(IH(e))return vb("WeakMap");if(FH(e))return vb("WeakSet");if(BH(e))return vb("WeakRef");if(EH(e))return ou(d(Number(e)));if(CH(e))return ou(d(Tb.call(e)));if(AH(e))return ou(pH.call(e));if(wH(e))return ou(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(!TH(e)&&!Tk(e)){var E=Ep(e,d),C=yk?yk(e)===Object.prototype:e instanceof Object||e.constructor===Object,P=e instanceof Object?"":"null prototype",M=!C&&lu&&Object(e)===e&&lu in e?Mb.call(vs(e),8,-1):P?"Object":"",I=C||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",U=I+(M||P?"["+hi.call(gk.call([],M||[],P||[]),": ")+"] ":"");return E.length===0?U+"{}":h?U+"{"+Ab(E,h)+"}":U+"{ "+hi.call(E,", ")+" }"}return String(e)};function Ck(r,e,t){var i=t.quoteStyle||e,s=Ak[i];return s+r+s}function vH(r){return bs.call(String(r),/"/g,"&quot;")}function uo(r){return!lu||!(typeof r=="object"&&(lu in r||typeof r[lu]<"u"))}function Eb(r){return vs(r)==="[object Array]"&&uo(r)}function TH(r){return vs(r)==="[object Date]"&&uo(r)}function Tk(r){return vs(r)==="[object RegExp]"&&uo(r)}function SH(r){return vs(r)==="[object Error]"&&uo(r)}function wH(r){return vs(r)==="[object String]"&&uo(r)}function EH(r){return vs(r)==="[object Number]"&&uo(r)}function AH(r){return vs(r)==="[object Boolean]"&&uo(r)}function Pk(r){if(na)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Sb)return!1;try{return Sb.call(r),!0}catch{}return!1}function CH(r){if(!r||typeof r!="object"||!Tb)return!1;try{return Tb.call(r),!0}catch{}return!1}var PH=Object.prototype.hasOwnProperty||function(r){return r in this};function Oi(r,e){return PH.call(r,e)}function vs(r){return mH.call(r)}function MH(r){if(r.name)return r.name;var e=xH.call(gH.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function Mk(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;t<i;t++)if(r[t]===e)return t;return-1}function RH(r){if(!Ap||!r||typeof r!="object")return!1;try{Ap.call(r);try{Cp.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function IH(r){if(!nu||!r||typeof r!="object")return!1;try{nu.call(r,nu);try{au.call(r,au)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function BH(r){if(!pk||!r||typeof r!="object")return!1;try{return pk.call(r),!0}catch{}return!1}function kH(r){if(!Cp||!r||typeof r!="object")return!1;try{Cp.call(r);try{Ap.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function FH(r){if(!au||!r||typeof r!="object")return!1;try{au.call(r,au);try{nu.call(r,nu)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function OH(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function Rk(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,i="... "+t+" more character"+(t>1?"s":"");return Rk(Mb.call(r,0,e.maxStringLength),e)+i}var s=bH[e.quoteStyle||"single"];s.lastIndex=0;var o=bs.call(bs.call(r,s,"\\$1"),/[\x00-\x1f]/g,UH);return Ck(o,"single",e)}function UH(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":"")+yH.call(e.toString(16))}function ou(r){return"Object("+r+")"}function vb(r){return r+" { ? }"}function Sk(r,e,t,i){var s=i?Ab(t,i):hi.call(t,", ");return r+" ("+e+") {"+s+"}"}function LH(r){for(var e=0;e<r.length;e++)if(Mk(r[e],`
1089
+ `))}var cM=v(()=>{Od();Ut();Ay();aM()});var Ic,uM=v(()=>{L();cM();Ic=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 lM(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}};Ic.extension={type:[w.WebGLSystem],name:"uniformGroup"}});function hM(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 Z.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 dM=v(()=>{De()});var UG,LG,GG,DG,NG,VG,fM,pM,mM=v(()=>{L();Gr();dM();UG=0,LG=1,GG=2,DG=3,NG=4,VG=5,fM=class jy{constructor(e){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[UG]=this.setBlend,this.map[LG]=this.setOffset,this.map[GG]=this.setCullFace,this.map[DG]=this.setDepthTest,this.map[NG]=this.setFrontFace,this.map[VG]=this.setDepthMask,this.checks=[],this.defaultState=rt.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=hM(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<<i)),t>>=1,i++;this.stateId=e.data}for(let t=0;t<this.checks.length;t++)this.checks[t](this,e)}forceState(e){e||(e=this.defaultState);for(let t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(let t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data}setBlend(e){this._updateCheck(jy._checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this._updateCheck(jy._checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this._cullFace=e,this.gl[e?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(e){this._frontFace=e,this._frontFaceDirty=!1;let t=this._invertFrontFace?!e:e;this._glFrontFace!==t&&(this._glFrontFace=t,this.gl.frontFace(this.gl[t?"CW":"CCW"]))}setBlendMode(e){if(this.blendModesMap[e]||(e="normal"),e===this.blendMode)return;this.blendMode=e;let t=this.blendModesMap[e],i=this.gl;t.length===2?i.blendFunc(t[0],t[1]):i.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,i.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(e,t){this.gl.polygonOffset(e,t)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(e,t){let i=this.checks.indexOf(e);t&&i===-1?this.checks.push(e):!t&&i!==-1&&this.checks.splice(i,1)}static _checkBlendMode(e,t){e.setBlendMode(t.blendMode)}static _checkPolygonOffset(e,t){e.setPolygonOffset(1,t.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};fM.extension={type:[w.WebGLSystem],name:"state"};pM=fM});var Kd,gM=v(()=>{Gy();Kd=class{constructor(e){this.target=Ly.TEXTURE_2D,this.texture=e,this.width=-1,this.height=-1,this.type=Se.UNSIGNED_BYTE,this.internalFormat=Wd.RGBA,this.format=Wd.RGBA,this.samplerType=0}}});var xM,yM=v(()=>{"use strict";xM={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 HG,_M,bM=v(()=>{"use strict";HG={"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},_M={id:"compressed",upload(r,e,t){t.pixelStorei(t.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight,o=!!HG[r.format];for(let n=0;n<r.resource.length;n++){let a=r.resource[n];o?t.compressedTexImage2D(t.TEXTURE_2D,n,e.internalFormat,i,s,0,a):t.texImage2D(t.TEXTURE_2D,n,e.internalFormat,i,s,0,e.format,e.type,a),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}}});var Zd,Yy=v(()=>{"use strict";Zd={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<n||c<a?((s!==n||o!==a)&&t.texImage2D(e.target,0,e.internalFormat,n,a,0,e.format,e.type,null),i===2?t.texSubImage2D(t.TEXTURE_2D,0,0,0,l,c,e.format,e.type,r.resource):t.texSubImage2D(t.TEXTURE_2D,0,0,0,e.format,e.type,r.resource)):s===n&&o===a?t.texSubImage2D(t.TEXTURE_2D,0,0,0,e.format,e.type,r.resource):i===2?t.texImage2D(e.target,0,e.internalFormat,n,a,0,e.format,e.type,r.resource):t.texImage2D(e.target,0,e.internalFormat,e.format,e.type,r.resource),e.width=n,e.height=a}}});var vM,TM=v(()=>{Yy();vM={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}Zd.upload(r,e,t,i)}}});var qy,SM,Qd,wM,EM=v(()=>{"use strict";qy={linear:9729,nearest:9728},SM={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Qd={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},wM={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Ky(r,e,t,i,s,o,n,a){let l=o;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){let c=Qd[n?"clamp-to-edge":r.addressModeU],u=Qd[n?"clamp-to-edge":r.addressModeV],h=Qd[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,qy[r.magFilter]),t){if(!a||r.mipmapFilter!=="linear"){let c=SM[r.minFilter][r.mipmapFilter];e[s](l,e.TEXTURE_MIN_FILTER,c)}}else e[s](l,e.TEXTURE_MIN_FILTER,qy[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,wM[r.compare])}var AM=v(()=>{EM()});function CM(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 PM=v(()=>{"use strict"});function MM(r,e){let t={},i=r.RGBA;return r instanceof Z.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 RM=v(()=>{De()});function IM(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 BM=v(()=>{"use strict"});var WG,Bc,kM=v(()=>{De();L();Ce();gM();yM();bM();Yy();TM();AM();PM();RM();BM();WG=4,Bc=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:Zd,buffer:xM,video:vM,compressed:_M},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=MM(e,this._renderer.context.extensions),this._mapFormatToType=IM(e),this._mapFormatToFormat=CM(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;o<i.length;o++)if(i[o]===t){this._activateLocation(o);let n=this.getGlSource(t);s.bindTexture(n.target,null),i[o]=null}}_activateLocation(e){this._activeTextureLocation!==e&&(this._activeTextureLocation=e,this._gl.activeTexture(this._gl.TEXTURE0+e))}_initSource(e){let t=this._gl,i=new Kd(t.createTexture());if(i.type=this._mapFormatToType[e.format],i.internalFormat=this._mapFormatToInternalFormat[e.format],i.format=this._mapFormatToFormat[e.format],e.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||e.isPowerOfTwo)){let s=Math.max(e.width,e.height);e.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[e.uid]=i,this.managedTextures.includes(e)||(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceUpdate,this),e.on("styleChange",this.onStyleChange,this),e.on("destroy",this.onSourceDestroy,this),e.on("unload",this.onSourceUnload,this),e.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(e)),this.onSourceUpdate(e),this.updateStyle(e,!1),i}onStyleChange(e){this.updateStyle(e,!1)}updateStyle(e,t){let i=this._gl,s=this.getGlSource(e);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=e,Ky(e.style,i,e.mipLevelCount>1,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,Ky(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=Z.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(WG*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)}};Bc.extension={type:[w.WebGLSystem],name:"texture"}});var LM={};$v(LM,{WebGLRenderer:()=>Zy});var zG,$G,XG,FM,OM,UM,Zy,GM=v(()=>{L();fP();pP();mP();Gl();Sy();Er();yP();vP();EP();PP();MP();RP();IP();LP();NP();sM();uM();mM();kM();zG=[...Bd,Pc,CP,bP,Sc,Bc,Mc,wc,Ic,Rc,Ac,pM,Cc,Ec],$G=[...kd],XG=[vc,bc,_c],FM=[],OM=[],UM=[];$.handleByNamedList(w.WebGLSystem,FM);$.handleByNamedList(w.WebGLPipes,OM);$.handleByNamedList(w.WebGLPipesAdaptor,UM);$.add(...zG,...$G,...XG);Zy=class extends ns{constructor(){let e={name:"webgl",type:Ye.WEBGL,systems:FM,renderPipes:OM,renderPipeAdaptors:UM};super(e)}}});var lk=oe((gSe,xb)=>{"use strict";var cH=Object.prototype.hasOwnProperty,Kt="~";function su(){}Object.create&&(su.prototype=Object.create(null),new su().__proto__||(Kt=!1));function uH(r,e,t){this.fn=r,this.context=e,this.once=t||!1}function ak(r,e,t,i,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var o=new uH(t,i||r,s),n=Kt?Kt+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 wp(r,e){--r._eventsCount===0?r._events=new su:delete r._events[e]}function Vt(){this._events=new su,this._eventsCount=0}Vt.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)cH.call(t,i)&&e.push(Kt?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};Vt.prototype.listeners=function(e){var t=Kt?Kt+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<o;s++)n[s]=i[s].fn;return n};Vt.prototype.listenerCount=function(e){var t=Kt?Kt+e:e,i=this._events[t];return i?i.fn?1:i.length:0};Vt.prototype.emit=function(e,t,i,s,o,n){var a=Kt?Kt+e:e;if(!this._events[a])return!1;var l=this._events[a],c=arguments.length,u,h;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,i),!0;case 4:return l.fn.call(l.context,t,i,s),!0;case 5:return l.fn.call(l.context,t,i,s,o),!0;case 6:return l.fn.call(l.context,t,i,s,o,n),!0}for(h=1,u=new Array(c-1);h<c;h++)u[h-1]=arguments[h];l.fn.apply(l.context,u)}else{var d=l.length,f;for(h=0;h<d;h++)switch(l[h].once&&this.removeListener(e,l[h].fn,void 0,!0),c){case 1:l[h].fn.call(l[h].context);break;case 2:l[h].fn.call(l[h].context,t);break;case 3:l[h].fn.call(l[h].context,t,i);break;case 4:l[h].fn.call(l[h].context,t,i,s);break;default:if(!u)for(f=1,u=new Array(c-1);f<c;f++)u[f-1]=arguments[f];l[h].fn.apply(l[h].context,u)}}return!0};Vt.prototype.on=function(e,t,i){return ak(this,e,t,i,!1)};Vt.prototype.once=function(e,t,i){return ak(this,e,t,i,!0)};Vt.prototype.removeListener=function(e,t,i,s){var o=Kt?Kt+e:e;if(!this._events[o])return this;if(!t)return wp(this,o),this;var n=this._events[o];if(n.fn)n.fn===t&&(!s||n.once)&&(!i||n.context===i)&&wp(this,o);else{for(var a=0,l=[],c=n.length;a<c;a++)(n[a].fn!==t||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:wp(this,o)}return this};Vt.prototype.removeAllListeners=function(e){var t;return e?(t=Kt?Kt+e:e,this._events[t]&&wp(this,t)):(this._events=new su,this._eventsCount=0),this};Vt.prototype.off=Vt.prototype.removeListener;Vt.prototype.addListener=Vt.prototype.on;Vt.prefixed=Kt;Vt.EventEmitter=Vt;typeof xb<"u"&&(xb.exports=Vt)});var ck=oe((sa,oa)=>{(function(r){var e=typeof sa=="object"&&sa&&!sa.nodeType&&sa,t=typeof oa=="object"&&oa&&!oa.nodeType&&oa,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="-",m=/^xn--/,g=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},T=n-a,p=Math.floor,b=String.fromCharCode,_;function S(G){throw new RangeError(y[G])}function E(G,N){for(var W=G.length,se=[];W--;)se[W]=N(G[W]);return se}function C(G,N){var W=G.split("@"),se="";W.length>1&&(se=W[0]+"@",G=W[1]),G=G.replace(x,".");var fe=G.split("."),Ee=E(fe,N).join(".");return se+Ee}function P(G){for(var N=[],W=0,se=G.length,fe,Ee;W<se;)fe=G.charCodeAt(W++),fe>=55296&&fe<=56319&&W<se?(Ee=G.charCodeAt(W++),(Ee&64512)==56320?N.push(((fe&1023)<<10)+(Ee&1023)+65536):(N.push(fe),W--)):N.push(fe);return N}function R(G){return E(G,function(N){var W="";return N>65535&&(N-=65536,W+=b(N>>>10&1023|55296),N=56320|N&1023),W+=b(N),W}).join("")}function I(G){return G-48<10?G-22:G-65<26?G-65:G-97<26?G-97:n}function U(G,N){return G+22+75*(G<26)-((N!=0)<<5)}function A(G,N,W){var se=0;for(G=W?p(G/u):G>>1,G+=p(G/N);G>T*l>>1;se+=n)G=p(G/T);return p(se+(T+1)*G/(G+c))}function O(G){var N=[],W=G.length,se,fe=0,Ee=d,ye=h,B,H,q,be,Ge,nt,Et,at,lt;for(B=G.lastIndexOf(f),B<0&&(B=0),H=0;H<B;++H)G.charCodeAt(H)>=128&&S("not-basic"),N.push(G.charCodeAt(H));for(q=B>0?B+1:0;q<W;){for(be=fe,Ge=1,nt=n;q>=W&&S("invalid-input"),Et=I(G.charCodeAt(q++)),(Et>=n||Et>p((o-fe)/Ge))&&S("overflow"),fe+=Et*Ge,at=nt<=ye?a:nt>=ye+l?l:nt-ye,!(Et<at);nt+=n)lt=n-at,Ge>p(o/lt)&&S("overflow"),Ge*=lt;se=N.length+1,ye=A(fe-be,se,be==0),p(fe/se)>o-Ee&&S("overflow"),Ee+=p(fe/se),fe%=se,N.splice(fe++,0,Ee)}return R(N)}function F(G){var N,W,se,fe,Ee,ye,B,H,q,be,Ge,nt=[],Et,at,lt,ar;for(G=P(G),Et=G.length,N=d,W=0,Ee=h,ye=0;ye<Et;++ye)Ge=G[ye],Ge<128&&nt.push(b(Ge));for(se=fe=nt.length,fe&&nt.push(f);se<Et;){for(B=o,ye=0;ye<Et;++ye)Ge=G[ye],Ge>=N&&Ge<B&&(B=Ge);for(at=se+1,B-N>p((o-W)/at)&&S("overflow"),W+=(B-N)*at,N=B,ye=0;ye<Et;++ye)if(Ge=G[ye],Ge<N&&++W>o&&S("overflow"),Ge==N){for(H=W,q=n;be=q<=Ee?a:q>=Ee+l?l:q-Ee,!(H<be);q+=n)ar=H-be,lt=n-be,nt.push(b(U(be+ar%lt,0))),H=p(ar/lt);nt.push(b(U(H,0))),Ee=A(W,at,se==fe),W=0,++se}++W,++N}return nt.join("")}function M(G){return C(G,function(N){return m.test(N)?O(N.slice(4).toLowerCase()):N})}function D(G){return C(G,function(N){return g.test(N)?"xn--"+F(N):N})}if(s={version:"1.4.1",ucs2:{decode:P,encode:R},decode:O,encode:F,toASCII:D,toUnicode:M},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(e&&t)if(oa.exports==e)t.exports=s;else for(_ in s)s.hasOwnProperty(_)&&(e[_]=s[_]);else r.punycode=s})(sa)});var co=oe((xSe,uk)=>{"use strict";uk.exports=TypeError});var hk=oe(()=>{});var cu=oe((bSe,Ik)=>{var Cb=typeof Map=="function"&&Map.prototype,yb=Object.getOwnPropertyDescriptor&&Cb?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Ap=Cb&&yb&&typeof yb.get=="function"?yb.get:null,dk=Cb&&Map.prototype.forEach,Pb=typeof Set=="function"&&Set.prototype,_b=Object.getOwnPropertyDescriptor&&Pb?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Cp=Pb&&_b&&typeof _b.get=="function"?_b.get:null,fk=Pb&&Set.prototype.forEach,hH=typeof WeakMap=="function"&&WeakMap.prototype,nu=hH?WeakMap.prototype.has:null,dH=typeof WeakSet=="function"&&WeakSet.prototype,au=dH?WeakSet.prototype.has:null,fH=typeof WeakRef=="function"&&WeakRef.prototype,pk=fH?WeakRef.prototype.deref:null,pH=Boolean.prototype.valueOf,mH=Object.prototype.toString,gH=Function.prototype.toString,xH=String.prototype.match,Mb=String.prototype.slice,bs=String.prototype.replace,yH=String.prototype.toUpperCase,mk=String.prototype.toLowerCase,wk=RegExp.prototype.test,gk=Array.prototype.concat,hi=Array.prototype.join,_H=Array.prototype.slice,xk=Math.floor,Tb=typeof BigInt=="function"?BigInt.prototype.valueOf:null,bb=Object.getOwnPropertySymbols,Sb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,na=typeof Symbol=="function"&&typeof Symbol.iterator=="object",lu=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===na||!0)?Symbol.toStringTag:null,Ek=Object.prototype.propertyIsEnumerable,yk=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function _k(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||wk.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-xk(-r):xk(r);if(i!==r){var s=String(i),o=Mb.call(e,s.length+1);return bs.call(s,t,"$&_")+"."+bs.call(bs.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return bs.call(e,t,"$&_")}var wb=hk(),bk=wb.custom,vk=Pk(bk)?bk:null,Ak={__proto__:null,double:'"',single:"'"},bH={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Ik.exports=function r(e,t,i,s){var o=t||{};if(Oi(o,"quoteStyle")&&!Oi(Ak,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Oi(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=Oi(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(Oi(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(Oi(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 Rk(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return a?_k(e,l):l}if(typeof e=="bigint"){var c=String(e)+"n";return a?_k(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 Eb(e)?"[Array]":"[Object]";var h=GH(o,i);if(typeof s>"u")s=[];else if(Mk(s,e)>=0)return"[Circular]";function d(A,O,F){if(O&&(s=_H.call(s),s.push(O)),F){var M={depth:o.depth};return Oi(o,"quoteStyle")&&(M.quoteStyle=o.quoteStyle),r(A,M,i+1,s)}return r(A,o,i+1,s)}if(typeof e=="function"&&!Tk(e)){var f=MH(e),m=Ep(e,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(m.length>0?" { "+hi.call(m,", ")+" }":"")}if(Pk(e)){var g=na?bs.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Sb.call(e);return typeof e=="object"&&!na?ou(g):g}if(OH(e)){for(var x="<"+mk.call(String(e.nodeName)),y=e.attributes||[],T=0;T<y.length;T++)x+=" "+y[T].name+"="+Ck(vH(y[T].value),"double",o);return x+=">",e.childNodes&&e.childNodes.length&&(x+="..."),x+="</"+mk.call(String(e.nodeName))+">",x}if(Eb(e)){if(e.length===0)return"[]";var p=Ep(e,d);return h&&!LH(p)?"["+Ab(p,h)+"]":"[ "+hi.call(p,", ")+" ]"}if(SH(e)){var b=Ep(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!Ek.call(e,"cause")?"{ ["+String(e)+"] "+hi.call(gk.call("[cause]: "+d(e.cause),b),", ")+" }":b.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+hi.call(b,", ")+" }"}if(typeof e=="object"&&n){if(vk&&typeof e[vk]=="function"&&wb)return wb(e,{depth:u-i});if(n!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(RH(e)){var _=[];return dk&&dk.call(e,function(A,O){_.push(d(O,e,!0)+" => "+d(A,e))}),Sk("Map",Ap.call(e),_,h)}if(kH(e)){var S=[];return fk&&fk.call(e,function(A){S.push(d(A,e))}),Sk("Set",Cp.call(e),S,h)}if(IH(e))return vb("WeakMap");if(FH(e))return vb("WeakSet");if(BH(e))return vb("WeakRef");if(EH(e))return ou(d(Number(e)));if(CH(e))return ou(d(Tb.call(e)));if(AH(e))return ou(pH.call(e));if(wH(e))return ou(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(!TH(e)&&!Tk(e)){var E=Ep(e,d),C=yk?yk(e)===Object.prototype:e instanceof Object||e.constructor===Object,P=e instanceof Object?"":"null prototype",R=!C&&lu&&Object(e)===e&&lu in e?Mb.call(vs(e),8,-1):P?"Object":"",I=C||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",U=I+(R||P?"["+hi.call(gk.call([],R||[],P||[]),": ")+"] ":"");return E.length===0?U+"{}":h?U+"{"+Ab(E,h)+"}":U+"{ "+hi.call(E,", ")+" }"}return String(e)};function Ck(r,e,t){var i=t.quoteStyle||e,s=Ak[i];return s+r+s}function vH(r){return bs.call(String(r),/"/g,"&quot;")}function uo(r){return!lu||!(typeof r=="object"&&(lu in r||typeof r[lu]<"u"))}function Eb(r){return vs(r)==="[object Array]"&&uo(r)}function TH(r){return vs(r)==="[object Date]"&&uo(r)}function Tk(r){return vs(r)==="[object RegExp]"&&uo(r)}function SH(r){return vs(r)==="[object Error]"&&uo(r)}function wH(r){return vs(r)==="[object String]"&&uo(r)}function EH(r){return vs(r)==="[object Number]"&&uo(r)}function AH(r){return vs(r)==="[object Boolean]"&&uo(r)}function Pk(r){if(na)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Sb)return!1;try{return Sb.call(r),!0}catch{}return!1}function CH(r){if(!r||typeof r!="object"||!Tb)return!1;try{return Tb.call(r),!0}catch{}return!1}var PH=Object.prototype.hasOwnProperty||function(r){return r in this};function Oi(r,e){return PH.call(r,e)}function vs(r){return mH.call(r)}function MH(r){if(r.name)return r.name;var e=xH.call(gH.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function Mk(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;t<i;t++)if(r[t]===e)return t;return-1}function RH(r){if(!Ap||!r||typeof r!="object")return!1;try{Ap.call(r);try{Cp.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function IH(r){if(!nu||!r||typeof r!="object")return!1;try{nu.call(r,nu);try{au.call(r,au)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function BH(r){if(!pk||!r||typeof r!="object")return!1;try{return pk.call(r),!0}catch{}return!1}function kH(r){if(!Cp||!r||typeof r!="object")return!1;try{Cp.call(r);try{Ap.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function FH(r){if(!au||!r||typeof r!="object")return!1;try{au.call(r,au);try{nu.call(r,nu)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function OH(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function Rk(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,i="... "+t+" more character"+(t>1?"s":"");return Rk(Mb.call(r,0,e.maxStringLength),e)+i}var s=bH[e.quoteStyle||"single"];s.lastIndex=0;var o=bs.call(bs.call(r,s,"\\$1"),/[\x00-\x1f]/g,UH);return Ck(o,"single",e)}function UH(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":"")+yH.call(e.toString(16))}function ou(r){return"Object("+r+")"}function vb(r){return r+" { ? }"}function Sk(r,e,t,i){var s=i?Ab(t,i):hi.call(t,", ");return r+" ("+e+") {"+s+"}"}function LH(r){for(var e=0;e<r.length;e++)if(Mk(r[e],`
1090
1090
  `)>=0)return!1;return!0}function GH(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=hi.call(Array(r.indent+1)," ");else return null;return{base:t,prev:hi.call(Array(e+1),t)}}function Ab(r,e){if(r.length===0)return"";var t=`
1091
1091
  `+e.prev+e.base;return t+hi.call(r,","+t)+`
1092
- `+e.prev}function Ep(r,e){var t=Eb(r),i=[];if(t){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=Oi(r,s)?e(r[s],r):""}var o=typeof bb=="function"?bb(r):[],n;if(na){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var l in r)Oi(r,l)&&(t&&String(Number(l))===l&&l<r.length||na&&n["$"+l]instanceof Symbol||(wk.call(/[^\w$]/,l)?i.push(e(l,r)+": "+e(r[l],r)):i.push(l+": "+e(r[l],r))));if(typeof bb=="function")for(var c=0;c<o.length;c++)Ek.call(r,o[c])&&i.push("["+e(o[c])+"]: "+e(r[o[c]],r));return i}});var kk=oe((vSe,Bk)=>{"use strict";var DH=cu(),NH=co(),Pp=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},VH=function(r,e){if(r){var t=Pp(r,e);return t&&t.value}},HH=function(r,e,t){var i=Pp(r,e);i?i.value=t:r.next={key:e,next:r.next,value:t}},WH=function(r,e){return r?!!Pp(r,e):!1},zH=function(r,e){if(r)return Pp(r,e,!0)};Bk.exports=function(){var e,t={assert:function(i){if(!t.has(i))throw new NH("Side channel does not contain "+DH(i))},delete:function(i){var s=e&&e.next,o=zH(e,i);return o&&s&&s===o&&(e=void 0),!!o},get:function(i){return VH(e,i)},has:function(i){return WH(e,i)},set:function(i,s){e||(e={next:void 0}),HH(e,i,s)}};return t}});var Rb=oe((TSe,Fk)=>{"use strict";Fk.exports=Object});var Uk=oe((SSe,Ok)=>{"use strict";Ok.exports=Error});var Gk=oe((wSe,Lk)=>{"use strict";Lk.exports=EvalError});var Nk=oe((ESe,Dk)=>{"use strict";Dk.exports=RangeError});var Hk=oe((ASe,Vk)=>{"use strict";Vk.exports=ReferenceError});var zk=oe((CSe,Wk)=>{"use strict";Wk.exports=SyntaxError});var Xk=oe((PSe,$k)=>{"use strict";$k.exports=URIError});var Yk=oe((MSe,jk)=>{"use strict";jk.exports=Math.abs});var Kk=oe((RSe,qk)=>{"use strict";qk.exports=Math.floor});var Qk=oe((ISe,Zk)=>{"use strict";Zk.exports=Math.max});var eF=oe((BSe,Jk)=>{"use strict";Jk.exports=Math.min});var rF=oe((kSe,tF)=>{"use strict";tF.exports=Math.pow});var sF=oe((FSe,iF)=>{"use strict";iF.exports=Math.round});var nF=oe((OSe,oF)=>{"use strict";oF.exports=Number.isNaN||function(e){return e!==e}});var lF=oe((USe,aF)=>{"use strict";var $H=nF();aF.exports=function(e){return $H(e)||e===0?e:e<0?-1:1}});var uF=oe((LSe,cF)=>{"use strict";cF.exports=Object.getOwnPropertyDescriptor});var Ib=oe((GSe,hF)=>{"use strict";var Mp=uF();if(Mp)try{Mp([],"length")}catch{Mp=null}hF.exports=Mp});var fF=oe((DSe,dF)=>{"use strict";var Rp=Object.defineProperty||!1;if(Rp)try{Rp({},"a",{value:1})}catch{Rp=!1}dF.exports=Rp});var mF=oe((NSe,pF)=>{"use strict";pF.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 yF=oe((VSe,xF)=>{"use strict";var gF=typeof Symbol<"u"&&Symbol,XH=mF();xF.exports=function(){return typeof gF!="function"||typeof Symbol!="function"||typeof gF("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:XH()}});var Bb=oe((HSe,_F)=>{"use strict";_F.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var kb=oe((WSe,bF)=>{"use strict";var jH=Rb();bF.exports=jH.getPrototypeOf||null});var SF=oe((zSe,TF)=>{"use strict";var YH="Function.prototype.bind called on incompatible ",qH=Object.prototype.toString,KH=Math.max,ZH="[object Function]",vF=function(e,t){for(var i=[],s=0;s<e.length;s+=1)i[s]=e[s];for(var o=0;o<t.length;o+=1)i[o+e.length]=t[o];return i},QH=function(e,t){for(var i=[],s=t||0,o=0;s<e.length;s+=1,o+=1)i[o]=e[s];return i},JH=function(r,e){for(var t="",i=0;i<r.length;i+=1)t+=r[i],i+1<r.length&&(t+=e);return t};TF.exports=function(e){var t=this;if(typeof t!="function"||qH.apply(t)!==ZH)throw new TypeError(YH+t);for(var i=QH(arguments,1),s,o=function(){if(this instanceof s){var u=t.apply(this,vF(i,arguments));return Object(u)===u?u:this}return t.apply(e,vF(i,arguments))},n=KH(0,t.length-i.length),a=[],l=0;l<n;l++)a[l]="$"+l;if(s=Function("binder","return function ("+JH(a,",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var c=function(){};c.prototype=t.prototype,s.prototype=new c,c.prototype=null}return s}});var uu=oe(($Se,wF)=>{"use strict";var e4=SF();wF.exports=Function.prototype.bind||e4});var Ip=oe((XSe,EF)=>{"use strict";EF.exports=Function.prototype.call});var Fb=oe((jSe,AF)=>{"use strict";AF.exports=Function.prototype.apply});var PF=oe((YSe,CF)=>{"use strict";CF.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var RF=oe((qSe,MF)=>{"use strict";var t4=uu(),r4=Fb(),i4=Ip(),s4=PF();MF.exports=s4||t4.call(i4,r4)});var Ob=oe((KSe,IF)=>{"use strict";var o4=uu(),n4=co(),a4=Ip(),l4=RF();IF.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new n4("a function is required");return l4(o4,a4,e)}});var LF=oe((ZSe,UF)=>{"use strict";var c4=Ob(),BF=Ib(),FF;try{FF=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var Ub=!!FF&&BF&&BF(Object.prototype,"__proto__"),OF=Object,kF=OF.getPrototypeOf;UF.exports=Ub&&typeof Ub.get=="function"?c4([Ub.get]):typeof kF=="function"?function(e){return kF(e==null?e:OF(e))}:!1});var HF=oe((QSe,VF)=>{"use strict";var GF=Bb(),DF=kb(),NF=LF();VF.exports=GF?function(e){return GF(e)}:DF?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return DF(e)}:NF?function(e){return NF(e)}:null});var zF=oe((JSe,WF)=>{"use strict";var u4=Function.prototype.call,h4=Object.prototype.hasOwnProperty,d4=uu();WF.exports=d4.call(u4,h4)});var Fp=oe((ewe,KF)=>{"use strict";var _e,f4=Rb(),p4=Uk(),m4=Gk(),g4=Nk(),x4=Hk(),ua=zk(),ca=co(),y4=Xk(),_4=Yk(),b4=Kk(),v4=Qk(),T4=eF(),S4=rF(),w4=sF(),E4=lF(),YF=Function,Lb=function(r){try{return YF('"use strict"; return ('+r+").constructor;")()}catch{}},hu=Ib(),A4=fF(),Gb=function(){throw new ca},C4=hu?function(){try{return arguments.callee,Gb}catch{try{return hu(arguments,"callee").get}catch{return Gb}}}():Gb,aa=yF()(),wt=HF(),P4=kb(),M4=Bb(),qF=Fb(),du=Ip(),la={},R4=typeof Uint8Array>"u"||!wt?_e:wt(Uint8Array),ho={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?_e:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?_e:ArrayBuffer,"%ArrayIteratorPrototype%":aa&&wt?wt([][Symbol.iterator]()):_e,"%AsyncFromSyncIteratorPrototype%":_e,"%AsyncFunction%":la,"%AsyncGenerator%":la,"%AsyncGeneratorFunction%":la,"%AsyncIteratorPrototype%":la,"%Atomics%":typeof Atomics>"u"?_e:Atomics,"%BigInt%":typeof BigInt>"u"?_e:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?_e:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?_e:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?_e:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":p4,"%eval%":eval,"%EvalError%":m4,"%Float16Array%":typeof Float16Array>"u"?_e:Float16Array,"%Float32Array%":typeof Float32Array>"u"?_e:Float32Array,"%Float64Array%":typeof Float64Array>"u"?_e:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?_e:FinalizationRegistry,"%Function%":YF,"%GeneratorFunction%":la,"%Int8Array%":typeof Int8Array>"u"?_e:Int8Array,"%Int16Array%":typeof Int16Array>"u"?_e:Int16Array,"%Int32Array%":typeof Int32Array>"u"?_e:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":aa&&wt?wt(wt([][Symbol.iterator]())):_e,"%JSON%":typeof JSON=="object"?JSON:_e,"%Map%":typeof Map>"u"?_e:Map,"%MapIteratorPrototype%":typeof Map>"u"||!aa||!wt?_e:wt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":f4,"%Object.getOwnPropertyDescriptor%":hu,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?_e:Promise,"%Proxy%":typeof Proxy>"u"?_e:Proxy,"%RangeError%":g4,"%ReferenceError%":x4,"%Reflect%":typeof Reflect>"u"?_e:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?_e:Set,"%SetIteratorPrototype%":typeof Set>"u"||!aa||!wt?_e:wt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?_e:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":aa&&wt?wt(""[Symbol.iterator]()):_e,"%Symbol%":aa?Symbol:_e,"%SyntaxError%":ua,"%ThrowTypeError%":C4,"%TypedArray%":R4,"%TypeError%":ca,"%Uint8Array%":typeof Uint8Array>"u"?_e:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?_e:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?_e:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?_e:Uint32Array,"%URIError%":y4,"%WeakMap%":typeof WeakMap>"u"?_e:WeakMap,"%WeakRef%":typeof WeakRef>"u"?_e:WeakRef,"%WeakSet%":typeof WeakSet>"u"?_e:WeakSet,"%Function.prototype.call%":du,"%Function.prototype.apply%":qF,"%Object.defineProperty%":A4,"%Object.getPrototypeOf%":P4,"%Math.abs%":_4,"%Math.floor%":b4,"%Math.max%":v4,"%Math.min%":T4,"%Math.pow%":S4,"%Math.round%":w4,"%Math.sign%":E4,"%Reflect.getPrototypeOf%":M4};if(wt)try{null.error}catch(r){$F=wt(wt(r)),ho["%Error.prototype%"]=$F}var $F,I4=function r(e){var t;if(e==="%AsyncFunction%")t=Lb("async function () {}");else if(e==="%GeneratorFunction%")t=Lb("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Lb("async function* () {}");else if(e==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(t=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&wt&&(t=wt(s.prototype))}return ho[e]=t,t},XF={__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"]},fu=uu(),Bp=zF(),B4=fu.call(du,Array.prototype.concat),k4=fu.call(qF,Array.prototype.splice),jF=fu.call(du,String.prototype.replace),kp=fu.call(du,String.prototype.slice),F4=fu.call(du,RegExp.prototype.exec),O4=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,U4=/\\(\\)?/g,L4=function(e){var t=kp(e,0,1),i=kp(e,-1);if(t==="%"&&i!=="%")throw new ua("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&t!=="%")throw new ua("invalid intrinsic syntax, expected opening `%`");var s=[];return jF(e,O4,function(o,n,a,l){s[s.length]=a?jF(l,U4,"$1"):n||o}),s},G4=function(e,t){var i=e,s;if(Bp(XF,i)&&(s=XF[i],i="%"+s[0]+"%"),Bp(ho,i)){var o=ho[i];if(o===la&&(o=I4(i)),typeof o>"u"&&!t)throw new ca("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:o}}throw new ua("intrinsic "+e+" does not exist!")};KF.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new ca("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new ca('"allowMissing" argument must be a boolean');if(F4(/^%?[^%]*%?$/,e)===null)throw new ua("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=L4(e),s=i.length>0?i[0]:"",o=G4("%"+s+"%",t),n=o.name,a=o.value,l=!1,c=o.alias;c&&(s=c[0],k4(i,B4([0,1],c)));for(var u=1,h=!0;u<i.length;u+=1){var d=i[u],f=kp(d,0,1),m=kp(d,-1);if((f==='"'||f==="'"||f==="`"||m==='"'||m==="'"||m==="`")&&f!==m)throw new ua("property names with quotes must have matching quotes");if((d==="constructor"||!h)&&(l=!0),s+="."+d,n="%"+s+"%",Bp(ho,n))a=ho[n];else if(a!=null){if(!(d in a)){if(!t)throw new ca("base intrinsic for "+e+" exists, but the property is not available.");return}if(hu&&u+1>=i.length){var g=hu(a,d);h=!!g,h&&"get"in g&&!("originalValue"in g.get)?a=g.get:a=a[d]}else h=Bp(a,d),a=a[d];h&&!l&&(ho[n]=a)}}return a}});var Db=oe((twe,JF)=>{"use strict";var ZF=Fp(),QF=Ob(),D4=QF([ZF("%String.prototype.indexOf%")]);JF.exports=function(e,t){var i=ZF(e,!!t);return typeof i=="function"&&D4(e,".prototype.")>-1?QF([i]):i}});var Nb=oe((rwe,t2)=>{"use strict";var N4=Fp(),pu=Db(),V4=cu(),H4=co(),e2=N4("%Map%",!0),W4=pu("Map.prototype.get",!0),z4=pu("Map.prototype.set",!0),$4=pu("Map.prototype.has",!0),X4=pu("Map.prototype.delete",!0),j4=pu("Map.prototype.size",!0);t2.exports=!!e2&&function(){var e,t={assert:function(i){if(!t.has(i))throw new H4("Side channel does not contain "+V4(i))},delete:function(i){if(e){var s=X4(e,i);return j4(e)===0&&(e=void 0),s}return!1},get:function(i){if(e)return W4(e,i)},has:function(i){return e?$4(e,i):!1},set:function(i,s){e||(e=new e2),z4(e,i,s)}};return t}});var i2=oe((iwe,r2)=>{"use strict";var Y4=Fp(),Up=Db(),q4=cu(),Op=Nb(),K4=co(),ha=Y4("%WeakMap%",!0),Z4=Up("WeakMap.prototype.get",!0),Q4=Up("WeakMap.prototype.set",!0),J4=Up("WeakMap.prototype.has",!0),eW=Up("WeakMap.prototype.delete",!0);r2.exports=ha?function(){var e,t,i={assert:function(s){if(!i.has(s))throw new K4("Side channel does not contain "+q4(s))},delete:function(s){if(ha&&s&&(typeof s=="object"||typeof s=="function")){if(e)return eW(e,s)}else if(Op&&t)return t.delete(s);return!1},get:function(s){return ha&&s&&(typeof s=="object"||typeof s=="function")&&e?Z4(e,s):t&&t.get(s)},has:function(s){return ha&&s&&(typeof s=="object"||typeof s=="function")&&e?J4(e,s):!!t&&t.has(s)},set:function(s,o){ha&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new ha),Q4(e,s,o)):Op&&(t||(t=Op()),t.set(s,o))}};return i}:Op});var o2=oe((swe,s2)=>{"use strict";var tW=co(),rW=cu(),iW=kk(),sW=Nb(),oW=i2(),nW=oW||sW||iW;s2.exports=function(){var e,t={assert:function(i){if(!t.has(i))throw new tW("Side channel does not contain "+rW(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=nW()),e.set(i,s)}};return t}});var Lp=oe((owe,n2)=>{"use strict";var aW=String.prototype.replace,lW=/%20/g,Vb={RFC1738:"RFC1738",RFC3986:"RFC3986"};n2.exports={default:Vb.RFC3986,formatters:{RFC1738:function(r){return aW.call(r,lW,"+")},RFC3986:function(r){return String(r)}},RFC1738:Vb.RFC1738,RFC3986:Vb.RFC3986}});var zb=oe((nwe,l2)=>{"use strict";var cW=Lp(),Hb=Object.prototype.hasOwnProperty,fo=Array.isArray,di=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),uW=function(e){for(;e.length>1;){var t=e.pop(),i=t.obj[t.prop];if(fo(i)){for(var s=[],o=0;o<i.length;++o)typeof i[o]<"u"&&s.push(i[o]);t.obj[t.prop]=s}}},a2=function(e,t){for(var i=t&&t.plainObjects?{__proto__:null}:{},s=0;s<e.length;++s)typeof e[s]<"u"&&(i[s]=e[s]);return i},hW=function r(e,t,i){if(!t)return e;if(typeof t!="object"&&typeof t!="function"){if(fo(e))e.push(t);else if(e&&typeof e=="object")(i&&(i.plainObjects||i.allowPrototypes)||!Hb.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);var s=e;return fo(e)&&!fo(t)&&(s=a2(e,i)),fo(e)&&fo(t)?(t.forEach(function(o,n){if(Hb.call(e,n)){var a=e[n];a&&typeof a=="object"&&o&&typeof o=="object"?e[n]=r(a,o,i):e.push(o)}else e[n]=o}),e):Object.keys(t).reduce(function(o,n){var a=t[n];return Hb.call(o,n)?o[n]=r(o[n],a,i):o[n]=a,o},s)},dW=function(e,t){return Object.keys(t).reduce(function(i,s){return i[s]=t[s],i},e)},fW=function(r,e,t){var i=r.replace(/\+/g," ");if(t==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},Wb=1024,pW=function(e,t,i,s,o){if(e.length===0)return e;var n=e;if(typeof e=="symbol"?n=Symbol.prototype.toString.call(e):typeof e!="string"&&(n=String(e)),i==="iso-8859-1")return escape(n).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var a="",l=0;l<n.length;l+=Wb){for(var c=n.length>=Wb?n.slice(l,l+Wb):n,u=[],h=0;h<c.length;++h){var d=c.charCodeAt(h);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===cW.RFC1738&&(d===40||d===41)){u[u.length]=c.charAt(h);continue}if(d<128){u[u.length]=di[d];continue}if(d<2048){u[u.length]=di[192|d>>6]+di[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=di[224|d>>12]+di[128|d>>6&63]+di[128|d&63];continue}h+=1,d=65536+((d&1023)<<10|c.charCodeAt(h)&1023),u[u.length]=di[240|d>>18]+di[128|d>>12&63]+di[128|d>>6&63]+di[128|d&63]}a+=u.join("")}return a},mW=function(e){for(var t=[{obj:{o:e},prop:"o"}],i=[],s=0;s<t.length;++s)for(var o=t[s],n=o.obj[o.prop],a=Object.keys(n),l=0;l<a.length;++l){var c=a[l],u=n[c];typeof u=="object"&&u!==null&&i.indexOf(u)===-1&&(t.push({obj:n,prop:c}),i.push(u))}return uW(t),e},gW=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},xW=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},yW=function(e,t){return[].concat(e,t)},_W=function(e,t){if(fo(e)){for(var i=[],s=0;s<e.length;s+=1)i.push(t(e[s]));return i}return t(e)};l2.exports={arrayToObject:a2,assign:dW,combine:yW,compact:mW,decode:fW,encode:pW,isBuffer:xW,isRegExp:gW,maybeMap:_W,merge:hW}});var p2=oe((awe,f2)=>{"use strict";var u2=o2(),Gp=zb(),mu=Lp(),bW=Object.prototype.hasOwnProperty,h2={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},fi=Array.isArray,vW=Array.prototype.push,d2=function(r,e){vW.apply(r,fi(e)?e:[e])},TW=Date.prototype.toISOString,c2=mu.default,_t={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Gp.encode,encodeValuesOnly:!1,filter:void 0,format:c2,formatter:mu.formatters[c2],indices:!1,serializeDate:function(e){return TW.call(e)},skipNulls:!1,strictNullHandling:!1},SW=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},$b={},wW=function r(e,t,i,s,o,n,a,l,c,u,h,d,f,m,g,x,y,T){for(var p=e,b=T,_=0,S=!1;(b=b.get($b))!==void 0&&!S;){var E=b.get(e);if(_+=1,typeof E<"u"){if(E===_)throw new RangeError("Cyclic object value");S=!0}typeof b.get($b)>"u"&&(_=0)}if(typeof u=="function"?p=u(t,p):p instanceof Date?p=f(p):i==="comma"&&fi(p)&&(p=Gp.maybeMap(p,function(W){return W instanceof Date?f(W):W})),p===null){if(n)return c&&!x?c(t,_t.encoder,y,"key",m):t;p=""}if(SW(p)||Gp.isBuffer(p)){if(c){var C=x?t:c(t,_t.encoder,y,"key",m);return[g(C)+"="+g(c(p,_t.encoder,y,"value",m))]}return[g(t)+"="+g(String(p))]}var P=[];if(typeof p>"u")return P;var M;if(i==="comma"&&fi(p))x&&c&&(p=Gp.maybeMap(p,c)),M=[{value:p.length>0?p.join(",")||null:void 0}];else if(fi(u))M=u;else{var I=Object.keys(p);M=h?I.sort(h):I}var U=l?String(t).replace(/\./g,"%2E"):String(t),A=s&&fi(p)&&p.length===1?U+"[]":U;if(o&&fi(p)&&p.length===0)return A+"[]";for(var O=0;O<M.length;++O){var F=M[O],R=typeof F=="object"&&F&&typeof F.value<"u"?F.value:p[F];if(!(a&&R===null)){var D=d&&l?String(F).replace(/\./g,"%2E"):String(F),G=fi(p)?typeof i=="function"?i(A,D):A:A+(d?"."+D:"["+D+"]");T.set(e,_);var N=u2();N.set($b,T),d2(P,r(R,G,i,s,o,n,a,l,i==="comma"&&x&&fi(p)?null:c,u,h,d,f,m,g,x,y,N))}}return P},EW=function(e){if(!e)return _t;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var t=e.charset||_t.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=mu.default;if(typeof e.format<"u"){if(!bW.call(mu.formatters,e.format))throw new TypeError("Unknown format option provided.");i=e.format}var s=mu.formatters[i],o=_t.filter;(typeof e.filter=="function"||fi(e.filter))&&(o=e.filter);var n;if(e.arrayFormat in h2?n=e.arrayFormat:"indices"in e?n=e.indices?"indices":"repeat":n=_t.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:_t.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:_t.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:_t.allowEmptyArrays,arrayFormat:n,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:_t.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?_t.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:_t.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:_t.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:_t.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:_t.encodeValuesOnly,filter:o,format:i,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:_t.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:_t.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:_t.strictNullHandling}};f2.exports=function(r,e){var t=r,i=EW(e),s,o;typeof i.filter=="function"?(o=i.filter,t=o("",t)):fi(i.filter)&&(o=i.filter,s=o);var n=[];if(typeof t!="object"||t===null)return"";var a=h2[i.arrayFormat],l=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(t)),i.sort&&s.sort(i.sort);for(var c=u2(),u=0;u<s.length;++u){var h=s[u],d=t[h];i.skipNulls&&d===null||d2(n,wW(d,h,a,l,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,c))}var f=n.join(i.delimiter),m=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?m+="utf8=%26%2310003%3B&":m+="utf8=%E2%9C%93&"),f.length>0?m+f:""}});var y2=oe((lwe,x2)=>{"use strict";var po=zb(),Xb=Object.prototype.hasOwnProperty,m2=Array.isArray,tt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:po.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},AW=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},g2=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},CW="utf8=%26%2310003%3B",PW="utf8=%E2%9C%93",MW=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<n.length;++l)n[l].indexOf("utf8=")===0&&(n[l]===PW?c="utf-8":n[l]===CW&&(c="iso-8859-1"),a=l,l=n.length);for(l=0;l<n.length;++l)if(l!==a){var u=n[l],h=u.indexOf("]="),d=h===-1?u.indexOf("="):h+1,f,m;d===-1?(f=t.decoder(u,tt.decoder,c,"key"),m=t.strictNullHandling?null:""):(f=t.decoder(u.slice(0,d),tt.decoder,c,"key"),m=po.maybeMap(g2(u.slice(d+1),t,m2(i[f])?i[f].length:0),function(x){return t.decoder(x,tt.decoder,c,"value")})),m&&t.interpretNumericEntities&&c==="iso-8859-1"&&(m=AW(String(m))),u.indexOf("[]=")>-1&&(m=m2(m)?[m]:m);var g=Xb.call(i,f);g&&t.duplicates==="combine"?i[f]=po.combine(i[f],m):(!g||t.duplicates==="last")&&(i[f]=m)}return i},RW=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:g2(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)?[]:po.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},IW=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&&Xb.call(Object.prototype,c)&&!i.allowPrototypes)return;u.push(c)}for(var h=0;i.depth>0&&(l=a.exec(o))!==null&&h<i.depth;){if(h+=1,!i.plainObjects&&Xb.call(Object.prototype,l[1].slice(1,-1))&&!i.allowPrototypes)return;u.push(l[1])}if(l){if(i.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+i.depth+" and strictDepth is true");u.push("["+o.slice(l.index)+"]")}return RW(u,t,i,s)}},BW=function(e){if(!e)return tt;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.decodeDotInKeys<"u"&&typeof e.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&typeof e.decoder<"u"&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof e.throwOnLimitExceeded<"u"&&typeof e.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var t=typeof e.charset>"u"?tt.charset:e.charset,i=typeof e.duplicates>"u"?tt.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:tt.allowDots:!!e.allowDots;return{allowDots:s,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:tt.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:tt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:tt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:tt.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:tt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:tt.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:tt.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:tt.decoder,delimiter:typeof e.delimiter=="string"||po.isRegExp(e.delimiter)?e.delimiter:tt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:tt.depth,duplicates:i,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:tt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:tt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:tt.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:tt.strictDepth,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:tt.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded=="boolean"?e.throwOnLimitExceeded:!1}};x2.exports=function(r,e){var t=BW(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?{__proto__:null}:{};for(var i=typeof r=="string"?MW(r,t):r,s=t.plainObjects?{__proto__:null}:{},o=Object.keys(i),n=0;n<o.length;++n){var a=o[n],l=IW(a,i[a],t,typeof r=="string");s=po.merge(s,l,t)}return t.allowSparse===!0?s:po.compact(s)}});var b2=oe((cwe,_2)=>{"use strict";var kW=p2(),FW=y2(),OW=Lp();_2.exports={formats:OW,parse:FW,stringify:kW}});var w2=oe(fa=>{"use strict";var UW=ck();function Rr(){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 LW=/^([a-z0-9.+-]+:)/i,GW=/:[0-9]*$/,DW=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,NW=["<",">",'"',"`"," ","\r",`
1093
- `," "],VW=["{","}","|","\\","^","`"].concat(NW),jb=["'"].concat(VW),v2=["%","/","?",";","#"].concat(jb),T2=["/","?","#"],HW=255,S2=/^[+a-z0-9A-Z_-]{0,63}$/,WW=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,zW={javascript:!0,"javascript:":!0},Yb={javascript:!0,"javascript:":!0},da={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},qb=b2();function gu(r,e,t){if(r&&typeof r=="object"&&r instanceof Rr)return r;var i=new Rr;return i.parse(r,e,t),i}Rr.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&&i<r.indexOf("#")?"?":"#",o=r.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),r=o.join(s);var a=r;if(a=a.trim(),!t&&r.split("#").length===1){var l=DW.exec(a);if(l)return this.path=a,this.href=a,this.pathname=l[1],l[2]?(this.search=l[2],e?this.query=qb.parse(this.search.substr(1)):this.query=this.search.substr(1)):e&&(this.search="",this.query={}),this}var c=LW.exec(a);if(c){c=c[0];var u=c.toLowerCase();this.protocol=u,a=a.substr(c.length)}if(t||c||a.match(/^\/\/[^@/]+@[^@/]+/)){var h=a.substr(0,2)==="//";h&&!(c&&Yb[c])&&(a=a.substr(2),this.slashes=!0)}if(!Yb[c]&&(h||c&&!da[c])){for(var d=-1,f=0;f<T2.length;f++){var m=a.indexOf(T2[f]);m!==-1&&(d===-1||m<d)&&(d=m)}var g,x;d===-1?x=a.lastIndexOf("@"):x=a.lastIndexOf("@",d),x!==-1&&(g=a.slice(0,x),a=a.slice(x+1),this.auth=decodeURIComponent(g)),d=-1;for(var f=0;f<v2.length;f++){var m=a.indexOf(v2[f]);m!==-1&&(d===-1||m<d)&&(d=m)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var y=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!y)for(var T=this.hostname.split(/\./),f=0,p=T.length;f<p;f++){var b=T[f];if(b&&!b.match(S2)){for(var _="",S=0,E=b.length;S<E;S++)b.charCodeAt(S)>127?_+="x":_+=b[S];if(!_.match(S2)){var C=T.slice(0,f),P=T.slice(f+1),M=b.match(WW);M&&(C.push(M[1]),P.unshift(M[2])),P.length&&(a="/"+P.join(".")+a),this.hostname=C.join(".");break}}}this.hostname.length>HW?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=UW.toASCII(this.hostname));var I=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+I,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!zW[u])for(var f=0,p=jb.length;f<p;f++){var A=jb[f];if(a.indexOf(A)!==-1){var O=encodeURIComponent(A);O===A&&(O=escape(A)),a=a.split(A).join(O)}}var F=a.indexOf("#");F!==-1&&(this.hash=a.substr(F),a=a.slice(0,F));var R=a.indexOf("?");if(R!==-1?(this.search=a.substr(R),this.query=a.substr(R+1),e&&(this.query=qb.parse(this.query)),a=a.slice(0,R)):e&&(this.search="",this.query={}),a&&(this.pathname=a),da[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var I=this.pathname||"",D=this.search||"";this.path=I+D}return this.href=this.format(),this};function $W(r){return typeof r=="string"&&(r=gu(r)),r instanceof Rr?r.format():Rr.prototype.format.call(r)}Rr.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var e=this.protocol||"",t=this.pathname||"",i=this.hash||"",s=!1,o="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=qb.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||da[e])&&s!==!1?(s="//"+(s||""),t&&t.charAt(0)!=="/"&&(t="/"+t)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),n&&n.charAt(0)!=="?"&&(n="?"+n),t=t.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),e+s+t+n+i};function XW(r,e){return gu(r,!1,!0).resolve(e)}Rr.prototype.resolve=function(r){return this.resolveObject(gu(r,!1,!0)).format()};function jW(r,e){return r?gu(r,!1,!0).resolveObject(e):e}Rr.prototype.resolveObject=function(r){if(typeof r=="string"){var e=new Rr;e.parse(r,!1,!0),r=e}for(var t=new Rr,i=Object.keys(this),s=0;s<i.length;s++){var o=i[s];t[o]=this[o]}if(t.hash=r.hash,r.href==="")return t.href=t.format(),t;if(r.slashes&&!r.protocol){for(var n=Object.keys(r),a=0;a<n.length;a++){var l=n[a];l!=="protocol"&&(t[l]=r[l])}return da[t.protocol]&&t.hostname&&!t.pathname&&(t.pathname="/",t.path=t.pathname),t.href=t.format(),t}if(r.protocol&&r.protocol!==t.protocol){if(!da[r.protocol]){for(var c=Object.keys(r),u=0;u<c.length;u++){var h=c[u];t[h]=r[h]}return t.href=t.format(),t}if(t.protocol=r.protocol,!r.host&&!Yb[r.protocol]){for(var p=(r.pathname||"").split("/");p.length&&!(r.host=p.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),p[0]!==""&&p.unshift(""),p.length<2&&p.unshift(""),t.pathname=p.join("/")}else t.pathname=r.pathname;if(t.search=r.search,t.query=r.query,t.host=r.host||"",t.auth=r.auth,t.hostname=r.hostname||r.host,t.port=r.port,t.pathname||t.search){var d=t.pathname||"",f=t.search||"";t.path=d+f}return t.slashes=t.slashes||r.slashes,t.href=t.format(),t}var m=t.pathname&&t.pathname.charAt(0)==="/",g=r.host||r.pathname&&r.pathname.charAt(0)==="/",x=g||m||t.host&&r.pathname,y=x,T=t.pathname&&t.pathname.split("/")||[],p=r.pathname&&r.pathname.split("/")||[],b=t.protocol&&!da[t.protocol];if(b&&(t.hostname="",t.port=null,t.host&&(T[0]===""?T[0]=t.host:T.unshift(t.host)),t.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(p[0]===""?p[0]=r.host:p.unshift(r.host)),r.host=null),x=x&&(p[0]===""||T[0]==="")),g)t.host=r.host||r.host===""?r.host:t.host,t.hostname=r.hostname||r.hostname===""?r.hostname:t.hostname,t.search=r.search,t.query=r.query,T=p;else if(p.length)T||(T=[]),T.pop(),T=T.concat(p),t.search=r.search,t.query=r.query;else if(r.search!=null){if(b){t.host=T.shift(),t.hostname=t.host;var _=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;_&&(t.auth=_.shift(),t.hostname=_.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(!T.length)return t.pathname=null,t.search?t.path="/"+t.search:t.path=null,t.href=t.format(),t;for(var S=T.slice(-1)[0],E=(t.host||r.host||T.length>1)&&(S==="."||S==="..")||S==="",C=0,P=T.length;P>=0;P--)S=T[P],S==="."?T.splice(P,1):S===".."?(T.splice(P,1),C++):C&&(T.splice(P,1),C--);if(!x&&!y)for(;C--;C)T.unshift("..");x&&T[0]!==""&&(!T[0]||T[0].charAt(0)!=="/")&&T.unshift(""),E&&T.join("/").substr(-1)!=="/"&&T.push("");var M=T[0]===""||T[0]&&T[0].charAt(0)==="/";if(b){t.hostname=M?"":T.length?T.shift():"",t.host=t.hostname;var _=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;_&&(t.auth=_.shift(),t.hostname=_.shift(),t.host=t.hostname)}return x=x||t.host&&T.length,x&&!M&&T.unshift(""),T.length>0?t.pathname=T.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};Rr.prototype.parseHost=function(){var r=this.host,e=GW.exec(r);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),r=r.substr(0,r.length-e.length)),r&&(this.hostname=r)};fa.parse=gu;fa.resolve=XW;fa.resolveObject=jW;fa.format=$W;fa.Url=Rr});var sU=()=>{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 m={buffer:await(await fetch(h.url)).arrayBuffer(),type:h.type,source:"buffer"};r.set(u,m)}))},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)}};L();var y1={extension:{type:w.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(x1(),dG))}};L();var b1={extension:{type:w.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(_1(),fG))}};L();kh();Ch();L();De();Gl();var Cd;function A1(r){return Cd!==void 0||(Cd=(()=>{let e={stencil:!0,failIfMajorPerformanceCaveat:r??ns.defaultOptions.failIfMajorPerformanceCaveat};try{if(!Z.get().getWebGLRenderingContext())return!1;let i=Z.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}})()),Cd}De();var Pd;async function C1(r={}){return Pd!==void 0||(Pd=await(async()=>{let e=Z.get().getNavigator().gpu;if(!e)return!1;try{return await(await e.requestAdapter(r)).requestDevice(),!0}catch{return!1}})()),Pd}Gl();var DM=["webgl","webgpu","canvas"];async function NM(r){let e=[];r.preference?(e.push(r.preference),DM.forEach(o=>{o!==r.preference&&e.push(o)})):e=DM.slice();let t,i={};for(let o=0;o<e.length;o++){let n=e[o];if(n==="webgpu"&&await C1()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(dP(),hP));t=a,i={...r,...r.webgpu};break}else if(n==="webgl"&&A1(r.failIfMajorPerformanceCaveat??ns.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(GM(),LM));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}Or();uy();Xe();var VM=class Qy{constructor(...e){this.stage=new ie,e[0]!==void 0&&Y(ne,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.renderer=await NM(e),Qy._plugins.forEach(t=>{t.init.call(this,e)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return Y(ne,"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=Qy._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}};VM._plugins=[];var kc=VM;$.handleByList(w.Application,kc._plugins);$.add(Yl);L();qi();hg();De();L();Os();mt();Ce();Nx();$x();var Fc=class extends mn{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 ee(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<this.pages.length;e++){let{texture:t}=this.pages[e];t.destroy(!0)}this.pages=null}static install(e){Ml.install(e)}static uninstall(e){Ml.uninstall(e)}};var Jd={test(r){return typeof r=="string"&&r.startsWith("info face=")},parse(r){let e=r.match(/^[a-z]+\s+.+$/gm),t={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let h in e){let d=e[h].match(/^[a-z]+/gm)[0],f=e[h].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),m={};for(let g in f){let x=f[g].split("="),y=x[0],T=x[1].replace(/"/gm,""),p=parseFloat(T),b=isNaN(p)?T:p;m[y]=b}t[d].push(m)}let i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=t.info,[o]=t.common,[n]=t.distanceField??[];n&&(i.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),i.fontSize=parseInt(s.size,10),i.fontFamily=s.face,i.lineHeight=parseInt(o.lineHeight,10);let a=t.page;for(let h=0;h<a.length;h++)i.pages.push({id:parseInt(a[h].id,10)||0,file:a[h].file});let l={};i.baseLineOffset=i.lineHeight-parseInt(o.base,10);let c=t.char;for(let h=0;h<c.length;h++){let d=c[h],f=parseInt(d.id,10),m=d.letter??d.char??String.fromCharCode(f);m==="space"&&(m=" "),l[f]=m,i.chars[m]={id:f,page:parseInt(d.page,10)||0,x:parseInt(d.x,10),y:parseInt(d.y,10),width:parseInt(d.width,10),height:parseInt(d.height,10),xOffset:parseInt(d.xoffset,10),yOffset:parseInt(d.yoffset,10),xAdvance:parseInt(d.xadvance,10),kerning:{}}}let u=t.kerning||[];for(let h=0;h<u.length;h++){let d=parseInt(u[h].first,10),f=parseInt(u[h].second,10),m=parseInt(u[h].amount,10);i.chars[l[f]].kerning[l[d]]=m}return i}};De();var Jy={test(r){let e=r;return typeof e!="string"&&"getElementsByTagName"in e&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(r){let e={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},t=r.getElementsByTagName("info")[0],i=r.getElementsByTagName("common")[0],s=r.getElementsByTagName("distanceField")[0];s&&(e.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=r.getElementsByTagName("page"),n=r.getElementsByTagName("char"),a=r.getElementsByTagName("kerning");e.fontSize=parseInt(t.getAttribute("size"),10),e.fontFamily=t.getAttribute("face"),e.lineHeight=parseInt(i.getAttribute("lineHeight"),10);for(let c=0;c<o.length;c++)e.pages.push({id:parseInt(o[c].getAttribute("id"),10)||0,file:o[c].getAttribute("file")});let l={};e.baseLineOffset=e.lineHeight-parseInt(i.getAttribute("base"),10);for(let c=0;c<n.length;c++){let u=n[c],h=parseInt(u.getAttribute("id"),10),d=u.getAttribute("letter")??u.getAttribute("char")??String.fromCharCode(h);d==="space"&&(d=" "),l[h]=d,e.chars[d]={id:h,page:parseInt(u.getAttribute("page"),10)||0,x:parseInt(u.getAttribute("x"),10),y:parseInt(u.getAttribute("y"),10),width:parseInt(u.getAttribute("width"),10),height:parseInt(u.getAttribute("height"),10),xOffset:parseInt(u.getAttribute("xoffset"),10),yOffset:parseInt(u.getAttribute("yoffset"),10),xAdvance:parseInt(u.getAttribute("xadvance"),10),kerning:{}}}for(let c=0;c<a.length;c++){let u=parseInt(a[c].getAttribute("first"),10),h=parseInt(a[c].getAttribute("second"),10),d=parseInt(a[c].getAttribute("amount"),10);e.chars[l[h]].kerning[l[u]]=d}return e}};var e_={test(r){return typeof r=="string"&&r.includes("<font>")?Jy.test(Z.get().parseXML(r)):!1},parse(r){return Jy.parse(Z.get().parseXML(r))}};var jG=[".xml",".fnt"],HM={extension:{type:w.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof Fc,getCacheableAssets(r,e){let t={};return r.forEach(i=>{t[i]=e,t[`${i}-bitmap`]=e}),t[`${e.fontFamily}-bitmap`]=e,t}},WM={extension:{type:w.LoadParser,priority:$t.Normal},name:"loadBitmapFont",test(r){return jG.includes(xt.extname(r).toLowerCase())},async testParse(r){return Jd.test(r)||e_.test(r)},async parse(r,e,t){let i=Jd.test(r)?Jd.parse(r):e_.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;h<o.length;++h){let d=o[h].file,f=xt.join(xt.dirname(s),d);f=rl(f,s),n.push({src:f,data:a})}let l=await t.load(n),c=n.map(h=>l[h.src]);return new Fc({data:i,textures:c},s)},async load(r,e){return await(await Z.get().fetch(r)).text()},async unload(r,e,t){await Promise.all(r.pages.map(i=>t.unload(i.texture.source._sourceOrigin))),r.destroy()}};ke();var ef=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;i<t;i++)e.push(this._assetList.pop());await this._loader.load(e),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(e){this._isActive!==e&&(this._isActive=e,e&&!this._isLoading&&this._next())}};Zi();L();Ce();var zM={extension:{type:w.CacheParser,name:"cacheTextureArray"},test:r=>Array.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}};L();async function tf(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 $M={extension:{type:w.DetectionParser,priority:1},test:async()=>tf("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(e=>e!=="avif")};L();var XM=["png","jpg","jpeg"],jM={extension:{type:w.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...XM],remove:async r=>r.filter(e=>!XM.includes(e))};L();var YG="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Mn(r){return YG?!1:document.createElement("video").canPlayType(r)!==""}var YM={extension:{type:w.DetectionParser,priority:0},test:async()=>Mn("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(e=>e!=="mp4"&&e!=="m4v")};L();var qM={extension:{type:w.DetectionParser,priority:0},test:async()=>Mn("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(e=>e!=="ogv")};L();var KM={extension:{type:w.DetectionParser,priority:0},test:async()=>Mn("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(e=>e!=="webm")};L();var ZM={extension:{type:w.DetectionParser,priority:0},test:async()=>tf("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(e=>e!=="webp")};ke();Os();tl();Ah();var rf=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||X(`[Assets] specified load parser "${t.loadParser}" not found while loading ${e}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(e,t,this)){o=a;break}}if(!o)return X(`[Assets] ${e} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(e,t,this),i.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,t,this)&&(s=await a.parse(s,t,this)||s,i.parser=a)}return s})(),i}async load(e,t){this._parsersValidated||this._validateParsers();let i=0,s={},o=Us(e),n=Xt(e,c=>({alias:[c],src:c,data:{}})),a=n.length,l=n.map(async c=>{let u=xt.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}.
1092
+ `+e.prev}function Ep(r,e){var t=Eb(r),i=[];if(t){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=Oi(r,s)?e(r[s],r):""}var o=typeof bb=="function"?bb(r):[],n;if(na){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var l in r)Oi(r,l)&&(t&&String(Number(l))===l&&l<r.length||na&&n["$"+l]instanceof Symbol||(wk.call(/[^\w$]/,l)?i.push(e(l,r)+": "+e(r[l],r)):i.push(l+": "+e(r[l],r))));if(typeof bb=="function")for(var c=0;c<o.length;c++)Ek.call(r,o[c])&&i.push("["+e(o[c])+"]: "+e(r[o[c]],r));return i}});var kk=oe((vSe,Bk)=>{"use strict";var DH=cu(),NH=co(),Pp=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},VH=function(r,e){if(r){var t=Pp(r,e);return t&&t.value}},HH=function(r,e,t){var i=Pp(r,e);i?i.value=t:r.next={key:e,next:r.next,value:t}},WH=function(r,e){return r?!!Pp(r,e):!1},zH=function(r,e){if(r)return Pp(r,e,!0)};Bk.exports=function(){var e,t={assert:function(i){if(!t.has(i))throw new NH("Side channel does not contain "+DH(i))},delete:function(i){var s=e&&e.next,o=zH(e,i);return o&&s&&s===o&&(e=void 0),!!o},get:function(i){return VH(e,i)},has:function(i){return WH(e,i)},set:function(i,s){e||(e={next:void 0}),HH(e,i,s)}};return t}});var Rb=oe((TSe,Fk)=>{"use strict";Fk.exports=Object});var Uk=oe((SSe,Ok)=>{"use strict";Ok.exports=Error});var Gk=oe((wSe,Lk)=>{"use strict";Lk.exports=EvalError});var Nk=oe((ESe,Dk)=>{"use strict";Dk.exports=RangeError});var Hk=oe((ASe,Vk)=>{"use strict";Vk.exports=ReferenceError});var zk=oe((CSe,Wk)=>{"use strict";Wk.exports=SyntaxError});var Xk=oe((PSe,$k)=>{"use strict";$k.exports=URIError});var Yk=oe((MSe,jk)=>{"use strict";jk.exports=Math.abs});var Kk=oe((RSe,qk)=>{"use strict";qk.exports=Math.floor});var Qk=oe((ISe,Zk)=>{"use strict";Zk.exports=Math.max});var eF=oe((BSe,Jk)=>{"use strict";Jk.exports=Math.min});var rF=oe((kSe,tF)=>{"use strict";tF.exports=Math.pow});var sF=oe((FSe,iF)=>{"use strict";iF.exports=Math.round});var nF=oe((OSe,oF)=>{"use strict";oF.exports=Number.isNaN||function(e){return e!==e}});var lF=oe((USe,aF)=>{"use strict";var $H=nF();aF.exports=function(e){return $H(e)||e===0?e:e<0?-1:1}});var uF=oe((LSe,cF)=>{"use strict";cF.exports=Object.getOwnPropertyDescriptor});var Ib=oe((GSe,hF)=>{"use strict";var Mp=uF();if(Mp)try{Mp([],"length")}catch{Mp=null}hF.exports=Mp});var fF=oe((DSe,dF)=>{"use strict";var Rp=Object.defineProperty||!1;if(Rp)try{Rp({},"a",{value:1})}catch{Rp=!1}dF.exports=Rp});var mF=oe((NSe,pF)=>{"use strict";pF.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 yF=oe((VSe,xF)=>{"use strict";var gF=typeof Symbol<"u"&&Symbol,XH=mF();xF.exports=function(){return typeof gF!="function"||typeof Symbol!="function"||typeof gF("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:XH()}});var Bb=oe((HSe,_F)=>{"use strict";_F.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var kb=oe((WSe,bF)=>{"use strict";var jH=Rb();bF.exports=jH.getPrototypeOf||null});var SF=oe((zSe,TF)=>{"use strict";var YH="Function.prototype.bind called on incompatible ",qH=Object.prototype.toString,KH=Math.max,ZH="[object Function]",vF=function(e,t){for(var i=[],s=0;s<e.length;s+=1)i[s]=e[s];for(var o=0;o<t.length;o+=1)i[o+e.length]=t[o];return i},QH=function(e,t){for(var i=[],s=t||0,o=0;s<e.length;s+=1,o+=1)i[o]=e[s];return i},JH=function(r,e){for(var t="",i=0;i<r.length;i+=1)t+=r[i],i+1<r.length&&(t+=e);return t};TF.exports=function(e){var t=this;if(typeof t!="function"||qH.apply(t)!==ZH)throw new TypeError(YH+t);for(var i=QH(arguments,1),s,o=function(){if(this instanceof s){var u=t.apply(this,vF(i,arguments));return Object(u)===u?u:this}return t.apply(e,vF(i,arguments))},n=KH(0,t.length-i.length),a=[],l=0;l<n;l++)a[l]="$"+l;if(s=Function("binder","return function ("+JH(a,",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var c=function(){};c.prototype=t.prototype,s.prototype=new c,c.prototype=null}return s}});var uu=oe(($Se,wF)=>{"use strict";var e4=SF();wF.exports=Function.prototype.bind||e4});var Ip=oe((XSe,EF)=>{"use strict";EF.exports=Function.prototype.call});var Fb=oe((jSe,AF)=>{"use strict";AF.exports=Function.prototype.apply});var PF=oe((YSe,CF)=>{"use strict";CF.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var RF=oe((qSe,MF)=>{"use strict";var t4=uu(),r4=Fb(),i4=Ip(),s4=PF();MF.exports=s4||t4.call(i4,r4)});var Ob=oe((KSe,IF)=>{"use strict";var o4=uu(),n4=co(),a4=Ip(),l4=RF();IF.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new n4("a function is required");return l4(o4,a4,e)}});var LF=oe((ZSe,UF)=>{"use strict";var c4=Ob(),BF=Ib(),FF;try{FF=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var Ub=!!FF&&BF&&BF(Object.prototype,"__proto__"),OF=Object,kF=OF.getPrototypeOf;UF.exports=Ub&&typeof Ub.get=="function"?c4([Ub.get]):typeof kF=="function"?function(e){return kF(e==null?e:OF(e))}:!1});var HF=oe((QSe,VF)=>{"use strict";var GF=Bb(),DF=kb(),NF=LF();VF.exports=GF?function(e){return GF(e)}:DF?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return DF(e)}:NF?function(e){return NF(e)}:null});var zF=oe((JSe,WF)=>{"use strict";var u4=Function.prototype.call,h4=Object.prototype.hasOwnProperty,d4=uu();WF.exports=d4.call(u4,h4)});var Fp=oe((ewe,KF)=>{"use strict";var _e,f4=Rb(),p4=Uk(),m4=Gk(),g4=Nk(),x4=Hk(),ua=zk(),ca=co(),y4=Xk(),_4=Yk(),b4=Kk(),v4=Qk(),T4=eF(),S4=rF(),w4=sF(),E4=lF(),YF=Function,Lb=function(r){try{return YF('"use strict"; return ('+r+").constructor;")()}catch{}},hu=Ib(),A4=fF(),Gb=function(){throw new ca},C4=hu?function(){try{return arguments.callee,Gb}catch{try{return hu(arguments,"callee").get}catch{return Gb}}}():Gb,aa=yF()(),wt=HF(),P4=kb(),M4=Bb(),qF=Fb(),du=Ip(),la={},R4=typeof Uint8Array>"u"||!wt?_e:wt(Uint8Array),ho={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?_e:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?_e:ArrayBuffer,"%ArrayIteratorPrototype%":aa&&wt?wt([][Symbol.iterator]()):_e,"%AsyncFromSyncIteratorPrototype%":_e,"%AsyncFunction%":la,"%AsyncGenerator%":la,"%AsyncGeneratorFunction%":la,"%AsyncIteratorPrototype%":la,"%Atomics%":typeof Atomics>"u"?_e:Atomics,"%BigInt%":typeof BigInt>"u"?_e:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?_e:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?_e:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?_e:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":p4,"%eval%":eval,"%EvalError%":m4,"%Float16Array%":typeof Float16Array>"u"?_e:Float16Array,"%Float32Array%":typeof Float32Array>"u"?_e:Float32Array,"%Float64Array%":typeof Float64Array>"u"?_e:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?_e:FinalizationRegistry,"%Function%":YF,"%GeneratorFunction%":la,"%Int8Array%":typeof Int8Array>"u"?_e:Int8Array,"%Int16Array%":typeof Int16Array>"u"?_e:Int16Array,"%Int32Array%":typeof Int32Array>"u"?_e:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":aa&&wt?wt(wt([][Symbol.iterator]())):_e,"%JSON%":typeof JSON=="object"?JSON:_e,"%Map%":typeof Map>"u"?_e:Map,"%MapIteratorPrototype%":typeof Map>"u"||!aa||!wt?_e:wt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":f4,"%Object.getOwnPropertyDescriptor%":hu,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?_e:Promise,"%Proxy%":typeof Proxy>"u"?_e:Proxy,"%RangeError%":g4,"%ReferenceError%":x4,"%Reflect%":typeof Reflect>"u"?_e:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?_e:Set,"%SetIteratorPrototype%":typeof Set>"u"||!aa||!wt?_e:wt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?_e:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":aa&&wt?wt(""[Symbol.iterator]()):_e,"%Symbol%":aa?Symbol:_e,"%SyntaxError%":ua,"%ThrowTypeError%":C4,"%TypedArray%":R4,"%TypeError%":ca,"%Uint8Array%":typeof Uint8Array>"u"?_e:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?_e:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?_e:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?_e:Uint32Array,"%URIError%":y4,"%WeakMap%":typeof WeakMap>"u"?_e:WeakMap,"%WeakRef%":typeof WeakRef>"u"?_e:WeakRef,"%WeakSet%":typeof WeakSet>"u"?_e:WeakSet,"%Function.prototype.call%":du,"%Function.prototype.apply%":qF,"%Object.defineProperty%":A4,"%Object.getPrototypeOf%":P4,"%Math.abs%":_4,"%Math.floor%":b4,"%Math.max%":v4,"%Math.min%":T4,"%Math.pow%":S4,"%Math.round%":w4,"%Math.sign%":E4,"%Reflect.getPrototypeOf%":M4};if(wt)try{null.error}catch(r){$F=wt(wt(r)),ho["%Error.prototype%"]=$F}var $F,I4=function r(e){var t;if(e==="%AsyncFunction%")t=Lb("async function () {}");else if(e==="%GeneratorFunction%")t=Lb("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Lb("async function* () {}");else if(e==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(t=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&wt&&(t=wt(s.prototype))}return ho[e]=t,t},XF={__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"]},fu=uu(),Bp=zF(),B4=fu.call(du,Array.prototype.concat),k4=fu.call(qF,Array.prototype.splice),jF=fu.call(du,String.prototype.replace),kp=fu.call(du,String.prototype.slice),F4=fu.call(du,RegExp.prototype.exec),O4=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,U4=/\\(\\)?/g,L4=function(e){var t=kp(e,0,1),i=kp(e,-1);if(t==="%"&&i!=="%")throw new ua("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&t!=="%")throw new ua("invalid intrinsic syntax, expected opening `%`");var s=[];return jF(e,O4,function(o,n,a,l){s[s.length]=a?jF(l,U4,"$1"):n||o}),s},G4=function(e,t){var i=e,s;if(Bp(XF,i)&&(s=XF[i],i="%"+s[0]+"%"),Bp(ho,i)){var o=ho[i];if(o===la&&(o=I4(i)),typeof o>"u"&&!t)throw new ca("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:o}}throw new ua("intrinsic "+e+" does not exist!")};KF.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new ca("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new ca('"allowMissing" argument must be a boolean');if(F4(/^%?[^%]*%?$/,e)===null)throw new ua("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=L4(e),s=i.length>0?i[0]:"",o=G4("%"+s+"%",t),n=o.name,a=o.value,l=!1,c=o.alias;c&&(s=c[0],k4(i,B4([0,1],c)));for(var u=1,h=!0;u<i.length;u+=1){var d=i[u],f=kp(d,0,1),m=kp(d,-1);if((f==='"'||f==="'"||f==="`"||m==='"'||m==="'"||m==="`")&&f!==m)throw new ua("property names with quotes must have matching quotes");if((d==="constructor"||!h)&&(l=!0),s+="."+d,n="%"+s+"%",Bp(ho,n))a=ho[n];else if(a!=null){if(!(d in a)){if(!t)throw new ca("base intrinsic for "+e+" exists, but the property is not available.");return}if(hu&&u+1>=i.length){var g=hu(a,d);h=!!g,h&&"get"in g&&!("originalValue"in g.get)?a=g.get:a=a[d]}else h=Bp(a,d),a=a[d];h&&!l&&(ho[n]=a)}}return a}});var Db=oe((twe,JF)=>{"use strict";var ZF=Fp(),QF=Ob(),D4=QF([ZF("%String.prototype.indexOf%")]);JF.exports=function(e,t){var i=ZF(e,!!t);return typeof i=="function"&&D4(e,".prototype.")>-1?QF([i]):i}});var Nb=oe((rwe,t2)=>{"use strict";var N4=Fp(),pu=Db(),V4=cu(),H4=co(),e2=N4("%Map%",!0),W4=pu("Map.prototype.get",!0),z4=pu("Map.prototype.set",!0),$4=pu("Map.prototype.has",!0),X4=pu("Map.prototype.delete",!0),j4=pu("Map.prototype.size",!0);t2.exports=!!e2&&function(){var e,t={assert:function(i){if(!t.has(i))throw new H4("Side channel does not contain "+V4(i))},delete:function(i){if(e){var s=X4(e,i);return j4(e)===0&&(e=void 0),s}return!1},get:function(i){if(e)return W4(e,i)},has:function(i){return e?$4(e,i):!1},set:function(i,s){e||(e=new e2),z4(e,i,s)}};return t}});var i2=oe((iwe,r2)=>{"use strict";var Y4=Fp(),Up=Db(),q4=cu(),Op=Nb(),K4=co(),ha=Y4("%WeakMap%",!0),Z4=Up("WeakMap.prototype.get",!0),Q4=Up("WeakMap.prototype.set",!0),J4=Up("WeakMap.prototype.has",!0),eW=Up("WeakMap.prototype.delete",!0);r2.exports=ha?function(){var e,t,i={assert:function(s){if(!i.has(s))throw new K4("Side channel does not contain "+q4(s))},delete:function(s){if(ha&&s&&(typeof s=="object"||typeof s=="function")){if(e)return eW(e,s)}else if(Op&&t)return t.delete(s);return!1},get:function(s){return ha&&s&&(typeof s=="object"||typeof s=="function")&&e?Z4(e,s):t&&t.get(s)},has:function(s){return ha&&s&&(typeof s=="object"||typeof s=="function")&&e?J4(e,s):!!t&&t.has(s)},set:function(s,o){ha&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new ha),Q4(e,s,o)):Op&&(t||(t=Op()),t.set(s,o))}};return i}:Op});var o2=oe((swe,s2)=>{"use strict";var tW=co(),rW=cu(),iW=kk(),sW=Nb(),oW=i2(),nW=oW||sW||iW;s2.exports=function(){var e,t={assert:function(i){if(!t.has(i))throw new tW("Side channel does not contain "+rW(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=nW()),e.set(i,s)}};return t}});var Lp=oe((owe,n2)=>{"use strict";var aW=String.prototype.replace,lW=/%20/g,Vb={RFC1738:"RFC1738",RFC3986:"RFC3986"};n2.exports={default:Vb.RFC3986,formatters:{RFC1738:function(r){return aW.call(r,lW,"+")},RFC3986:function(r){return String(r)}},RFC1738:Vb.RFC1738,RFC3986:Vb.RFC3986}});var zb=oe((nwe,l2)=>{"use strict";var cW=Lp(),Hb=Object.prototype.hasOwnProperty,fo=Array.isArray,di=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),uW=function(e){for(;e.length>1;){var t=e.pop(),i=t.obj[t.prop];if(fo(i)){for(var s=[],o=0;o<i.length;++o)typeof i[o]<"u"&&s.push(i[o]);t.obj[t.prop]=s}}},a2=function(e,t){for(var i=t&&t.plainObjects?{__proto__:null}:{},s=0;s<e.length;++s)typeof e[s]<"u"&&(i[s]=e[s]);return i},hW=function r(e,t,i){if(!t)return e;if(typeof t!="object"&&typeof t!="function"){if(fo(e))e.push(t);else if(e&&typeof e=="object")(i&&(i.plainObjects||i.allowPrototypes)||!Hb.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);var s=e;return fo(e)&&!fo(t)&&(s=a2(e,i)),fo(e)&&fo(t)?(t.forEach(function(o,n){if(Hb.call(e,n)){var a=e[n];a&&typeof a=="object"&&o&&typeof o=="object"?e[n]=r(a,o,i):e.push(o)}else e[n]=o}),e):Object.keys(t).reduce(function(o,n){var a=t[n];return Hb.call(o,n)?o[n]=r(o[n],a,i):o[n]=a,o},s)},dW=function(e,t){return Object.keys(t).reduce(function(i,s){return i[s]=t[s],i},e)},fW=function(r,e,t){var i=r.replace(/\+/g," ");if(t==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},Wb=1024,pW=function(e,t,i,s,o){if(e.length===0)return e;var n=e;if(typeof e=="symbol"?n=Symbol.prototype.toString.call(e):typeof e!="string"&&(n=String(e)),i==="iso-8859-1")return escape(n).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var a="",l=0;l<n.length;l+=Wb){for(var c=n.length>=Wb?n.slice(l,l+Wb):n,u=[],h=0;h<c.length;++h){var d=c.charCodeAt(h);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===cW.RFC1738&&(d===40||d===41)){u[u.length]=c.charAt(h);continue}if(d<128){u[u.length]=di[d];continue}if(d<2048){u[u.length]=di[192|d>>6]+di[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=di[224|d>>12]+di[128|d>>6&63]+di[128|d&63];continue}h+=1,d=65536+((d&1023)<<10|c.charCodeAt(h)&1023),u[u.length]=di[240|d>>18]+di[128|d>>12&63]+di[128|d>>6&63]+di[128|d&63]}a+=u.join("")}return a},mW=function(e){for(var t=[{obj:{o:e},prop:"o"}],i=[],s=0;s<t.length;++s)for(var o=t[s],n=o.obj[o.prop],a=Object.keys(n),l=0;l<a.length;++l){var c=a[l],u=n[c];typeof u=="object"&&u!==null&&i.indexOf(u)===-1&&(t.push({obj:n,prop:c}),i.push(u))}return uW(t),e},gW=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},xW=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},yW=function(e,t){return[].concat(e,t)},_W=function(e,t){if(fo(e)){for(var i=[],s=0;s<e.length;s+=1)i.push(t(e[s]));return i}return t(e)};l2.exports={arrayToObject:a2,assign:dW,combine:yW,compact:mW,decode:fW,encode:pW,isBuffer:xW,isRegExp:gW,maybeMap:_W,merge:hW}});var p2=oe((awe,f2)=>{"use strict";var u2=o2(),Gp=zb(),mu=Lp(),bW=Object.prototype.hasOwnProperty,h2={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},fi=Array.isArray,vW=Array.prototype.push,d2=function(r,e){vW.apply(r,fi(e)?e:[e])},TW=Date.prototype.toISOString,c2=mu.default,_t={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Gp.encode,encodeValuesOnly:!1,filter:void 0,format:c2,formatter:mu.formatters[c2],indices:!1,serializeDate:function(e){return TW.call(e)},skipNulls:!1,strictNullHandling:!1},SW=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},$b={},wW=function r(e,t,i,s,o,n,a,l,c,u,h,d,f,m,g,x,y,T){for(var p=e,b=T,_=0,S=!1;(b=b.get($b))!==void 0&&!S;){var E=b.get(e);if(_+=1,typeof E<"u"){if(E===_)throw new RangeError("Cyclic object value");S=!0}typeof b.get($b)>"u"&&(_=0)}if(typeof u=="function"?p=u(t,p):p instanceof Date?p=f(p):i==="comma"&&fi(p)&&(p=Gp.maybeMap(p,function(W){return W instanceof Date?f(W):W})),p===null){if(n)return c&&!x?c(t,_t.encoder,y,"key",m):t;p=""}if(SW(p)||Gp.isBuffer(p)){if(c){var C=x?t:c(t,_t.encoder,y,"key",m);return[g(C)+"="+g(c(p,_t.encoder,y,"value",m))]}return[g(t)+"="+g(String(p))]}var P=[];if(typeof p>"u")return P;var R;if(i==="comma"&&fi(p))x&&c&&(p=Gp.maybeMap(p,c)),R=[{value:p.length>0?p.join(",")||null:void 0}];else if(fi(u))R=u;else{var I=Object.keys(p);R=h?I.sort(h):I}var U=l?String(t).replace(/\./g,"%2E"):String(t),A=s&&fi(p)&&p.length===1?U+"[]":U;if(o&&fi(p)&&p.length===0)return A+"[]";for(var O=0;O<R.length;++O){var F=R[O],M=typeof F=="object"&&F&&typeof F.value<"u"?F.value:p[F];if(!(a&&M===null)){var D=d&&l?String(F).replace(/\./g,"%2E"):String(F),G=fi(p)?typeof i=="function"?i(A,D):A:A+(d?"."+D:"["+D+"]");T.set(e,_);var N=u2();N.set($b,T),d2(P,r(M,G,i,s,o,n,a,l,i==="comma"&&x&&fi(p)?null:c,u,h,d,f,m,g,x,y,N))}}return P},EW=function(e){if(!e)return _t;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var t=e.charset||_t.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=mu.default;if(typeof e.format<"u"){if(!bW.call(mu.formatters,e.format))throw new TypeError("Unknown format option provided.");i=e.format}var s=mu.formatters[i],o=_t.filter;(typeof e.filter=="function"||fi(e.filter))&&(o=e.filter);var n;if(e.arrayFormat in h2?n=e.arrayFormat:"indices"in e?n=e.indices?"indices":"repeat":n=_t.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:_t.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:_t.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:_t.allowEmptyArrays,arrayFormat:n,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:_t.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?_t.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:_t.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:_t.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:_t.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:_t.encodeValuesOnly,filter:o,format:i,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:_t.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:_t.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:_t.strictNullHandling}};f2.exports=function(r,e){var t=r,i=EW(e),s,o;typeof i.filter=="function"?(o=i.filter,t=o("",t)):fi(i.filter)&&(o=i.filter,s=o);var n=[];if(typeof t!="object"||t===null)return"";var a=h2[i.arrayFormat],l=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(t)),i.sort&&s.sort(i.sort);for(var c=u2(),u=0;u<s.length;++u){var h=s[u],d=t[h];i.skipNulls&&d===null||d2(n,wW(d,h,a,l,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,c))}var f=n.join(i.delimiter),m=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?m+="utf8=%26%2310003%3B&":m+="utf8=%E2%9C%93&"),f.length>0?m+f:""}});var y2=oe((lwe,x2)=>{"use strict";var po=zb(),Xb=Object.prototype.hasOwnProperty,m2=Array.isArray,tt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:po.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},AW=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},g2=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},CW="utf8=%26%2310003%3B",PW="utf8=%E2%9C%93",MW=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<n.length;++l)n[l].indexOf("utf8=")===0&&(n[l]===PW?c="utf-8":n[l]===CW&&(c="iso-8859-1"),a=l,l=n.length);for(l=0;l<n.length;++l)if(l!==a){var u=n[l],h=u.indexOf("]="),d=h===-1?u.indexOf("="):h+1,f,m;d===-1?(f=t.decoder(u,tt.decoder,c,"key"),m=t.strictNullHandling?null:""):(f=t.decoder(u.slice(0,d),tt.decoder,c,"key"),m=po.maybeMap(g2(u.slice(d+1),t,m2(i[f])?i[f].length:0),function(x){return t.decoder(x,tt.decoder,c,"value")})),m&&t.interpretNumericEntities&&c==="iso-8859-1"&&(m=AW(String(m))),u.indexOf("[]=")>-1&&(m=m2(m)?[m]:m);var g=Xb.call(i,f);g&&t.duplicates==="combine"?i[f]=po.combine(i[f],m):(!g||t.duplicates==="last")&&(i[f]=m)}return i},RW=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:g2(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)?[]:po.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},IW=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&&Xb.call(Object.prototype,c)&&!i.allowPrototypes)return;u.push(c)}for(var h=0;i.depth>0&&(l=a.exec(o))!==null&&h<i.depth;){if(h+=1,!i.plainObjects&&Xb.call(Object.prototype,l[1].slice(1,-1))&&!i.allowPrototypes)return;u.push(l[1])}if(l){if(i.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+i.depth+" and strictDepth is true");u.push("["+o.slice(l.index)+"]")}return RW(u,t,i,s)}},BW=function(e){if(!e)return tt;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.decodeDotInKeys<"u"&&typeof e.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&typeof e.decoder<"u"&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof e.throwOnLimitExceeded<"u"&&typeof e.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var t=typeof e.charset>"u"?tt.charset:e.charset,i=typeof e.duplicates>"u"?tt.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:tt.allowDots:!!e.allowDots;return{allowDots:s,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:tt.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:tt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:tt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:tt.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:tt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:tt.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:tt.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:tt.decoder,delimiter:typeof e.delimiter=="string"||po.isRegExp(e.delimiter)?e.delimiter:tt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:tt.depth,duplicates:i,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:tt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:tt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:tt.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:tt.strictDepth,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:tt.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded=="boolean"?e.throwOnLimitExceeded:!1}};x2.exports=function(r,e){var t=BW(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?{__proto__:null}:{};for(var i=typeof r=="string"?MW(r,t):r,s=t.plainObjects?{__proto__:null}:{},o=Object.keys(i),n=0;n<o.length;++n){var a=o[n],l=IW(a,i[a],t,typeof r=="string");s=po.merge(s,l,t)}return t.allowSparse===!0?s:po.compact(s)}});var b2=oe((cwe,_2)=>{"use strict";var kW=p2(),FW=y2(),OW=Lp();_2.exports={formats:OW,parse:FW,stringify:kW}});var w2=oe(fa=>{"use strict";var UW=ck();function Rr(){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 LW=/^([a-z0-9.+-]+:)/i,GW=/:[0-9]*$/,DW=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,NW=["<",">",'"',"`"," ","\r",`
1093
+ `," "],VW=["{","}","|","\\","^","`"].concat(NW),jb=["'"].concat(VW),v2=["%","/","?",";","#"].concat(jb),T2=["/","?","#"],HW=255,S2=/^[+a-z0-9A-Z_-]{0,63}$/,WW=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,zW={javascript:!0,"javascript:":!0},Yb={javascript:!0,"javascript:":!0},da={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},qb=b2();function gu(r,e,t){if(r&&typeof r=="object"&&r instanceof Rr)return r;var i=new Rr;return i.parse(r,e,t),i}Rr.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&&i<r.indexOf("#")?"?":"#",o=r.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),r=o.join(s);var a=r;if(a=a.trim(),!t&&r.split("#").length===1){var l=DW.exec(a);if(l)return this.path=a,this.href=a,this.pathname=l[1],l[2]?(this.search=l[2],e?this.query=qb.parse(this.search.substr(1)):this.query=this.search.substr(1)):e&&(this.search="",this.query={}),this}var c=LW.exec(a);if(c){c=c[0];var u=c.toLowerCase();this.protocol=u,a=a.substr(c.length)}if(t||c||a.match(/^\/\/[^@/]+@[^@/]+/)){var h=a.substr(0,2)==="//";h&&!(c&&Yb[c])&&(a=a.substr(2),this.slashes=!0)}if(!Yb[c]&&(h||c&&!da[c])){for(var d=-1,f=0;f<T2.length;f++){var m=a.indexOf(T2[f]);m!==-1&&(d===-1||m<d)&&(d=m)}var g,x;d===-1?x=a.lastIndexOf("@"):x=a.lastIndexOf("@",d),x!==-1&&(g=a.slice(0,x),a=a.slice(x+1),this.auth=decodeURIComponent(g)),d=-1;for(var f=0;f<v2.length;f++){var m=a.indexOf(v2[f]);m!==-1&&(d===-1||m<d)&&(d=m)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var y=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!y)for(var T=this.hostname.split(/\./),f=0,p=T.length;f<p;f++){var b=T[f];if(b&&!b.match(S2)){for(var _="",S=0,E=b.length;S<E;S++)b.charCodeAt(S)>127?_+="x":_+=b[S];if(!_.match(S2)){var C=T.slice(0,f),P=T.slice(f+1),R=b.match(WW);R&&(C.push(R[1]),P.unshift(R[2])),P.length&&(a="/"+P.join(".")+a),this.hostname=C.join(".");break}}}this.hostname.length>HW?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=UW.toASCII(this.hostname));var I=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+I,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!zW[u])for(var f=0,p=jb.length;f<p;f++){var A=jb[f];if(a.indexOf(A)!==-1){var O=encodeURIComponent(A);O===A&&(O=escape(A)),a=a.split(A).join(O)}}var F=a.indexOf("#");F!==-1&&(this.hash=a.substr(F),a=a.slice(0,F));var M=a.indexOf("?");if(M!==-1?(this.search=a.substr(M),this.query=a.substr(M+1),e&&(this.query=qb.parse(this.query)),a=a.slice(0,M)):e&&(this.search="",this.query={}),a&&(this.pathname=a),da[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var I=this.pathname||"",D=this.search||"";this.path=I+D}return this.href=this.format(),this};function $W(r){return typeof r=="string"&&(r=gu(r)),r instanceof Rr?r.format():Rr.prototype.format.call(r)}Rr.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var e=this.protocol||"",t=this.pathname||"",i=this.hash||"",s=!1,o="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=qb.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||da[e])&&s!==!1?(s="//"+(s||""),t&&t.charAt(0)!=="/"&&(t="/"+t)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),n&&n.charAt(0)!=="?"&&(n="?"+n),t=t.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),e+s+t+n+i};function XW(r,e){return gu(r,!1,!0).resolve(e)}Rr.prototype.resolve=function(r){return this.resolveObject(gu(r,!1,!0)).format()};function jW(r,e){return r?gu(r,!1,!0).resolveObject(e):e}Rr.prototype.resolveObject=function(r){if(typeof r=="string"){var e=new Rr;e.parse(r,!1,!0),r=e}for(var t=new Rr,i=Object.keys(this),s=0;s<i.length;s++){var o=i[s];t[o]=this[o]}if(t.hash=r.hash,r.href==="")return t.href=t.format(),t;if(r.slashes&&!r.protocol){for(var n=Object.keys(r),a=0;a<n.length;a++){var l=n[a];l!=="protocol"&&(t[l]=r[l])}return da[t.protocol]&&t.hostname&&!t.pathname&&(t.pathname="/",t.path=t.pathname),t.href=t.format(),t}if(r.protocol&&r.protocol!==t.protocol){if(!da[r.protocol]){for(var c=Object.keys(r),u=0;u<c.length;u++){var h=c[u];t[h]=r[h]}return t.href=t.format(),t}if(t.protocol=r.protocol,!r.host&&!Yb[r.protocol]){for(var p=(r.pathname||"").split("/");p.length&&!(r.host=p.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),p[0]!==""&&p.unshift(""),p.length<2&&p.unshift(""),t.pathname=p.join("/")}else t.pathname=r.pathname;if(t.search=r.search,t.query=r.query,t.host=r.host||"",t.auth=r.auth,t.hostname=r.hostname||r.host,t.port=r.port,t.pathname||t.search){var d=t.pathname||"",f=t.search||"";t.path=d+f}return t.slashes=t.slashes||r.slashes,t.href=t.format(),t}var m=t.pathname&&t.pathname.charAt(0)==="/",g=r.host||r.pathname&&r.pathname.charAt(0)==="/",x=g||m||t.host&&r.pathname,y=x,T=t.pathname&&t.pathname.split("/")||[],p=r.pathname&&r.pathname.split("/")||[],b=t.protocol&&!da[t.protocol];if(b&&(t.hostname="",t.port=null,t.host&&(T[0]===""?T[0]=t.host:T.unshift(t.host)),t.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(p[0]===""?p[0]=r.host:p.unshift(r.host)),r.host=null),x=x&&(p[0]===""||T[0]==="")),g)t.host=r.host||r.host===""?r.host:t.host,t.hostname=r.hostname||r.hostname===""?r.hostname:t.hostname,t.search=r.search,t.query=r.query,T=p;else if(p.length)T||(T=[]),T.pop(),T=T.concat(p),t.search=r.search,t.query=r.query;else if(r.search!=null){if(b){t.host=T.shift(),t.hostname=t.host;var _=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;_&&(t.auth=_.shift(),t.hostname=_.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(!T.length)return t.pathname=null,t.search?t.path="/"+t.search:t.path=null,t.href=t.format(),t;for(var S=T.slice(-1)[0],E=(t.host||r.host||T.length>1)&&(S==="."||S==="..")||S==="",C=0,P=T.length;P>=0;P--)S=T[P],S==="."?T.splice(P,1):S===".."?(T.splice(P,1),C++):C&&(T.splice(P,1),C--);if(!x&&!y)for(;C--;C)T.unshift("..");x&&T[0]!==""&&(!T[0]||T[0].charAt(0)!=="/")&&T.unshift(""),E&&T.join("/").substr(-1)!=="/"&&T.push("");var R=T[0]===""||T[0]&&T[0].charAt(0)==="/";if(b){t.hostname=R?"":T.length?T.shift():"",t.host=t.hostname;var _=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;_&&(t.auth=_.shift(),t.hostname=_.shift(),t.host=t.hostname)}return x=x||t.host&&T.length,x&&!R&&T.unshift(""),T.length>0?t.pathname=T.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};Rr.prototype.parseHost=function(){var r=this.host,e=GW.exec(r);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),r=r.substr(0,r.length-e.length)),r&&(this.hostname=r)};fa.parse=gu;fa.resolve=XW;fa.resolveObject=jW;fa.format=$W;fa.Url=Rr});var sU=()=>{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 m={buffer:await(await fetch(h.url)).arrayBuffer(),type:h.type,source:"buffer"};r.set(u,m)}))},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)}};L();var y1={extension:{type:w.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(x1(),dG))}};L();var b1={extension:{type:w.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(_1(),fG))}};L();kh();Ch();L();De();Gl();var Cd;function A1(r){return Cd!==void 0||(Cd=(()=>{let e={stencil:!0,failIfMajorPerformanceCaveat:r??ns.defaultOptions.failIfMajorPerformanceCaveat};try{if(!Z.get().getWebGLRenderingContext())return!1;let i=Z.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}})()),Cd}De();var Pd;async function C1(r={}){return Pd!==void 0||(Pd=await(async()=>{let e=Z.get().getNavigator().gpu;if(!e)return!1;try{return await(await e.requestAdapter(r)).requestDevice(),!0}catch{return!1}})()),Pd}Gl();var DM=["webgl","webgpu","canvas"];async function NM(r){let e=[];r.preference?(e.push(r.preference),DM.forEach(o=>{o!==r.preference&&e.push(o)})):e=DM.slice();let t,i={};for(let o=0;o<e.length;o++){let n=e[o];if(n==="webgpu"&&await C1()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(dP(),hP));t=a,i={...r,...r.webgpu};break}else if(n==="webgl"&&A1(r.failIfMajorPerformanceCaveat??ns.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(GM(),LM));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}Or();uy();Xe();var VM=class Qy{constructor(...e){this.stage=new ie,e[0]!==void 0&&Y(ne,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.renderer=await NM(e),Qy._plugins.forEach(t=>{t.init.call(this,e)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return Y(ne,"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=Qy._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}};VM._plugins=[];var kc=VM;$.handleByList(w.Application,kc._plugins);$.add(Yl);L();qi();hg();De();L();Os();mt();Ce();Nx();$x();var Fc=class extends mn{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 ee(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<this.pages.length;e++){let{texture:t}=this.pages[e];t.destroy(!0)}this.pages=null}static install(e){Ml.install(e)}static uninstall(e){Ml.uninstall(e)}};var Jd={test(r){return typeof r=="string"&&r.startsWith("info face=")},parse(r){let e=r.match(/^[a-z]+\s+.+$/gm),t={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let h in e){let d=e[h].match(/^[a-z]+/gm)[0],f=e[h].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),m={};for(let g in f){let x=f[g].split("="),y=x[0],T=x[1].replace(/"/gm,""),p=parseFloat(T),b=isNaN(p)?T:p;m[y]=b}t[d].push(m)}let i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=t.info,[o]=t.common,[n]=t.distanceField??[];n&&(i.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),i.fontSize=parseInt(s.size,10),i.fontFamily=s.face,i.lineHeight=parseInt(o.lineHeight,10);let a=t.page;for(let h=0;h<a.length;h++)i.pages.push({id:parseInt(a[h].id,10)||0,file:a[h].file});let l={};i.baseLineOffset=i.lineHeight-parseInt(o.base,10);let c=t.char;for(let h=0;h<c.length;h++){let d=c[h],f=parseInt(d.id,10),m=d.letter??d.char??String.fromCharCode(f);m==="space"&&(m=" "),l[f]=m,i.chars[m]={id:f,page:parseInt(d.page,10)||0,x:parseInt(d.x,10),y:parseInt(d.y,10),width:parseInt(d.width,10),height:parseInt(d.height,10),xOffset:parseInt(d.xoffset,10),yOffset:parseInt(d.yoffset,10),xAdvance:parseInt(d.xadvance,10),kerning:{}}}let u=t.kerning||[];for(let h=0;h<u.length;h++){let d=parseInt(u[h].first,10),f=parseInt(u[h].second,10),m=parseInt(u[h].amount,10);i.chars[l[f]].kerning[l[d]]=m}return i}};De();var Jy={test(r){let e=r;return typeof e!="string"&&"getElementsByTagName"in e&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(r){let e={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},t=r.getElementsByTagName("info")[0],i=r.getElementsByTagName("common")[0],s=r.getElementsByTagName("distanceField")[0];s&&(e.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=r.getElementsByTagName("page"),n=r.getElementsByTagName("char"),a=r.getElementsByTagName("kerning");e.fontSize=parseInt(t.getAttribute("size"),10),e.fontFamily=t.getAttribute("face"),e.lineHeight=parseInt(i.getAttribute("lineHeight"),10);for(let c=0;c<o.length;c++)e.pages.push({id:parseInt(o[c].getAttribute("id"),10)||0,file:o[c].getAttribute("file")});let l={};e.baseLineOffset=e.lineHeight-parseInt(i.getAttribute("base"),10);for(let c=0;c<n.length;c++){let u=n[c],h=parseInt(u.getAttribute("id"),10),d=u.getAttribute("letter")??u.getAttribute("char")??String.fromCharCode(h);d==="space"&&(d=" "),l[h]=d,e.chars[d]={id:h,page:parseInt(u.getAttribute("page"),10)||0,x:parseInt(u.getAttribute("x"),10),y:parseInt(u.getAttribute("y"),10),width:parseInt(u.getAttribute("width"),10),height:parseInt(u.getAttribute("height"),10),xOffset:parseInt(u.getAttribute("xoffset"),10),yOffset:parseInt(u.getAttribute("yoffset"),10),xAdvance:parseInt(u.getAttribute("xadvance"),10),kerning:{}}}for(let c=0;c<a.length;c++){let u=parseInt(a[c].getAttribute("first"),10),h=parseInt(a[c].getAttribute("second"),10),d=parseInt(a[c].getAttribute("amount"),10);e.chars[l[h]].kerning[l[u]]=d}return e}};var e_={test(r){return typeof r=="string"&&r.includes("<font>")?Jy.test(Z.get().parseXML(r)):!1},parse(r){return Jy.parse(Z.get().parseXML(r))}};var jG=[".xml",".fnt"],HM={extension:{type:w.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof Fc,getCacheableAssets(r,e){let t={};return r.forEach(i=>{t[i]=e,t[`${i}-bitmap`]=e}),t[`${e.fontFamily}-bitmap`]=e,t}},WM={extension:{type:w.LoadParser,priority:$t.Normal},name:"loadBitmapFont",test(r){return jG.includes(xt.extname(r).toLowerCase())},async testParse(r){return Jd.test(r)||e_.test(r)},async parse(r,e,t){let i=Jd.test(r)?Jd.parse(r):e_.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;h<o.length;++h){let d=o[h].file,f=xt.join(xt.dirname(s),d);f=rl(f,s),n.push({src:f,data:a})}let l=await t.load(n),c=n.map(h=>l[h.src]);return new Fc({data:i,textures:c},s)},async load(r,e){return await(await Z.get().fetch(r)).text()},async unload(r,e,t){await Promise.all(r.pages.map(i=>t.unload(i.texture.source._sourceOrigin))),r.destroy()}};ke();var ef=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;i<t;i++)e.push(this._assetList.pop());await this._loader.load(e),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(e){this._isActive!==e&&(this._isActive=e,e&&!this._isLoading&&this._next())}};Zi();L();Ce();var zM={extension:{type:w.CacheParser,name:"cacheTextureArray"},test:r=>Array.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}};L();async function tf(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 $M={extension:{type:w.DetectionParser,priority:1},test:async()=>tf("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(e=>e!=="avif")};L();var XM=["png","jpg","jpeg"],jM={extension:{type:w.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...XM],remove:async r=>r.filter(e=>!XM.includes(e))};L();var YG="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Mn(r){return YG?!1:document.createElement("video").canPlayType(r)!==""}var YM={extension:{type:w.DetectionParser,priority:0},test:async()=>Mn("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(e=>e!=="mp4"&&e!=="m4v")};L();var qM={extension:{type:w.DetectionParser,priority:0},test:async()=>Mn("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(e=>e!=="ogv")};L();var KM={extension:{type:w.DetectionParser,priority:0},test:async()=>Mn("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(e=>e!=="webm")};L();var ZM={extension:{type:w.DetectionParser,priority:0},test:async()=>tf("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(e=>e!=="webp")};ke();Os();tl();Ah();var rf=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||X(`[Assets] specified load parser "${t.loadParser}" not found while loading ${e}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(e,t,this)){o=a;break}}if(!o)return X(`[Assets] ${e} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(e,t,this),i.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,t,this)&&(s=await a.parse(s,t,this)||s,i.parser=a)}return s})(),i}async load(e,t){this._parsersValidated||this._validateParsers();let i=0,s={},o=Us(e),n=Xt(e,c=>({alias:[c],src:c,data:{}})),a=n.length,l=n.map(async c=>{let u=xt.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}.
1094
1094
  ${h}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(e){let i=Xt(e,s=>({alias:[s],src:s})).map(async s=>{let o=xt.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]&&X(`[Assets] loadParser name conflict "${t.name}"`):X("[Assets] loadParser should have a name"),{...e,[t.name]:t}),{})}};De();L();function Ar(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}`)}Os();function Cr(r,e){let t=r.split("?")[0],i=xt.extname(t).toLowerCase();return Array.isArray(e)?e.includes(i):i===e}qi();var qG=".json",KG="application/json",QM={extension:{type:w.LoadParser,priority:$t.Low},name:"loadJson",test(r){return Ar(r,KG)||Cr(r,qG)},async load(r){return await(await Z.get().fetch(r)).json()}};De();L();qi();var ZG=".txt",QG="text/plain",JM={name:"loadTxt",extension:{type:w.LoadParser,priority:$t.Low,name:"loadTxt"},test(r){return Ar(r,QG)||Cr(r,ZG)},async load(r){return await(await Z.get().fetch(r)).text()}};De();L();ke();Os();Zi();qi();var JG=["normal","bold","100","200","300","400","500","600","700","800","900"],eD=[".ttf",".otf",".woff",".woff2"],tD=["font/ttf","font/otf","font/woff","font/woff2"],rD=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function iD(r){let e=xt.extname(r),s=xt.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(rD)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var sD=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function oD(r){return sD.test(r)?r:encodeURI(r)}var eR={extension:{type:w.LoadParser,priority:$t.Low},name:"loadWebFont",test(r){return Ar(r,tD)||Cr(r,eD)},async load(r,e){let t=Z.get().getFontFaceSet();if(t){let i=[],s=e.data?.family??iD(r),o=e.data?.weights?.filter(a=>JG.includes(a))??["normal"],n=e.data??{};for(let a=0;a<o.length;a++){let l=o[a],c=new FontFace(s,`url(${oD(r)})`,{...n,weight:l});await c.load(),t.add(c),i.push(c)}return Pe.set(`${s}-and-url`,{url:r,fontFaces:i}),i.length===1?i[0]:i}return X("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(e=>{Pe.remove(`${e.family}-and-url`),Z.get().getFontFaceSet().delete(e)})}};De();L();$o();dd();Wo();function Rn(r,e=1){let t=hr.RETINA_PREFIX?.exec(r);return t?parseFloat(t[1]):e}qi();Ce();ke();Zi();function In(r,e,t){r.label=t,r._sourceOrigin=t;let i=new k({source:r,label:t}),s=()=>{delete e.promiseCache[t],Pe.has(t)&&Pe.remove(t)};return i.source.once("destroy",()=>{e.promiseCache[t]&&(X("[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||(X("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}var nD=".svg",aD="image/svg+xml",tR={extension:{type:w.LoadParser,priority:$t.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(r){return Ar(r,aD)||Cr(r,nD)},async load(r,e,t){return e.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?cD(r):lD(r,e,t,this.config.crossOrigin)},unload(r){r.destroy(!0)}};async function lD(r,e,t,i){let o=await(await Z.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||Rn(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,...m}=e.data??{},g=new Jt({resource:l,alphaMode:"premultiply-alpha-on-upload",resolution:u,...m});return In(g,t,r)}async function cD(r){let t=await(await Z.get().fetch(r)).text(),i=new jt;return i.svg(t),i}De();L();$o();var uD=`(function () {
1095
1095
  'use strict';
1096
1096
 
@@ -1260,9 +1260,9 @@ fn mainFragment(
1260
1260
  }`;function hR(r,e){let t=af[e],i=t.length,s=[],o=[],n=[];for(let h=0;h<e;h++){s[h]=`@location(${h}) offset${h}: vec2<f32>,`,r?o[h]=`filteredCord + vec2(${h-i+1} * pixelStrength, 0.0),`:o[h]=`filteredCord + vec2(0.0, ${h-i+1} * pixelStrength),`;let d=h<i?h:e-h-1,f=t[d].toString();n[h]=`finalColor += textureSample(uTexture, uSampler, offset${h}) * ${f};`}let a=s.join(`
1261
1261
  `),l=o.join(`
1262
1262
  `),c=n.join(`
1263
- `),u=uR.replace("%blur-struct%",a).replace("%blur-vertex-out%",l).replace("%blur-fragment-in%",a).replace("%blur-sampling%",c).replace("%dimension%",r?"z":"w");return rr.from({vertex:{source:u,entryPoint:"mainVertex"},fragment:{source:u,entryPoint:"mainFragment"}})}var dR=class fR extends ai{constructor(e){e={...fR.defaultOptions,...e};let t=cR(e.horizontal,e.kernelSize),i=hR(e.horizontal,e.kernelSize);super({glProgram:t,gpuProgram:i,resources:{blurUniforms:{uStrength:{value:0,type:"f32"}}},...e}),this.horizontal=e.horizontal,this._quality=0,this.quality=e.quality,this.blur=e.strength,this._uniforms=this.resources.blurUniforms.uniforms}apply(e,t,i,s){if(this._uniforms.uStrength=this.strength/this.passes,this.passes===1)e.applyFilter(this,t,i,s);else{let o=Fe.getSameSizeTexture(t),n=t,a=o;this._state.blend=!1;let l=e.renderer.type===Ye.WEBGPU;for(let c=0;c<this.passes-1;c++){e.applyFilter(this,n,a,c===0?!0:l);let u=a;a=n,n=u}this._state.blend=!0,e.applyFilter(this,n,i,s),Fe.returnTexture(o)}}get blur(){return this.strength}set blur(e){this.padding=1+Math.abs(e)*2,this.strength=e}get quality(){return this._quality}set quality(e){this._quality=e,this.passes=e}};dR.defaultOptions={strength:8,quality:4,kernelSize:5};var lf=dR;var On=class extends ai{constructor(...e){let t=e[0]??{};typeof t=="number"&&(Y(ne,"BlurFilter constructor params are now options object. See params: { strength, quality, resolution, kernelSize }"),t={strength:t},e[1]!==void 0&&(t.quality=e[1]),e[2]!==void 0&&(t.resolution=e[2]||"inherit"),e[3]!==void 0&&(t.kernelSize=e[3])),t={...lf.defaultOptions,...t};let{strength:i,strengthX:s,strengthY:o,quality:n,...a}=t;super({...a,compatibleRenderers:Ye.BOTH,resources:{}}),this._repeatEdgePixels=!1,this.blurXFilter=new lf({horizontal:!0,...t}),this.blurYFilter=new lf({horizontal:!1,...t}),this.quality=n,this.strengthX=s??i,this.strengthY=o??i,this.repeatEdgePixels=!1}apply(e,t,i,s){let o=Math.abs(this.blurXFilter.strength),n=Math.abs(this.blurYFilter.strength);if(o&&n){let a=Fe.getSameSizeTexture(t);this.blurXFilter.blendMode="normal",this.blurXFilter.apply(e,t,a,!0),this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(e,a,i,s),Fe.returnTexture(a)}else n?(this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(e,t,i,s)):(this.blurXFilter.blendMode=this.blendMode,this.blurXFilter.apply(e,t,i,s))}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.blur),Math.abs(this.blurYFilter.blur))*2}get strength(){if(this.strengthX!==this.strengthY)throw new Error("BlurFilter's strengthX and strengthY are different");return this.strengthX}set strength(e){this.blurXFilter.blur=this.blurYFilter.blur=e,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(e){this.blurXFilter.quality=this.blurYFilter.quality=e}get strengthX(){return this.blurXFilter.blur}set strengthX(e){this.blurXFilter.blur=e,this.updatePadding()}get strengthY(){return this.blurYFilter.blur}set strengthY(e){this.blurYFilter.blur=e,this.updatePadding()}get blur(){return Y("8.3.0","BlurFilter.blur is deprecated, please use BlurFilter.strength instead."),this.strength}set blur(e){Y("8.3.0","BlurFilter.blur is deprecated, please use BlurFilter.strength instead."),this.strength=e}get blurX(){return Y("8.3.0","BlurFilter.blurX is deprecated, please use BlurFilter.strengthX instead."),this.strengthX}set blurX(e){Y("8.3.0","BlurFilter.blurX is deprecated, please use BlurFilter.strengthX instead."),this.strengthX=e}get blurY(){return Y("8.3.0","BlurFilter.blurY is deprecated, please use BlurFilter.strengthY instead."),this.strengthY}set blurY(e){Y("8.3.0","BlurFilter.blurY is deprecated, please use BlurFilter.strengthY instead."),this.strengthY=e}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(e){this._repeatEdgePixels=e,this.updatePadding()}};On.defaultOptions={strength:8,quality:4,kernelSize:5};Ce();Ka();Ho();sl();var Uc=class r extends Re{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&&(gt.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(gt.shared.add(this.update,this,Kr.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.currentFrame<s||this.animationSpeed<0&&this.currentFrame>s)&&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;i<e.length;++i)t.push(k.from(e[i]));return new r(t)}static fromImages(e){let t=[];for(let i=0;i<e.length;++i)t.push(k.from(e[i]));return new r(t)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(e){if(e[0]instanceof k)this._textures=e,this._durations=null;else{this._textures=[],this._durations=[];for(let t=0;t<e.length;t++)this._textures.push(e[t].texture),this._durations.push(e[t].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let e=Math.floor(this._currentTime)%this._textures.length;return e<0&&(e+=this._textures.length),e}set currentFrame(e){if(e<0||e>this.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?(gt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(gt.shared.add(this.update,this),this._isConnectedToTicker=!0))}};ah();Xe();Eh();var cf=class extends Yi{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 Ct({_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 pR(r,e){let t=r[0]??{};return(typeof t=="string"||r[1])&&(Y(ne,`use new ${e}({ text: "hi!", style }) instead`),t={text:t,style:r[1]}),t}Cl();$s();var dr=class extends cf{constructor(...e){let t=pR(e,"Text");super(t,Ie),this.renderPipeId="text"}updateBounds(){let e=this._bounds,t=this._anchor,i=Ne.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}};Ul();ve();mt();Ut();yy();Ce();Id();vg();Or();Lx();sl();Cl();$s();dg();Ft();var vD=As(Yh(),1);$.add(y1,b1);var TD=new(window.AudioContext||window.webkitAudioContext),uf={},Lc={},SD=(r,e)=>{if(uf[r])return uf[r];if(Lc[r])return Lc[r];if(e.byteLength!==0)return Lc[r]=TD.decodeAudioData(e).then(t=>(uf[r]=t,t)).catch(t=>{console.error(`AudioAsset.load: Failed to decode ${r}:`,t)}).finally(()=>{delete Lc[r]}),Lc[r]},wD=r=>uf[r],Un={load:SD,getAsset:wD};var it=({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 s_=({type:r})=>({type:r});var o_=({type:r,add:e,update:t,delete:i})=>({type:r,add:e,update:t,delete:i});var hf={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation",blurX:"blurX",blurY:"blurY"};var df={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"],blurX:["_routeGraphicsBlur","x"],blurY:["_routeGraphicsBlur","y"]};var Ks={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 Le={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var mR={color:"black",alpha:1,blur:0,offsetX:2,offsetY:2},ED=(r={})=>{let e=typeof r.stroke=="object"&&r.stroke!==null?r.stroke:{};return{...e,color:r.strokeColor??e.color??Le.strokeColor,width:r.strokeWidth??e.width??Le.strokeWidth}},AD=r=>{if(r===void 0)return;if(r===null||r===!1)return null;let e=typeof r=="object"&&r!==null?{...mR,...r}:mR,t=e.offsetX,i=e.offsetY,s=Math.hypot(t,i);return{alpha:e.alpha,angle:s===0?0:Math.atan2(i,t),blur:e.blur,color:e.color,distance:s}},CD=r=>r?Math.ceil(Math.max(0,r.blur)+r.distance):0,Mt=(r={},e={})=>{let t=e.includeShadow!==!1,{strokeColor:i,strokeWidth:s,stroke:o,shadow:n,...a}=r;delete a.dropShadow;let l={...a,stroke:ED({strokeColor:i,strokeWidth:s,stroke:o})};if(t){let c=AD(n),u=CD(c),h=Math.max(a.padding??0,u);n!==void 0&&(l.dropShadow=c),h>0&&(l.padding=h)}return l};var ci=(r,e)=>{let t={fill:e?.fill??Le.fill,fontFamily:e?.fontFamily??Le.fontFamily,fontSize:e?.fontSize??Le.fontSize,align:e?.align??Le.align,lineHeight:e?.lineHeight??Le.lineHeight,wordWrap:e?.wordWrap??Le.wordWrap,breakWords:e?.breakWords??Le.breakWords,strokeColor:e?.strokeColor??Le.strokeColor,strokeWidth:e?.strokeWidth??Le.strokeWidth,wordWrapWidth:e?.wordWrapWidth??Le.wordWrapWidth,...Object.prototype.hasOwnProperty.call(e??{},"shadow")?{shadow:e.shadow}:{}};r.style=Mt(t)};var PD=(r,e)=>typeof e!="string"?e:r[e]??e,MD=(r,e,t,i)=>{let s=PD(t,e);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n<s.length-1;n++){let a=s[n];a in o||(o[a]={}),o=o[a]}return o[s[s.length-1]]=i,r},gR=(r,e,t=df)=>{for(let i of e)for(let[s,o]of Object.entries(i.tween)){if(!hf[s])throw new Error(`${s} is not a supported property for animation.`);o.initialValue!==void 0&&MD(r,s,t,o.initialValue)}},ff=({animations:r,animationBus:e,completionTracker:t,element:i,targetState:s,onComplete:o})=>{for(let n of r){if(typeof e?.hasContext=="function"&&e.hasContext(n.id))continue;for(let[c,u]of Object.entries(n.tween))if(u.auto&&(!s||!Object.prototype.hasOwnProperty.call(s,c)))throw new Error(`Animation "${n.id}" cannot auto-resolve property "${c}" from targetState.`);let a=n.playback?.continuity!=="persistent",l=a?t.getVersion():null;a&&t.track(l),e.dispatch({type:"START",payload:{id:n.id,animationType:n.type,targetId:n.targetId,continuity:n.playback?.continuity??"render",signature:n.signature??JSON.stringify({type:n.type,tween:n.tween,playback:n.playback??null}),element:i,properties:n.tween,targetState:s,onComplete:()=>{a&&t.complete(l),o?.(n)}}})}};var RD=r=>{if(!r?.dropShadow||typeof r.clone!="function")return r;let e=r.clone();return e.dropShadow=null,e};function pf(r,e){let t=r.text.substring(0,e),s=Ne.measureText(t,RD(r.style)).width;return r.x+s}var ID=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})}),n_=ID;var Gc={softness:1.25,easing:"linear",lineOverlap:0,lineDelay:0},BD=18,kD=64,l_={linear:r=>r,easeOutCubic:r=>1-(1-r)**3},FD=(r,e,t)=>Math.max(e,Math.min(t,r)),a_=(r,e)=>typeof r=="number"&&Number.isFinite(r)?r:e,Zs=(r={})=>{let e=r&&typeof r=="object"?r:{};return{softness:Math.max(0,a_(e.softness,Gc.softness)),easing:Object.prototype.hasOwnProperty.call(l_,e.easing)?e.easing:Gc.easing,lineOverlap:FD(a_(e.lineOverlap,Gc.lineOverlap),0,.95),lineDelay:Math.max(0,a_(e.lineDelay,Gc.lineDelay))}},c_=r=>l_[r]??l_[Gc.easing],u_=({maxLineHeight:r,softWipe:e})=>Math.max(BD,Math.min(kD,Math.round(r*e.softness)));var Ri=Symbol("textRevealRuntime"),mf=Symbol("textRevealSnapshot"),d_=50,OD=0,f_=100,h_=f_-1,xR=10,UD=120,LD=.9,GD=(r,e,t)=>Math.max(e,Math.min(t,r)),_R=(r=d_)=>typeof r!="number"||!Number.isFinite(r)?d_:Math.max(OD,Math.min(f_,r)),DD=r=>_R(r)>=f_,p_=r=>{let e=Math.min(_R(r),h_),i=(h_>0?e/h_:0)**LD;return xR*(UD/xR)**i},ND=r=>r?.revealEffect==="softWipe"?"softWipe":"typewriter",m_=r=>{let e=r?.initialRevealedCharacters;return typeof e!="number"||!Number.isFinite(e)?0:Math.max(0,Math.floor(e))},VD=r=>(r?.content??[]).reduce((e,t)=>e+(t.lineParts??[]).reduce((i,s)=>i+(s.text?.length??0),0),0),Ln=r=>r?.revealEffect==="none"||DD(r?.speed??d_),HD=r=>{let e=new Re(k.EMPTY);if(r?.indicator?.revealing?.src){let t=k.from(r.indicator.revealing.src);e=new Re(t),e.width=r.indicator.revealing.width??t.width,e.height=r.indicator.revealing.height??t.height}return e},cs=(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},Ii=(r,e,t)=>{r.x=t,r.y=e?e.y+(e.lineMaxHeight-r.height):0},Qs=(r,e,t)=>{if(!e||e.text.length===0){r.x=t;return}r.x=pf(e,e.text.length-1)+t},WD=(r,e)=>{if(r[Ri]){let t=r[Ri];delete r[Ri],t()}r[Ri]=e},zD=r=>r?.[mf]??null,Dc=(r,e)=>r?e?(r[mf]=e,e):(delete r[mf],null):null,bR=r=>{let e=zD(r);return!e||e.mode!=="typewriter"||e.completed===!0?null:e},vR=r=>!!bR(r),g_=r=>{if(r[Ri]){let t=r[Ri];delete r[Ri],t()}delete r[mf],r.onRender=void 0,r.removeChildren().forEach(t=>{t.destroy({children:!0})})},x_=(r,e="",t="")=>{let i=new Ie(Mt(r.textStyle)),s=new dr({text:e,style:i,x:Math.round(r.x),y:Math.round(r.y)}),o=null;if(r.furigana){let n=new Ie(Mt(r.furigana.textStyle));o=new dr({text:t,style:n,x:Math.round(r.furigana.x),y:Math.round(r.furigana.y)})}return{text:s,furiganaText:o}},y_=(r,e)=>{let t=null,i=null,s=0,o=0,n=[];for(let a=0;a<e.content.length;a++){let l=e.content[a],c=new ie({label:`${e.id}-line-${a}`}),u=[],h=null,d=0;r.addChild(c),i=l,o=Math.max(o,l.lineMaxHeight??0);for(let f=0;f<l.lineParts.length;f++){let m=l.lineParts[f],{text:g,furiganaText:x}=x_(m,m.text,m.furigana?.text||"");x&&(c.addChild(x),u.push(x)),c.addChild(g),u.push(g),t=g,h=g,s+=m.text.length,d+=m.text.length}if(u.length>0){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()}},yR=({contentContainer:r,indicatorSprite:e,element:t})=>{let i=t?.indicator?.offset??12,{lastTextObject:s,lastChunk:o}=y_(r,t);Ii(e,o,i),Qs(e,s,i),cs(e,t)},$D=({contentContainer:r,indicatorSprite:e,element:t,revealedCharacters:i})=>{let s=t?.indicator?.offset??12,o=t.content[0]??null,n=VD(t),a=Math.min(i,Math.max(0,n)),l=null,c=null;if(a<=0){Ii(e,o,s);return}e:for(let u=0;u<t.content.length;u++){let h=t.content[u];for(let d=0;d<h.lineParts.length;d++){let f=h.lineParts[d],m=Math.min(f.text.length,a);if(m<=0)break e;let g=f.furigana?.text||"",x=g.length,y=f.text.length>0?Math.round(m/f.text.length*x):0,{text:T,furiganaText:p}=x_(f,f.text.substring(0,m),g.substring(0,y));if(p&&r.addChild(p),r.addChild(T),l=T,c=h,a-=m,m<f.text.length)break e}}c?(Ii(e,c,s),Qs(e,l,s)):Ii(e,o,s),i>=n&&cs(e,t)},XD=({contentContainer:r,indicatorSprite:e,element:t})=>{let i=m_(t);if(i<=0){let s=t?.indicator?.offset??12,o=t.content[0]??null;Ii(e,o,s);return}t.revealEffect==="softWipe"?ZD({contentContainer:r,indicatorSprite:e,element:t,revealedCharacters:i}):$D({contentContainer:r,indicatorSprite:e,element:t,revealedCharacters:i})},jD=async({contentContainer:r,indicatorSprite:e,element:t,signal:i,startAtCharacter:s=0,snapshot:o=null})=>{let n=p_(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;h<t.content.length;h++){if(i?.aborted||r.destroyed)return!1;let d=t.content[h],f=!1;Ii(e,d,a);for(let m=0;m<d.lineParts.length;m++){if(i?.aborted||r.destroyed)return!1;let g=d.lineParts[m],{text:x,furiganaText:y}=x_(g);y&&r.addChild(y),r.addChild(x);let T=g.text,p=g.furigana?.text||"",b=p.length,_=Math.min(T.length,u),S=T.length>0?Math.round(_/T.length*b):0;x.text=T.substring(0,_),y&&(y.text=p.substring(0,S)),u-=_,_>0&&(e.x=pf(x,_-1)+a);for(let E=_;E<T.length;E++){if(i?.aborted||r.destroyed)return!1;if(x.text=T.substring(0,E+1),e.x=pf(x,E)+a,f=!0,o&&(o.revealedCharacters+=1),y){let C=Math.round((E+1)/T.length*b);y.text=p.substring(0,C)}E<T.length-1&&await n_(l,i)}}h<t.content.length-1&&f&&await n_(c,i)}return cs(e,t),o&&(o.completed=!0),!0},TR=({lines:r,edgeWidth:e,baseDuration:t,softWipe:i})=>{let s=r.map(c=>{let u=Math.max(1,c.totalCharacters),h=1+e/Math.max(1,c.bounds.width);return u*h}),o=s.reduce((c,u)=>c+u,0),n=[],a=0,l=0;for(let c=0;c<r.length;c++){let u=s[c],h=o>0?Math.max(1,t*u/o):t,d=Math.max(0,a),f=d+h;n.push({...r[c],startTime:d,endTime:f,duration:h}),l=Math.max(l,f),a=f-h*i.lineOverlap+i.lineDelay}return{timedLines:n,duration:Math.max(1,Math.ceil(l))}},YD=({currentTime:r,line:e,easing:t})=>{let i=e.duration>0?(r-e.startTime)/e.duration:1;return t(Math.max(0,Math.min(i,1)))},qD=({progress:r,easingName:e})=>{let t=GD(r,0,1);return e==="easeOutCubic"?1-Math.cbrt(1-t):t},SR=({timedLines:r,initialRevealedCharacters:e,softWipe:t,easingName:i})=>{let s=Math.max(0,Math.floor(e)),o=s<=0,n=0,a=0;return{timedLines:r.map(c=>{let u=Math.max(0,c.totalCharacters??0),h=0,d=!1;if(!o&&s>0)if(u<=0||s>=u)s-=u,h=1,d=!0;else{let g=s/u;h=qD({progress:g,easingName:i}),s=0,o=!0}if(d)return{...c,startTime:-c.duration,endTime:0};o=!0;let f=h>0?-h*c.duration:Math.max(0,n),m=f+c.duration;return a=Math.max(a,m),n=m-c.duration*t.lineOverlap+t.lineDelay,{...c,startTime:f,endTime:m}}),duration:Math.max(1,Math.ceil(a))}},KD=r=>{r.forEach(e=>{e&&(e.line.container.mask===e.sprite&&(e.line.container.mask=null),e.sprite.parent&&e.sprite.parent.removeChild(e.sprite),e.sprite.destroy(),e.texture.destroy(!0))})},wR=({contentContainer:r,timedLines:e,edgeWidth:t})=>{let i=e.map(s=>{let o=document.createElement("canvas");o.width=Math.max(1,Math.ceil(s.bounds.width+t)),o.height=Math.max(1,Math.ceil(s.bounds.height));let n=o.getContext("2d");if(!n)return null;let a=qs(o),l=new Re(a);return l.x=Math.floor(s.bounds.x-t),l.y=Math.floor(s.bounds.y),s.container.mask=l,r.addChild(l),{canvas:o,context:n,texture:a,sprite:l,line:s,edgeWidth:t}});return i.some(s=>s===null)?(KD(i),null):i},ER=({timedLines:r,lineMasks:e,easing:t,indicatorSprite:i,indicatorOffset:s,currentTime:o})=>{let n=r[0],a=n.bounds.x;for(let l=0;l<r.length;l++){let c=r[l],u=e[l],h=YD({currentTime:o,line:c,easing:t}),{context:d,canvas:f,texture:m}=u;if(d.clearRect(0,0,f.width,f.height),h<=0){m.source.update();continue}let g=0,x=c.bounds.width+u.edgeWidth,y=u.edgeWidth,T=y+h*x,p=Math.max(y,T-u.edgeWidth);p>y&&(d.fillStyle="#ffffff",d.fillRect(y,g,Math.min(p-y,c.bounds.width),c.bounds.height));let b=Math.max(y,T-u.edgeWidth),_=Math.min(y+c.bounds.width,T);if(_>b){let S=d.createLinearGradient(b,0,_,0);S.addColorStop(0,"rgba(255, 255, 255, 1)"),S.addColorStop(1,"rgba(255, 255, 255, 0)"),d.fillStyle=S,d.fillRect(b,g,_-b,c.bounds.height)}m.source.update(),n=c,a=c.bounds.x+Math.min(c.bounds.width,Math.max(0,T-y))}Ii(i,n.chunk,s),i.x=a+s},ZD=({contentContainer:r,indicatorSprite:e,element:t,revealedCharacters:i})=>{let s=t?.indicator?.offset??12,{lines:o,lastTextObject:n,lastChunk:a,totalCharacters:l,maxLineHeight:c}=y_(r,t);if(Ii(e,a,s),o.length===0||l===0||i>=l||!o.some(T=>T.bounds.width>0&&T.bounds.height>0)||!globalThis.document){Qs(e,n,s),cs(e,t);return}let u=Zs(t.softWipe),h=c_(u.easing),d=u_({maxLineHeight:c,softWipe:u}),f=p_(t.speed??50),m=Math.max(1,Math.round(l/f*1e3)),g=TR({lines:o,edgeWidth:d,baseDuration:m,softWipe:u}),{timedLines:x}=SR({timedLines:g.timedLines,initialRevealedCharacters:i,softWipe:u,easingName:u.easing}),y=wR({contentContainer:r,timedLines:x,edgeWidth:d});if(!y){Qs(e,n,s),cs(e,t);return}ER({timedLines:x,lineMasks:y,easing:h,indicatorSprite:e,indicatorOffset:s,currentTime:0})},QD=({container:r,contentContainer:e,indicatorSprite:t,element:i,animationBus:s,completionTracker:o})=>{let n=i?.indicator?.offset??12,a=p_(i.speed??50),{lines:l,lastTextObject:c,lastChunk:u,totalCharacters:h,maxLineHeight:d}=y_(e,i),f=m_(i);if(Ii(t,u,n),l.length===0||h===0||f>=h||!l.some(I=>I.bounds.width>0&&I.bounds.height>0)||!globalThis.document||!s)return Qs(t,c,n),cs(t,i),!1;let m=Zs(i.softWipe),g=c_(m.easing),x=u_({maxLineHeight:d,softWipe:m}),y=Math.max(1,Math.round(h/a*1e3)),T=TR({lines:l,edgeWidth:x,baseDuration:y,softWipe:m}),{timedLines:p,duration:b}=SR({timedLines:T.timedLines,initialRevealedCharacters:f,softWipe:m,easingName:m.easing}),_=o.getVersion(),S=`${i.id}-soft-wipe`,E=wR({contentContainer:e,timedLines:p,edgeWidth:x});if(!E)return Qs(t,c,n),cs(t,i),!1;let C=!1,P=I=>{C||(C=!0,r[Ri]===M&&delete r[Ri],E.forEach(U=>{U.line.container.mask===U.sprite&&(U.line.container.mask=null),U.sprite.parent&&U.sprite.parent.removeChild(U.sprite),U.sprite.destroy(),U.texture.destroy(!0)}),I&&(Qs(t,c,n),cs(t,i)))},M=()=>{s.dispatch({type:"CANCEL",id:S}),P(!1)};return WD(r,M),o.track(_),s.dispatch({type:"START",payload:{id:S,driver:"custom",duration:b,applyFrame:I=>{ER({timedLines:p,lineMasks:E,easing:g,indicatorSprite:t,indicatorOffset:n,currentTime:Math.min(b,I)})},applyTargetState:()=>{P(!1)},onComplete:()=>{o.complete(_),P(!0)},onCancel:()=>{o.complete(_),P(!1)},isValid:()=>!!r&&!r.destroyed&&!e.destroyed&&!t.destroyed}}),!0},Bi=async({container:r,element:e,completionTracker:t,animationBus:i,zIndex:s,signal:o,playback:n="autoplay"})=>{if(o?.aborted||r.destroyed)return;let a=Ln(e),l=n==="resume"?bR(r):null,c=m_(e);if(n==="resume"&&!l)return;g_(r),r.zIndex=s;let u=new ie({label:`${e.id}-content`}),h=HD(e);r.addChild(u),r.addChild(h);try{if(n==="paused-initial"){a||Dc(r,{mode:ND(e),revealedCharacters:c,completed:!1}),a?(Dc(r,{mode:"none",completed:!0}),yR({contentContainer:u,indicatorSprite:h,element:e})):XD({contentContainer:u,indicatorSprite:h,element:e});return}let d=t.getVersion(),f=!1;if(a)t.track(d),Dc(r,{mode:"none",completed:!0}),yR({contentContainer:u,indicatorSprite:h,element:e}),f=!0;else if(e.revealEffect==="softWipe")if(Dc(r,{mode:"softWipe",revealedCharacters:c,completed:!1}),!QD({container:r,contentContainer:u,indicatorSprite:h,element:e,animationBus:i,completionTracker:t})&&!o?.aborted&&!r.destroyed)t.track(d),f=!0;else return;else{t.track(d);let m=l?.revealedCharacters??c,g=Dc(r,{mode:"typewriter",revealedCharacters:m,completed:!1});f=await jD({contentContainer:u,indicatorSprite:h,element:e,signal:o,startAtCharacter:m,snapshot:g})}f&&!o?.aborted&&!r.destroyed&&t.complete(d)}catch(d){if(d?.name!=="AbortError"&&!o?.aborted)throw d}};var gf=({suppressAnimations:r=!1,deferredMountOperations:e=[]}={})=>({suppressAnimations:r,deferredMountOperations:e}),AR=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":Bi({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;ff({animations:r.animations,animationBus:r.animationBus,completionTracker:r.completionTracker,element:r.element,targetState:r.targetState});return}},Nc=(r,e)=>{if(e?.type){if(!r?.suppressAnimations){AR(e);return}r.deferredMountOperations.push(e)}},Vc=r=>{r?.deferredMountOperations&&(r.deferredMountOperations.length=0)},CR=(r,e)=>Nc(r,{type:"play-animated-sprite",animatedSprite:e}),PR=(r,e)=>Nc(r,{type:"play-video",video:e}),MR=(r,{app:e,emitter:t,container:i,tickerCallback:s})=>Nc(r,{type:"start-particles",app:e,emitter:t,container:i,tickerCallback:s}),xf=(r,{container:e,element:t,completionTracker:i,animationBus:s,zIndex:o,signal:n})=>Nc(r,{type:"autoplay-text-reveal",container:e,element:t,completionTracker:i,animationBus:s,zIndex:o,signal:n}),RR=(r,{animations:e,animationBus:t,completionTracker:i,element:s,targetState:o})=>Nc(r,{type:"start-update-animations",animations:e,animationBus:t,completionTracker:i,element:s,targetState:o}),IR=r=>{if(!r?.deferredMountOperations?.length)return;let e=r.deferredMountOperations.splice(0);for(let t of e)AR(t)};var JD=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<r.length;n++)if(!pe(r[n],e[n]))return!1;return!0}let s=Object.keys(r),o=Object.keys(e);if(s.length!==o.length)return!1;for(let n of s)if(!JD.call(e,n)||!pe(r[n],e[n]))return!1;return!0};var Js=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 Js(t))e.add(i);return e};var BR=(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},yf=(r,e)=>r?r instanceof Map?r.get(e)??[]:r.filter(t=>t.targetId===e):[],eN=(r,e)=>yf(r,e).filter(t=>t.type==="update"),_f=(r,e)=>yf(r,e).find(t=>t.type==="transition")??null,Hc=(r=[],e,t=[])=>{for(let i of r){if(i?.id===e)return{element:i,ancestorIds:t};if(Array.isArray(i?.children)){let s=Hc(i.children,e,[...t,i.id]);if(s)return s}}return null},kR=(r,e)=>pe(r?.ancestorIds??null,e?.ancestorIds??null),tN=({subtreeRoot:r,nextAnimations:e,continuingAnimationId:t})=>{if(!r)return!1;let i=Js(r);for(let s of e??[])if(!(!s||s.id===t)&&i.has(s.targetId))return!0;return!1},__=(r={})=>r.type==="update"?JSON.stringify({type:r.type,tween:r.tween,playback:r.playback??null}):JSON.stringify({type:r.type,prev:r.prev??null,next:r.next??null,mask:r.mask??null,playback:r.playback??null}),rN=({prevState:r,nextState:e,animation:t})=>{let i=Hc(r?.elements,t.targetId),s=Hc(e?.elements,t.targetId);return i!==null&&s!==null&&kR(i,s)&&pe(i.element,s.element)},iN=({prevState:r,nextState:e,animation:t})=>{let i=Hc(r?.elements,t.targetId),s=Hc(e?.elements,t.targetId);return i===null&&s===null?!0:i===null||s===null||!kR(i,s)||!pe(i.element,s.element)?!1:!tN({subtreeRoot:s.element,nextAnimations:e?.animations,continuingAnimationId:t.id})},FR=({prevState:r,nextState:e,activeAnimations:t})=>{let i=new Set,s=t instanceof Map?t:new Map(t?.map(o=>[o.id,o])??[]);for(let o of e?.animations??[]){if(o?.playback?.continuity!=="persistent")continue;let n=s.get(o.id);if(n&&!(n.type!==o.type||n.targetId!==o.targetId||n.signature!==__(o))){if(o.type==="update"){rN({prevState:r,nextState:e,animation:o})&&i.add(o.id);continue}iN({prevState:r,nextState:e,animation:o})&&i.add(o.id)}}return{continuedAnimationIds:i}},sN=({animations:r,targetId:e,animationBus:t,completionTracker:i,element:s,targetState:o,onComplete:n,renderContext:a})=>{let l=eN(r,e),c=l.filter(h=>typeof t?.hasContext=="function"?t.hasContext(h.id):!1),u=l.filter(h=>!c.includes(h));if(l.length===0)return!1;if(u.length===0)return!0;if(a?.suppressAnimations){if(n)throw new Error("Deferred update animations do not support onComplete hooks.");return gR(s,u),RR(a,{animations:u,animationBus:t,completionTracker:i,element:s,targetState:o}),!0}return ff({animations:u,animationBus:t,completionTracker:i,element:s,targetState:o,onComplete:n}),!0};var J=sN;var OR=r=>!!r&&typeof r=="object"&&!Array.isArray(r),oN=(r,e)=>e===void 0?r:e===null||e===!1?null:OR(e)?{...OR(r)?r:{},...e}:e,ui=(r={},e={})=>{if(!e)return{...r};let t={...r,...e};return Object.prototype.hasOwnProperty.call(e,"shadow")&&(t.shadow=oN(r?.shadow,e.shadow)),t};var LR=Symbol("routeGraphicsTextAnchorRatios"),eo=Symbol("routeGraphicsTextLayoutState"),UR=(r,e)=>typeof r!="number"||r===0?0:e/r,b_=r=>r?.align??Le.align,nN=r=>{let e=r[eo];return e?.fixedWidth&&typeof e.layoutWidth=="number"?e.layoutWidth:typeof e?.measuredWidth=="number"?e.measuredWidth:r.width},aN=(r,e)=>{let t=Ne.measureText(String(r??""),new Ie(Mt(e,{includeShadow:!1})));return{width:t.width,height:t.height}},GR=r=>r?.shadow!==void 0&&r.shadow!==null&&r.shadow!==!1,S_=(r,e)=>GR(e)?aN(r.text,e):{width:r.width,height:r.height},v_=r=>{let e=r[eo];return typeof e?.measuredWidth=="number"?e.measuredWidth:r.width},lN=r=>{let e=r[eo];return typeof e?.measuredHeight=="number"?e.measuredHeight:r.height},DR=(r,e,t)=>{let i=!!e.__fixedWidth,s=t??S_(r,e.textStyle),o=s.width??e.measuredWidth??e.width,n=s.height??e.height??r.height;r[eo]={fixedWidth:i,layoutWidth:i?e.width:o,measuredWidth:o,measuredHeight:n}},T_=(r,e,t)=>{let i=Math.max(0,r-e);return t==="center"?i/2:t==="right"?i:0},w_=r=>{let e=r.measuredWidth??r.width,t=T_(r.width,e,b_(r.textStyle));return{x:r.x+t,y:r.y}},bf=(r,e)=>{let t=S_(r,e.textStyle),i=e.__fixedWidth&&typeof e.width=="number"?e.width:t.width,s=t.height,o=typeof e.__anchorXRatio=="number"?e.__anchorXRatio:UR(i,e.originX),n=typeof e.__anchorYRatio=="number"?e.__anchorYRatio:UR(s,e.originY);r[LR]={x:o,y:n},DR(r,e,t)},cN=r=>typeof r?.fontSize!="number"||r.fontSize===0||typeof r?.lineHeight!="number"?Le.lineHeight:r.lineHeight/r.fontSize,uN=(r,e)=>{if(!e)return r;let t=ui(r,e);if(e.fontSize!==void 0||e.lineHeight!==void 0){let i=e.lineHeight??cN(r);t.lineHeight=Math.round(t.fontSize*i)}return t},NR=(r,e,t)=>{let i=r[LR],s=nN(r),o=uN(e,t);if(!i){ci(r,o);return}let n=T_(s,v_(r),b_(r.style)),l=r.x-n+s*i.x,c=r.y+lN(r)*i.y;ci(r,o);let u=S_(r,o),d=r[eo]?.fixedWidth===!0?s:u.width,f=T_(d,u.width,b_(o));r.x=l-d*i.x+f,r.y=c-u.height*i.y,r[eo]={...r[eo]??{},layoutWidth:d,measuredWidth:u.width,measuredHeight:u.height}},vf=(r,e)=>{DR(r,e);let t=GR(e.textStyle)?e.measuredWidth??v_(r):v_(r),i=w_({...e,measuredWidth:t,width:e.__fixedWidth&&typeof e.width=="number"?e.width:t});r.x=i.x,r.y=i.y};var ze=(r,e=100)=>Math.min(Math.max(r??e,0),100)/100;var VR=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}},Rt=r=>{let e=VR(r);return e===void 0||e===0},HR=r=>VR(r)===2;var E_=Symbol.for("routeGraphics.setInheritedHover"),WR=Symbol.for("routeGraphics.treeInheritedHoverActive"),A_=Symbol.for("routeGraphics.setInheritedPress"),zR=Symbol.for("routeGraphics.treeInheritedPressActive"),C_=Symbol.for("routeGraphics.setInheritedRightPress"),$R=Symbol.for("routeGraphics.treeInheritedRightPressActive"),Gn=r=>Array.isArray(r?.children)?r.children:[],P_=({displayObject:r,symbol:e,source:t,isActive:i})=>{let s=r?.[e];typeof s=="function"&&s(t,i)},Tf=({displayObject:r,symbol:e})=>{r&&e in r&&delete r[e]},M_=({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:()=>{Tf({displayObject:r,symbol:e})}}},Dn=r=>Tf({displayObject:r,symbol:E_}),Sf=r=>Tf({displayObject:r,symbol:A_}),wf=r=>Tf({displayObject:r,symbol:C_}),us=({displayObject:r,onHoverChange:e})=>{let t=M_({displayObject:r,symbol:E_,onStateChange:e});return{setDirectHover:t.setDirectState,isHovering:t.isActive,destroy:t.destroy}},Nn=({displayObject:r,onPressChange:e})=>{let t=M_({displayObject:r,symbol:A_,onStateChange:e});return{setDirectPress:t.setDirectState,isPressed:t.isActive,destroy:t.destroy}},Vn=({displayObject:r,onPressChange:e})=>{let t=M_({displayObject:r,symbol:C_,onStateChange:e});return{setDirectPress:t.setDirectState,isPressed:t.isActive,destroy:t.destroy}},R_=r=>r?.[WR]===!0,I_=r=>r?.[zR]===!0,B_=r=>r?.[$R]===!0,Hn=({root:r,isHovered:e})=>{if(!r)return;r[WR]=e;let t=[...Gn(r)];for(;t.length>0;){let i=t.pop();P_({displayObject:i,symbol:E_,source:r,isActive:e}),t.push(...Gn(i))}},to=({root:r,isPressed:e})=>{if(!r)return;r[zR]=e;let t=[...Gn(r)];for(;t.length>0;){let i=t.pop();P_({displayObject:i,symbol:A_,source:r,isActive:e}),t.push(...Gn(i))}},ki=({root:r,isPressed:e})=>{if(!r)return;r[$R]=e;let t=[...Gn(r)];for(;t.length>0;){let i=t.pop();P_({displayObject:i,symbol:C_,source:r,isActive:e}),t.push(...Gn(i))}};var XR="__rtglScrollHandled",jR=r=>r?.payload&&typeof r.payload=="object"?r.payload:{},Pr=({canvas:r,displayObject:e,width:t,height:i,scrollUpEvent:s,scrollDownEvent:o,eventHandler:n})=>{if(!s&&!o)return;let a=!1,l=Number.isFinite(t)&&Number.isFinite(i)&&t>0&&i>0;e.eventMode="static",l&&(e.hitArea=new ee(0,0,Math.round(t),Math.round(i)));let c=(m,g)=>{g?.[XR]||(g&&(g[XR]=!0),m<0&&s&&n?n("scrollUp",{_event:{id:e.label},...jR(s)}):m>0&&o&&n&&n("scrollDown",{_event:{id:e.label},...jR(o)}))},u=()=>{a=!0},h=()=>{a=!1},d=m=>{m.preventDefault?.(),c(m.deltaY,m.nativeEvent)},f=m=>{a&&(m.preventDefault(),c(m.deltaY,m))};e.on("pointerover",u),e.on("pointerout",h),e.on("wheel",d),r?.addEventListener("wheel",f,{passive:!1}),e._cleanupScrollInteraction=()=>{a=!1,e.off("pointerover",u),e.off("pointerout",h),e.off("wheel",d),r?.removeEventListener("wheel",f),l&&(e.hitArea=null),delete e._cleanupScrollInteraction}},k_=({root:r})=>{r?._cleanupScrollInteraction?.(),r?.children?.forEach(e=>{k_({root:e})})};var Wn=r=>{r._cleanupScrollInteraction?.(),r.removeAllListeners("pointerover"),r.removeAllListeners("pointerout"),r.removeAllListeners("pointerdown"),r.removeAllListeners("pointerupoutside"),r.removeAllListeners("pointerup"),r.removeAllListeners("rightdown"),r.removeAllListeners("rightclick"),r.removeAllListeners("rightup"),r.removeAllListeners("rightupoutside"),r.removeAllListeners("wheel"),Dn(r),Sf(r),wf(r),r.cursor="auto",r.eventMode="auto"},Wc=({app:r,displayObject:e,textComputedNode:t,eventHandler:i,applyStyle:s})=>{let o=t?.hover,n=t?.click,a=t?.rightClick,l=t?.scrollUp,c=t?.scrollDown,u=null,h=null,d=null,f=()=>{let m=u?.isHovering()??!1,g=h?.isPressed()??!1;(d?.isPressed()??!1)&&a?.textStyle?s(a.textStyle):g&&n?.textStyle?s(n.textStyle):m&&o?.textStyle?s(o.textStyle):s()};if(o){let{cursor:m,soundSrc:g,payload:x}=o;e.eventMode="static",u=us({displayObject:e,onHoverChange:f});let y=()=>{u.setDirectHover(!0),x&&i&&i("hover",{_event:{id:e.label},...x}),m&&(e.cursor=m),g&&r.audioStage.add({id:`hover-${Date.now()}`,url:g,loop:!1})},T=()=>{u.setDirectHover(!1),e.cursor="auto"};e.on("pointerover",y),e.on("pointerout",T)}if(n){let{soundSrc:m,soundVolume:g,payload:x}=n;e.eventMode="static",h=Nn({displayObject:e,onPressChange:f});let y=b=>{Rt(b)&&h.setDirectPress(!0)},T=b=>{Rt(b)&&(h.setDirectPress(!1),x&&i&&i("click",{_event:{id:e.label},...x}),m&&r.audioStage.add({id:`click-${Date.now()}`,url:m,loop:!1,volume:ze(g)}))},p=()=>{h.setDirectPress(!1)};e.on("pointerdown",y),e.on("pointerup",T),e.on("pointerupoutside",p)}if(a){let{soundSrc:m,payload:g}=a;e.eventMode="static",d=Vn({displayObject:e,onPressChange:f});let x=()=>{d.setDirectPress(!0)},y=()=>{d.setDirectPress(!1)},T=()=>{d.setDirectPress(!1),g&&i&&i("rightClick",{_event:{id:e.label},...g}),m&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:m,loop:!1})},p=()=>{d.setDirectPress(!1)};e.on("rightdown",x),e.on("rightup",y),e.on("rightclick",T),e.on("rightupoutside",p)}(l||c)&&Pr({canvas:r.canvas,displayObject:e,scrollUpEvent:l,scrollDownEvent:c,eventHandler:i})};var KR=Symbol("routeGraphicsRichTextDisplay"),hN=r=>r?.align??Le.align,dN=(r,e,t)=>{let i=Math.max(0,r-e.width),s=0;return t==="center"?s=i/2:t==="right"&&(s=i),s-e.x},fN=r=>{r.removeChildren().forEach(t=>{t.destroy({children:!0})})},YR=({text:r,style:e,x:t,y:i})=>new dr({text:r,style:new Ie(Mt(e)),x:Math.round(t),y:Math.round(i)}),qR=(r,e)=>e?ui(r,e):r,ro=r=>Array.isArray(r?.content),ZR=r=>!!r?.[KR],QR=r=>({x:r.x,y:r.y}),zc=(r,e,t)=>{fN(r),r.label=e.id,r.x=Math.round(e.x??0),r.y=Math.round(e.y??0),r.alpha=e.alpha??1;let i=e.width??e.measuredWidth??0;for(let s=0;s<e.content.length;s++){let o=e.content[s],n=new ie({label:`${e.id}-line-${s}`});for(let l of o.lineParts??[])l.furigana&&n.addChild(YR({text:l.furigana.text,style:qR(l.furigana.textStyle,t),x:l.furigana.x,y:l.furigana.y})),n.addChild(YR({text:l.text,style:qR(l.textStyle,t),x:l.x,y:l.y}));let a=n.getLocalBounds();n.x=dN(i,a,hN(e.textStyle)),r.addChild(n)}r.hitArea=new ee(0,0,Math.max(0,i),Math.max(0,e.height??0))},JR=(r,e)=>{let t=new ie({label:r.id});return t[KR]=!0,t.zIndex=e,zc(t,r),t};var F_=r=>({...ro(r)?QR(r):w_(r),alpha:r.alpha}),O_=(r,e)=>{if(ro(r))return JR(r,e);let t=new dr({label:r.id});return t.zIndex=e,t.text=r.content,ci(t,r.textStyle),bf(t,r),t.alpha=r.alpha,vf(t,r),t},Ef=(r,e,t)=>{if(ro(e)){zc(r,e,t);return}NR(r,e.textStyle,t)},eI=({app:r,parent:e,element:t,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=O_(t,l);Wc({app:r,displayObject:c,textComputedNode:t,eventHandler:s,applyStyle:u=>Ef(c,t,u)}),e.addChild(c),J({animations:i,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:F_(t),renderContext:a})};var pN=(r,e)=>ZR(r)!==ro(e),mN=({app:r,parent:e,displayObject:t,textComputedNode:i,eventHandler:s,zIndex:o})=>{Wn(t);let n=O_(i,o);return Wc({app:r,displayObject:n,textComputedNode:i,eventHandler:s,applyStyle:a=>Ef(n,i,a)}),e.addChild(n),t.destroy({children:!0}),n},gN=(r,e)=>{r.text=e.content,ci(r,e.textStyle),bf(r,e),vf(r,e),r.alpha=e.alpha},xN=({displayObject:r,textComputedNode:e,app:t,eventHandler:i})=>{ro(e)?zc(r,e):gN(r,e),Wn(r),Wc({app:t,displayObject:r,textComputedNode:e,eventHandler:i,applyStyle:s=>Ef(r,e,s)})},tI=({app:r,parent:e,prevElement:t,nextElement:i,eventHandler:s,animations:o,animationBus:n,completionTracker:a,zIndex:l})=>{let c=e.children.find(d=>d.label===t.id);if(!c)return;c.zIndex=l;let u=()=>{if(!pe(t,i)){if(pN(c,i)){c=mN({app:r,parent:e,displayObject:c,textComputedNode:i,eventHandler:s,zIndex:l});return}xN({displayObject:c,textComputedNode:i,app:r,eventHandler:s})}};J({animations:o,targetId:t.id,animationBus:n,completionTracker:a,element:c,targetState:F_(i),onComplete:()=>{u()}})||u()};var rI=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o)return;J({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(Wn(o),o.destroy({children:!0}))}})||(Wn(o),o.destroy({children:!0}))};var iI=({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(Ks).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Ks).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===Ks.CONTAINER&&(e=r.width,t=r.height);let{x:i,y:s,originX:o,originY:n}=iI({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 yN=r=>typeof r!="number"||!Number.isFinite(r)?0:Math.max(0,Math.floor(r)),_N="top",bN=2,sI=["top","bottom"],vN=new Set(sI),TN=(r,e)=>{if(r===void 0)return _N;if(vN.has(r))return r;throw new Error(`Input Error: ${e}.placement must be one of ${sI.join(", ")}.`)},SN=(r,e)=>{if(r===void 0)return 0;if(typeof r=="number"&&Number.isFinite(r)&&r>=0)return r;throw new Error(`Input Error: ${e}.gap must be a finite number >= 0.`)},wN=({placement:r,gap:e,x:t,y:i,partWidth:s,partHeight:o,furiganaWidth:n,furiganaHeight:a})=>{let l=Math.round(t+(s-n)/2);return r==="bottom"?{x:l,y:i+o+e}:{x:l,y:i-a+bN-e}},EN=r=>r===`
1263
+ `),u=uR.replace("%blur-struct%",a).replace("%blur-vertex-out%",l).replace("%blur-fragment-in%",a).replace("%blur-sampling%",c).replace("%dimension%",r?"z":"w");return rr.from({vertex:{source:u,entryPoint:"mainVertex"},fragment:{source:u,entryPoint:"mainFragment"}})}var dR=class fR extends ai{constructor(e){e={...fR.defaultOptions,...e};let t=cR(e.horizontal,e.kernelSize),i=hR(e.horizontal,e.kernelSize);super({glProgram:t,gpuProgram:i,resources:{blurUniforms:{uStrength:{value:0,type:"f32"}}},...e}),this.horizontal=e.horizontal,this._quality=0,this.quality=e.quality,this.blur=e.strength,this._uniforms=this.resources.blurUniforms.uniforms}apply(e,t,i,s){if(this._uniforms.uStrength=this.strength/this.passes,this.passes===1)e.applyFilter(this,t,i,s);else{let o=Fe.getSameSizeTexture(t),n=t,a=o;this._state.blend=!1;let l=e.renderer.type===Ye.WEBGPU;for(let c=0;c<this.passes-1;c++){e.applyFilter(this,n,a,c===0?!0:l);let u=a;a=n,n=u}this._state.blend=!0,e.applyFilter(this,n,i,s),Fe.returnTexture(o)}}get blur(){return this.strength}set blur(e){this.padding=1+Math.abs(e)*2,this.strength=e}get quality(){return this._quality}set quality(e){this._quality=e,this.passes=e}};dR.defaultOptions={strength:8,quality:4,kernelSize:5};var lf=dR;var On=class extends ai{constructor(...e){let t=e[0]??{};typeof t=="number"&&(Y(ne,"BlurFilter constructor params are now options object. See params: { strength, quality, resolution, kernelSize }"),t={strength:t},e[1]!==void 0&&(t.quality=e[1]),e[2]!==void 0&&(t.resolution=e[2]||"inherit"),e[3]!==void 0&&(t.kernelSize=e[3])),t={...lf.defaultOptions,...t};let{strength:i,strengthX:s,strengthY:o,quality:n,...a}=t;super({...a,compatibleRenderers:Ye.BOTH,resources:{}}),this._repeatEdgePixels=!1,this.blurXFilter=new lf({horizontal:!0,...t}),this.blurYFilter=new lf({horizontal:!1,...t}),this.quality=n,this.strengthX=s??i,this.strengthY=o??i,this.repeatEdgePixels=!1}apply(e,t,i,s){let o=Math.abs(this.blurXFilter.strength),n=Math.abs(this.blurYFilter.strength);if(o&&n){let a=Fe.getSameSizeTexture(t);this.blurXFilter.blendMode="normal",this.blurXFilter.apply(e,t,a,!0),this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(e,a,i,s),Fe.returnTexture(a)}else n?(this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(e,t,i,s)):(this.blurXFilter.blendMode=this.blendMode,this.blurXFilter.apply(e,t,i,s))}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.blur),Math.abs(this.blurYFilter.blur))*2}get strength(){if(this.strengthX!==this.strengthY)throw new Error("BlurFilter's strengthX and strengthY are different");return this.strengthX}set strength(e){this.blurXFilter.blur=this.blurYFilter.blur=e,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(e){this.blurXFilter.quality=this.blurYFilter.quality=e}get strengthX(){return this.blurXFilter.blur}set strengthX(e){this.blurXFilter.blur=e,this.updatePadding()}get strengthY(){return this.blurYFilter.blur}set strengthY(e){this.blurYFilter.blur=e,this.updatePadding()}get blur(){return Y("8.3.0","BlurFilter.blur is deprecated, please use BlurFilter.strength instead."),this.strength}set blur(e){Y("8.3.0","BlurFilter.blur is deprecated, please use BlurFilter.strength instead."),this.strength=e}get blurX(){return Y("8.3.0","BlurFilter.blurX is deprecated, please use BlurFilter.strengthX instead."),this.strengthX}set blurX(e){Y("8.3.0","BlurFilter.blurX is deprecated, please use BlurFilter.strengthX instead."),this.strengthX=e}get blurY(){return Y("8.3.0","BlurFilter.blurY is deprecated, please use BlurFilter.strengthY instead."),this.strengthY}set blurY(e){Y("8.3.0","BlurFilter.blurY is deprecated, please use BlurFilter.strengthY instead."),this.strengthY=e}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(e){this._repeatEdgePixels=e,this.updatePadding()}};On.defaultOptions={strength:8,quality:4,kernelSize:5};Ce();Ka();Ho();sl();var Uc=class r extends Re{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&&(gt.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(gt.shared.add(this.update,this,Kr.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.currentFrame<s||this.animationSpeed<0&&this.currentFrame>s)&&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;i<e.length;++i)t.push(k.from(e[i]));return new r(t)}static fromImages(e){let t=[];for(let i=0;i<e.length;++i)t.push(k.from(e[i]));return new r(t)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(e){if(e[0]instanceof k)this._textures=e,this._durations=null;else{this._textures=[],this._durations=[];for(let t=0;t<e.length;t++)this._textures.push(e[t].texture),this._durations.push(e[t].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let e=Math.floor(this._currentTime)%this._textures.length;return e<0&&(e+=this._textures.length),e}set currentFrame(e){if(e<0||e>this.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?(gt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(gt.shared.add(this.update,this),this._isConnectedToTicker=!0))}};ah();Xe();Eh();var cf=class extends Yi{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 Ct({_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 pR(r,e){let t=r[0]??{};return(typeof t=="string"||r[1])&&(Y(ne,`use new ${e}({ text: "hi!", style }) instead`),t={text:t,style:r[1]}),t}Cl();$s();var dr=class extends cf{constructor(...e){let t=pR(e,"Text");super(t,Ie),this.renderPipeId="text"}updateBounds(){let e=this._bounds,t=this._anchor,i=Ne.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}};Ul();ve();mt();Ut();yy();Ce();Id();vg();Or();Lx();sl();Cl();$s();dg();Ft();var vD=As(Yh(),1);$.add(y1,b1);var TD=new(window.AudioContext||window.webkitAudioContext),uf={},Lc={},SD=(r,e)=>{if(uf[r])return uf[r];if(Lc[r])return Lc[r];if(e.byteLength!==0)return Lc[r]=TD.decodeAudioData(e).then(t=>(uf[r]=t,t)).catch(t=>{console.error(`AudioAsset.load: Failed to decode ${r}:`,t)}).finally(()=>{delete Lc[r]}),Lc[r]},wD=r=>uf[r],Un={load:SD,getAsset:wD};var it=({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 s_=({type:r})=>({type:r});var o_=({type:r,add:e,update:t,delete:i})=>({type:r,add:e,update:t,delete:i});var hf={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation",blurX:"blurX",blurY:"blurY"};var df={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"],blurX:["_routeGraphicsBlur","x"],blurY:["_routeGraphicsBlur","y"]};var Ks={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 Le={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var mR={color:"black",alpha:1,blur:0,offsetX:2,offsetY:2},ED=(r={})=>{let e=typeof r.stroke=="object"&&r.stroke!==null?r.stroke:{};return{...e,color:r.strokeColor??e.color??Le.strokeColor,width:r.strokeWidth??e.width??Le.strokeWidth}},AD=r=>{if(r===void 0)return;if(r===null||r===!1)return null;let e=typeof r=="object"&&r!==null?{...mR,...r}:mR,t=e.offsetX,i=e.offsetY,s=Math.hypot(t,i);return{alpha:e.alpha,angle:s===0?0:Math.atan2(i,t),blur:e.blur,color:e.color,distance:s}},CD=r=>r?Math.ceil(Math.max(0,r.blur)+r.distance):0,Mt=(r={},e={})=>{let t=e.includeShadow!==!1,{strokeColor:i,strokeWidth:s,stroke:o,shadow:n,...a}=r;delete a.dropShadow;let l={...a,stroke:ED({strokeColor:i,strokeWidth:s,stroke:o})};if(t){let c=AD(n),u=CD(c),h=Math.max(a.padding??0,u);n!==void 0&&(l.dropShadow=c),h>0&&(l.padding=h)}return l};var ci=(r,e)=>{let t={fill:e?.fill??Le.fill,fontFamily:e?.fontFamily??Le.fontFamily,fontSize:e?.fontSize??Le.fontSize,align:e?.align??Le.align,lineHeight:e?.lineHeight??Le.lineHeight,wordWrap:e?.wordWrap??Le.wordWrap,breakWords:e?.breakWords??Le.breakWords,strokeColor:e?.strokeColor??Le.strokeColor,strokeWidth:e?.strokeWidth??Le.strokeWidth,wordWrapWidth:e?.wordWrapWidth??Le.wordWrapWidth,...Object.prototype.hasOwnProperty.call(e??{},"shadow")?{shadow:e.shadow}:{}};r.style=Mt(t)};var PD=(r,e)=>typeof e!="string"?e:r[e]??e,MD=(r,e,t,i)=>{let s=PD(t,e);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n<s.length-1;n++){let a=s[n];a in o||(o[a]={}),o=o[a]}return o[s[s.length-1]]=i,r},gR=(r,e,t=df)=>{for(let i of e)for(let[s,o]of Object.entries(i.tween)){if(!hf[s])throw new Error(`${s} is not a supported property for animation.`);o.initialValue!==void 0&&MD(r,s,t,o.initialValue)}},ff=({animations:r,animationBus:e,completionTracker:t,element:i,targetState:s,onComplete:o})=>{for(let n of r){if(typeof e?.hasContext=="function"&&e.hasContext(n.id))continue;for(let[c,u]of Object.entries(n.tween))if(u.auto&&(!s||!Object.prototype.hasOwnProperty.call(s,c)))throw new Error(`Animation "${n.id}" cannot auto-resolve property "${c}" from targetState.`);let a=n.playback?.continuity!=="persistent",l=a?t.getVersion():null;a&&t.track(l),e.dispatch({type:"START",payload:{id:n.id,animationType:n.type,targetId:n.targetId,continuity:n.playback?.continuity??"render",signature:n.signature??JSON.stringify({type:n.type,tween:n.tween,playback:n.playback??null}),element:i,properties:n.tween,targetState:s,onComplete:()=>{a&&t.complete(l),o?.(n)}}})}};var RD=r=>{if(!r?.dropShadow||typeof r.clone!="function")return r;let e=r.clone();return e.dropShadow=null,e};function pf(r,e){let t=r.text.substring(0,e),s=Ne.measureText(t,RD(r.style)).width;return r.x+s}var ID=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})}),n_=ID;var Gc={softness:1.25,easing:"linear",lineOverlap:0,lineDelay:0},BD=18,kD=64,l_={linear:r=>r,easeOutCubic:r=>1-(1-r)**3},FD=(r,e,t)=>Math.max(e,Math.min(t,r)),a_=(r,e)=>typeof r=="number"&&Number.isFinite(r)?r:e,Zs=(r={})=>{let e=r&&typeof r=="object"?r:{};return{softness:Math.max(0,a_(e.softness,Gc.softness)),easing:Object.prototype.hasOwnProperty.call(l_,e.easing)?e.easing:Gc.easing,lineOverlap:FD(a_(e.lineOverlap,Gc.lineOverlap),0,.95),lineDelay:Math.max(0,a_(e.lineDelay,Gc.lineDelay))}},c_=r=>l_[r]??l_[Gc.easing],u_=({maxLineHeight:r,softWipe:e})=>Math.max(BD,Math.min(kD,Math.round(r*e.softness)));var Ri=Symbol("textRevealRuntime"),mf=Symbol("textRevealSnapshot"),d_=50,OD=0,f_=100,h_=f_-1,xR=10,UD=120,LD=.9,GD=(r,e,t)=>Math.max(e,Math.min(t,r)),_R=(r=d_)=>typeof r!="number"||!Number.isFinite(r)?d_:Math.max(OD,Math.min(f_,r)),DD=r=>_R(r)>=f_,p_=r=>{let e=Math.min(_R(r),h_),i=(h_>0?e/h_:0)**LD;return xR*(UD/xR)**i},ND=r=>r?.revealEffect==="softWipe"?"softWipe":"typewriter",m_=r=>{let e=r?.initialRevealedCharacters;return typeof e!="number"||!Number.isFinite(e)?0:Math.max(0,Math.floor(e))},VD=r=>(r?.content??[]).reduce((e,t)=>e+(t.lineParts??[]).reduce((i,s)=>i+(s.text?.length??0),0),0),Ln=r=>r?.revealEffect==="none"||DD(r?.speed??d_),HD=r=>{let e=new Re(k.EMPTY);if(r?.indicator?.revealing?.src){let t=k.from(r.indicator.revealing.src);e=new Re(t),e.width=r.indicator.revealing.width??t.width,e.height=r.indicator.revealing.height??t.height}return e},cs=(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},Ii=(r,e,t)=>{r.x=t,r.y=e?e.y+(e.lineMaxHeight-r.height):0},Qs=(r,e,t)=>{if(!e||e.text.length===0){r.x=t;return}r.x=pf(e,e.text.length-1)+t},WD=(r,e)=>{if(r[Ri]){let t=r[Ri];delete r[Ri],t()}r[Ri]=e},zD=r=>r?.[mf]??null,Dc=(r,e)=>r?e?(r[mf]=e,e):(delete r[mf],null):null,bR=r=>{let e=zD(r);return!e||e.mode!=="typewriter"||e.completed===!0?null:e},vR=r=>!!bR(r),g_=r=>{if(r[Ri]){let t=r[Ri];delete r[Ri],t()}delete r[mf],r.onRender=void 0,r.removeChildren().forEach(t=>{t.destroy({children:!0})})},x_=(r,e="",t="")=>{let i=new Ie(Mt(r.textStyle)),s=new dr({text:e,style:i,x:Math.round(r.x),y:Math.round(r.y)}),o=null;if(r.furigana){let n=new Ie(Mt(r.furigana.textStyle));o=new dr({text:t,style:n,x:Math.round(r.furigana.x),y:Math.round(r.furigana.y)})}return{text:s,furiganaText:o}},y_=(r,e)=>{let t=null,i=null,s=0,o=0,n=[];for(let a=0;a<e.content.length;a++){let l=e.content[a],c=new ie({label:`${e.id}-line-${a}`}),u=[],h=null,d=0;r.addChild(c),i=l,o=Math.max(o,l.lineMaxHeight??0);for(let f=0;f<l.lineParts.length;f++){let m=l.lineParts[f],{text:g,furiganaText:x}=x_(m,m.text,m.furigana?.text||"");x&&(c.addChild(x),u.push(x)),c.addChild(g),u.push(g),t=g,h=g,s+=m.text.length,d+=m.text.length}if(u.length>0){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()}},yR=({contentContainer:r,indicatorSprite:e,element:t})=>{let i=t?.indicator?.offset??12,{lastTextObject:s,lastChunk:o}=y_(r,t);Ii(e,o,i),Qs(e,s,i),cs(e,t)},$D=({contentContainer:r,indicatorSprite:e,element:t,revealedCharacters:i})=>{let s=t?.indicator?.offset??12,o=t.content[0]??null,n=VD(t),a=Math.min(i,Math.max(0,n)),l=null,c=null;if(a<=0){Ii(e,o,s);return}e:for(let u=0;u<t.content.length;u++){let h=t.content[u];for(let d=0;d<h.lineParts.length;d++){let f=h.lineParts[d],m=Math.min(f.text.length,a);if(m<=0)break e;let g=f.furigana?.text||"",x=g.length,y=f.text.length>0?Math.round(m/f.text.length*x):0,{text:T,furiganaText:p}=x_(f,f.text.substring(0,m),g.substring(0,y));if(p&&r.addChild(p),r.addChild(T),l=T,c=h,a-=m,m<f.text.length)break e}}c?(Ii(e,c,s),Qs(e,l,s)):Ii(e,o,s),i>=n&&cs(e,t)},XD=({contentContainer:r,indicatorSprite:e,element:t})=>{let i=m_(t);if(i<=0){let s=t?.indicator?.offset??12,o=t.content[0]??null;Ii(e,o,s);return}t.revealEffect==="softWipe"?ZD({contentContainer:r,indicatorSprite:e,element:t,revealedCharacters:i}):$D({contentContainer:r,indicatorSprite:e,element:t,revealedCharacters:i})},jD=async({contentContainer:r,indicatorSprite:e,element:t,signal:i,startAtCharacter:s=0,snapshot:o=null})=>{let n=p_(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;h<t.content.length;h++){if(i?.aborted||r.destroyed)return!1;let d=t.content[h],f=!1;Ii(e,d,a);for(let m=0;m<d.lineParts.length;m++){if(i?.aborted||r.destroyed)return!1;let g=d.lineParts[m],{text:x,furiganaText:y}=x_(g);y&&r.addChild(y),r.addChild(x);let T=g.text,p=g.furigana?.text||"",b=p.length,_=Math.min(T.length,u),S=T.length>0?Math.round(_/T.length*b):0;x.text=T.substring(0,_),y&&(y.text=p.substring(0,S)),u-=_,_>0&&(e.x=pf(x,_-1)+a);for(let E=_;E<T.length;E++){if(i?.aborted||r.destroyed)return!1;if(x.text=T.substring(0,E+1),e.x=pf(x,E)+a,f=!0,o&&(o.revealedCharacters+=1),y){let C=Math.round((E+1)/T.length*b);y.text=p.substring(0,C)}E<T.length-1&&await n_(l,i)}}h<t.content.length-1&&f&&await n_(c,i)}return cs(e,t),o&&(o.completed=!0),!0},TR=({lines:r,edgeWidth:e,baseDuration:t,softWipe:i})=>{let s=r.map(c=>{let u=Math.max(1,c.totalCharacters),h=1+e/Math.max(1,c.bounds.width);return u*h}),o=s.reduce((c,u)=>c+u,0),n=[],a=0,l=0;for(let c=0;c<r.length;c++){let u=s[c],h=o>0?Math.max(1,t*u/o):t,d=Math.max(0,a),f=d+h;n.push({...r[c],startTime:d,endTime:f,duration:h}),l=Math.max(l,f),a=f-h*i.lineOverlap+i.lineDelay}return{timedLines:n,duration:Math.max(1,Math.ceil(l))}},YD=({currentTime:r,line:e,easing:t})=>{let i=e.duration>0?(r-e.startTime)/e.duration:1;return t(Math.max(0,Math.min(i,1)))},qD=({progress:r,easingName:e})=>{let t=GD(r,0,1);return e==="easeOutCubic"?1-Math.cbrt(1-t):t},SR=({timedLines:r,initialRevealedCharacters:e,softWipe:t,easingName:i})=>{let s=Math.max(0,Math.floor(e)),o=s<=0,n=0,a=0;return{timedLines:r.map(c=>{let u=Math.max(0,c.totalCharacters??0),h=0,d=!1;if(!o&&s>0)if(u<=0||s>=u)s-=u,h=1,d=!0;else{let g=s/u;h=qD({progress:g,easingName:i}),s=0,o=!0}if(d)return{...c,startTime:-c.duration,endTime:0};o=!0;let f=h>0?-h*c.duration:Math.max(0,n),m=f+c.duration;return a=Math.max(a,m),n=m-c.duration*t.lineOverlap+t.lineDelay,{...c,startTime:f,endTime:m}}),duration:Math.max(1,Math.ceil(a))}},KD=r=>{r.forEach(e=>{e&&(e.line.container.mask===e.sprite&&(e.line.container.mask=null),e.sprite.parent&&e.sprite.parent.removeChild(e.sprite),e.sprite.destroy(),e.texture.destroy(!0))})},wR=({contentContainer:r,timedLines:e,edgeWidth:t})=>{let i=e.map(s=>{let o=document.createElement("canvas");o.width=Math.max(1,Math.ceil(s.bounds.width+t)),o.height=Math.max(1,Math.ceil(s.bounds.height));let n=o.getContext("2d");if(!n)return null;let a=qs(o),l=new Re(a);return l.x=Math.floor(s.bounds.x-t),l.y=Math.floor(s.bounds.y),s.container.mask=l,r.addChild(l),{canvas:o,context:n,texture:a,sprite:l,line:s,edgeWidth:t}});return i.some(s=>s===null)?(KD(i),null):i},ER=({timedLines:r,lineMasks:e,easing:t,indicatorSprite:i,indicatorOffset:s,currentTime:o})=>{let n=r[0],a=n.bounds.x;for(let l=0;l<r.length;l++){let c=r[l],u=e[l],h=YD({currentTime:o,line:c,easing:t}),{context:d,canvas:f,texture:m}=u;if(d.clearRect(0,0,f.width,f.height),h<=0){m.source.update();continue}let g=0,x=c.bounds.width+u.edgeWidth,y=u.edgeWidth,T=y+h*x,p=Math.max(y,T-u.edgeWidth);p>y&&(d.fillStyle="#ffffff",d.fillRect(y,g,Math.min(p-y,c.bounds.width),c.bounds.height));let b=Math.max(y,T-u.edgeWidth),_=Math.min(y+c.bounds.width,T);if(_>b){let S=d.createLinearGradient(b,0,_,0);S.addColorStop(0,"rgba(255, 255, 255, 1)"),S.addColorStop(1,"rgba(255, 255, 255, 0)"),d.fillStyle=S,d.fillRect(b,g,_-b,c.bounds.height)}m.source.update(),n=c,a=c.bounds.x+Math.min(c.bounds.width,Math.max(0,T-y))}Ii(i,n.chunk,s),i.x=a+s},ZD=({contentContainer:r,indicatorSprite:e,element:t,revealedCharacters:i})=>{let s=t?.indicator?.offset??12,{lines:o,lastTextObject:n,lastChunk:a,totalCharacters:l,maxLineHeight:c}=y_(r,t);if(Ii(e,a,s),o.length===0||l===0||i>=l||!o.some(T=>T.bounds.width>0&&T.bounds.height>0)||!globalThis.document){Qs(e,n,s),cs(e,t);return}let u=Zs(t.softWipe),h=c_(u.easing),d=u_({maxLineHeight:c,softWipe:u}),f=p_(t.speed??50),m=Math.max(1,Math.round(l/f*1e3)),g=TR({lines:o,edgeWidth:d,baseDuration:m,softWipe:u}),{timedLines:x}=SR({timedLines:g.timedLines,initialRevealedCharacters:i,softWipe:u,easingName:u.easing}),y=wR({contentContainer:r,timedLines:x,edgeWidth:d});if(!y){Qs(e,n,s),cs(e,t);return}ER({timedLines:x,lineMasks:y,easing:h,indicatorSprite:e,indicatorOffset:s,currentTime:0})},QD=({container:r,contentContainer:e,indicatorSprite:t,element:i,animationBus:s,completionTracker:o})=>{let n=i?.indicator?.offset??12,a=p_(i.speed??50),{lines:l,lastTextObject:c,lastChunk:u,totalCharacters:h,maxLineHeight:d}=y_(e,i),f=m_(i);if(Ii(t,u,n),l.length===0||h===0||f>=h||!l.some(I=>I.bounds.width>0&&I.bounds.height>0)||!globalThis.document||!s)return Qs(t,c,n),cs(t,i),!1;let m=Zs(i.softWipe),g=c_(m.easing),x=u_({maxLineHeight:d,softWipe:m}),y=Math.max(1,Math.round(h/a*1e3)),T=TR({lines:l,edgeWidth:x,baseDuration:y,softWipe:m}),{timedLines:p,duration:b}=SR({timedLines:T.timedLines,initialRevealedCharacters:f,softWipe:m,easingName:m.easing}),_=o.getVersion(),S=`${i.id}-soft-wipe`,E=wR({contentContainer:e,timedLines:p,edgeWidth:x});if(!E)return Qs(t,c,n),cs(t,i),!1;let C=!1,P=I=>{C||(C=!0,r[Ri]===R&&delete r[Ri],E.forEach(U=>{U.line.container.mask===U.sprite&&(U.line.container.mask=null),U.sprite.parent&&U.sprite.parent.removeChild(U.sprite),U.sprite.destroy(),U.texture.destroy(!0)}),I&&(Qs(t,c,n),cs(t,i)))},R=()=>{s.dispatch({type:"CANCEL",id:S}),P(!1)};return WD(r,R),o.track(_),s.dispatch({type:"START",payload:{id:S,driver:"custom",duration:b,applyFrame:I=>{ER({timedLines:p,lineMasks:E,easing:g,indicatorSprite:t,indicatorOffset:n,currentTime:Math.min(b,I)})},applyTargetState:()=>{P(!1)},onComplete:()=>{o.complete(_),P(!0)},onCancel:()=>{o.complete(_),P(!1)},isValid:()=>!!r&&!r.destroyed&&!e.destroyed&&!t.destroyed}}),!0},Bi=async({container:r,element:e,completionTracker:t,animationBus:i,zIndex:s,signal:o,playback:n="autoplay"})=>{if(o?.aborted||r.destroyed)return;let a=Ln(e),l=n==="resume"?bR(r):null,c=m_(e);if(n==="resume"&&!l)return;g_(r),r.zIndex=s;let u=new ie({label:`${e.id}-content`}),h=HD(e);r.addChild(u),r.addChild(h);try{if(n==="paused-initial"){a||Dc(r,{mode:ND(e),revealedCharacters:c,completed:!1}),a?(Dc(r,{mode:"none",completed:!0}),yR({contentContainer:u,indicatorSprite:h,element:e})):XD({contentContainer:u,indicatorSprite:h,element:e});return}let d=t.getVersion(),f=!1;if(a)t.track(d),Dc(r,{mode:"none",completed:!0}),yR({contentContainer:u,indicatorSprite:h,element:e}),f=!0;else if(e.revealEffect==="softWipe")if(Dc(r,{mode:"softWipe",revealedCharacters:c,completed:!1}),!QD({container:r,contentContainer:u,indicatorSprite:h,element:e,animationBus:i,completionTracker:t})&&!o?.aborted&&!r.destroyed)t.track(d),f=!0;else return;else{t.track(d);let m=l?.revealedCharacters??c,g=Dc(r,{mode:"typewriter",revealedCharacters:m,completed:!1});f=await jD({contentContainer:u,indicatorSprite:h,element:e,signal:o,startAtCharacter:m,snapshot:g})}f&&!o?.aborted&&!r.destroyed&&t.complete(d)}catch(d){if(d?.name!=="AbortError"&&!o?.aborted)throw d}};var gf=({suppressAnimations:r=!1,deferredMountOperations:e=[]}={})=>({suppressAnimations:r,deferredMountOperations:e}),AR=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":Bi({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;ff({animations:r.animations,animationBus:r.animationBus,completionTracker:r.completionTracker,element:r.element,targetState:r.targetState});return}},Nc=(r,e)=>{if(e?.type){if(!r?.suppressAnimations){AR(e);return}r.deferredMountOperations.push(e)}},Vc=r=>{r?.deferredMountOperations&&(r.deferredMountOperations.length=0)},CR=(r,e)=>Nc(r,{type:"play-animated-sprite",animatedSprite:e}),PR=(r,e)=>Nc(r,{type:"play-video",video:e}),MR=(r,{app:e,emitter:t,container:i,tickerCallback:s})=>Nc(r,{type:"start-particles",app:e,emitter:t,container:i,tickerCallback:s}),xf=(r,{container:e,element:t,completionTracker:i,animationBus:s,zIndex:o,signal:n})=>Nc(r,{type:"autoplay-text-reveal",container:e,element:t,completionTracker:i,animationBus:s,zIndex:o,signal:n}),RR=(r,{animations:e,animationBus:t,completionTracker:i,element:s,targetState:o})=>Nc(r,{type:"start-update-animations",animations:e,animationBus:t,completionTracker:i,element:s,targetState:o}),IR=r=>{if(!r?.deferredMountOperations?.length)return;let e=r.deferredMountOperations.splice(0);for(let t of e)AR(t)};var JD=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<r.length;n++)if(!pe(r[n],e[n]))return!1;return!0}let s=Object.keys(r),o=Object.keys(e);if(s.length!==o.length)return!1;for(let n of s)if(!JD.call(e,n)||!pe(r[n],e[n]))return!1;return!0};var Js=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 Js(t))e.add(i);return e};var BR=(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},yf=(r,e)=>r?r instanceof Map?r.get(e)??[]:r.filter(t=>t.targetId===e):[],eN=(r,e)=>yf(r,e).filter(t=>t.type==="update"),_f=(r,e)=>yf(r,e).find(t=>t.type==="transition")??null,Hc=(r=[],e,t=[])=>{for(let i of r){if(i?.id===e)return{element:i,ancestorIds:t};if(Array.isArray(i?.children)){let s=Hc(i.children,e,[...t,i.id]);if(s)return s}}return null},kR=(r,e)=>pe(r?.ancestorIds??null,e?.ancestorIds??null),tN=({subtreeRoot:r,nextAnimations:e,continuingAnimationId:t})=>{if(!r)return!1;let i=Js(r);for(let s of e??[])if(!(!s||s.id===t)&&i.has(s.targetId))return!0;return!1},__=(r={})=>r.type==="update"?JSON.stringify({type:r.type,tween:r.tween,playback:r.playback??null}):JSON.stringify({type:r.type,prev:r.prev??null,next:r.next??null,mask:r.mask??null,playback:r.playback??null}),rN=({prevState:r,nextState:e,animation:t})=>{let i=Hc(r?.elements,t.targetId),s=Hc(e?.elements,t.targetId);return i!==null&&s!==null&&kR(i,s)&&pe(i.element,s.element)},iN=({prevState:r,nextState:e,animation:t})=>{let i=Hc(r?.elements,t.targetId),s=Hc(e?.elements,t.targetId);return i===null&&s===null?!0:i===null||s===null||!kR(i,s)||!pe(i.element,s.element)?!1:!tN({subtreeRoot:s.element,nextAnimations:e?.animations,continuingAnimationId:t.id})},FR=({prevState:r,nextState:e,activeAnimations:t})=>{let i=new Set,s=t instanceof Map?t:new Map(t?.map(o=>[o.id,o])??[]);for(let o of e?.animations??[]){if(o?.playback?.continuity!=="persistent")continue;let n=s.get(o.id);if(n&&!(n.type!==o.type||n.targetId!==o.targetId||n.signature!==__(o))){if(o.type==="update"){rN({prevState:r,nextState:e,animation:o})&&i.add(o.id);continue}iN({prevState:r,nextState:e,animation:o})&&i.add(o.id)}}return{continuedAnimationIds:i}},sN=({animations:r,targetId:e,animationBus:t,completionTracker:i,element:s,targetState:o,onComplete:n,renderContext:a})=>{let l=eN(r,e),c=l.filter(h=>typeof t?.hasContext=="function"?t.hasContext(h.id):!1),u=l.filter(h=>!c.includes(h));if(l.length===0)return!1;if(u.length===0)return!0;if(a?.suppressAnimations){if(n)throw new Error("Deferred update animations do not support onComplete hooks.");return gR(s,u),RR(a,{animations:u,animationBus:t,completionTracker:i,element:s,targetState:o}),!0}return ff({animations:u,animationBus:t,completionTracker:i,element:s,targetState:o,onComplete:n}),!0};var J=sN;var OR=r=>!!r&&typeof r=="object"&&!Array.isArray(r),oN=(r,e)=>e===void 0?r:e===null||e===!1?null:OR(e)?{...OR(r)?r:{},...e}:e,ui=(r={},e={})=>{if(!e)return{...r};let t={...r,...e};return Object.prototype.hasOwnProperty.call(e,"shadow")&&(t.shadow=oN(r?.shadow,e.shadow)),t};var LR=Symbol("routeGraphicsTextAnchorRatios"),eo=Symbol("routeGraphicsTextLayoutState"),UR=(r,e)=>typeof r!="number"||r===0?0:e/r,b_=r=>r?.align??Le.align,nN=r=>{let e=r[eo];return e?.fixedWidth&&typeof e.layoutWidth=="number"?e.layoutWidth:typeof e?.measuredWidth=="number"?e.measuredWidth:r.width},aN=(r,e)=>{let t=Ne.measureText(String(r??""),new Ie(Mt(e,{includeShadow:!1})));return{width:t.width,height:t.height}},GR=r=>r?.shadow!==void 0&&r.shadow!==null&&r.shadow!==!1,S_=(r,e)=>GR(e)?aN(r.text,e):{width:r.width,height:r.height},v_=r=>{let e=r[eo];return typeof e?.measuredWidth=="number"?e.measuredWidth:r.width},lN=r=>{let e=r[eo];return typeof e?.measuredHeight=="number"?e.measuredHeight:r.height},DR=(r,e,t)=>{let i=!!e.__fixedWidth,s=t??S_(r,e.textStyle),o=s.width??e.measuredWidth??e.width,n=s.height??e.height??r.height;r[eo]={fixedWidth:i,layoutWidth:i?e.width:o,measuredWidth:o,measuredHeight:n}},T_=(r,e,t)=>{let i=Math.max(0,r-e);return t==="center"?i/2:t==="right"?i:0},w_=r=>{let e=r.measuredWidth??r.width,t=T_(r.width,e,b_(r.textStyle));return{x:r.x+t,y:r.y}},bf=(r,e)=>{let t=S_(r,e.textStyle),i=e.__fixedWidth&&typeof e.width=="number"?e.width:t.width,s=t.height,o=typeof e.__anchorXRatio=="number"?e.__anchorXRatio:UR(i,e.originX),n=typeof e.__anchorYRatio=="number"?e.__anchorYRatio:UR(s,e.originY);r[LR]={x:o,y:n},DR(r,e,t)},cN=r=>typeof r?.fontSize!="number"||r.fontSize===0||typeof r?.lineHeight!="number"?Le.lineHeight:r.lineHeight/r.fontSize,uN=(r,e)=>{if(!e)return r;let t=ui(r,e);if(e.fontSize!==void 0||e.lineHeight!==void 0){let i=e.lineHeight??cN(r);t.lineHeight=Math.round(t.fontSize*i)}return t},NR=(r,e,t)=>{let i=r[LR],s=nN(r),o=uN(e,t);if(!i){ci(r,o);return}let n=T_(s,v_(r),b_(r.style)),l=r.x-n+s*i.x,c=r.y+lN(r)*i.y;ci(r,o);let u=S_(r,o),d=r[eo]?.fixedWidth===!0?s:u.width,f=T_(d,u.width,b_(o));r.x=l-d*i.x+f,r.y=c-u.height*i.y,r[eo]={...r[eo]??{},layoutWidth:d,measuredWidth:u.width,measuredHeight:u.height}},vf=(r,e)=>{DR(r,e);let t=GR(e.textStyle)?e.measuredWidth??v_(r):v_(r),i=w_({...e,measuredWidth:t,width:e.__fixedWidth&&typeof e.width=="number"?e.width:t});r.x=i.x,r.y=i.y};var ze=(r,e=100)=>Math.min(Math.max(r??e,0),100)/100;var VR=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}},Rt=r=>{let e=VR(r);return e===void 0||e===0},HR=r=>VR(r)===2;var E_=Symbol.for("routeGraphics.setInheritedHover"),WR=Symbol.for("routeGraphics.treeInheritedHoverActive"),A_=Symbol.for("routeGraphics.setInheritedPress"),zR=Symbol.for("routeGraphics.treeInheritedPressActive"),C_=Symbol.for("routeGraphics.setInheritedRightPress"),$R=Symbol.for("routeGraphics.treeInheritedRightPressActive"),Gn=r=>Array.isArray(r?.children)?r.children:[],P_=({displayObject:r,symbol:e,source:t,isActive:i})=>{let s=r?.[e];typeof s=="function"&&s(t,i)},Tf=({displayObject:r,symbol:e})=>{r&&e in r&&delete r[e]},M_=({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:()=>{Tf({displayObject:r,symbol:e})}}},Dn=r=>Tf({displayObject:r,symbol:E_}),Sf=r=>Tf({displayObject:r,symbol:A_}),wf=r=>Tf({displayObject:r,symbol:C_}),us=({displayObject:r,onHoverChange:e})=>{let t=M_({displayObject:r,symbol:E_,onStateChange:e});return{setDirectHover:t.setDirectState,isHovering:t.isActive,destroy:t.destroy}},Nn=({displayObject:r,onPressChange:e})=>{let t=M_({displayObject:r,symbol:A_,onStateChange:e});return{setDirectPress:t.setDirectState,isPressed:t.isActive,destroy:t.destroy}},Vn=({displayObject:r,onPressChange:e})=>{let t=M_({displayObject:r,symbol:C_,onStateChange:e});return{setDirectPress:t.setDirectState,isPressed:t.isActive,destroy:t.destroy}},R_=r=>r?.[WR]===!0,I_=r=>r?.[zR]===!0,B_=r=>r?.[$R]===!0,Hn=({root:r,isHovered:e})=>{if(!r)return;r[WR]=e;let t=[...Gn(r)];for(;t.length>0;){let i=t.pop();P_({displayObject:i,symbol:E_,source:r,isActive:e}),t.push(...Gn(i))}},to=({root:r,isPressed:e})=>{if(!r)return;r[zR]=e;let t=[...Gn(r)];for(;t.length>0;){let i=t.pop();P_({displayObject:i,symbol:A_,source:r,isActive:e}),t.push(...Gn(i))}},ki=({root:r,isPressed:e})=>{if(!r)return;r[$R]=e;let t=[...Gn(r)];for(;t.length>0;){let i=t.pop();P_({displayObject:i,symbol:C_,source:r,isActive:e}),t.push(...Gn(i))}};var XR="__rtglScrollHandled",jR=r=>r?.payload&&typeof r.payload=="object"?r.payload:{},Pr=({canvas:r,displayObject:e,width:t,height:i,scrollUpEvent:s,scrollDownEvent:o,eventHandler:n})=>{if(!s&&!o)return;let a=!1,l=Number.isFinite(t)&&Number.isFinite(i)&&t>0&&i>0;e.eventMode="static",l&&(e.hitArea=new ee(0,0,Math.round(t),Math.round(i)));let c=(m,g)=>{g?.[XR]||(g&&(g[XR]=!0),m<0&&s&&n?n("scrollUp",{_event:{id:e.label},...jR(s)}):m>0&&o&&n&&n("scrollDown",{_event:{id:e.label},...jR(o)}))},u=()=>{a=!0},h=()=>{a=!1},d=m=>{m.preventDefault?.(),c(m.deltaY,m.nativeEvent)},f=m=>{a&&(m.preventDefault(),c(m.deltaY,m))};e.on("pointerover",u),e.on("pointerout",h),e.on("wheel",d),r?.addEventListener("wheel",f,{passive:!1}),e._cleanupScrollInteraction=()=>{a=!1,e.off("pointerover",u),e.off("pointerout",h),e.off("wheel",d),r?.removeEventListener("wheel",f),l&&(e.hitArea=null),delete e._cleanupScrollInteraction}},k_=({root:r})=>{r?._cleanupScrollInteraction?.(),r?.children?.forEach(e=>{k_({root:e})})};var Wn=r=>{r._cleanupScrollInteraction?.(),r.removeAllListeners("pointerover"),r.removeAllListeners("pointerout"),r.removeAllListeners("pointerdown"),r.removeAllListeners("pointerupoutside"),r.removeAllListeners("pointerup"),r.removeAllListeners("rightdown"),r.removeAllListeners("rightclick"),r.removeAllListeners("rightup"),r.removeAllListeners("rightupoutside"),r.removeAllListeners("wheel"),Dn(r),Sf(r),wf(r),r.cursor="auto",r.eventMode="auto"},Wc=({app:r,displayObject:e,textComputedNode:t,eventHandler:i,applyStyle:s})=>{let o=t?.hover,n=t?.click,a=t?.rightClick,l=t?.scrollUp,c=t?.scrollDown,u=null,h=null,d=null,f=()=>{let m=u?.isHovering()??!1,g=h?.isPressed()??!1;(d?.isPressed()??!1)&&a?.textStyle?s(a.textStyle):g&&n?.textStyle?s(n.textStyle):m&&o?.textStyle?s(o.textStyle):s()};if(o){let{cursor:m,soundSrc:g,payload:x}=o;e.eventMode="static",u=us({displayObject:e,onHoverChange:f});let y=()=>{u.setDirectHover(!0),x&&i&&i("hover",{_event:{id:e.label},...x}),m&&(e.cursor=m),g&&r.audioStage.add({id:`hover-${Date.now()}`,url:g,loop:!1})},T=()=>{u.setDirectHover(!1),e.cursor="auto"};e.on("pointerover",y),e.on("pointerout",T)}if(n){let{soundSrc:m,soundVolume:g,payload:x}=n;e.eventMode="static",h=Nn({displayObject:e,onPressChange:f});let y=b=>{Rt(b)&&h.setDirectPress(!0)},T=b=>{Rt(b)&&(h.setDirectPress(!1),x&&i&&i("click",{_event:{id:e.label},...x}),m&&r.audioStage.add({id:`click-${Date.now()}`,url:m,loop:!1,volume:ze(g)}))},p=()=>{h.setDirectPress(!1)};e.on("pointerdown",y),e.on("pointerup",T),e.on("pointerupoutside",p)}if(a){let{soundSrc:m,payload:g}=a;e.eventMode="static",d=Vn({displayObject:e,onPressChange:f});let x=()=>{d.setDirectPress(!0)},y=()=>{d.setDirectPress(!1)},T=()=>{d.setDirectPress(!1),g&&i&&i("rightClick",{_event:{id:e.label},...g}),m&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:m,loop:!1})},p=()=>{d.setDirectPress(!1)};e.on("rightdown",x),e.on("rightup",y),e.on("rightclick",T),e.on("rightupoutside",p)}(l||c)&&Pr({canvas:r.canvas,displayObject:e,scrollUpEvent:l,scrollDownEvent:c,eventHandler:i})};var KR=Symbol("routeGraphicsRichTextDisplay"),hN=r=>r?.align??Le.align,dN=(r,e,t)=>{let i=Math.max(0,r-e.width),s=0;return t==="center"?s=i/2:t==="right"&&(s=i),s-e.x},fN=r=>{r.removeChildren().forEach(t=>{t.destroy({children:!0})})},YR=({text:r,style:e,x:t,y:i})=>new dr({text:r,style:new Ie(Mt(e)),x:Math.round(t),y:Math.round(i)}),qR=(r,e)=>e?ui(r,e):r,ro=r=>Array.isArray(r?.content),ZR=r=>!!r?.[KR],QR=r=>({x:r.x,y:r.y}),zc=(r,e,t)=>{fN(r),r.label=e.id,r.x=Math.round(e.x??0),r.y=Math.round(e.y??0),r.alpha=e.alpha??1;let i=e.width??e.measuredWidth??0;for(let s=0;s<e.content.length;s++){let o=e.content[s],n=new ie({label:`${e.id}-line-${s}`});for(let l of o.lineParts??[])l.furigana&&n.addChild(YR({text:l.furigana.text,style:qR(l.furigana.textStyle,t),x:l.furigana.x,y:l.furigana.y})),n.addChild(YR({text:l.text,style:qR(l.textStyle,t),x:l.x,y:l.y}));let a=n.getLocalBounds();n.x=dN(i,a,hN(e.textStyle)),r.addChild(n)}r.hitArea=new ee(0,0,Math.max(0,i),Math.max(0,e.height??0))},JR=(r,e)=>{let t=new ie({label:r.id});return t[KR]=!0,t.zIndex=e,zc(t,r),t};var F_=r=>({...ro(r)?QR(r):w_(r),alpha:r.alpha}),O_=(r,e)=>{if(ro(r))return JR(r,e);let t=new dr({label:r.id});return t.zIndex=e,t.text=r.content,ci(t,r.textStyle),bf(t,r),t.alpha=r.alpha,vf(t,r),t},Ef=(r,e,t)=>{if(ro(e)){zc(r,e,t);return}NR(r,e.textStyle,t)},eI=({app:r,parent:e,element:t,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=O_(t,l);Wc({app:r,displayObject:c,textComputedNode:t,eventHandler:s,applyStyle:u=>Ef(c,t,u)}),e.addChild(c),J({animations:i,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:F_(t),renderContext:a})};var pN=(r,e)=>ZR(r)!==ro(e),mN=({app:r,parent:e,displayObject:t,textComputedNode:i,eventHandler:s,zIndex:o})=>{Wn(t);let n=O_(i,o);return Wc({app:r,displayObject:n,textComputedNode:i,eventHandler:s,applyStyle:a=>Ef(n,i,a)}),e.addChild(n),t.destroy({children:!0}),n},gN=(r,e)=>{r.text=e.content,ci(r,e.textStyle),bf(r,e),vf(r,e),r.alpha=e.alpha},xN=({displayObject:r,textComputedNode:e,app:t,eventHandler:i})=>{ro(e)?zc(r,e):gN(r,e),Wn(r),Wc({app:t,displayObject:r,textComputedNode:e,eventHandler:i,applyStyle:s=>Ef(r,e,s)})},tI=({app:r,parent:e,prevElement:t,nextElement:i,eventHandler:s,animations:o,animationBus:n,completionTracker:a,zIndex:l})=>{let c=e.children.find(d=>d.label===t.id);if(!c)return;c.zIndex=l;let u=()=>{if(!pe(t,i)){if(pN(c,i)){c=mN({app:r,parent:e,displayObject:c,textComputedNode:i,eventHandler:s,zIndex:l});return}xN({displayObject:c,textComputedNode:i,app:r,eventHandler:s})}};J({animations:o,targetId:t.id,animationBus:n,completionTracker:a,element:c,targetState:F_(i),onComplete:()=>{u()}})||u()};var rI=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o)return;J({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(Wn(o),o.destroy({children:!0}))}})||(Wn(o),o.destroy({children:!0}))};var iI=({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(Ks).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Ks).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===Ks.CONTAINER&&(e=r.width,t=r.height);let{x:i,y:s,originX:o,originY:n}=iI({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 yN=r=>typeof r!="number"||!Number.isFinite(r)?0:Math.max(0,Math.floor(r)),_N="top",bN=2,sI=["top","bottom"],vN=new Set(sI),TN=(r,e)=>{if(r===void 0)return _N;if(vN.has(r))return r;throw new Error(`Input Error: ${e}.placement must be one of ${sI.join(", ")}.`)},SN=(r,e)=>{if(r===void 0)return 0;if(typeof r=="number"&&Number.isFinite(r)&&r>=0)return r;throw new Error(`Input Error: ${e}.gap must be a finite number >= 0.`)},wN=({placement:r,gap:e,x:t,y:i,partWidth:s,partHeight:o,furiganaWidth:n,furiganaHeight:a})=>{let l=Math.round(t+(s-n)/2);return r==="bottom"?{x:l,y:i+o+e}:{x:l,y:i-a+bN-e}},EN=r=>r===`
1264
1264
  `||r==="\r",AN=r=>typeof r=="string"&&Ne.isBreakingSpace(r),CN=(r,e,t)=>{let i=0,s=0;for(;i<r.length&&s<e.length&&r[i]===e[s];)i+=1,s+=1;if(s<e.length){let a=Math.min(r.length,e.length);return{remainingText:r.slice(a),consumedExplicitNewline:!1}}let o=i,n=o;for(;n<r.length&&AN(r[n]);)n+=1;if(EN(r[n])){let a=n+1;return r[n]==="\r"&&r[n+1]===`
1265
- `&&(a+=1),{remainingText:r.slice(a),consumedExplicitNewline:!0}}return t?{remainingText:r.slice(n),consumedExplicitNewline:!1}:{remainingText:r.slice(o),consumedExplicitNewline:!1}},U_=(r,e,{minimumWidth:t=e}={})=>{let i=[],s=[],o=0,n=0,a=0,l=0,c=0,u=[...r],h=new WeakSet,d=Math.max(10,r.reduce((g,x)=>g+(x?.text?.length??0),0)*4),f=()=>{i.push({lineParts:[...s],y:n,lineMaxHeight:a}),o=0,n+=a,a=0,s=[]};for(;u.length>0;){if(c+=1,c>d)throw new Error("[parseTextRevealing] Failed to make progress while wrapping text.");let g=u[0];if(!g.text||g.text.length===0){u.shift();continue}let x=g.text,y=Math.max(1,Math.round(e-o)),T=g.textStyle.wordWrap?{...g.textStyle,wordWrapWidth:y}:g.textStyle,p=Ne.measureText(g.text,new Ie(Mt(T,{includeShadow:!1})));if(p.lineWidths[0]>y&&s.length>0){f();continue}let b=p.lines[0]??"",_=p.lines.length>1,S="",E=!1;if(p.lines.length===1&&g.text.endsWith(" ")&&!b.endsWith(" ")&&(b+=" "),b.length>0){let I=CN(x,b,_);S=I.remainingText,E=I.consumedExplicitNewline}if(b.length===0&&x.length>0){let I=x.match(/^\s+/)?.[0]??"";b=I.length>0?I:x[0],S=x.slice(b.length)}if(S===x){let I=x.match(/^\s+/)?.[0]??x[0]??"";if(I.length===0)throw new Error("[parseTextRevealing] Failed to consume text while wrapping.");b=I,S=x.slice(I.length)}let C=Ne.measureText(b,new Ie({...Mt(g.textStyle,{includeShadow:!1}),wordWrap:!1,breakWords:!1})),P=Math.max(0,Math.round(C.width??p.lineWidths[0]??0)),M={text:b,textStyle:T,height:C.height,x:o,y:n};if(g.furigana&&!h.has(g)){h.add(g);let I=Ne.measureText(g.furigana.text,new Ie(Mt(g.furigana.textStyle,{includeShadow:!1}))),U=wN({placement:g.furigana.placement,gap:g.furigana.gap,x:o,y:n,partWidth:P,partHeight:C.height,furiganaWidth:I.width,furiganaHeight:I.height}),A={text:g.furigana.text,textStyle:g.furigana.textStyle,x:U.x,y:U.y};M.furigana=A}s.push(M),a=Math.max(a,C.height),o+=P,l=Math.max(l,o),S&&S.length>0?g.text=S:u.shift(),(_||E)&&o>0&&f()}s.length>0&&i.push({lineParts:s,y:n,lineMaxHeight:a});for(let g=0;g<i.length;g++){let x=i[g].lineMaxHeight;i[g].lineParts=i[g].lineParts.map(y=>{let T=y.height;y.height&&delete y.height;let p=y.y+(x-T),b=y.furigana;return b&&(b.y=b.y-y.y+p),{...y,...b&&{furigana:b},y:p}})}let m=i.length>0?i[i.length-1].y+i[i.length-1].lineMaxHeight:0;return{chunks:i,width:Math.max(l,t),height:m}},L_=({content:r,defaultTextStyle:e,width:t})=>(r||[]).map((i,s)=>{let o=ui(e,i.textStyle);o.lineHeight=Math.round(o.lineHeight*o.fontSize),typeof t=="number"&&(o.wordWrapWidth=t,o.wordWrap=!0);let n=null;if(i.furigana){let l=ui(e,i.furigana.textStyle);l.lineHeight=Math.round(l.lineHeight*l.fontSize),typeof t=="number"&&(l.wordWrapWidth=t,l.wordWrap=!0),n={text:String(i.furigana.text),textStyle:l,placement:TN(i.furigana.placement,`content[${s}].furigana`),gap:SN(i.furigana.gap,`content[${s}].furigana`)}}return{text:String(i.text).replace(/ +$/,l=>"\xA0".repeat(l.length)),textStyle:o,...n&&{furigana:n}}}),oI=({state:r})=>{let e=ui({...Le,wordWrap:!0},r.textStyle),t=L_({content:r.content,defaultTextStyle:e,width:r.width||void 0}),i=r.width||500,{chunks:s,width:o,height:n}=U_(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},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.softWipe!==void 0&&{softWipe:Zs(r.softWipe)},...r.initialRevealedCharacters!==void 0&&{initialRevealedCharacters:yN(r.initialRevealedCharacters)},...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var PN=1e5,MN=(r,e)=>typeof r.width=="number"?r.width:e.wordWrap&&typeof e.wordWrapWidth=="number"&&Number.isFinite(e.wordWrapWidth)&&e.wordWrapWidth>0?e.wordWrapWidth:PN,nI=({state:r})=>{let e=Array.isArray(r.content),t=ui(Le,r.textStyle),i={...t};if(i.lineHeight=Math.round(i.fontSize*i.lineHeight),typeof r.width=="number"&&(i.wordWrapWidth=r.width,i.wordWrap=!0),e){let d=MN(r,t),f=L_({content:r.content,defaultTextStyle:t,width:typeof r.width=="number"?r.width:void 0}),{chunks:m,width:g,height:x}=U_(f,d,{minimumWidth:0}),y=Math.round(g),T=Math.round(x),p=typeof r.width=="number"?Math.round(r.width):y,_={...yt({...r,width:p,height:T}),content:m,measuredWidth:y,textStyle:{...i},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick},...r.scrollUp&&{scrollUp:r.scrollUp},...r.scrollDown&&{scrollDown:r.scrollDown}};return Object.defineProperties(_,{__anchorXRatio:{value:r.anchorX??0,enumerable:!1},__anchorYRatio:{value:r.anchorY??0,enumerable:!1},__fixedWidth:{value:typeof r.width=="number",enumerable:!1}}),_}let s=String(r.content??""),{width:o,height:n}=Ne.measureText(s,new Ie(Mt(i,{includeShadow:!1}))),a=Math.round(o),l=Math.round(n),c=typeof r.width=="number"?Math.round(r.width):a,h={...yt({...r,width:c,height:l}),content:s,measuredWidth:a,textStyle:{...i},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick},...r.scrollUp&&{scrollUp:r.scrollUp},...r.scrollDown&&{scrollDown:r.scrollDown}};return Object.defineProperties(h,{__anchorXRatio:{value:r.anchorX??0,enumerable:!1},__anchorYRatio:{value:r.anchorY??0,enumerable:!1},__fixedWidth:{value:typeof r.width=="number",enumerable:!1}}),h};var RN=it({type:"text",add:eI,update:tI,delete:rI,parse:nI});var IN=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,aI=({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:m,border:g,alpha:x,scaleX:y,scaleY:T}=t,p=new We;p.label=c,p.zIndex=n;let b={x:u,y:h,alpha:x};y!==void 0&&(b.scaleX=y),T!==void 0&&(b.scaleY=T),(()=>{p.clear(),p.rect(0,0,Math.round(d),Math.round(f)).fill(IN(m)),p.x=Math.round(u),p.y=Math.round(h),p.alpha=x,p.scale.x=1,p.scale.y=1,g&&p.stroke({color:g.color,alpha:g.alpha,width:Math.round(g.width)})})();let S=t?.hover,E=t?.click,C=t?.rightClick,P=t?.scrollUp,M=t?.scrollDown,I=t?.drag;if(S){let{cursor:U,soundSrc:A,payload:O}=S;p.eventMode="static";let F=()=>{O&&o&&o("hover",{_event:{id:p.label},...O}),U&&(p.cursor=U),A&&r.audioStage.add({id:`hover-${Date.now()}`,url:A,loop:!1})},R=()=>{p.cursor="auto"};p.on("pointerover",F),p.on("pointerout",R)}if(E){let{soundSrc:U,soundVolume:A,payload:O}=E;p.eventMode="static";let F=R=>{Rt(R)&&(O&&o&&o("click",{_event:{id:p.label},...O}),U&&r.audioStage.add({id:`click-${Date.now()}`,url:U,loop:!1,volume:ze(A)}))};p.on("pointerup",F)}if(C){let{soundSrc:U,payload:A}=C;p.eventMode="static";let O=()=>{A&&o&&o("rightClick",{_event:{id:p.label},...A}),U&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:U,loop:!1})};p.on("rightclick",O)}if((P||M)&&Pr({canvas:r.canvas,displayObject:p,width:d,height:f,scrollUpEvent:P,scrollDownEvent:M,eventHandler:o}),I){let{start:U,end:A,move:O}=I;p.eventMode="static";let F=()=>{p._isDragging=!0,U&&o&&o("dragStart",{_event:{id:p.label},...typeof U?.payload=="object"?U.payload:{}})},R=()=>{p._isDragging=!1,A&&o&&o("dragEnd",{_event:{id:p.label},...typeof A?.payload=="object"?A.payload:{}})},D=G=>{O&&o&&p._isDragging&&o("dragMove",{_event:{id:p.label,x:G.global.x,y:G.global.y},...typeof O?.payload=="object"?O.payload:{}})};p.on("pointerdown",F),p.on("pointerup",R),p.on("globalpointermove",D),p.on("pointerupoutside",R)}e.addChild(p),J({animations:i,targetId:c,animationBus:s,completionTracker:a,element:p,targetState:b,renderContext:l})};var BN=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,lI=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,eventHandler:n,zIndex:a,completionTracker:l})=>{let c=e.children.find(S=>S.label===t.id);if(!c)return;c.zIndex=a;let{x:u,y:h,width:d,height:f,fill:m,border:g,alpha:x,scaleX:y,scaleY:T}=i,p={x:u,y:h,alpha:x};y!==void 0&&(p.scaleX=y),T!==void 0&&(p.scaleY=T);let b=()=>{if(!pe(t,i)){c._cleanupScrollInteraction?.(),c.clear(),c.rect(0,0,Math.round(d),Math.round(f)).fill(BN(m)),c.x=Math.round(u),c.y=Math.round(h),c.alpha=x,c.scale.x=1,c.scale.y=1,g&&c.stroke({color:g.color,alpha:g.alpha,width:Math.round(g.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 S=i?.hover,E=i?.click,C=i?.rightClick,P=i?.scrollUp,M=i?.scrollDown,I=i?.drag;if(S){let{cursor:U,soundSrc:A,payload:O}=S;c.eventMode="static";let F=()=>{O&&n&&n("hover",{_event:{id:c.label},...O}),U&&(c.cursor=U),A&&r.audioStage.add({id:`hover-${Date.now()}`,url:A,loop:!1})},R=()=>{c.cursor="auto"};c.on("pointerover",F),c.on("pointerout",R)}if(E){let{soundSrc:U,soundVolume:A,payload:O}=E;c.eventMode="static";let F=R=>{Rt(R)&&(O&&n&&n("click",{_event:{id:c.label},...O}),U&&r.audioStage.add({id:`click-${Date.now()}`,url:U,loop:!1,volume:ze(A)}))};c.on("pointerup",F)}if(C){let{soundSrc:U,payload:A}=C;c.eventMode="static";let O=()=>{A&&n&&n("rightClick",{_event:{id:c.label},...A}),U&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:U,loop:!1})};c.on("rightclick",O)}if((P||M)&&Pr({canvas:r.canvas,displayObject:c,width:d,height:f,scrollUpEvent:P,scrollDownEvent:M,eventHandler:n}),I){let{start:U,end:A,move:O}=I;c.eventMode="static";let F=()=>{c._isDragging=!0,U&&n&&n("dragStart",{_event:{id:c.label},...typeof U?.payload=="object"?U.payload:{}})},R=()=>{c._isDragging=!1,A&&n&&n("dragEnd",{_event:{id:c.label},...typeof A?.payload=="object"?A.payload:{}})},D=G=>{O&&n&&c._isDragging&&n("dragMove",{_event:{id:c.label,x:G.global.x,y:G.global.y},...typeof O?.payload=="object"?O.payload:{}})};c.on("pointerdown",F),c.on("pointerup",R),c.on("globalpointermove",D),c.on("pointerupoutside",R)}}};J({animations:s,targetId:t.id,animationBus:o,completionTracker:l,element:c,targetState:p,onComplete:()=>{b()}})||b()};var cI=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o)return;J({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 uI=({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 kN=it({type:"rect",add:aI,update:lI,delete:cI,parse:uI});var G_="__routeGraphicsManagedFilters",FN=["shadow","blur"],ON=r=>(r[G_]||Object.defineProperty(r,G_,{value:new Map,enumerable:!1,configurable:!0}),r[G_]),UN=r=>r.filters?Array.isArray(r.filters)?r.filters:[r.filters]:[],LN=(r,e,t)=>{let i=new Set(e.values());t&&i.add(t);let s=UN(r).filter(a=>!i.has(a)),n=[...FN.map(a=>e.get(a)).filter(Boolean),...s];r.filters=n.length>0?n:null},D_=(r,e,t)=>{let i=ON(r),s=i.get(e);t?i.set(e,t):i.delete(e),LN(r,i,s),s&&s!==t&&s.destroy?.()};var dI="_routeGraphicsBlur",Cf="_routeGraphicsBlurFilter",N_="_routeGraphicsBlurOptions",GN=new Set([5,7,9,11,13,15]),Af={quality:4,kernelSize:5,repeatEdgePixels:!1},fI=r=>typeof r=="number"&&Number.isFinite(r),hI=(r,e)=>{if(!fI(r)||r<0)throw new Error(`Input Error: ${e} must be a finite number >= 0`)},hs=(r,e="blur")=>{if(r===void 0)return;if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(r.x===void 0||r.y===void 0)throw new Error(`Input Error: ${e}.x and ${e}.y are required`);hI(r.x,`${e}.x`),hI(r.y,`${e}.y`);let t=r.quality??Af.quality;if(!fI(t)||t<1)throw new Error(`Input Error: ${e}.quality must be a finite number >= 1`);let i=r.kernelSize??Af.kernelSize;if(!GN.has(i))throw new Error(`Input Error: ${e}.kernelSize must be one of 5, 7, 9, 11, 13, 15`);let s=r.repeatEdgePixels??Af.repeatEdgePixels;if(typeof s!="boolean")throw new Error(`Input Error: ${e}.repeatEdgePixels must be a boolean`);return{x:r.x,y:r.y,quality:t,kernelSize:i,repeatEdgePixels:s}},DN=(r,e)=>r?r instanceof Map?r.get(e)??[]:r.filter(t=>t?.targetId===e):[],Gt=(r,e)=>DN(r,e).some(t=>t?.type==="update"&&(t.tween?.blurX||t.tween?.blurY)),NN=r=>({get x(){return r.strengthX},set x(e){r.strengthX=Math.max(0,e)},get y(){return r.strengthY},set y(e){r.strengthY=Math.max(0,e)}}),VN=(r,e)=>{let t=r[N_];return r[Cf]&&t?.quality===e.quality&&t?.kernelSize===e.kernelSize&&t?.repeatEdgePixels===e.repeatEdgePixels},HN=r=>{D_(r,"blur",null),delete r[dI],delete r[Cf],delete r[N_]},ut=(r,e,{force:t=!1}={})=>{if(!e&&!t){HN(r);return}let i=e??{x:0,y:0,...Af},s=VN(r,i)?r[Cf]:new On({strengthX:i.x,strengthY:i.y,quality:i.quality,kernelSize:i.kernelSize});s.repeatEdgePixels=i.repeatEdgePixels,s.strengthX=i.x,s.strengthY=i.y,r[Cf]=s,r[N_]={quality:i.quality,kernelSize:i.kernelSize,repeatEdgePixels:i.repeatEdgePixels},r[dI]=NN(s),D_(r,"blur",s)},Dt=(r,{force:e=!1}={})=>!r?.blur&&!e?{}:{blurX:r?.blur?.x??0,blurY:r?.blur?.y??0};var pI=({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:m,alpha:g}=t,x=m?k.from(m):k.EMPTY,y=new Re(x);y.label=c,y.zIndex=l,y.x=Math.round(u),y.y=Math.round(h),y.width=Math.round(d),y.height=Math.round(f),y.alpha=g;let T=Gt(i,c);ut(y,t.blur,{force:T});let p=t?.hover,b=t?.click,_=t?.rightClick,S=t?.scrollUp,E=t?.scrollDown,C=null,P=null,M=null,I=()=>{let U=C?.isHovering()??!1,A=P?.isPressed()??!1;if((M?.isPressed()??!1)&&_?.src){let F=k.from(_.src);y.texture=F}else if(A&&b?.src){let F=k.from(b.src);y.texture=F}else if(U&&p?.src){let F=k.from(p.src);y.texture=F}else y.texture=x};if(p){let{cursor:U,soundSrc:A,payload:O}=p;y.eventMode="static",C=us({displayObject:y,onHoverChange:I});let F=()=>{C.setDirectHover(!0),O&&s&&s("hover",{_event:{id:y.label},...O}),U&&(y.cursor=U),A&&r.audioStage.add({id:`hover-${Date.now()}`,url:A,loop:!1})},R=()=>{C.setDirectHover(!1),y.cursor="auto"};y.on("pointerover",F),y.on("pointerout",R)}if(b){let{soundSrc:U,soundVolume:A,payload:O}=b;y.eventMode="static",P=Nn({displayObject:y,onPressChange:I});let F=G=>{Rt(G)&&P.setDirectPress(!0)},R=G=>{Rt(G)&&(P.setDirectPress(!1),O&&s&&s("click",{_event:{id:y.label},...O}),U&&r.audioStage.add({id:`click-${Date.now()}`,url:U,loop:!1,volume:ze(A)}))},D=()=>{P.setDirectPress(!1)};y.on("pointerdown",F),y.on("pointerup",R),y.on("pointerupoutside",D)}if(_){let{soundSrc:U,payload:A}=_;y.eventMode="static",M=Vn({displayObject:y,onPressChange:I});let O=()=>{M.setDirectPress(!0)},F=()=>{M.setDirectPress(!1)},R=()=>{M.setDirectPress(!1),A&&s&&s("rightClick",{_event:{id:y.label},...A}),U&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:U,loop:!1})},D=()=>{M.setDirectPress(!1)};y.on("rightdown",O),y.on("rightup",F),y.on("rightclick",R),y.on("rightupoutside",D)}(S||E)&&Pr({canvas:r.canvas,displayObject:y,scrollUpEvent:S,scrollDownEvent:E,eventHandler:s}),e.addChild(y),J({animations:i,targetId:c,animationBus:o,completionTracker:n,element:y,targetState:{x:u,y:h,width:d,height:f,alpha:g,...Dt(t,{force:T})},renderContext:a})};var mI=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(p=>p.label===t.id);if(!c)return;c.zIndex=l;let{x:u,y:h,width:d,height:f,src:m,alpha:g}=i,x=Gt(s,t.id);x&&ut(c,t.blur,{force:!0});let y=()=>{if(!pe(t,i)){c._cleanupScrollInteraction?.();let p=m?k.from(m):k.EMPTY;c.texture=p,c.x=Math.round(u),c.y=Math.round(h),c.width=Math.round(d),c.height=Math.round(f),c.alpha=g,ut(c,i.blur,{force:x}),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"),c.removeAllListeners("wheel"),Dn(c),Sf(c),wf(c);let b=i?.hover,_=i?.click,S=i?.rightClick,E=i?.scrollUp,C=i?.scrollDown,P=null,M=null,I=null,U=()=>{let A=P?.isHovering()??!1,O=M?.isPressed()??!1;if((I?.isPressed()??!1)&&S?.src){let R=k.from(S.src);c.texture=R}else if(O&&_?.src){let R=k.from(_.src);c.texture=R}else if(A&&b?.src){let R=k.from(b.src);c.texture=R}else c.texture=p};if(b){let{cursor:A,soundSrc:O,payload:F}=b;c.eventMode="static",P=us({displayObject:c,onHoverChange:U});let R=()=>{P.setDirectHover(!0),F&&a&&a("hover",{_event:{id:c.label},...F}),A&&(c.cursor=A),O&&r.audioStage.add({id:`hover-${Date.now()}`,url:O,loop:!1})},D=()=>{P.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",R),c.on("pointerout",D)}if(_){let{soundSrc:A,soundVolume:O,payload:F}=_;c.eventMode="static",M=Nn({displayObject:c,onPressChange:U});let R=N=>{Rt(N)&&M.setDirectPress(!0)},D=N=>{Rt(N)&&(M.setDirectPress(!1),F&&a&&a("click",{_event:{id:c.label},...F}),A&&r.audioStage.add({id:`click-${Date.now()}`,url:A,loop:!1,volume:ze(O)}))},G=()=>{M.setDirectPress(!1)};c.on("pointerdown",R),c.on("pointerup",D),c.on("pointerupoutside",G)}if(S){let{soundSrc:A,payload:O}=S;c.eventMode="static",I=Vn({displayObject:c,onPressChange:U});let F=()=>{I.setDirectPress(!0)},R=()=>{I.setDirectPress(!1)},D=()=>{I.setDirectPress(!1),O&&a&&a("rightClick",{_event:{id:c.label},...O}),A&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:A,loop:!1})},G=()=>{I.setDirectPress(!1)};c.on("rightdown",F),c.on("rightup",R),c.on("rightclick",D),c.on("rightupoutside",G)}(E||C)&&Pr({canvas:r.canvas,displayObject:c,scrollUpEvent:E,scrollDownEvent:C,eventHandler:a})}};J({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:u,y:h,width:d,height:f,alpha:g,...Dt(i,{force:x})},onComplete:()=>{y()}})||y()};var gI=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.children.find(a=>a.label===e.id);if(!o)return;J({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 xI=({state:r})=>({...yt(r),src:r.src??"",alpha:r.alpha??1,...r.blur!==void 0&&{blur:hs(r.blur)},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick},...r.scrollUp&&{scrollUp:r.scrollUp},...r.scrollDown&&{scrollDown:r.scrollDown}});var WN=it({type:"sprite",add:pI,update:mI,delete:gI,parse:xI});var zN=r=>!r||r.ended?!0:Number.isFinite(r.duration)&&r.duration>0&&r.currentTime>=r.duration,V_=({videoElement:r,video:e})=>{e&&r?._videoEndedListener&&e.removeEventListener("ended",r._videoEndedListener),r&&(r._videoEndedListener=void 0,r._playbackStateVersion=null)},Pf=({videoElement:r,video:e,loop:t,completionTracker:i})=>{if(V_({videoElement:r,video:e}),(t??!1)||zN(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 yI=({parent:r,element:e,animations:t,animationBus:i,renderContext:s,completionTracker:o,zIndex:n})=>{let{id:a,x:l,y:c,width:u,height:h,src:d,volume:f,loop:m,alpha:g}=e,x=k.from(d),y=x.source.resource;y.pause(),y.currentTime=0,y.loop=m??!1,y.volume=ze(f),y.muted=!1;let T=new Re(x);T.label=a,T.zIndex=n,T._videoEndedListener=void 0,T._playbackStateVersion=null,T.x=Math.round(l),T.y=Math.round(c),T.width=Math.round(u),T.height=Math.round(h),T.alpha=g??1;let p=Gt(t,a);ut(T,e.blur,{force:p}),Pf({videoElement:T,video:y,loop:m,completionTracker:o}),PR(s,y),r.addChild(T),J({animations:t,targetId:a,animationBus:i,completionTracker:o,element:T,targetState:{x:l,y:c,width:u,height:h,alpha:g??1,...Dt(e,{force:p})},renderContext:s})};var _I=({parent:r,prevElement:e,nextElement:t,animations:i,animationBus:s,eventHandler:o,completionTracker:n,zIndex:a})=>{let l=r.children.find(y=>y.label===e.id);if(!l)return;l.zIndex=a;let{x:c,y:u,width:h,height:d,alpha:f}=t,m=Gt(i,e.id);m&&ut(l,e.blur,{force:!0});let g=()=>{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,ut(l,t.blur,{force:m});let y=l.texture.source.resource;if(e.src!==t.src){let T=y;V_({videoElement:l,video:T}),T&&T.pause();let p=k.from(t.src);l.texture=p,y=p.source.resource,y.muted=!1,y.pause(),y.currentTime=0}Pf({videoElement:l,video:y,loop:t.loop,completionTracker:n}),y.volume=ze(t.volume),y.loop=t.loop??!1,e.src!==t.src&&y.play()}};J({animations:i,targetId:e.id,animationBus:s,completionTracker:n,element:l,targetState:{x:c,y:u,width:h,height:d,alpha:f??1,...Dt(t,{force:m})},onComplete:g})||g()};var bI=({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()}};J({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var vI=({state:r})=>({...yt(r),src:r.src,volume:r.volume??100,loop:r.loop??!1,...r.blur!==void 0&&{blur:hs(r.blur)}});var $N=it({type:"video",add:yI,update:_I,delete:bI,parse:vI});var TI=0,SI=16,zn=Symbol("routeGraphicsSliderRuntime"),XN=(r,e)=>r!==null&&typeof r=="object"&&Object.prototype.hasOwnProperty.call(r,e),z_=r=>Math.max(0,Math.min(1,r)),wI=r=>r.initialValue??r.min,H_=r=>{if(!(!r||typeof r!="object")){if(typeof r.pointerId=="number")return r.pointerId;if(typeof r.nativeEvent?.pointerId=="number")return r.nativeEvent.pointerId;if(typeof r.data?.pointerId=="number")return r.data.pointerId}},jN=r=>{if(!r||typeof r!="object")return null;if(typeof r.clientX=="number"&&typeof r.clientY=="number")return{x:r.clientX,y:r.clientY};let e=r.changedTouches?.[0]??r.touches?.[0];return e&&typeof e.clientX=="number"&&typeof e.clientY=="number"?{x:e.clientX,y:e.clientY}:null},EI=r=>typeof globalThis.addEventListener=="function"&&typeof globalThis.removeEventListener=="function"&&typeof globalThis.document?.addEventListener=="function"&&typeof globalThis.document?.removeEventListener=="function"&&typeof r?.renderer?.events?.mapPositionToPoint=="function",YN=({app:r,nativeEvent:e})=>{let t=jN(e);if(!t)return null;let i={x:0,y:0};return r.renderer.events.mapPositionToPoint(i,t.x,t.y),i},AI=r=>{r.removeNativeDragListeners?.(),r.removeNativeDragListeners=null},qN=({runtime:r,moveListener:e,upListener:t})=>{if(!EI(r.app)||r.removeNativeDragListeners)return;let i=[],s=(o,n,a)=>{o.addEventListener(n,a,!0),i.push([o,n,a])};typeof globalThis.PointerEvent=="function"?(s(globalThis.document,"pointermove",e),s(globalThis,"pointerup",t),s(globalThis,"pointercancel",t)):(s(globalThis.document,"mousemove",e),s(globalThis,"mouseup",t),"ontouchstart"in globalThis&&(s(globalThis.document,"touchmove",e),s(globalThis,"touchend",t),s(globalThis,"touchcancel",t))),r.removeNativeDragListeners=()=>{for(let[o,n,a]of i)o.removeEventListener(n,a,!0)}},io=r=>r?k.from(r):k.EMPTY,$n=r=>({bar:`${r}-bar`,inactiveBar:`${r}-inactive-bar`,barMask:`${r}-bar-mask`,thumb:`${r}-thumb`}),CI=({sliderContainer:r,fromId:e,toId:t})=>{if(e===t)return;let i=$n(e),s=$n(t);for(let[o,n]of Object.entries(i)){let a=r.getChildByLabel(n);a&&(a.label=s[o])}},Xn=({sliderContainer:r,id:e})=>{let t=$n(e);return{bar:r.getChildByLabel(t.bar),inactiveBar:r.getChildByLabel(t.inactiveBar),barMask:r.getChildByLabel(t.barMask),thumb:r.getChildByLabel(t.thumb)}},W_=({baseValue:r,override:e,key:t})=>XN(e,t)?e[t]??"":r??"",KN=(r,e=null)=>({thumbSrc:W_({baseValue:r.thumbSrc,override:e,key:"thumbSrc"}),barSrc:W_({baseValue:r.barSrc,override:e,key:"barSrc"}),inactiveBarSrc:W_({baseValue:r.inactiveBarSrc,override:e,key:"inactiveBarSrc"})}),ZN=r=>{let e=new Re(k.EMPTY);return e.label=r,e.eventMode="static",e.zIndex=0,e},QN=r=>{let e=new We;return e.label=r,e.zIndex=0,e},JN=({sliderContainer:r,id:e,bar:t})=>{let i=$n(e),{inactiveBar:s,barMask:o}=Xn({sliderContainer:r,id:e});return s||(s=ZN(i.inactiveBar),r.addChild(s)),o||(o=QN(i.barMask),r.addChild(o)),t.mask=o,{inactiveBar:s,barMask:o}},e3=({sliderContainer:r,id:e,bar:t})=>{let{inactiveBar:i,barMask:s}=Xn({sliderContainer:r,id:e});t?.mask===s&&(t.mask=null),i&&(r.removeChild(i),i.destroy()),s&&(r.removeChild(s),s.destroy())},PI=({currentValue:r,min:e,max:t})=>{let i=t-e;return i<=0?0:z_((r-e)/i)},t3=({barMask:r,direction:e,width:t,height:i,currentValue:s,min:o,max:n})=>{if(!r)return;let a=PI({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})},r3=({thumb:r,direction:e,currentValue:t,min:i,max:s,trackWidth:o,trackHeight:n})=>{let a=PI({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)},Rf=({thumb:r,thumbSrc:e,direction:t,trackWidth:i,trackHeight:s})=>{let o=t==="horizontal"?s-TI*2:i-TI*2,n=io(e),a=n.width||SI,l=n.height||SI,c=o/a,u=o/l,h=Math.min(c,u);r.width=a*h,r.height=l*h},i3=({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}=KN(e,s),{bar:m}=Xn({sliderContainer:r,id:o});if(m){if(m.texture=io(h),m.width=n,m.height=a,t.texture=io(f),d){let{inactiveBar:g,barMask:x}=JN({sliderContainer:r,id:o,bar:m});g.texture=io(d),g.width=n,g.height=a,t3({barMask:x,direction:l,width:n,height:a,currentValue:i,min:c,max:u})}else e3({sliderContainer:r,id:o,bar:m});r3({thumb:t,direction:l,currentValue:i,min:c,max:u,trackWidth:n,trackHeight:a})}},s3=({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=z_(h/d)}else{let h=r.y-e.height/2,d=Math.max(a-e.height,1);c=z_(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},MI=({sliderContainer:r,sliderComputedNode:e,cursor:t})=>{let i=t??"auto",{bar:s,inactiveBar:o,thumb:n}=Xn({sliderContainer:r,id:e.id});r.cursor=i,s&&(s.cursor=i),o&&(o.cursor=i),n&&(n.cursor=i)},$c=r=>{i3({sliderContainer:r.sliderContainer,sliderComputedNode:r.sliderComputedNode,thumb:r.thumb,currentValue:r.currentValue,hoverOverride:r.sliderComputedNode.hover&&r.hoverController?.isHovering()?r.sliderComputedNode.hover:null})},Mf=r=>{let e=r.hoverController?.isHovering()===!0?r.sliderComputedNode.hover?.cursor:null;MI({sliderContainer:r.sliderContainer,sliderComputedNode:r.sliderComputedNode,cursor:e})},RI=({app:r,sliderContainer:e,sliderComputedNode:t,thumb:i,eventHandler:s})=>{let o=e[zn];return o||(Dn(e),o={app:r,sliderContainer:e,sliderComputedNode:t,thumb:i,eventHandler:s,currentValue:wI(t),isDragging:!1,activePointerId:void 0,listenersBound:!1,hoverController:null,removeNativeDragListeners:null},o.hoverController=us({displayObject:e,onHoverChange:()=>{$c(o),Mf(o)}}),e[zn]=o),o.app=r,o.sliderContainer=e,o.sliderComputedNode=t,o.thumb=i,o.eventHandler=s,o},If=({app:r,sliderContainer:e,sliderComputedNode:t,thumb:i,eventHandler:s,adoptExternalValue:o=!0})=>{let n=RI({app:r,sliderContainer:e,sliderComputedNode:t,thumb:i,eventHandler:s});return o&&(n.currentValue=wI(t)),$c(n),Mf(n),n},II=({sliderContainer:r})=>{let e=r?.[zn];e&&(AI(e),e.hoverController?.destroy?.(),delete r[zn])},BI=({app:r,sliderContainer:e,sliderComputedNode:t,thumb:i,eventHandler:s})=>{let o=RI({app:r,sliderContainer:e,sliderComputedNode:t,thumb:i,eventHandler:s});if(o.listenersBound)return;o.listenersBound=!0;let n=m=>{let{sliderComputedNode:g}=o,x=o.sliderContainer.toLocal(m),y=s3({position:x,thumb:o.thumb,direction:g.direction,min:g.min,max:g.max,step:g.step,trackWidth:g.width,trackHeight:g.height});y!==o.currentValue&&(o.currentValue=y,$c(o),g.change?.payload&&o.eventHandler&&o.eventHandler("change",{_event:{id:g.id,value:o.currentValue},...g.change.payload}))},a=m=>{m?.global&&n(m.global)},l=m=>{let g=H_(m);o.activePointerId!==void 0&&g!==void 0&&g!==o.activePointerId||o.isDragging&&(o.isDragging=!1,o.activePointerId=void 0,AI(o))},c=m=>{if(!o.isDragging)return;let g=H_(m);if(o.activePointerId!==void 0&&g!==void 0&&g!==o.activePointerId)return;let x=YN({app:o.app,nativeEvent:m});x&&n(x)},u=m=>{o.isDragging=!0,o.activePointerId=H_(m),qN({runtime:o,moveListener:c,upListener:l}),a(m)},h=m=>{o.isDragging&&a(m)};e.on("pointerdown",u),EI(r)||e.on("globalpointermove",h),e.on("pointerup",l),e.on("pointerupoutside",l);let d=()=>{o.hoverController?.setDirectHover(!0),$c(o),Mf(o);let m=o.sliderComputedNode.hover;m&&(MI({sliderContainer:o.sliderContainer,sliderComputedNode:o.sliderComputedNode,cursor:m.cursor}),m.soundSrc&&o.app?.audioStage?.add({id:`hover-${Date.now()}`,url:m.soundSrc,loop:!1}))},f=()=>{o.isDragging||(o.hoverController?.setDirectHover(!1),$c(o),Mf(o))};e.on("pointerover",d),e.on("pointerout",f),e.on("pointerupoutside",f)};var kI=({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:m,thumbSrc:g,barSrc:x}=t,y=new ie;y.label=c,y.zIndex=l,y.x=u,y.y=h,y.alpha=m,y.sortableChildren=!0,y.eventMode="static";let T=$n(c),p=new Re(io(x));p.label=T.bar,p.eventMode="static",p.zIndex=1;let b=new Re(io(g));b.label=T.thumb,b.eventMode="static",b.zIndex=2,Rf({thumb:b,thumbSrc:g,direction:t.direction,trackWidth:d,trackHeight:f}),y.addChild(p),y.addChild(b),BI({app:r,sliderContainer:y,sliderComputedNode:t,thumb:b,eventHandler:n}),If({app:r,sliderContainer:y,sliderComputedNode:t,thumb:b,eventHandler:n}),e.addChild(y),J({animations:i,targetId:c,animationBus:s,completionTracker:o,element:y,targetState:{x:u,y:h,alpha:m},renderContext:a})};var FI=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(g=>g.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),CI({sliderContainer:c,fromId:t.id,toId:i.id});let{bar:g,thumb:x}=Xn({sliderContainer:c,id:i.id});if(g&&x&&Rf({thumb:x,thumbSrc:i.thumbSrc,direction:i.direction,trackWidth:i.width,trackHeight:i.height}),!g||!x)return;let y=c[zn]?.isDragging!==!0||t.initialValue!==i.initialValue;If({app:r,sliderContainer:c,sliderComputedNode:i,thumb:x,eventHandler:a,adoptExternalValue:y})}},{x:h,y:d,alpha:f}=i;J({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,alpha:f},onComplete:u})||u()};var OI=({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&&(II({sliderContainer:n}),n.destroy({children:!0}))};J({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var o3=(r,e,t)=>Math.max(e,Math.min(t,r)),UI=({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");let s=o3(r.initialValue,t,i);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:s,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var n3=it({type:"slider",add:kI,update:FI,delete:OI,parse:UI});var qn=Symbol("routeGraphicsInputRuntime"),Bf={top:10,right:12,bottom:10,left:12},jn={fill:"#FFFFFF",fillAlpha:1,strokeColor:"#2E2E2E",strokeWidth:1,strokeAlpha:1},kf={strokeColor:"#4A89FF",strokeWidth:2,strokeAlpha:1},LI={fill:"#4A89FF",alpha:.3},$_={fill:"#111111",width:2},a3=(r={})=>{let e=r.fontSize??Le.fontSize,t=r.lineHeight??Le.lineHeight;return typeof t!="number"?Math.round(e*Le.lineHeight):t>8?Math.round(t):Math.round(e*t)},Lf=(r={},e={})=>({...Le,...r,align:r.align??"left",lineHeight:a3(r),wordWrap:!1,breakWords:!1,wordWrapWidth:e.wordWrapWidth??0,whiteSpace:"pre"}),X_=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??Bf.top,right:r?.right??Bf.right,bottom:r?.bottom??Bf.bottom,left:r?.left??Bf.left},Yn=r=>String(r??"").replace(/\r\n/g,`
1265
+ `&&(a+=1),{remainingText:r.slice(a),consumedExplicitNewline:!0}}return t?{remainingText:r.slice(n),consumedExplicitNewline:!1}:{remainingText:r.slice(o),consumedExplicitNewline:!1}},U_=(r,e,{minimumWidth:t=e}={})=>{let i=[],s=[],o=0,n=0,a=0,l=0,c=0,u=[...r],h=new WeakSet,d=Math.max(10,r.reduce((g,x)=>g+(x?.text?.length??0),0)*4),f=()=>{i.push({lineParts:[...s],y:n,lineMaxHeight:a}),o=0,n+=a,a=0,s=[]};for(;u.length>0;){if(c+=1,c>d)throw new Error("[parseTextRevealing] Failed to make progress while wrapping text.");let g=u[0];if(!g.text||g.text.length===0){u.shift();continue}let x=g.text,y=Math.max(1,Math.round(e-o)),T=g.textStyle.wordWrap?{...g.textStyle,wordWrapWidth:y}:g.textStyle,p=Ne.measureText(g.text,new Ie(Mt(T,{includeShadow:!1})));if(p.lineWidths[0]>y&&s.length>0){f();continue}let b=p.lines[0]??"",_=p.lines.length>1,S="",E=!1;if(p.lines.length===1&&g.text.endsWith(" ")&&!b.endsWith(" ")&&(b+=" "),b.length>0){let I=CN(x,b,_);S=I.remainingText,E=I.consumedExplicitNewline}if(b.length===0&&x.length>0){let I=x.match(/^\s+/)?.[0]??"";b=I.length>0?I:x[0],S=x.slice(b.length)}if(S===x){let I=x.match(/^\s+/)?.[0]??x[0]??"";if(I.length===0)throw new Error("[parseTextRevealing] Failed to consume text while wrapping.");b=I,S=x.slice(I.length)}let C=Ne.measureText(b,new Ie({...Mt(g.textStyle,{includeShadow:!1}),wordWrap:!1,breakWords:!1})),P=Math.max(0,Math.round(C.width??p.lineWidths[0]??0)),R={text:b,textStyle:T,height:C.height,x:o,y:n};if(g.furigana&&!h.has(g)){h.add(g);let I=Ne.measureText(g.furigana.text,new Ie(Mt(g.furigana.textStyle,{includeShadow:!1}))),U=wN({placement:g.furigana.placement,gap:g.furigana.gap,x:o,y:n,partWidth:P,partHeight:C.height,furiganaWidth:I.width,furiganaHeight:I.height}),A={text:g.furigana.text,textStyle:g.furigana.textStyle,x:U.x,y:U.y};R.furigana=A}s.push(R),a=Math.max(a,C.height),o+=P,l=Math.max(l,o),S&&S.length>0?g.text=S:u.shift(),(_||E)&&o>0&&f()}s.length>0&&i.push({lineParts:s,y:n,lineMaxHeight:a});for(let g=0;g<i.length;g++){let x=i[g].lineMaxHeight;i[g].lineParts=i[g].lineParts.map(y=>{let T=y.height;y.height&&delete y.height;let p=y.y+(x-T),b=y.furigana;return b&&(b.y=b.y-y.y+p),{...y,...b&&{furigana:b},y:p}})}let m=i.length>0?i[i.length-1].y+i[i.length-1].lineMaxHeight:0;return{chunks:i,width:Math.max(l,t),height:m}},L_=({content:r,defaultTextStyle:e,width:t})=>(r||[]).map((i,s)=>{let o=ui(e,i.textStyle);o.lineHeight=Math.round(o.lineHeight*o.fontSize),typeof t=="number"&&(o.wordWrapWidth=t,o.wordWrap=!0);let n=null;if(i.furigana){let l=ui(e,i.furigana.textStyle);l.lineHeight=Math.round(l.lineHeight*l.fontSize),typeof t=="number"&&(l.wordWrapWidth=t,l.wordWrap=!0),n={text:String(i.furigana.text),textStyle:l,placement:TN(i.furigana.placement,`content[${s}].furigana`),gap:SN(i.furigana.gap,`content[${s}].furigana`)}}return{text:String(i.text).replace(/ +$/,l=>"\xA0".repeat(l.length)),textStyle:o,...n&&{furigana:n}}}),oI=({state:r})=>{let e=ui({...Le,wordWrap:!0},r.textStyle),t=L_({content:r.content,defaultTextStyle:e,width:r.width||void 0}),i=r.width||500,{chunks:s,width:o,height:n}=U_(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},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.softWipe!==void 0&&{softWipe:Zs(r.softWipe)},...r.initialRevealedCharacters!==void 0&&{initialRevealedCharacters:yN(r.initialRevealedCharacters)},...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var PN=1e5,MN=(r,e)=>typeof r.width=="number"?r.width:e.wordWrap&&typeof e.wordWrapWidth=="number"&&Number.isFinite(e.wordWrapWidth)&&e.wordWrapWidth>0?e.wordWrapWidth:PN,nI=({state:r})=>{let e=Array.isArray(r.content),t=ui(Le,r.textStyle),i={...t};if(i.lineHeight=Math.round(i.fontSize*i.lineHeight),typeof r.width=="number"&&(i.wordWrapWidth=r.width,i.wordWrap=!0),e){let d=MN(r,t),f=L_({content:r.content,defaultTextStyle:t,width:typeof r.width=="number"?r.width:void 0}),{chunks:m,width:g,height:x}=U_(f,d,{minimumWidth:0}),y=Math.round(g),T=Math.round(x),p=typeof r.width=="number"?Math.round(r.width):y,_={...yt({...r,width:p,height:T}),content:m,measuredWidth:y,textStyle:{...i},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick},...r.scrollUp&&{scrollUp:r.scrollUp},...r.scrollDown&&{scrollDown:r.scrollDown}};return Object.defineProperties(_,{__anchorXRatio:{value:r.anchorX??0,enumerable:!1},__anchorYRatio:{value:r.anchorY??0,enumerable:!1},__fixedWidth:{value:typeof r.width=="number",enumerable:!1}}),_}let s=String(r.content??""),{width:o,height:n}=Ne.measureText(s,new Ie(Mt(i,{includeShadow:!1}))),a=Math.round(o),l=Math.round(n),c=typeof r.width=="number"?Math.round(r.width):a,h={...yt({...r,width:c,height:l}),content:s,measuredWidth:a,textStyle:{...i},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick},...r.scrollUp&&{scrollUp:r.scrollUp},...r.scrollDown&&{scrollDown:r.scrollDown}};return Object.defineProperties(h,{__anchorXRatio:{value:r.anchorX??0,enumerable:!1},__anchorYRatio:{value:r.anchorY??0,enumerable:!1},__fixedWidth:{value:typeof r.width=="number",enumerable:!1}}),h};var RN=it({type:"text",add:eI,update:tI,delete:rI,parse:nI});var IN=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,aI=({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:m,border:g,alpha:x,scaleX:y,scaleY:T}=t,p=new We;p.label=c,p.zIndex=n;let b={x:u,y:h,alpha:x};y!==void 0&&(b.scaleX=y),T!==void 0&&(b.scaleY=T),(()=>{p.clear(),p.rect(0,0,Math.round(d),Math.round(f)).fill(IN(m)),p.x=Math.round(u),p.y=Math.round(h),p.alpha=x,p.scale.x=1,p.scale.y=1,g&&p.stroke({color:g.color,alpha:g.alpha,width:Math.round(g.width)})})();let S=t?.hover,E=t?.click,C=t?.rightClick,P=t?.scrollUp,R=t?.scrollDown,I=t?.drag;if(S){let{cursor:U,soundSrc:A,payload:O}=S;p.eventMode="static";let F=()=>{O&&o&&o("hover",{_event:{id:p.label},...O}),U&&(p.cursor=U),A&&r.audioStage.add({id:`hover-${Date.now()}`,url:A,loop:!1})},M=()=>{p.cursor="auto"};p.on("pointerover",F),p.on("pointerout",M)}if(E){let{soundSrc:U,soundVolume:A,payload:O}=E;p.eventMode="static";let F=M=>{Rt(M)&&(O&&o&&o("click",{_event:{id:p.label},...O}),U&&r.audioStage.add({id:`click-${Date.now()}`,url:U,loop:!1,volume:ze(A)}))};p.on("pointerup",F)}if(C){let{soundSrc:U,payload:A}=C;p.eventMode="static";let O=()=>{A&&o&&o("rightClick",{_event:{id:p.label},...A}),U&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:U,loop:!1})};p.on("rightclick",O)}if((P||R)&&Pr({canvas:r.canvas,displayObject:p,width:d,height:f,scrollUpEvent:P,scrollDownEvent:R,eventHandler:o}),I){let{start:U,end:A,move:O}=I;p.eventMode="static";let F=()=>{p._isDragging=!0,U&&o&&o("dragStart",{_event:{id:p.label},...typeof U?.payload=="object"?U.payload:{}})},M=()=>{p._isDragging=!1,A&&o&&o("dragEnd",{_event:{id:p.label},...typeof A?.payload=="object"?A.payload:{}})},D=G=>{O&&o&&p._isDragging&&o("dragMove",{_event:{id:p.label,x:G.global.x,y:G.global.y},...typeof O?.payload=="object"?O.payload:{}})};p.on("pointerdown",F),p.on("pointerup",M),p.on("globalpointermove",D),p.on("pointerupoutside",M)}e.addChild(p),J({animations:i,targetId:c,animationBus:s,completionTracker:a,element:p,targetState:b,renderContext:l})};var BN=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,lI=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,eventHandler:n,zIndex:a,completionTracker:l})=>{let c=e.children.find(S=>S.label===t.id);if(!c)return;c.zIndex=a;let{x:u,y:h,width:d,height:f,fill:m,border:g,alpha:x,scaleX:y,scaleY:T}=i,p={x:u,y:h,alpha:x};y!==void 0&&(p.scaleX=y),T!==void 0&&(p.scaleY=T);let b=()=>{if(!pe(t,i)){c._cleanupScrollInteraction?.(),c.clear(),c.rect(0,0,Math.round(d),Math.round(f)).fill(BN(m)),c.x=Math.round(u),c.y=Math.round(h),c.alpha=x,c.scale.x=1,c.scale.y=1,g&&c.stroke({color:g.color,alpha:g.alpha,width:Math.round(g.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 S=i?.hover,E=i?.click,C=i?.rightClick,P=i?.scrollUp,R=i?.scrollDown,I=i?.drag;if(S){let{cursor:U,soundSrc:A,payload:O}=S;c.eventMode="static";let F=()=>{O&&n&&n("hover",{_event:{id:c.label},...O}),U&&(c.cursor=U),A&&r.audioStage.add({id:`hover-${Date.now()}`,url:A,loop:!1})},M=()=>{c.cursor="auto"};c.on("pointerover",F),c.on("pointerout",M)}if(E){let{soundSrc:U,soundVolume:A,payload:O}=E;c.eventMode="static";let F=M=>{Rt(M)&&(O&&n&&n("click",{_event:{id:c.label},...O}),U&&r.audioStage.add({id:`click-${Date.now()}`,url:U,loop:!1,volume:ze(A)}))};c.on("pointerup",F)}if(C){let{soundSrc:U,payload:A}=C;c.eventMode="static";let O=()=>{A&&n&&n("rightClick",{_event:{id:c.label},...A}),U&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:U,loop:!1})};c.on("rightclick",O)}if((P||R)&&Pr({canvas:r.canvas,displayObject:c,width:d,height:f,scrollUpEvent:P,scrollDownEvent:R,eventHandler:n}),I){let{start:U,end:A,move:O}=I;c.eventMode="static";let F=()=>{c._isDragging=!0,U&&n&&n("dragStart",{_event:{id:c.label},...typeof U?.payload=="object"?U.payload:{}})},M=()=>{c._isDragging=!1,A&&n&&n("dragEnd",{_event:{id:c.label},...typeof A?.payload=="object"?A.payload:{}})},D=G=>{O&&n&&c._isDragging&&n("dragMove",{_event:{id:c.label,x:G.global.x,y:G.global.y},...typeof O?.payload=="object"?O.payload:{}})};c.on("pointerdown",F),c.on("pointerup",M),c.on("globalpointermove",D),c.on("pointerupoutside",M)}}};J({animations:s,targetId:t.id,animationBus:o,completionTracker:l,element:c,targetState:p,onComplete:()=>{b()}})||b()};var cI=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o)return;J({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 uI=({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 kN=it({type:"rect",add:aI,update:lI,delete:cI,parse:uI});var G_="__routeGraphicsManagedFilters",FN=["shadow","blur"],ON=r=>(r[G_]||Object.defineProperty(r,G_,{value:new Map,enumerable:!1,configurable:!0}),r[G_]),UN=r=>r.filters?Array.isArray(r.filters)?r.filters:[r.filters]:[],LN=(r,e,t)=>{let i=new Set(e.values());t&&i.add(t);let s=UN(r).filter(a=>!i.has(a)),n=[...FN.map(a=>e.get(a)).filter(Boolean),...s];r.filters=n.length>0?n:null},D_=(r,e,t)=>{let i=ON(r),s=i.get(e);t?i.set(e,t):i.delete(e),LN(r,i,s),s&&s!==t&&s.destroy?.()};var dI="_routeGraphicsBlur",Cf="_routeGraphicsBlurFilter",N_="_routeGraphicsBlurOptions",GN=new Set([5,7,9,11,13,15]),Af={quality:4,kernelSize:5,repeatEdgePixels:!1},fI=r=>typeof r=="number"&&Number.isFinite(r),hI=(r,e)=>{if(!fI(r)||r<0)throw new Error(`Input Error: ${e} must be a finite number >= 0`)},hs=(r,e="blur")=>{if(r===void 0)return;if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(r.x===void 0||r.y===void 0)throw new Error(`Input Error: ${e}.x and ${e}.y are required`);hI(r.x,`${e}.x`),hI(r.y,`${e}.y`);let t=r.quality??Af.quality;if(!fI(t)||t<1)throw new Error(`Input Error: ${e}.quality must be a finite number >= 1`);let i=r.kernelSize??Af.kernelSize;if(!GN.has(i))throw new Error(`Input Error: ${e}.kernelSize must be one of 5, 7, 9, 11, 13, 15`);let s=r.repeatEdgePixels??Af.repeatEdgePixels;if(typeof s!="boolean")throw new Error(`Input Error: ${e}.repeatEdgePixels must be a boolean`);return{x:r.x,y:r.y,quality:t,kernelSize:i,repeatEdgePixels:s}},DN=(r,e)=>r?r instanceof Map?r.get(e)??[]:r.filter(t=>t?.targetId===e):[],Gt=(r,e)=>DN(r,e).some(t=>t?.type==="update"&&(t.tween?.blurX||t.tween?.blurY)),NN=r=>({get x(){return r.strengthX},set x(e){r.strengthX=Math.max(0,e)},get y(){return r.strengthY},set y(e){r.strengthY=Math.max(0,e)}}),VN=(r,e)=>{let t=r[N_];return r[Cf]&&t?.quality===e.quality&&t?.kernelSize===e.kernelSize&&t?.repeatEdgePixels===e.repeatEdgePixels},HN=r=>{D_(r,"blur",null),delete r[dI],delete r[Cf],delete r[N_]},ut=(r,e,{force:t=!1}={})=>{if(!e&&!t){HN(r);return}let i=e??{x:0,y:0,...Af},s=VN(r,i)?r[Cf]:new On({strengthX:i.x,strengthY:i.y,quality:i.quality,kernelSize:i.kernelSize});s.repeatEdgePixels=i.repeatEdgePixels,s.strengthX=i.x,s.strengthY=i.y,r[Cf]=s,r[N_]={quality:i.quality,kernelSize:i.kernelSize,repeatEdgePixels:i.repeatEdgePixels},r[dI]=NN(s),D_(r,"blur",s)},Dt=(r,{force:e=!1}={})=>!r?.blur&&!e?{}:{blurX:r?.blur?.x??0,blurY:r?.blur?.y??0};var pI=({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:m,alpha:g}=t,x=m?k.from(m):k.EMPTY,y=new Re(x);y.label=c,y.zIndex=l,y.x=Math.round(u),y.y=Math.round(h),y.width=Math.round(d),y.height=Math.round(f),y.alpha=g;let T=Gt(i,c);ut(y,t.blur,{force:T});let p=t?.hover,b=t?.click,_=t?.rightClick,S=t?.scrollUp,E=t?.scrollDown,C=null,P=null,R=null,I=()=>{let U=C?.isHovering()??!1,A=P?.isPressed()??!1;if((R?.isPressed()??!1)&&_?.src){let F=k.from(_.src);y.texture=F}else if(A&&b?.src){let F=k.from(b.src);y.texture=F}else if(U&&p?.src){let F=k.from(p.src);y.texture=F}else y.texture=x};if(p){let{cursor:U,soundSrc:A,payload:O}=p;y.eventMode="static",C=us({displayObject:y,onHoverChange:I});let F=()=>{C.setDirectHover(!0),O&&s&&s("hover",{_event:{id:y.label},...O}),U&&(y.cursor=U),A&&r.audioStage.add({id:`hover-${Date.now()}`,url:A,loop:!1})},M=()=>{C.setDirectHover(!1),y.cursor="auto"};y.on("pointerover",F),y.on("pointerout",M)}if(b){let{soundSrc:U,soundVolume:A,payload:O}=b;y.eventMode="static",P=Nn({displayObject:y,onPressChange:I});let F=G=>{Rt(G)&&P.setDirectPress(!0)},M=G=>{Rt(G)&&(P.setDirectPress(!1),O&&s&&s("click",{_event:{id:y.label},...O}),U&&r.audioStage.add({id:`click-${Date.now()}`,url:U,loop:!1,volume:ze(A)}))},D=()=>{P.setDirectPress(!1)};y.on("pointerdown",F),y.on("pointerup",M),y.on("pointerupoutside",D)}if(_){let{soundSrc:U,payload:A}=_;y.eventMode="static",R=Vn({displayObject:y,onPressChange:I});let O=()=>{R.setDirectPress(!0)},F=()=>{R.setDirectPress(!1)},M=()=>{R.setDirectPress(!1),A&&s&&s("rightClick",{_event:{id:y.label},...A}),U&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:U,loop:!1})},D=()=>{R.setDirectPress(!1)};y.on("rightdown",O),y.on("rightup",F),y.on("rightclick",M),y.on("rightupoutside",D)}(S||E)&&Pr({canvas:r.canvas,displayObject:y,scrollUpEvent:S,scrollDownEvent:E,eventHandler:s}),e.addChild(y),J({animations:i,targetId:c,animationBus:o,completionTracker:n,element:y,targetState:{x:u,y:h,width:d,height:f,alpha:g,...Dt(t,{force:T})},renderContext:a})};var mI=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(p=>p.label===t.id);if(!c)return;c.zIndex=l;let{x:u,y:h,width:d,height:f,src:m,alpha:g}=i,x=Gt(s,t.id);x&&ut(c,t.blur,{force:!0});let y=()=>{if(!pe(t,i)){c._cleanupScrollInteraction?.();let p=m?k.from(m):k.EMPTY;c.texture=p,c.x=Math.round(u),c.y=Math.round(h),c.width=Math.round(d),c.height=Math.round(f),c.alpha=g,ut(c,i.blur,{force:x}),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"),c.removeAllListeners("wheel"),Dn(c),Sf(c),wf(c);let b=i?.hover,_=i?.click,S=i?.rightClick,E=i?.scrollUp,C=i?.scrollDown,P=null,R=null,I=null,U=()=>{let A=P?.isHovering()??!1,O=R?.isPressed()??!1;if((I?.isPressed()??!1)&&S?.src){let M=k.from(S.src);c.texture=M}else if(O&&_?.src){let M=k.from(_.src);c.texture=M}else if(A&&b?.src){let M=k.from(b.src);c.texture=M}else c.texture=p};if(b){let{cursor:A,soundSrc:O,payload:F}=b;c.eventMode="static",P=us({displayObject:c,onHoverChange:U});let M=()=>{P.setDirectHover(!0),F&&a&&a("hover",{_event:{id:c.label},...F}),A&&(c.cursor=A),O&&r.audioStage.add({id:`hover-${Date.now()}`,url:O,loop:!1})},D=()=>{P.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",M),c.on("pointerout",D)}if(_){let{soundSrc:A,soundVolume:O,payload:F}=_;c.eventMode="static",R=Nn({displayObject:c,onPressChange:U});let M=N=>{Rt(N)&&R.setDirectPress(!0)},D=N=>{Rt(N)&&(R.setDirectPress(!1),F&&a&&a("click",{_event:{id:c.label},...F}),A&&r.audioStage.add({id:`click-${Date.now()}`,url:A,loop:!1,volume:ze(O)}))},G=()=>{R.setDirectPress(!1)};c.on("pointerdown",M),c.on("pointerup",D),c.on("pointerupoutside",G)}if(S){let{soundSrc:A,payload:O}=S;c.eventMode="static",I=Vn({displayObject:c,onPressChange:U});let F=()=>{I.setDirectPress(!0)},M=()=>{I.setDirectPress(!1)},D=()=>{I.setDirectPress(!1),O&&a&&a("rightClick",{_event:{id:c.label},...O}),A&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:A,loop:!1})},G=()=>{I.setDirectPress(!1)};c.on("rightdown",F),c.on("rightup",M),c.on("rightclick",D),c.on("rightupoutside",G)}(E||C)&&Pr({canvas:r.canvas,displayObject:c,scrollUpEvent:E,scrollDownEvent:C,eventHandler:a})}};J({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:u,y:h,width:d,height:f,alpha:g,...Dt(i,{force:x})},onComplete:()=>{y()}})||y()};var gI=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.children.find(a=>a.label===e.id);if(!o)return;J({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 xI=({state:r})=>({...yt(r),src:r.src??"",alpha:r.alpha??1,...r.blur!==void 0&&{blur:hs(r.blur)},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick},...r.scrollUp&&{scrollUp:r.scrollUp},...r.scrollDown&&{scrollDown:r.scrollDown}});var WN=it({type:"sprite",add:pI,update:mI,delete:gI,parse:xI});var zN=r=>!r||r.ended?!0:Number.isFinite(r.duration)&&r.duration>0&&r.currentTime>=r.duration,V_=({videoElement:r,video:e})=>{e&&r?._videoEndedListener&&e.removeEventListener("ended",r._videoEndedListener),r&&(r._videoEndedListener=void 0,r._playbackStateVersion=null)},Pf=({videoElement:r,video:e,loop:t,completionTracker:i})=>{if(V_({videoElement:r,video:e}),(t??!1)||zN(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 yI=({parent:r,element:e,animations:t,animationBus:i,renderContext:s,completionTracker:o,zIndex:n})=>{let{id:a,x:l,y:c,width:u,height:h,src:d,volume:f,loop:m,alpha:g}=e,x=k.from(d),y=x.source.resource;y.pause(),y.currentTime=0,y.loop=m??!1,y.volume=ze(f),y.muted=!1;let T=new Re(x);T.label=a,T.zIndex=n,T._videoEndedListener=void 0,T._playbackStateVersion=null,T.x=Math.round(l),T.y=Math.round(c),T.width=Math.round(u),T.height=Math.round(h),T.alpha=g??1;let p=Gt(t,a);ut(T,e.blur,{force:p}),Pf({videoElement:T,video:y,loop:m,completionTracker:o}),PR(s,y),r.addChild(T),J({animations:t,targetId:a,animationBus:i,completionTracker:o,element:T,targetState:{x:l,y:c,width:u,height:h,alpha:g??1,...Dt(e,{force:p})},renderContext:s})};var _I=({parent:r,prevElement:e,nextElement:t,animations:i,animationBus:s,eventHandler:o,completionTracker:n,zIndex:a})=>{let l=r.children.find(y=>y.label===e.id);if(!l)return;l.zIndex=a;let{x:c,y:u,width:h,height:d,alpha:f}=t,m=Gt(i,e.id);m&&ut(l,e.blur,{force:!0});let g=()=>{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,ut(l,t.blur,{force:m});let y=l.texture.source.resource;if(e.src!==t.src){let T=y;V_({videoElement:l,video:T}),T&&T.pause();let p=k.from(t.src);l.texture=p,y=p.source.resource,y.muted=!1,y.pause(),y.currentTime=0}Pf({videoElement:l,video:y,loop:t.loop,completionTracker:n}),y.volume=ze(t.volume),y.loop=t.loop??!1,e.src!==t.src&&y.play()}};J({animations:i,targetId:e.id,animationBus:s,completionTracker:n,element:l,targetState:{x:c,y:u,width:h,height:d,alpha:f??1,...Dt(t,{force:m})},onComplete:g})||g()};var bI=({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()}};J({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var vI=({state:r})=>({...yt(r),src:r.src,volume:r.volume??100,loop:r.loop??!1,...r.blur!==void 0&&{blur:hs(r.blur)}});var $N=it({type:"video",add:yI,update:_I,delete:bI,parse:vI});var TI=0,SI=16,zn=Symbol("routeGraphicsSliderRuntime"),XN=(r,e)=>r!==null&&typeof r=="object"&&Object.prototype.hasOwnProperty.call(r,e),z_=r=>Math.max(0,Math.min(1,r)),wI=r=>r.initialValue??r.min,H_=r=>{if(!(!r||typeof r!="object")){if(typeof r.pointerId=="number")return r.pointerId;if(typeof r.nativeEvent?.pointerId=="number")return r.nativeEvent.pointerId;if(typeof r.data?.pointerId=="number")return r.data.pointerId}},jN=r=>{if(!r||typeof r!="object")return null;if(typeof r.clientX=="number"&&typeof r.clientY=="number")return{x:r.clientX,y:r.clientY};let e=r.changedTouches?.[0]??r.touches?.[0];return e&&typeof e.clientX=="number"&&typeof e.clientY=="number"?{x:e.clientX,y:e.clientY}:null},EI=r=>typeof globalThis.addEventListener=="function"&&typeof globalThis.removeEventListener=="function"&&typeof globalThis.document?.addEventListener=="function"&&typeof globalThis.document?.removeEventListener=="function"&&typeof r?.renderer?.events?.mapPositionToPoint=="function",YN=({app:r,nativeEvent:e})=>{let t=jN(e);if(!t)return null;let i={x:0,y:0};return r.renderer.events.mapPositionToPoint(i,t.x,t.y),i},AI=r=>{r.removeNativeDragListeners?.(),r.removeNativeDragListeners=null},qN=({runtime:r,moveListener:e,upListener:t})=>{if(!EI(r.app)||r.removeNativeDragListeners)return;let i=[],s=(o,n,a)=>{o.addEventListener(n,a,!0),i.push([o,n,a])};typeof globalThis.PointerEvent=="function"?(s(globalThis.document,"pointermove",e),s(globalThis,"pointerup",t),s(globalThis,"pointercancel",t)):(s(globalThis.document,"mousemove",e),s(globalThis,"mouseup",t),"ontouchstart"in globalThis&&(s(globalThis.document,"touchmove",e),s(globalThis,"touchend",t),s(globalThis,"touchcancel",t))),r.removeNativeDragListeners=()=>{for(let[o,n,a]of i)o.removeEventListener(n,a,!0)}},io=r=>r?k.from(r):k.EMPTY,$n=r=>({bar:`${r}-bar`,inactiveBar:`${r}-inactive-bar`,barMask:`${r}-bar-mask`,thumb:`${r}-thumb`}),CI=({sliderContainer:r,fromId:e,toId:t})=>{if(e===t)return;let i=$n(e),s=$n(t);for(let[o,n]of Object.entries(i)){let a=r.getChildByLabel(n);a&&(a.label=s[o])}},Xn=({sliderContainer:r,id:e})=>{let t=$n(e);return{bar:r.getChildByLabel(t.bar),inactiveBar:r.getChildByLabel(t.inactiveBar),barMask:r.getChildByLabel(t.barMask),thumb:r.getChildByLabel(t.thumb)}},W_=({baseValue:r,override:e,key:t})=>XN(e,t)?e[t]??"":r??"",KN=(r,e=null)=>({thumbSrc:W_({baseValue:r.thumbSrc,override:e,key:"thumbSrc"}),barSrc:W_({baseValue:r.barSrc,override:e,key:"barSrc"}),inactiveBarSrc:W_({baseValue:r.inactiveBarSrc,override:e,key:"inactiveBarSrc"})}),ZN=r=>{let e=new Re(k.EMPTY);return e.label=r,e.eventMode="static",e.zIndex=0,e},QN=r=>{let e=new We;return e.label=r,e.zIndex=0,e},JN=({sliderContainer:r,id:e,bar:t})=>{let i=$n(e),{inactiveBar:s,barMask:o}=Xn({sliderContainer:r,id:e});return s||(s=ZN(i.inactiveBar),r.addChild(s)),o||(o=QN(i.barMask),r.addChild(o)),t.mask=o,{inactiveBar:s,barMask:o}},e3=({sliderContainer:r,id:e,bar:t})=>{let{inactiveBar:i,barMask:s}=Xn({sliderContainer:r,id:e});t?.mask===s&&(t.mask=null),i&&(r.removeChild(i),i.destroy()),s&&(r.removeChild(s),s.destroy())},PI=({currentValue:r,min:e,max:t})=>{let i=t-e;return i<=0?0:z_((r-e)/i)},t3=({barMask:r,direction:e,width:t,height:i,currentValue:s,min:o,max:n})=>{if(!r)return;let a=PI({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})},r3=({thumb:r,direction:e,currentValue:t,min:i,max:s,trackWidth:o,trackHeight:n})=>{let a=PI({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)},Rf=({thumb:r,thumbSrc:e,direction:t,trackWidth:i,trackHeight:s})=>{let o=t==="horizontal"?s-TI*2:i-TI*2,n=io(e),a=n.width||SI,l=n.height||SI,c=o/a,u=o/l,h=Math.min(c,u);r.width=a*h,r.height=l*h},i3=({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}=KN(e,s),{bar:m}=Xn({sliderContainer:r,id:o});if(m){if(m.texture=io(h),m.width=n,m.height=a,t.texture=io(f),d){let{inactiveBar:g,barMask:x}=JN({sliderContainer:r,id:o,bar:m});g.texture=io(d),g.width=n,g.height=a,t3({barMask:x,direction:l,width:n,height:a,currentValue:i,min:c,max:u})}else e3({sliderContainer:r,id:o,bar:m});r3({thumb:t,direction:l,currentValue:i,min:c,max:u,trackWidth:n,trackHeight:a})}},s3=({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=z_(h/d)}else{let h=r.y-e.height/2,d=Math.max(a-e.height,1);c=z_(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},MI=({sliderContainer:r,sliderComputedNode:e,cursor:t})=>{let i=t??"auto",{bar:s,inactiveBar:o,thumb:n}=Xn({sliderContainer:r,id:e.id});r.cursor=i,s&&(s.cursor=i),o&&(o.cursor=i),n&&(n.cursor=i)},$c=r=>{i3({sliderContainer:r.sliderContainer,sliderComputedNode:r.sliderComputedNode,thumb:r.thumb,currentValue:r.currentValue,hoverOverride:r.sliderComputedNode.hover&&r.hoverController?.isHovering()?r.sliderComputedNode.hover:null})},Mf=r=>{let e=r.hoverController?.isHovering()===!0?r.sliderComputedNode.hover?.cursor:null;MI({sliderContainer:r.sliderContainer,sliderComputedNode:r.sliderComputedNode,cursor:e})},RI=({app:r,sliderContainer:e,sliderComputedNode:t,thumb:i,eventHandler:s})=>{let o=e[zn];return o||(Dn(e),o={app:r,sliderContainer:e,sliderComputedNode:t,thumb:i,eventHandler:s,currentValue:wI(t),isDragging:!1,activePointerId:void 0,listenersBound:!1,hoverController:null,removeNativeDragListeners:null},o.hoverController=us({displayObject:e,onHoverChange:()=>{$c(o),Mf(o)}}),e[zn]=o),o.app=r,o.sliderContainer=e,o.sliderComputedNode=t,o.thumb=i,o.eventHandler=s,o},If=({app:r,sliderContainer:e,sliderComputedNode:t,thumb:i,eventHandler:s,adoptExternalValue:o=!0})=>{let n=RI({app:r,sliderContainer:e,sliderComputedNode:t,thumb:i,eventHandler:s});return o&&(n.currentValue=wI(t)),$c(n),Mf(n),n},II=({sliderContainer:r})=>{let e=r?.[zn];e&&(AI(e),e.hoverController?.destroy?.(),delete r[zn])},BI=({app:r,sliderContainer:e,sliderComputedNode:t,thumb:i,eventHandler:s})=>{let o=RI({app:r,sliderContainer:e,sliderComputedNode:t,thumb:i,eventHandler:s});if(o.listenersBound)return;o.listenersBound=!0;let n=m=>{let{sliderComputedNode:g}=o,x=o.sliderContainer.toLocal(m),y=s3({position:x,thumb:o.thumb,direction:g.direction,min:g.min,max:g.max,step:g.step,trackWidth:g.width,trackHeight:g.height});y!==o.currentValue&&(o.currentValue=y,$c(o),g.change?.payload&&o.eventHandler&&o.eventHandler("change",{_event:{id:g.id,value:o.currentValue},...g.change.payload}))},a=m=>{m?.global&&n(m.global)},l=m=>{let g=H_(m);o.activePointerId!==void 0&&g!==void 0&&g!==o.activePointerId||o.isDragging&&(o.isDragging=!1,o.activePointerId=void 0,AI(o))},c=m=>{if(!o.isDragging)return;let g=H_(m);if(o.activePointerId!==void 0&&g!==void 0&&g!==o.activePointerId)return;let x=YN({app:o.app,nativeEvent:m});x&&n(x)},u=m=>{o.isDragging=!0,o.activePointerId=H_(m),qN({runtime:o,moveListener:c,upListener:l}),a(m)},h=m=>{o.isDragging&&a(m)};e.on("pointerdown",u),EI(r)||e.on("globalpointermove",h),e.on("pointerup",l),e.on("pointerupoutside",l);let d=()=>{o.hoverController?.setDirectHover(!0),$c(o),Mf(o);let m=o.sliderComputedNode.hover;m&&(MI({sliderContainer:o.sliderContainer,sliderComputedNode:o.sliderComputedNode,cursor:m.cursor}),m.soundSrc&&o.app?.audioStage?.add({id:`hover-${Date.now()}`,url:m.soundSrc,loop:!1}))},f=()=>{o.isDragging||(o.hoverController?.setDirectHover(!1),$c(o),Mf(o))};e.on("pointerover",d),e.on("pointerout",f),e.on("pointerupoutside",f)};var kI=({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:m,thumbSrc:g,barSrc:x}=t,y=new ie;y.label=c,y.zIndex=l,y.x=u,y.y=h,y.alpha=m,y.sortableChildren=!0,y.eventMode="static";let T=$n(c),p=new Re(io(x));p.label=T.bar,p.eventMode="static",p.zIndex=1;let b=new Re(io(g));b.label=T.thumb,b.eventMode="static",b.zIndex=2,Rf({thumb:b,thumbSrc:g,direction:t.direction,trackWidth:d,trackHeight:f}),y.addChild(p),y.addChild(b),BI({app:r,sliderContainer:y,sliderComputedNode:t,thumb:b,eventHandler:n}),If({app:r,sliderContainer:y,sliderComputedNode:t,thumb:b,eventHandler:n}),e.addChild(y),J({animations:i,targetId:c,animationBus:s,completionTracker:o,element:y,targetState:{x:u,y:h,alpha:m},renderContext:a})};var FI=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(g=>g.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),CI({sliderContainer:c,fromId:t.id,toId:i.id});let{bar:g,thumb:x}=Xn({sliderContainer:c,id:i.id});if(g&&x&&Rf({thumb:x,thumbSrc:i.thumbSrc,direction:i.direction,trackWidth:i.width,trackHeight:i.height}),!g||!x)return;let y=c[zn]?.isDragging!==!0||t.initialValue!==i.initialValue;If({app:r,sliderContainer:c,sliderComputedNode:i,thumb:x,eventHandler:a,adoptExternalValue:y})}},{x:h,y:d,alpha:f}=i;J({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,alpha:f},onComplete:u})||u()};var OI=({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&&(II({sliderContainer:n}),n.destroy({children:!0}))};J({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var o3=(r,e,t)=>Math.max(e,Math.min(t,r)),UI=({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");let s=o3(r.initialValue,t,i);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:s,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var n3=it({type:"slider",add:kI,update:FI,delete:OI,parse:UI});var qn=Symbol("routeGraphicsInputRuntime"),Bf={top:10,right:12,bottom:10,left:12},jn={fill:"#FFFFFF",fillAlpha:1,strokeColor:"#2E2E2E",strokeWidth:1,strokeAlpha:1},kf={strokeColor:"#4A89FF",strokeWidth:2,strokeAlpha:1},LI={fill:"#4A89FF",alpha:.3},$_={fill:"#111111",width:2},a3=(r={})=>{let e=r.fontSize??Le.fontSize,t=r.lineHeight??Le.lineHeight;return typeof t!="number"?Math.round(e*Le.lineHeight):t>8?Math.round(t):Math.round(e*t)},Lf=(r={},e={})=>({...Le,...r,align:r.align??"left",lineHeight:a3(r),wordWrap:!1,breakWords:!1,wordWrapWidth:e.wordWrapWidth??0,whiteSpace:"pre"}),X_=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??Bf.top,right:r?.right??Bf.right,bottom:r?.bottom??Bf.bottom,left:r?.left??Bf.left},Yn=r=>String(r??"").replace(/\r\n/g,`
1266
1266
  `).replace(/\r/g,`
1267
1267
  `),l3=(r,e,t)=>{let i=Math.max(0,r-e);return t==="center"?i/2:t==="right"?i:0},NI=r=>new Ie(Mt(r,{includeShadow:!1})),or=(r,e)=>Ne.measureText(r,NI(e)).width,ds=(r,e,t)=>Math.max(e,Math.min(t,r)),GI=({text:r,style:e,targetX:t})=>{let i=Number.isFinite(t)?t:0;if(i<=0||r.length===0)return 0;let s=or(r,e);if(i>=s)return r.length;for(let o=1;o<=r.length;o+=1){let n=or(r.slice(0,o-1),e),a=or(r.slice(0,o),e),l=n+(a-n)/2;if(i<l)return o-1}return r.length},DI=(r,e)=>{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}},c3=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}},u3=({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=c3(n);if(l&&(o=DI(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=DI(o,a)),{fullBounds:s,visibleBounds:o}},h3=(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},d3=({displayedValue:r,textStyle:e})=>{let t=or(r,e);return{lines:[{text:r,width:t,startIndex:0}],lineHeight:e.lineHeight,totalHeight:e.lineHeight,maxLineWidth:t,textValue:r}},f3=({displayedValue:r,textStyle:e})=>{let t=Yn(r),i=t.split(`
1268
1268
  `),s=i.map((a,l)=>({text:a,width:or(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}},p3=({element:r,displayedValue:e,textStyle:t})=>r.multiline?f3({displayedValue:e,textStyle:t}):d3({displayedValue:e,textStyle:t}),Ff=({value:r,index:e})=>{let t=Yn(r),i=ds(e,0,t.length),s=0,o=0;for(let n=0;n<i;n+=1){if(t[n]===`
@@ -1547,7 +1547,7 @@ fn mainFragment(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32>
1547
1547
 
1548
1548
  return vec4(outputValue, outputValue, outputValue, 1.0);
1549
1549
  }
1550
- `,$f=(r="red")=>{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])}},lB=$f("red"),Q_=(r,e)=>Ys.create({width:r,height:e,resolution:1}),D3=(r,e)=>{let t=new Ae({uMaskInvert:{value:e?1:0,type:"f32"},uMaskChannelWeights:{value:r,type:"vec4<f32>"}});return{filter:ai.from({gpu:{vertex:{source:aB,entryPoint:"mainVertex"},fragment:{source:aB,entryPoint:"mainFragment"}},gl:{vertex:dB,fragment:G3,name:"replace-mask-channel-filter"},resources:{maskChannelUniforms:t}}),maskChannelUniforms:t}},cB=({app:r,texture:e,width:t,height:i,channelWeights:s,invert:o=!1})=>{let n=k.from(e),a=new Re(n);a.width=t,a.height=i,a.filterArea=new ee(0,0,t,i);let l=new ie;l.addChild(a);let c=Q_(t,i),{filter:u}=D3(s,o);return a.filters=[u],r.renderer.render({container:l,target:c,clear:!0}),a.filters=[],l.destroy({children:!0}),u.destroy(),c},N3=(r,e,t,i)=>{if(!e)return{textures:[k.WHITE.source],channelWeights:$f("red"),invert:0,destroy:()=>{}};if(e.kind==="single"){let s=cB({app:r,texture:e.texture,width:t,height:i,channelWeights:$f(e.channel??"red"),invert:e.invert??!1});return{textures:[s.source],channelWeights:lB,invert:0,destroy:()=>{s.destroy(!0)}}}if(e.kind==="sequence"){let s=e.frames.map(o=>cB({app:r,texture:o.texture,width:t,height:i,channelWeights:$f(e.channel??"red"),invert:e.invert??!1}));return{textures:s.map(o=>o.source),channelWeights:lB,invert:0,destroy:()=>{for(let o of s)o.destroy(!0)}}}throw new Error(`Unsupported replace mask kind: ${e.kind}.`)},V3=()=>{let r=new Ae({uProgress:{value:0,type:"f32"},uSoftness:{value:.001,type:"f32"},uMaskMix:{value:0,type:"f32"},uMaskInvert:{value:0,type:"f32"},uMaskDirectReveal:{value:0,type:"f32"},uMaskChannelWeights:{value:new Float32Array([1,0,0,0]),type:"vec4<f32>"},uSecondaryMatrix:{value:new V,type:"mat3x3<f32>"},uSecondaryClamp:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"}});return{filter:ai.from({gpu:{vertex:{source:nB,entryPoint:"mainVertex"},fragment:{source:nB,entryPoint:"mainFragment"}},gl:{vertex:dB,fragment:L3,name:"replace-mask-filter"},resources:{replaceMaskUniforms:r,uNextTexture:k.EMPTY.source,uMaskTextureA:k.EMPTY.source,uMaskTextureB:k.EMPTY.source}}),replaceMaskUniforms:r}},H3=({progress:r=0,frames:e=[],sampleMode:t="hold"}={})=>{if(e.length<=1)return{fromIndex:0,toIndex:0,mix:0};let i=J_(r);if(t==="linear"){if(i<=e[0].at)return{fromIndex:0,toIndex:0,mix:0};let o=e.length-1;if(i>=e[o].at)return{fromIndex:o,toIndex:o,mix:0};for(let n=0;n<e.length-1;n++){let a=e[n],l=e[n+1];if(i<=l.at){let c=l.at-a.at;return{fromIndex:n,toIndex:n+1,mix:c===0?0:(i-a.at)/c}}}return{fromIndex:o,toIndex:o,mix:0}}let s=0;for(let o=1;o<e.length&&!(i<e[o].at);o++)s=o;return{fromIndex:s,toIndex:s,mix:0}},W3=(r,e,t,i,s)=>{let o=U3(e),n=jc([{timeline:o}]),a=Math.max(e?.softness??.001,1e-4),{textures:l,channelWeights:c,invert:u,destroy:h}=N3(r,e,t,i),d=s.resources.replaceMaskUniforms,f=-1,m=-1;return{duration:n,progressTimeline:o,apply:g=>{let x=e?.kind==="sequence"?H3({progress:g,frames:e.frames,sampleMode:e.sample??"hold"}):{fromIndex:0,toIndex:0,mix:0};x.fromIndex!==f&&(s.resources.uMaskTextureA=l[x.fromIndex]??k.EMPTY.source,f=x.fromIndex),x.toIndex!==m&&(s.resources.uMaskTextureB=l[x.toIndex]??k.EMPTY.source,m=x.toIndex),d.uniforms.uProgress=J_(g),d.uniforms.uSoftness=a,d.uniforms.uMaskMix=x.mix,d.uniforms.uMaskInvert=u,d.uniforms.uMaskDirectReveal=e?.kind==="sequence"?1:0,d.uniforms.uMaskChannelWeights=c,d.update()},destroy:h}},z3=(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])},$3=r=>{let e=new ie;for(let t of r)t?.wrapper&&e.addChild(t.wrapper);return hB(uB(e))},zf=({app:r,container:e,target:t,frame:i})=>{r.renderer.render({container:e,target:t,clear:!0,transform:new V(1,0,0,1,-i.x,-i.y)})},X3=(r,e)=>{!r||r.parent!==e||e.removeChild(r)},ms=(r,e)=>{r?.wrapper&&!r.wrapper.destroyed&&(fr({app:e,root:r.wrapper}),r.wrapper.destroy({children:!0})),r?.texture?.destroy(!0)},j3=({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})},Y3=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>{let o=new ie;o.zIndex=s,t?.wrapper&&o.addChild(t.wrapper),i?.wrapper&&o.addChild(i.wrapper);let n=Xf(t?.wrapper??null,e.prev?.tween,r),a=Xf(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(),fr({app:r,root:o}),o.destroy({children:!0}),ms(t,r),ms(i,r)}}},q3=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>{let o=$3([t,i]),n=new ie,a=new ie;t?.wrapper&&n.addChild(t.wrapper),i?.wrapper&&a.addChild(i.wrapper);let l=Q_(o.width,o.height),c=Q_(o.width,o.height),u=new ie;u.zIndex=s;let h=new Re(l);h.x=o.x,h.y=o.y,h.filterArea=new ee(0,0,o.width,o.height),u.addChild(h);let{filter:d}=V3();d.resources.uNextTexture=c.source,h.filters=[d];let f=z3(o.width,o.height),m=typeof d.apply=="function"?d.apply.bind(d):(b,_,S,E)=>{b.applyFilter(d,_,S,E)};d.apply=(b,_,S,E)=>{let C=d.resources.replaceMaskUniforms;b.calculateSpriteMatrix(C.uniforms.uSecondaryMatrix,h),C.uniforms.uSecondaryClamp=f,C.update(),m(b,_,S,E)};let g=W3(r,e.mask,o.width,o.height,d),x=Xf(t?.wrapper??null,e.prev?.tween,r),y=Xf(i?.wrapper??null,e.next?.tween,r),T=!1,p=!1;return t?.wrapper||zf({app:r,container:n,target:l,frame:o}),i?.wrapper||zf({app:r,container:a,target:c,frame:o}),{overlay:u,duration:Math.max(x.duration,y.duration,g.duration),apply:b=>{x.apply(b),y.apply(b),t?.wrapper&&(x.duration>0||!T)&&(zf({app:r,container:n,target:l,frame:o}),T=!0),i?.wrapper&&(y.duration>0||!p)&&(zf({app:r,container:a,target:c,frame:o}),p=!0);let _=J_(Yc(g.progressTimeline,b));g.apply(_)},destroy:()=>{u.removeFromParent(),h.filters=[],d.destroy(),fr({app:r,root:u}),fr({app:r,root:n}),fr({app:r,root:a}),u.destroy({children:!0}),n.destroy({children:!0}),a.destroy({children:!0}),l.destroy(!0),c.destroy(!0),ms(t,r),ms(i,r),g.destroy()}}},K3=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>e.mask?q3({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s}):Y3({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s}),Z3=({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},Q3=async r=>r&&typeof r.then=="function"?r:r??null,jf=({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 m=t?e.children.find(W=>W.label===t.id)??null:null;if(t&&!m)throw new Error(`Transition animation "${s.id}" could not find the previous element "${t.id}".`);let g=m?oB(r,m):null,x=s.playback?.continuity==="persistent",y=__(s),T=x?new AbortController:null,p=T?.signal??f,b=new ie,_=gf({suppressAnimations:!0}),S=!x,E=S?a.getVersion():null,C=!1,P=d,M=()=>{!S||C||(a.track(E),C=!0)},I=()=>{C&&(a.complete(E),C=!1)},U={value:null},A={value:null},O=!1,F=()=>{typeof n?.removePending=="function"&&n.removePending(s.id)},R=({zIndex:W}={})=>{typeof W=="number"&&(P=W,U.value&&!U.value.destroyed&&(U.value.zIndex=P),A.value?.overlay&&!A.value.overlay.destroyed&&(A.value.overlay.zIndex=P))},D=({flushDeferredEffects:W})=>{if(!O){if(O=!0,U.value&&!U.value.destroyed&&(U.value.visible=!0),A.value?.destroy(),W){IR(_);return}Vc(_)}};x&&typeof n?.registerPending=="function"&&n.registerPending({id:s.id,animationType:s.type,targetId:s.targetId,signature:y,continuity:"persistent",onCancel:()=>{T?.abort(),Vc(_),fr({app:r,root:b}),b.destroy({children:!0}),ms(g,r),I()},onContinuationUpdate:R}),M();let G=W=>{if(p?.aborted||e.destroyed){F(),Vc(_),fr({app:r,root:b}),b.destroy({children:!0}),ms(g,r),I();return}if(i&&!W)throw F(),Vc(_),I(),new Error(`Transition animation "${s.id}" could not create the next element "${i.id}".`);U.value=W;let se=W?oB(r,W):null,fe=j3({prevElement:t,nextElement:i,animation:s,prevSubject:g,nextSubject:se});fe.prevSubject!==g&&ms(g,r),fe.nextSubject!==se&&ms(se,r),X3(W,b),fr({app:r,root:b}),b.destroy({children:!0}),m&&h.delete({app:r,parent:e,element:t,animations:[],animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,signal:p}),W&&(W.zIndex=P,e.addChild(W),W.visible=!1);let Ee=K3({app:r,animation:s,prevSubject:fe.prevSubject,nextSubject:fe.nextSubject,zIndex:P});A.value=Ee,e.addChild(Ee.overlay);let ye={id:s.id,driver:"custom",animationType:s.type,targetId:s.targetId,signature:y,continuity:x?"persistent":"render",onContinuationUpdate:R,duration:Ee.duration,applyFrame:Ee.apply,applyTargetState:()=>{D({flushDeferredEffects:!1})},onComplete:()=>{try{D({flushDeferredEffects:!0})}finally{I()}},onCancel:()=>{I()},isValid:()=>!!Ee.overlay&&!Ee.overlay.destroyed&&(!W||!W.destroyed)};x&&typeof n?.activatePending=="function"&&n.activatePending(s.id,ye)||(F(),n.dispatch({type:"START",payload:ye}))},N=i?Z3({app:r,parent:b,nextElement:i,plugin:h,animations:o,eventHandler:l,animationBus:n,completionTracker:a,elementPlugins:c,renderContext:_,zIndex:d,signal:p}):null;if(N&&typeof N.then=="function"){Q3(N).then(G);return}G(N??null)};var no=({app:r,parent:e,prevComputedTree:t,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c=gf(),signal:u})=>{e.sortableChildren=!0;let h=new Map(l.map(_=>[_.type,_])),d=BR(s),f=new Map,m=new Map;for(let _ of t)f.set(_.id,_);for(let _=0;_<i.length;_++)m.set(i[_].id,_);let{toAddElement:g,toDeleteElement:x,toUpdateElement:y}=iB(t,i,s),T=new Set(y.map(({next:_})=>_.id)),p=_=>{let S=h.get(_);if(!S)throw new Error(`No plugin found for element type: ${_}`);return S},b=_=>e.children.find(S=>S.label===_)?.zIndex??-1;for(let _ of i){let S=f.get(_.id);!S||T.has(_.id)||!pe(S,_)||p(_.type).shouldUpdateUnchanged?.({app:r,parent:e,prevElement:S,nextElement:_,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:m.get(_.id)??-1,signal:u})!==!0||(y.push({prev:S,next:_}),T.add(_.id))}for(let _ of e.children){let S=m.get(_.label);S!==void 0&&(_.zIndex=S)}for(let _ of x){let S=c.suppressAnimations?null:_f(d,_.id),E=S&&typeof o?.hasContext=="function"&&o.hasContext(S.id),C=p(_.type);if(!E){if(S){jf({app:r,parent:e,prevElement:_,nextElement:null,animation:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:C,zIndex:b(_.id),signal:u});continue}C.delete({app:r,parent:e,element:_,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,signal:u})}}for(let _ of g){let S=c.suppressAnimations?null:_f(d,_.id),E=S&&typeof o?.hasContext=="function"&&o.hasContext(S.id),C=p(_.type),P=m.get(_.id)??-1;if(E){typeof o?.updateContinuation=="function"&&o.updateContinuation(S.id,{zIndex:P});continue}if(S){jf({app:r,parent:e,prevElement:null,nextElement:_,animation:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:C,zIndex:P,signal:u});continue}C.add({app:r,parent:e,element:_,animations:d,eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,renderContext:c,zIndex:P,signal:u})}for(let{prev:_,next:S}of y){let E=p(S.type),C=m.get(S.id)??-1,P=c.suppressAnimations?null:_f(d,S.id);if(P&&typeof o?.hasContext=="function"&&o.hasContext(P.id))typeof o?.updateContinuation=="function"&&o.updateContinuation(P.id,{zIndex:C});else if(P){jf({app:r,parent:e,prevElement:_,nextElement:S,animation:P,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:E,zIndex:C,signal:u});continue}E.update({app:r,parent:e,prevElement:_,nextElement:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:C,signal:u})}};var J3=(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},eV=({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})}},fB=({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:m,scroll:g,alpha:x}=t,y=new ie;y.label=h,y.zIndex=l,y.x=Math.round(d),y.y=Math.round(f),y.alpha=x;let T=Gt(i,h);ut(y,t.blur,{force:T}),e.addChild(y),m&&m.length>0&&(J3(m)?eV({app:r,container:y,children:m,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,completionTracker:c,signal:u}):no({app:r,parent:y,prevComputedTree:[],nextComputedTree:m,animations:i,animationBus:o,completionTracker:c,eventHandler:s,elementPlugins:n,renderContext:a,signal:u})),(g||t.anchorToBottom)&&Xc({container:y,element:t,interactive:!!g,allowViewportWithoutScroll:!!t.anchorToBottom}),Vf({app:r,container:y,element:t,eventHandler:s}),J({animations:i,targetId:h,animationBus:o,completionTracker:c,element:y,targetState:{x:d,y:f,alpha:x,...Dt(t,{force:T})},renderContext:a})};var pB=({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(p=>p.label===t.id);if(!d)return;d.zIndex=c;let{x:f,y:m,alpha:g}=i,x=Gt(o,t.id);x&&ut(d,t.blur,{force:!0});let y=()=>{if(!pe(t,i)){d.x=Math.round(f),d.y=Math.round(m),d.label=i.id,d.alpha=g,d.scale.x=1,d.scale.y=1,ut(d,i.blur,{force:x});let S=t.scroll||t.anchorToBottom,E=i.scroll||i.anchorToBottom,C=E?QI({container:d}):null;S!==E?E?Xc({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:C}):q_({container:d}):E&&(q_({container:d}),Xc({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:C})),Vf({app:r,container:d,element:i,eventHandler:s})}let p=!pe(t.children,i.children),b=Js({children:i.children}),_=Array.from(b).some(S=>yf(o,S).length>0);if(p||_){let E=d.children.find(C=>C.label===`${i.id}-content`)||d;no({app:r,parent:E,nextComputedTree:i.children,prevComputedTree:t.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:u,renderContext:l,signal:h}),eB({container:d}),tB({container:d}),rB({container:d})}};J({animations:o,targetId:t.id,animationBus:n,completionTracker:u,element:d,targetState:{x:f,y:m,alpha:g,...Dt(i,{force:x})},onComplete:()=>{y()}})||y()};var mB=({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&&(k_({root:a}),fr({app:r,root:a}),e.removeChild(a),a.destroy({children:!0}))};J({animations:s,targetId:t.id,animationBus:i,completionTracker:n,element:a,targetState:null,onComplete:l})||l()};var gB=({state:r,parserPlugins:e=[]})=>{let t=r.direction==="horizontal"||r.direction==="vertical"?r.direction:"absolute",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,m=0,g=0,x=0,y=0;for(let b=0;b<n.length;b++){let _=n[b];b>0?t==="horizontal"?(_.x=u,_.y=m):t==="vertical"&&(_.x=g,_.y=h):(t==="horizontal"||t==="vertical")&&(_.x=0,_.y=0);let S=e.find(E=>E.type===_.type);if(S){let E=_.scaleX!==void 0||r.scaleX!==void 0,C=_.scaleY!==void 0||r.scaleY!==void 0,P=(_.scaleX??1)*(r.scaleX??1),M=(_.scaleY??1)*(r.scaleY??1);_=S.parse({state:{..._,...E?{scaleX:P}:{},...C?{scaleY:M}:{}},parserPlugins:e})}if(t==="horizontal"){let E=b<n.length-1?s:0;r.width&&_.width+x>r.width&&!i&&!r.anchorToBottom?(u=0,x=0,m+=d+o,d=_.height,_.x=0,_.y=m):d=Math.max(d,_.height),u+=_.width+E,x=_.x+_.width,l=Math.max(u,l),c=Math.max(_.height+_.y,c)}else if(t==="vertical"){let E=b<n.length-1?o:0;r.height&&_.height+y>r.height&&!i&&!r.anchorToBottom?(h=0,y=0,g+=f+s,f=_.width,_.x=g,_.y=0):f=Math.max(f,_.width),h+=_.height+E,y=_.y+_.height,l=Math.max(_.width+_.x,l),c=Math.max(h,c)}else l=Math.max(_.width+_.x,l),c=Math.max(_.height+_.y,c);a.push(_)}let p={...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)},...r.blur!==void 0&&{blur:hs(r.blur)},rotation:r.rotation??0};return r.rightClick&&(p.rightClick=r.rightClick),r.scrollUp&&(p.scrollUp=r.scrollUp),r.scrollDown&&(p.scrollDown=r.scrollDown),p};var tV=it({type:"container",add:fB,update:pB,delete:mB,parse:gB});var xB=async({parent:r,element:e,animations:t,animationBus:i,renderContext:s,completionTracker:o,zIndex:n,signal:a})=>{if(a?.aborted)return;let l=new ie;if(l.label=e.id,l.zIndex=n,e.x!==void 0&&(l.x=Math.round(e.x)),e.y!==void 0&&(l.y=Math.round(e.y)),e.alpha!==void 0&&(l.alpha=e.alpha),r.addChild(l),J({animations:t,targetId:e.id,animationBus:i,completionTracker:o,element:l,targetState:{x:e.x??l.x,y:e.y??l.y,alpha:e.alpha??l.alpha},renderContext:s}),s?.suppressAnimations&&!Ln(e)){await Bi({container:l,element:e,completionTracker:o,animationBus:i,zIndex:n,signal:a,playback:"paused-initial"}),xf(s,{container:l,element:e,completionTracker:o,animationBus:i,zIndex:n,signal:a});return}await Bi({container:l,element:e,completionTracker:o,animationBus:i,zIndex:n,signal:a,playback:"autoplay"})};var yB=(r={})=>JSON.stringify({content:r.content??null,revealEffect:r.revealEffect??"typewriter",softWipe:(r.revealEffect??"typewriter")==="softWipe"?Zs(r.softWipe):null,speed:r.speed??50,initialRevealedCharacters:r.initialRevealedCharacters??0,width:r.width??null,indicator:r.indicator??null,x:r.x??null,y:r.y??null,alpha:r.alpha??1}),rV=(r,e)=>yB(r)!==yB(e),_B=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),!rV(e,t)){o?.suppressAnimations!==!0&&!Ln(t)&&await Bi({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"resume"});return}if(o?.suppressAnimations===!0&&!Ln(t)){await Bi({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"paused-initial"}),xf(o,{container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l});return}await Bi({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"autoplay"})};J({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 bB=({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&&(g_(o),o.destroy({children:!0}))};J({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var iV=it({type:"text-revealing",add:xB,update:_B,delete:bB,parse:oI,shouldUpdateUnchanged:({parent:r,nextElement:e})=>vR(r.children.find(t=>t.label===e.id))});var Yf=(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},qf=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var vB=(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},eb=(r={})=>!r||typeof r!="object"?{}:Object.fromEntries(Object.entries(r).map(([e,t])=>[e,Array.isArray(t)?t.map(i=>String(i)):[]])),sV=(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<t)return[];let s=r.slice(t,i+1),o=String(e.direction??"forward").toLowerCase();if(o==="reverse"||o==="backward")return[...s].reverse();if(o==="pingpong")return[...s,...s.slice(1,-1).reverse()];if(o==="pingpong_reverse"){let n=[...s].reverse();return[...n,...n.slice(1,-1).reverse()]}return s},oV=(r=[],e=[])=>!Array.isArray(r)||e.length===0?{}:Object.fromEntries(r.map(t=>{let i=typeof t?.name=="string"?t.name:"";return i?[i,sV(e,t)]:null}).filter(Boolean)),Qn=(r={})=>{let e=r??{},t=eb(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,vB(s)]}).filter(Boolean)):Object.fromEntries(Object.entries(e.frames??{}).map(([s,o])=>[s,vB(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}}:{}}}},Jn=(r={},e={},t={},i=[])=>({...oV(t?.frameTags,i),...eb(e),...eb(r)}),nV=(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)},ao=({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=nV(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},Kf=({spritesheet:r,atlas:e,clips:t={},playback:i,legacyAnimation:s})=>{let o=ao({atlas:e,clips:t,playback:i,legacyAnimation:s});return{frameTextures:o.frames.map(a=>r.textures[a]),playback:o}},Zf=r=>typeof r=="number"?r/60:.5;var TB=async({app:r,parent:e,element:t,animations:i,animationBus:s,renderContext:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let{id:c,x:u,y:h,width:d,height:f,src:m,atlas:g,clips:x,playback:y,alpha:T}=t,p=Qn(g),b=Jn(x,g?.animations,g?.meta,Object.keys(p.frames??{})),_=ao({atlas:p,clips:b,playback:y}),S=n?.getVersion?.();n?.track?.(S);try{let E=new Ki(k.from(m),p);if(await E.parse(),l?.aborted||e.destroyed)return;let{frameTextures:C}=Kf({spritesheet:E,atlas:p,clips:b,playback:_}),P=new Uc(C);P.label=c,P.zIndex=a,P.animationSpeed=Zf(_.fps),P.loop=_.loop,r.debug?Yf(P,c,r.debug,()=>{typeof r.render=="function"&&r.render()}):_.autoplay&&CR(o,P),P.x=Math.round(u),P.y=Math.round(h),P.width=Math.round(d),P.height=Math.round(f),P.alpha=T;let M=Gt(i,c);ut(P,t.blur,{force:M}),e.addChild(P),J({animations:i,targetId:c,animationBus:s,completionTracker:n,element:P,targetState:{x:u,y:h,width:d,height:f,alpha:T,...Dt(t,{force:M})},renderContext:o}),typeof r.render=="function"&&r.render()}finally{n?.complete?.(S)}};var SB=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(T=>T.label===t.id);if(!c)return;c.zIndex=a;let u=Gt(s,t.id);u&&ut(c,t.blur,{force:!0});let h=async()=>{if(!(l?.aborted||c.destroyed)&&!pe(t,i)){let T=i.src,p=Qn(i.atlas),b=Jn(i.clips,i.atlas?.animations,i.atlas?.meta,Object.keys(p.frames??{})),_=ao({atlas:p,clips:b,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,ut(c,i.blur,{force:u});let S=!pe(t.playback,i.playback),E=!pe(t.clips,i.clips),C=t.src!==T||!pe(t.atlas,i.atlas);if(c.animationSpeed=Zf(_.fps),c.loop=_.loop,S||E||C){let P=n?.getVersion?.();n?.track?.(P);try{let M=new Ki(k.from(T),p);if(await M.parse(),l?.aborted||c.destroyed)return;let{frameTextures:I}=Kf({spritesheet:M,atlas:p,clips:b,playback:_});c.textures=I,typeof r.render=="function"&&r.render(),!r.debug&&_.autoplay?c.play():(r.debug||c.stop?.(),t.id!==i.id&&(qf(c),Yf(c,i.id,r.debug,()=>{typeof r.render=="function"&&r.render()})))}finally{n?.complete?.(P)}}}},{x:d,y:f,width:m,height:g,alpha:x}=i;J({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:d,y:f,width:m,height:g,alpha:x,...Dt(i,{force:u})},onComplete:()=>{h()}})||await h()};var wB=({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&&qf(n),n&&!n.destroyed&&(n.stop(),n.destroy())};J({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var EB=({state:r})=>{let e=yt(r),t=r.atlas,i=Qn(t),s=Jn(r.clips,t?.animations,t?.meta,Object.keys(i.frames??{})),o=ao({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,...r.blur!==void 0&&{blur:hs(r.blur)}}};var AB=it({type:"spritesheet-animation",add:TB,update:SB,delete:wB,parse:EB}),aV=AB;var lV=s_({type:"tween"});var lo=new Map,cV=r=>({id:r.id,url:r.src,loop:r.loop??!1,volume:ze(r.volume,100)}),CB=r=>lo.has(r),qc=r=>{let e=lo.get(r);e!==void 0&&(clearTimeout(e),lo.delete(r))},tb=({app:r,element:e})=>{let t=cV(e);if(qc(t.id),e.startDelayMs&&e.startDelayMs>0){let i=setTimeout(()=>{lo.delete(t.id),r.audioStage.add(t)},e.startDelayMs);lo.set(t.id,i);return}r.audioStage.add(t)},rb=()=>{for(let r of lo.values())clearTimeout(r);lo.clear()},PB=({app:r,element:e})=>{tb({app:r,element:e})};var MB=({app:r,prevElement:e,nextElement:t})=>{let i=e.id;if((t.startDelayMs??0)>0){r.audioStage.remove(i),tb({app:r,element:t});return}if(CB(i)){qc(i),r.audioStage.add({id:i,url:t.src,loop:t.loop??!1,volume:ze(t.volume,100)});return}let o=r.audioStage.getById(i);if(!o){r.audioStage.add({id:i,url:t.src,loop:t.loop??!1,volume:ze(t.volume,100)});return}o.url=t.src,o.loop=t.loop??!1,o.volume=ze(t.volume,100)};var RB=({app:r,element:e})=>{qc(e.id),r.audioStage.remove(e.id)};var uV=o_({type:"sound",add:PB,update:MB,delete:RB});var Kc=class extends Re{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(e){this.destroyed||(this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy(e))}};function ib(r){let e=new We;return e.circle(0,0,3),e.fill({color:16777215}),r.renderer.generateTexture(e)}function sb(r){let e=new We;return e.rect(0,0,1,8),e.fill({color:8965375}),r.renderer.generateTexture(e)}function ob(r){let e=new We;return e.circle(0,0,4),e.fill({color:16777215}),r.renderer.generateTexture(e)}function Zc(r,e,t){return r+(e-r)*t}function Jf(r){if(typeof r=="number")return r;let e=r.replace(/^(#|0x)/,"");return parseInt(e,16)}function IB(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(Zc(i,n,t)),u=Math.round(Zc(s,a,t)),h=Math.round(Zc(o,l,t));return c<<16|u<<8|h}var Qf=class r{constructor(e,t,i=!1){this.value=i?Jf(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<i.length;n++)o.next=new r(i[n].value,i[n].time,t),o=o.next;return s}},Nr=class{constructor(e=!1){this.first=null,this.isColor=e,this.ease=null}reset(e){Array.isArray(e)?this.first=Qf.createList(e,this.isColor):this.first=e}getValue(e){if(this.ease&&(e=this.ease(e)),!this.first.next||e<=this.first.time)return this.first.value;let t=this.first;for(;t.next&&t.next.time<e;)t=t.next;if(!t.next||e>=t.next.time)return t.next?t.next.value:t.value;let i=(e-t.time)/(t.next.time-t.time);return this.isColor?IB(t.value,t.next.value,i):Zc(t.value,t.next.value,i)}};var ep=class{static type="alpha";constructor(e){this.list=new Nr(!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)}},tp=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 BB(r,e,t){return Math.min(Math.max(r,e),t)}function Nt(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+hV(r,s)*(i-t):s.kind==="normal"?dV(r,t,i,s):t+r()*(i-t)}function hV(r,e){let t=e.toward??"min",i=BB(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 dV(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 BB(s+l*o,e,t)}var rp=class{static type="scale";constructor(e){this.list=new Nr(!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)}},ip=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=Nt(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 fV=Math.PI/180,sp=class{static type="speed";constructor(e){this.list=new Nr(!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}},op=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=Nt(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}},np=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=Nt(t.emitter.random.bind(t.emitter),this.speed),s=Nt(t.emitter.random.bind(t.emitter),this.direction)*fV;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 Y0e=Math.PI/180,ap=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))}},lp=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 Qc=Math.PI/180,cp=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)*Qc}initParticles(e){let t=e;for(;t;)t.rotation=Nt(t.emitter.random.bind(t.emitter),this.startRange)*Qc,t.rotationSpeed=Nt(t.emitter.random.bind(t.emitter),this.speedRange)*Qc,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}},up=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=Nt(t.emitter.random.bind(t.emitter),this.range)*Qc,t=t.next}updateParticle(e,t){}},hp=class{static type="noRotation";constructor(e){this.rotation=(e.rotation??0)*Qc}initParticles(e){let t=e;for(;t;)t.rotation=this.rotation,t=t.next}updateParticle(e,t){e.rotation=this.rotation}};var dp=class{static type="color";constructor(e){this.list=new Nr(!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)}},fp=class{static type="colorStatic";constructor(e){this.color=Jf(e.color)}initParticles(e){let t=e;for(;t;)t.tint=this.color,t=t.next}updateParticle(e,t){}};var pp=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}},mp=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)}},nb=class{constructor(e){this.x=e.x,this.y=e.y}getRandPos(e,t){e.x=this.x,e.y=this.y}},ab=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}},pV={rect:pp,rectangle:pp,torus:mp,circle:mp,point:nb,line:ab};var gp=class{static type="spawnShape";constructor(e){let t=pV[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){}},xp=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 kB=Math.PI/180,yp=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=Nt(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"?Nt(e,this.velocity.angle??{min:0,max:360})*kB:Nt(e,this.velocity.direction??0)*kB: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 FB=new Map,OB=new Map;function lb(r,e){FB.set(r,e)}function It(r){OB.set(r.type,r)}function UB(r,e){let t=FB.get(r);return t?t(e):null}function LB(r){return OB.get(r)}lb("circle",ob);lb("snowflake",ib);lb("raindrop",sb);It(ep);It(tp);It(rp);It(ip);It(sp);It(op);It(np);It(ap);It(lp);It(cp);It(up);It(hp);It(dp);It(fp);It(gp);It(xp);It(yp);var _p=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 mV(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r.mode=="string"&&Array.isArray(r.items)}var Jc=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 _p(e.seed):null,e.texture&&(mV(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=LB(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 Kc(this),e}_unlinkActiveParticle(e){return!e||!(e===this._activeFirst||e===this._activeLast||e.prev!==null||e.next!==null)?!1:(e.prev?e.prev.next=e.next:this._activeFirst=e.next,e.next?e.next.prev=e.prev:this._activeLast=e.prev,e.prev=null,e.next=null,this._activeFirst?this.particleCount=Math.max(0,this.particleCount-1):(this._activeLast=null,this.particleCount=0),!0)}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;n<e;n++){let a=this._createParticle();a.texture=i??this._pickTexture();let l=Nt(this.random.bind(this),this.lifetime);a.init(l),s||(s=a),o&&(o.next=a,a.prev=o),o=a,this.container.addChild(a)}for(let n of this.initBehaviors)n.initParticles(s);return this._activeLast?(this._activeLast.next=s,s.prev=this._activeLast):this._activeFirst=s,this._activeLast=o,this.particleCount+=e,s}emitNow(){this.spawn(this.particlesPerWave)}recycle(e){if(!e||e.destroyed){this._unlinkActiveParticle(e);return}for(let t of this.recycleBehaviors)t.recycleParticle(e);this._unlinkActiveParticle(e)&&(e.parent&&e.parent.removeChild(e),e.next=this._poolFirst,this._poolFirst=e)}update(e){if(this.destroyed)return;if(this.emitterLifetime>0&&(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.destroyed||!t.position){this._unlinkActiveParticle(t),t=i;continue}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.x<s.x||t.x>s.x+s.width||t.y<s.y||t.y>s.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 gV(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r.mode=="string"&&Array.isArray(r.items)}function xV(r,e){let t=new We,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 GB(r,e){if(typeof e=="object"&&e?.shape)return xV(r,e);let t=e??"circle",i=UB(t,r);if(!i)try{i=k.from(t)}catch{return console.warn(`Failed to load particle texture: ${t}`),null}return i}function yV(r,e){let t=[];for(let i of e.items){let s=i.src?i.src:i,o=GB(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 eu=({app:r,parent:e,element:t,animations:i,animationBus:s,completionTracker:o,renderContext:n,zIndex:a})=>{let l=new ie;l.label=t.id,l.zIndex=a,e.addChild(l);let c=t.width,u=t.height;l.x=t.x??0,l.y=t.y??0;let h={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},d=gV(t.texture)?yV(r,t.texture):GB(r,t.texture);if(!d)return;h.texture=d;let f=new Jc(l,h);l.emitter=f;let m=h.frequency<=0;if(m){f.emitNow(),f.emit=!1;let x=y=>{if(!y.length)return;let[T,...p]=y;(T===0&&typeof requestAnimationFrame=="function"?requestAnimationFrame:_=>setTimeout(_,T))(()=>{f.destroyed||f.particleCount>0||(f.emitNow(),x(p))})};x([0,50,150])}if(h.recycleOnBounds&&!m){let x=Math.min(t.count??100,h.maxParticles);f.spawn(x);let y=f._activeFirst;for(;y;)y.y=f.random()*u,y.age=f.random()*y.maxLife*.8,y=y.next}let g=x=>{if(f.destroyed){r.ticker.remove(g);return}let y=Math.min(typeof x.deltaMS=="number"?x.deltaMS/1e3:x.deltaTime/60,.1);f.update(y)};l.tickerCallback=g,MR(n,{app:r,emitter:f,container:l,tickerCallback:g}),t.alpha!==void 0&&(l.alpha=t.alpha),J({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:l,targetState:{x:t.x??0,y:t.y??0,alpha:t.alpha??l.alpha},renderContext:n})};var bp=({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&&(Z_({app:r,particleElement:n}),n.destroy({children:!0}))};J({animations:s,targetId:t.id,animationBus:i,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var DB=({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){eu({app:r,parent:e,element:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l});return}if(c.zIndex=l,_V(t,i))bp({app:r,parent:e,element:t,animations:s,animationBus:o,completionTracker:n}),eu({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)};J({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 _V(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 cb(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(Ks).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Ks).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 NB(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 VB(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;e<r.behaviors.length;e++){let t=r.behaviors[e];if(typeof t!="object"||t===null||Array.isArray(t))throw new Error(`Input Error: behaviors[${e}] must be an object`);if(!t.type||typeof t.type!="string")throw new Error(`Input Error: behaviors[${e}] must have a 'type' string property`)}}function HB(r){if(!r.emitter)throw new Error("Input Error: Particles require 'emitter'");if(typeof r.emitter!="object"||Array.isArray(r.emitter))throw new Error("Input Error: 'emitter' must be an object");if(!r.emitter.lifetime)throw new Error("Input Error: emitter.lifetime is required");if(typeof r.emitter.lifetime!="object"||Array.isArray(r.emitter.lifetime))throw new Error("Input Error: emitter.lifetime must be an object");if(typeof r.emitter.lifetime.min!="number"||typeof r.emitter.lifetime.max!="number")throw new Error("Input Error: emitter.lifetime.min and max must be numbers");if(r.emitter.lifetime.min<0||r.emitter.lifetime.max<0)throw new Error("Input Error: emitter.lifetime.min and max must be non-negative");if(r.emitter.lifetime.min>r.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function WB(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 zB(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 bV=new Set(["continuous","burst"]),vV=new Set(["point","rect","circle","line"]),TV=new Set(["single","random","cycle"]),SV=new Set(["perParticle","perWave"]),$B=new Set(["uniform","normal","bias"]),XB=new Set(["min","max","center"]),wV=new Set(["none","fixed","random","spin"]);function KB(r){if(EV(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");AV(e),PV(t,i),MV(i),FV(s)}function EV(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&&(de(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&&de(r.x,"x"),r.y!==void 0&&de(r.y,"y"),r.seed!==void 0&&de(r.seed,"seed")}function AV(r){if(!bV.has(r.mode))throw new Error("Input Error: modules.emission.mode must be 'continuous' or 'burst'");if(r.mode==="continuous"){if(de(r.rate,"modules.emission.rate"),r.rate<=0)throw new Error("Input Error: modules.emission.rate must be positive")}else if(qB(r.burstCount,"modules.emission.burstCount"),r.burstCount<=0)throw new Error("Input Error: modules.emission.burstCount must be positive");if(r.maxActive!==void 0&&(qB(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"&&(de(r.duration,"modules.emission.duration"),r.duration<0))throw new Error("Input Error: modules.emission.duration must be non-negative");if(gs(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(!vV.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");CV(r.source.kind,r.source.data)}function CV(r,e){if(r==="point"){de(e.x,"modules.emission.source.data.x"),de(e.y,"modules.emission.source.data.y");return}if(r==="rect"){if(de(e.x,"modules.emission.source.data.x"),de(e.y,"modules.emission.source.data.y"),de(e.width,"modules.emission.source.data.width"),de(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(de(e.x,"modules.emission.source.data.x"),de(e.y,"modules.emission.source.data.y"),de(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&&(de(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}de(e.x1,"modules.emission.source.data.x1"),de(e.y1,"modules.emission.source.data.y1"),de(e.x2,"modules.emission.source.data.x2"),de(e.y2,"modules.emission.source.data.y2")}function PV(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'");gs(t.speed,"modules.movement.velocity.speed",{allowNegative:!1}),t.kind==="directional"?gs(t.direction,"modules.movement.velocity.direction",{allowNegative:!0}):t.angle!==void 0&&gs(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");de(r.acceleration.x,"modules.movement.acceleration.x"),de(r.acceleration.y,"modules.movement.acceleration.y")}if(r.maxSpeed!==void 0&&(de(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 MV(r){RV(r.texture),r.scale!==void 0&&jB(r.scale,"modules.appearance.scale",{allowNegative:!1,modes:["single","range","curve"]}),r.alpha!==void 0&&jB(r.alpha,"modules.appearance.alpha",{min:0,max:1,modes:["single","curve"]}),r.color!==void 0&&BV(r.color,"modules.appearance.color"),r.rotation!==void 0&&kV(r.rotation)}function RV(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){ZB(r,"modules.appearance.texture");return}if(!TV.has(r.mode))throw new Error("Input Error: modules.appearance.texture.mode must be 'single', 'random', or 'cycle'");if(r.pick!==void 0&&!SV.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;e<r.items.length;e++){let t=r.items[e];IV(t,`modules.appearance.texture.items[${e}]`)}}}function IV(r,e){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(r.src!==void 0){if(typeof r.src!="string"||r.src.length===0)throw new Error(`Input Error: ${e}.src must be a non-empty string`)}else if(r.shape)ZB(r,e);else throw new Error(`Input Error: ${e} must define either 'src' or shape fields`);if(r.weight!==void 0&&(de(r.weight,`${e}.weight`),r.weight<=0))throw new Error(`Input Error: ${e}.weight must be positive`)}function ZB(r,e){if(!["circle","ellipse","rect"].includes(r.shape))throw new Error(`Input Error: ${e}.shape must be 'circle', 'ellipse', or 'rect'`);if(r.radius!==void 0&&de(r.radius,`${e}.radius`),r.width!==void 0&&de(r.width,`${e}.width`),r.height!==void 0&&de(r.height,`${e}.height`),r.color!==void 0&&typeof r.color!="string"&&typeof r.color!="number")throw new Error(`Input Error: ${e}.color must be a string or number`)}function jB(r,e,t){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(!t.modes.includes(r.mode))throw new Error(`Input Error: ${e}.mode must be one of ${t.modes.join(", ")}`);if(r.mode==="single"){tu(r.value,`${e}.value`,t);return}if(r.mode==="range"){gs(r,e,t);return}if(!Array.isArray(r.keys)||r.keys.length===0)throw new Error(`Input Error: ${e}.keys must be a non-empty array`);let i=-1/0;for(let s=0;s<r.keys.length;s++){let o=r.keys[s];if(!o||typeof o!="object"||Array.isArray(o))throw new Error(`Input Error: ${e}.keys[${s}] must be an object`);if(de(o.time,`${e}.keys[${s}].time`),o.time<0||o.time>1)throw new Error(`Input Error: ${e}.keys[${s}].time must be between 0 and 1`);if(o.time<i)throw new Error(`Input Error: ${e}.keys must be sorted by time`);i=o.time,tu(o.value,`${e}.keys[${s}].value`,t)}}function BV(r,e){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(r.mode==="single"){YB(r.value,`${e}.value`);return}if(r.mode!=="gradient")throw new Error("Input Error: modules.appearance.color.mode must be 'single' or 'gradient'");if(!Array.isArray(r.keys)||r.keys.length===0)throw new Error(`Input Error: ${e}.keys must be a non-empty array`);let t=-1/0;for(let i=0;i<r.keys.length;i++){let s=r.keys[i];if(!s||typeof s!="object"||Array.isArray(s))throw new Error(`Input Error: ${e}.keys[${i}] must be an object`);if(de(s.time,`${e}.keys[${i}].time`),s.time<0||s.time>1)throw new Error(`Input Error: ${e}.keys[${i}].time must be between 0 and 1`);if(s.time<t)throw new Error(`Input Error: ${e}.keys must be sorted by time`);t=s.time,YB(s.value,`${e}.keys[${i}].value`)}}function YB(r,e){if(typeof r!="string"&&typeof r!="number")throw new Error(`Input Error: ${e} must be a string or number`)}function kV(r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.appearance.rotation must be an object");if(!wV.has(r.mode))throw new Error("Input Error: modules.appearance.rotation.mode must be 'none', 'fixed', 'random', or 'spin'");if(r.mode!=="none"){if(r.mode==="fixed"){de(r.value,"modules.appearance.rotation.value");return}if(r.mode==="random"){gs(r,"modules.appearance.rotation",{allowNegative:!0});return}gs(r.start,"modules.appearance.rotation.start",{allowNegative:!0}),gs(r.speed,"modules.appearance.rotation.speed",{allowNegative:!0})}}function FV(r){if(r!==void 0){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.bounds must be an object");if(r.mode!=="none"&&r.mode!=="recycle")throw new Error("Input Error: modules.bounds.mode must be 'none' or 'recycle'");if(r.mode!=="none"){if(r.source!=="area"&&r.source!=="custom")throw new Error("Input Error: modules.bounds.source must be 'area' or 'custom'");if(r.padding!==void 0&&OV(r.padding,"modules.bounds.padding"),r.source==="custom"){if(!r.custom||typeof r.custom!="object"||Array.isArray(r.custom))throw new Error("Input Error: modules.bounds.custom must be an object");de(r.custom.x,"modules.bounds.custom.x"),de(r.custom.y,"modules.bounds.custom.y"),de(r.custom.width,"modules.bounds.custom.width"),de(r.custom.height,"modules.bounds.custom.height")}}}}function OV(r,e){if(typeof r!="number"){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be a number or object`);for(let t of["top","right","bottom","left"])de(r[t],`${e}.${t}`)}}function gs(r,e,t={}){if(typeof r=="number"){tu(r,e,t);return}if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be a number or range object`);if(de(r.min,`${e}.min`),de(r.max??r.min,`${e}.max`),tu(r.min,`${e}.min`,t),tu(r.max??r.min,`${e}.max`,t),r.min>(r.max??r.min))throw new Error(`Input Error: ${e}.min cannot be greater than max`);r.distribution!==void 0&&UV(r.distribution,`${e}.distribution`)}function tu(r,e,t={}){if(de(r,e),!t.allowNegative&&r<0)throw new Error(`Input Error: ${e} must be non-negative`);if(t.min!==void 0&&r<t.min)throw new Error(`Input Error: ${e} must be at least ${t.min}`);if(t.max!==void 0&&r>t.max)throw new Error(`Input Error: ${e} must be at most ${t.max}`)}function UV(r,e){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(!$B.has(r.kind))throw new Error(`Input Error: ${e}.kind must be one of ${[...$B].join(", ")}`);if(r.kind==="bias"){if(!XB.has(r.toward??"min"))throw new Error(`Input Error: ${e}.toward must be one of ${[...XB].join(", ")}`);r.strength!==void 0&&de(r.strength,`${e}.strength`)}r.kind==="normal"&&(r.mean!==void 0&&de(r.mean,`${e}.mean`),r.deviation!==void 0&&de(r.deviation,`${e}.deviation`))}function de(r,e){if(typeof r!="number"||Number.isNaN(r))throw new Error(`Input Error: ${e} must be a number`)}function qB(r,e){if(de(r,e),!Number.isInteger(r))throw new Error(`Input Error: ${e} must be an integer`)}function QB(r){let e=LV(r),t=[];t.push(GV(r.modules.emission.source));let i=NV(r.modules.movement);i&&t.push(i),t.push(...VV(r.modules.appearance));let s=YV(r.modules.bounds,r.width,r.height);s&&(e.spawnBounds=s.spawnBounds,e.recycleOnBounds=!0);let o=HV(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 LV(r){let{emission:e}=r.modules,t={lifetime:xs(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 GV(r){return{type:"spawnShape",config:{type:r.kind,data:DV(r.kind,r.data)}}}function DV(r,e){return r==="rect"?{x:e.x,y:e.y,w:e.width,h:e.height}:{...e}}function NV(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:xs(r.velocity.speed)},r.velocity.kind==="directional"?e.velocity.direction=xs(r.velocity.direction):e.velocity.angle=xs(r.velocity.angle??{min:0,max:360})),r.acceleration&&(e.acceleration={x:r.acceleration.x,y:r.acceleration.y}),{type:"movement",config:e}}function VV(r){let e=[];if(r.scale&&e.push(zV(r.scale)),r.alpha&&e.push($V(r.alpha)),r.color&&e.push(XV(r.color)),r.rotation){let t=jV(r.rotation);t&&e.push(t)}return e}function HV(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(WV)};if(e.mode==="single"&&e.items.length===1){let[t]=e.items;return t.src??JB(t)}return e}function WV(r){if(r.src)return r.weight===void 0?{src:r.src}:{src:r.src,weight:r.weight};let e=JB(r);return r.weight!==void 0&&(e.weight=r.weight),e}function JB(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 zV(r){return r.mode==="curve"?{type:"scale",config:{list:ub(r.keys)}}:{type:"scaleStatic",config:r.mode==="single"?{min:r.value,max:r.value}:xs(r)}}function $V(r){return r.mode==="curve"?{type:"alpha",config:{list:ub(r.keys)}}:{type:"alphaStatic",config:{alpha:r.value}}}function XV(r){return r.mode==="gradient"?{type:"color",config:{list:ub(r.keys)}}:{type:"colorStatic",config:{color:r.value}}}function jV(r){if(r.mode==="none")return null;if(r.mode==="fixed")return{type:"noRotation",config:{rotation:r.value}};if(r.mode==="random"){let i=xs(r);return{type:"rotationStatic",config:{min:i.min,max:i.max,distribution:i.distribution}}}let e=xs(r.start),t=xs(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 YV(r,e,t){if(!r||r.mode==="none")return null;if(r.source==="custom")return{spawnBounds:{...r.custom}};let i=qV(r.padding??0);return{spawnBounds:{x:-i.left,y:-i.top,width:e+i.left+i.right,height:t+i.top+i.bottom}}}function qV(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 ub(r){return r.map(e=>({time:e.time,value:e.value}))}function xs(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 ek=({state:r})=>{if(r.modules)return cb(r),KB(r),QB(r);cb(r),NB(r),VB(r),HB(r),WB(r),zB(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 KV=it({type:"particles",add:eu,update:DB,delete:bp,parse:ek});var tk=(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):pe(c,u)||a.push({prev:c,next:u})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var rk=new Set(["audio-channel","sound"]),ZV=new Set(["audioTransition"]),QV=new Set(["enter","exit","update"]),JV=new Set(["volume"]),eH=new Set(["linear"]),tH={enter:new Set(["from","duration","easing"]),exit:new Set(["to","duration","easing"]),update:new Set(["duration","easing"])},rH=r=>r!==null&&typeof r=="object"&&!Array.isArray(r),ta=(r,e)=>{if(!rH(r))throw new Error(`Input error: ${e} must be an object.`)},ra=(r,e)=>{if(typeof r!="string"||r.length===0)throw new Error(`Input error: ${e} must be a non-empty string.`)},ru=(r,e,{min:t,max:i}={})=>{if(typeof r!="number"||Number.isNaN(r))throw new Error(`Input error: ${e} must be a number.`);if(t!==void 0&&r<t)throw new Error(`Input error: ${e} must be greater than or equal to ${t}.`);if(i!==void 0&&r>i)throw new Error(`Input error: ${e} must be less than or equal to ${i}.`)},hb=(r,e)=>{if(r!==void 0&&typeof r!="boolean")throw new Error(`Input error: ${e} must be a boolean.`)},ea=(r,e,t)=>{r!=null&&ru(r,e,t)},ik=(r,e)=>r==null?100:(ru(r,e),Math.max(0,Math.min(100,r))),vp=(r,e,t)=>{if(r.has(e))throw new Error(`Input error: duplicate audio render-state id "${e}" at ${t}.`);r.add(e)},sk=(r,e,t,i,s=null)=>{if(ra(r.id,`${e}.id`),vp(t,r.id,`${e}.id`),ra(r.src,`${e}.src`),r.delay!==void 0)throw new Error(`Input error: ${e}.delay is not supported. Use ${e}.startDelayMs instead.`);let o=ik(r.volume,`${e}.volume`);if(hb(r.muted,`${e}.muted`),ea(r.pan,`${e}.pan`,{min:-1,max:1}),hb(r.loop,`${e}.loop`),ea(r.startDelayMs,`${e}.startDelayMs`,{min:0}),ea(r.playbackRate,`${e}.playbackRate`,{min:0}),ea(r.startAt,`${e}.startAt`,{min:0}),ea(r.endAt,`${e}.endAt`,{min:0}),r.endAt!==void 0&&r.endAt!==null&&r.startAt!==void 0&&r.endAt<r.startAt)throw new Error(`Input error: ${e}.endAt must be greater than or equal to startAt.`);i.push({id:r.id,type:"sound",src:r.src,volume:o,muted:r.muted??!1,pan:r.pan??0,loop:r.loop??!1,startDelayMs:r.startDelayMs??0,playbackRate:r.playbackRate??1,startAt:r.startAt??0,endAt:r.endAt??null,channelId:s})},iH=(r,e,t,i,s)=>{ra(r.id,`${e}.id`),vp(t,r.id,`${e}.id`);let o=ik(r.volume,`${e}.volume`);if(hb(r.muted,`${e}.muted`),ea(r.pan,`${e}.pan`,{min:-1,max:1}),r.children!==void 0&&!Array.isArray(r.children))throw new Error(`Input error: ${e}.children must be an array.`);i.push({id:r.id,type:"audio-channel",volume:o,muted:r.muted??!1,pan:r.pan??0});for(let[n,a]of(r.children??[]).entries()){let l=`${e}.children[${n}]`;if(ta(a,l),a.type==="audio-channel")throw new Error(`Input error: nested audio-channel nodes are not supported at ${l}.`);if(a.type!=="sound")throw new Error(`Input error: ${l}.type must be "sound".`);sk(a,l,t,s,r.id)}},sH=(r,e)=>{if(!Array.isArray(r))throw new Error("Input error: `audio` must be an array.");let t=[],i=[],s=new Set;for(let[o,n]of r.entries()){let a=`audio[${o}]`;if(ta(n,a),!rk.has(n.type)){ra(n.id,`${a}.id`),vp(e,n.id,`${a}.id`);continue}if(n.type==="audio-channel"){iH(n,a,e,t,i),s.add(n.id);for(let l of i)l.channelId===n.id&&s.add(l.id)}else sk(n,a,e,i),s.add(n.id)}return{channels:t,sounds:i,builtinNodeIds:s}},oH=(r,e,t,i)=>{ta(r,t);for(let s of Object.keys(r))if(!tH[e].has(s))throw new Error(`Input error: unsupported audio transition field "${s}" at ${t}.`);if(r.duration===void 0)throw new Error(`Input error: ${t}.duration is required.`);if(ru(r.duration,`${t}.duration`,{min:0}),r.easing===void 0)throw new Error(`Input error: ${t}.easing is required.`);if(!eH.has(r.easing))throw new Error(`Input error: ${t}.easing "${r.easing}" is not supported.`);if(e==="enter"){if(r.from===void 0)throw new Error(`Input error: ${t}.from is required.`);ru(r.from,`${t}.from`,{min:0,max:100})}if(e==="exit"){if(r.to===void 0)throw new Error(`Input error: ${t}.to is required.`);ru(r.to,`${t}.to`,{min:0,max:100})}if(i!=="volume")throw new Error(`Input error: unsupported audio transition property "${i}" at ${t}.`)},nH=(r,e,t)=>{if(ra(r.targetId,`${e}.targetId`),!t.has(r.targetId))throw new Error(`Input error: ${e}.targetId "${r.targetId}" does not resolve to an audio node.`);ta(r.properties,`${e}.properties`);for(let[i,s]of Object.entries(r.properties)){if(!JV.has(i))throw new Error(`Input error: unsupported audio transition property "${i}" at ${e}.properties.`);ta(s,`${e}.properties.${i}`);for(let[o,n]of Object.entries(s)){if(!QV.has(o))throw new Error(`Input error: unsupported audio transition phase "${o}" at ${e}.properties.${i}.`);oH(n,o,`${e}.properties.${i}.${o}`,i)}}},aH=(r,e,t)=>{if(!Array.isArray(r))throw new Error("Input error: `audioEffects` must be an array.");for(let[i,s]of r.entries()){let o=`audioEffects[${i}]`;if(ta(s,o),ra(s.id,`${o}.id`),vp(e,s.id,`${o}.id`),!ZV.has(s.type))throw new Error(`Input error: unsupported audio effect type "${s.type}" at ${o}.`);s.type==="audioTransition"&&nH(s,o,t)}};var ys=({audio:r=[],audioEffects:e=[]}={})=>{let t=new Set,i=sH(r,t);return aH(e,t,i.builtinNodeIds),{audio:r,audioEffects:e,channels:i.channels,sounds:i.sounds}},ok=r=>rk.has(r?.type),db=(r=[])=>r.filter(ok),fb=(r=[])=>r.filter(e=>!ok(e));var nk=({app:r,prevAudioTree:e,nextAudioTree:t,audioPlugins:i})=>{let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=tk(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})}},pb=({app:r,prevAudioTree:e,nextAudioTree:t,prevAudioEffects:i=[],nextAudioEffects:s=[],audioPlugins:o})=>{if(ys({audio:e,audioEffects:i}),ys({audio:t,audioEffects:s}),typeof r.audioStage?.renderGraph=="function"){r.audioStage.renderGraph({prevAudio:db(e),nextAudio:db(t),prevAudioEffects:i,nextAudioEffects:s}),nk({app:r,prevAudioTree:fb(e),nextAudioTree:fb(t),audioPlugins:o});return}nk({app:r,prevAudioTree:e,nextAudioTree:t,audioPlugins:o})};var pr=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(pr||{}),mb=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(mb||{}),Tp=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Tp||{}),ae=(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))(ae||{}),ia=(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))(ia||{}),z=(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))(z||{}),Fi=(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))(Fi||{}),ue=(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))(ue||{}),j=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(j||{}),Mr=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(Mr||{}),iu=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(iu||{}),Vr=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Vr||{}),mr=(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))(mr||{}),_s=(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))(_s||{}),Sp=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Sp||{}),qt=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(qt||{}),ht=(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))(ht||{});var Oe=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Oe||{}),nr=(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))(nr||{});var gb={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 te={ADAPTER:gb,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};tg();var lH=ji.default??ji,Hr=lH(globalThis.navigator);te.RETINA_PREFIX=/@([0-9\.]+)x/;te.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var go=As(lk(),1),JW=As(Yh(),1);var Kb=As(w2(),1);var E2={};function xe(r,e,t=3){if(E2[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}
1550
+ `,$f=(r="red")=>{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])}},lB=$f("red"),Q_=(r,e)=>Ys.create({width:r,height:e,resolution:1}),D3=(r,e)=>{let t=new Ae({uMaskInvert:{value:e?1:0,type:"f32"},uMaskChannelWeights:{value:r,type:"vec4<f32>"}});return{filter:ai.from({gpu:{vertex:{source:aB,entryPoint:"mainVertex"},fragment:{source:aB,entryPoint:"mainFragment"}},gl:{vertex:dB,fragment:G3,name:"replace-mask-channel-filter"},resources:{maskChannelUniforms:t}}),maskChannelUniforms:t}},cB=({app:r,texture:e,width:t,height:i,channelWeights:s,invert:o=!1})=>{let n=k.from(e),a=new Re(n);a.width=t,a.height=i,a.filterArea=new ee(0,0,t,i);let l=new ie;l.addChild(a);let c=Q_(t,i),{filter:u}=D3(s,o);return a.filters=[u],r.renderer.render({container:l,target:c,clear:!0}),a.filters=[],l.destroy({children:!0}),u.destroy(),c},N3=(r,e,t,i)=>{if(!e)return{textures:[k.WHITE.source],channelWeights:$f("red"),invert:0,destroy:()=>{}};if(e.kind==="single"){let s=cB({app:r,texture:e.texture,width:t,height:i,channelWeights:$f(e.channel??"red"),invert:e.invert??!1});return{textures:[s.source],channelWeights:lB,invert:0,destroy:()=>{s.destroy(!0)}}}if(e.kind==="sequence"){let s=e.frames.map(o=>cB({app:r,texture:o.texture,width:t,height:i,channelWeights:$f(e.channel??"red"),invert:e.invert??!1}));return{textures:s.map(o=>o.source),channelWeights:lB,invert:0,destroy:()=>{for(let o of s)o.destroy(!0)}}}throw new Error(`Unsupported replace mask kind: ${e.kind}.`)},V3=()=>{let r=new Ae({uProgress:{value:0,type:"f32"},uSoftness:{value:.001,type:"f32"},uMaskMix:{value:0,type:"f32"},uMaskInvert:{value:0,type:"f32"},uMaskDirectReveal:{value:0,type:"f32"},uMaskChannelWeights:{value:new Float32Array([1,0,0,0]),type:"vec4<f32>"},uSecondaryMatrix:{value:new V,type:"mat3x3<f32>"},uSecondaryClamp:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"}});return{filter:ai.from({gpu:{vertex:{source:nB,entryPoint:"mainVertex"},fragment:{source:nB,entryPoint:"mainFragment"}},gl:{vertex:dB,fragment:L3,name:"replace-mask-filter"},resources:{replaceMaskUniforms:r,uNextTexture:k.EMPTY.source,uMaskTextureA:k.EMPTY.source,uMaskTextureB:k.EMPTY.source}}),replaceMaskUniforms:r}},H3=({progress:r=0,frames:e=[],sampleMode:t="hold"}={})=>{if(e.length<=1)return{fromIndex:0,toIndex:0,mix:0};let i=J_(r);if(t==="linear"){if(i<=e[0].at)return{fromIndex:0,toIndex:0,mix:0};let o=e.length-1;if(i>=e[o].at)return{fromIndex:o,toIndex:o,mix:0};for(let n=0;n<e.length-1;n++){let a=e[n],l=e[n+1];if(i<=l.at){let c=l.at-a.at;return{fromIndex:n,toIndex:n+1,mix:c===0?0:(i-a.at)/c}}}return{fromIndex:o,toIndex:o,mix:0}}let s=0;for(let o=1;o<e.length&&!(i<e[o].at);o++)s=o;return{fromIndex:s,toIndex:s,mix:0}},W3=(r,e,t,i,s)=>{let o=U3(e),n=jc([{timeline:o}]),a=Math.max(e?.softness??.001,1e-4),{textures:l,channelWeights:c,invert:u,destroy:h}=N3(r,e,t,i),d=s.resources.replaceMaskUniforms,f=-1,m=-1;return{duration:n,progressTimeline:o,apply:g=>{let x=e?.kind==="sequence"?H3({progress:g,frames:e.frames,sampleMode:e.sample??"hold"}):{fromIndex:0,toIndex:0,mix:0};x.fromIndex!==f&&(s.resources.uMaskTextureA=l[x.fromIndex]??k.EMPTY.source,f=x.fromIndex),x.toIndex!==m&&(s.resources.uMaskTextureB=l[x.toIndex]??k.EMPTY.source,m=x.toIndex),d.uniforms.uProgress=J_(g),d.uniforms.uSoftness=a,d.uniforms.uMaskMix=x.mix,d.uniforms.uMaskInvert=u,d.uniforms.uMaskDirectReveal=e?.kind==="sequence"?1:0,d.uniforms.uMaskChannelWeights=c,d.update()},destroy:h}},z3=(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])},$3=r=>{let e=new ie;for(let t of r)t?.wrapper&&e.addChild(t.wrapper);return hB(uB(e))},zf=({app:r,container:e,target:t,frame:i})=>{r.renderer.render({container:e,target:t,clear:!0,transform:new V(1,0,0,1,-i.x,-i.y)})},X3=(r,e)=>{!r||r.parent!==e||e.removeChild(r)},ms=(r,e)=>{r?.wrapper&&!r.wrapper.destroyed&&(fr({app:e,root:r.wrapper}),r.wrapper.destroy({children:!0})),r?.texture?.destroy(!0)},j3=({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})},Y3=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>{let o=new ie;o.zIndex=s,t?.wrapper&&o.addChild(t.wrapper),i?.wrapper&&o.addChild(i.wrapper);let n=Xf(t?.wrapper??null,e.prev?.tween,r),a=Xf(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(),fr({app:r,root:o}),o.destroy({children:!0}),ms(t,r),ms(i,r)}}},q3=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>{let o=$3([t,i]),n=new ie,a=new ie;t?.wrapper&&n.addChild(t.wrapper),i?.wrapper&&a.addChild(i.wrapper);let l=Q_(o.width,o.height),c=Q_(o.width,o.height),u=new ie;u.zIndex=s;let h=new Re(l);h.x=o.x,h.y=o.y,h.filterArea=new ee(0,0,o.width,o.height),u.addChild(h);let{filter:d}=V3();d.resources.uNextTexture=c.source,h.filters=[d];let f=z3(o.width,o.height),m=typeof d.apply=="function"?d.apply.bind(d):(b,_,S,E)=>{b.applyFilter(d,_,S,E)};d.apply=(b,_,S,E)=>{let C=d.resources.replaceMaskUniforms;b.calculateSpriteMatrix(C.uniforms.uSecondaryMatrix,h),C.uniforms.uSecondaryClamp=f,C.update(),m(b,_,S,E)};let g=W3(r,e.mask,o.width,o.height,d),x=Xf(t?.wrapper??null,e.prev?.tween,r),y=Xf(i?.wrapper??null,e.next?.tween,r),T=!1,p=!1;return t?.wrapper||zf({app:r,container:n,target:l,frame:o}),i?.wrapper||zf({app:r,container:a,target:c,frame:o}),{overlay:u,duration:Math.max(x.duration,y.duration,g.duration),apply:b=>{x.apply(b),y.apply(b),t?.wrapper&&(x.duration>0||!T)&&(zf({app:r,container:n,target:l,frame:o}),T=!0),i?.wrapper&&(y.duration>0||!p)&&(zf({app:r,container:a,target:c,frame:o}),p=!0);let _=J_(Yc(g.progressTimeline,b));g.apply(_)},destroy:()=>{u.removeFromParent(),h.filters=[],d.destroy(),fr({app:r,root:u}),fr({app:r,root:n}),fr({app:r,root:a}),u.destroy({children:!0}),n.destroy({children:!0}),a.destroy({children:!0}),l.destroy(!0),c.destroy(!0),ms(t,r),ms(i,r),g.destroy()}}},K3=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>e.mask?q3({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s}):Y3({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s}),Z3=({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},Q3=async r=>r&&typeof r.then=="function"?r:r??null,jf=({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 m=t?e.children.find(W=>W.label===t.id)??null:null;if(t&&!m)throw new Error(`Transition animation "${s.id}" could not find the previous element "${t.id}".`);let g=m?oB(r,m):null,x=s.playback?.continuity==="persistent",y=__(s),T=x?new AbortController:null,p=T?.signal??f,b=new ie,_=gf({suppressAnimations:!0}),S=!x,E=S?a.getVersion():null,C=!1,P=d,R=()=>{!S||C||(a.track(E),C=!0)},I=()=>{C&&(a.complete(E),C=!1)},U={value:null},A={value:null},O=!1,F=()=>{typeof n?.removePending=="function"&&n.removePending(s.id)},M=({zIndex:W}={})=>{typeof W=="number"&&(P=W,U.value&&!U.value.destroyed&&(U.value.zIndex=P),A.value?.overlay&&!A.value.overlay.destroyed&&(A.value.overlay.zIndex=P))},D=({flushDeferredEffects:W})=>{if(!O){if(O=!0,U.value&&!U.value.destroyed&&(U.value.visible=!0),A.value?.destroy(),W){IR(_);return}Vc(_)}};x&&typeof n?.registerPending=="function"&&n.registerPending({id:s.id,animationType:s.type,targetId:s.targetId,signature:y,continuity:"persistent",onCancel:()=>{T?.abort(),Vc(_),fr({app:r,root:b}),b.destroy({children:!0}),ms(g,r),I()},onContinuationUpdate:M}),R();let G=W=>{if(p?.aborted||e.destroyed){F(),Vc(_),fr({app:r,root:b}),b.destroy({children:!0}),ms(g,r),I();return}if(i&&!W)throw F(),Vc(_),I(),new Error(`Transition animation "${s.id}" could not create the next element "${i.id}".`);U.value=W;let se=W?oB(r,W):null,fe=j3({prevElement:t,nextElement:i,animation:s,prevSubject:g,nextSubject:se});fe.prevSubject!==g&&ms(g,r),fe.nextSubject!==se&&ms(se,r),X3(W,b),fr({app:r,root:b}),b.destroy({children:!0}),m&&h.delete({app:r,parent:e,element:t,animations:[],animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,signal:p}),W&&(W.zIndex=P,e.addChild(W),W.visible=!1);let Ee=K3({app:r,animation:s,prevSubject:fe.prevSubject,nextSubject:fe.nextSubject,zIndex:P});A.value=Ee,e.addChild(Ee.overlay);let ye={id:s.id,driver:"custom",animationType:s.type,targetId:s.targetId,signature:y,continuity:x?"persistent":"render",onContinuationUpdate:M,duration:Ee.duration,applyFrame:Ee.apply,applyTargetState:()=>{D({flushDeferredEffects:!1})},onComplete:()=>{try{D({flushDeferredEffects:!0})}finally{I()}},onCancel:()=>{I()},isValid:()=>!!Ee.overlay&&!Ee.overlay.destroyed&&(!W||!W.destroyed)};x&&typeof n?.activatePending=="function"&&n.activatePending(s.id,ye)||(F(),n.dispatch({type:"START",payload:ye}))},N=i?Z3({app:r,parent:b,nextElement:i,plugin:h,animations:o,eventHandler:l,animationBus:n,completionTracker:a,elementPlugins:c,renderContext:_,zIndex:d,signal:p}):null;if(N&&typeof N.then=="function"){Q3(N).then(G);return}G(N??null)};var no=({app:r,parent:e,prevComputedTree:t,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c=gf(),signal:u})=>{e.sortableChildren=!0;let h=new Map(l.map(_=>[_.type,_])),d=BR(s),f=new Map,m=new Map;for(let _ of t)f.set(_.id,_);for(let _=0;_<i.length;_++)m.set(i[_].id,_);let{toAddElement:g,toDeleteElement:x,toUpdateElement:y}=iB(t,i,s),T=new Set(y.map(({next:_})=>_.id)),p=_=>{let S=h.get(_);if(!S)throw new Error(`No plugin found for element type: ${_}`);return S},b=_=>e.children.find(S=>S.label===_)?.zIndex??-1;for(let _ of i){let S=f.get(_.id);!S||T.has(_.id)||!pe(S,_)||p(_.type).shouldUpdateUnchanged?.({app:r,parent:e,prevElement:S,nextElement:_,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:m.get(_.id)??-1,signal:u})!==!0||(y.push({prev:S,next:_}),T.add(_.id))}for(let _ of e.children){let S=m.get(_.label);S!==void 0&&(_.zIndex=S)}for(let _ of x){let S=c.suppressAnimations?null:_f(d,_.id),E=S&&typeof o?.hasContext=="function"&&o.hasContext(S.id),C=p(_.type);if(!E){if(S){jf({app:r,parent:e,prevElement:_,nextElement:null,animation:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:C,zIndex:b(_.id),signal:u});continue}C.delete({app:r,parent:e,element:_,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,signal:u})}}for(let _ of g){let S=c.suppressAnimations?null:_f(d,_.id),E=S&&typeof o?.hasContext=="function"&&o.hasContext(S.id),C=p(_.type),P=m.get(_.id)??-1;if(E){typeof o?.updateContinuation=="function"&&o.updateContinuation(S.id,{zIndex:P});continue}if(S){jf({app:r,parent:e,prevElement:null,nextElement:_,animation:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:C,zIndex:P,signal:u});continue}C.add({app:r,parent:e,element:_,animations:d,eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,renderContext:c,zIndex:P,signal:u})}for(let{prev:_,next:S}of y){let E=p(S.type),C=m.get(S.id)??-1,P=c.suppressAnimations?null:_f(d,S.id);if(P&&typeof o?.hasContext=="function"&&o.hasContext(P.id))typeof o?.updateContinuation=="function"&&o.updateContinuation(P.id,{zIndex:C});else if(P){jf({app:r,parent:e,prevElement:_,nextElement:S,animation:P,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:E,zIndex:C,signal:u});continue}E.update({app:r,parent:e,prevElement:_,nextElement:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:C,signal:u})}};var J3=(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},eV=({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})}},fB=({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:m,scroll:g,alpha:x}=t,y=new ie;y.label=h,y.zIndex=l,y.x=Math.round(d),y.y=Math.round(f),y.alpha=x;let T=Gt(i,h);ut(y,t.blur,{force:T}),e.addChild(y),m&&m.length>0&&(J3(m)?eV({app:r,container:y,children:m,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,completionTracker:c,signal:u}):no({app:r,parent:y,prevComputedTree:[],nextComputedTree:m,animations:i,animationBus:o,completionTracker:c,eventHandler:s,elementPlugins:n,renderContext:a,signal:u})),(g||t.anchorToBottom)&&Xc({container:y,element:t,interactive:!!g,allowViewportWithoutScroll:!!t.anchorToBottom}),Vf({app:r,container:y,element:t,eventHandler:s}),J({animations:i,targetId:h,animationBus:o,completionTracker:c,element:y,targetState:{x:d,y:f,alpha:x,...Dt(t,{force:T})},renderContext:a})};var pB=({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(p=>p.label===t.id);if(!d)return;d.zIndex=c;let{x:f,y:m,alpha:g}=i,x=Gt(o,t.id);x&&ut(d,t.blur,{force:!0});let y=()=>{if(!pe(t,i)){d.x=Math.round(f),d.y=Math.round(m),d.label=i.id,d.alpha=g,d.scale.x=1,d.scale.y=1,ut(d,i.blur,{force:x});let S=t.scroll||t.anchorToBottom,E=i.scroll||i.anchorToBottom,C=E?QI({container:d}):null;S!==E?E?Xc({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:C}):q_({container:d}):E&&(q_({container:d}),Xc({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:C})),Vf({app:r,container:d,element:i,eventHandler:s})}let p=!pe(t.children,i.children),b=Js({children:i.children}),_=Array.from(b).some(S=>yf(o,S).length>0);if(p||_){let E=d.children.find(C=>C.label===`${i.id}-content`)||d;no({app:r,parent:E,nextComputedTree:i.children,prevComputedTree:t.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:u,renderContext:l,signal:h}),eB({container:d}),tB({container:d}),rB({container:d})}};J({animations:o,targetId:t.id,animationBus:n,completionTracker:u,element:d,targetState:{x:f,y:m,alpha:g,...Dt(i,{force:x})},onComplete:()=>{y()}})||y()};var mB=({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&&(k_({root:a}),fr({app:r,root:a}),e.removeChild(a),a.destroy({children:!0}))};J({animations:s,targetId:t.id,animationBus:i,completionTracker:n,element:a,targetState:null,onComplete:l})||l()};var gB=({state:r,parserPlugins:e=[]})=>{let t=r.direction==="horizontal"||r.direction==="vertical"?r.direction:"absolute",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,m=0,g=0,x=0,y=0;for(let b=0;b<n.length;b++){let _=n[b];b>0?t==="horizontal"?(_.x=u,_.y=m):t==="vertical"&&(_.x=g,_.y=h):(t==="horizontal"||t==="vertical")&&(_.x=0,_.y=0);let S=e.find(E=>E.type===_.type);if(S){let E=_.scaleX!==void 0||r.scaleX!==void 0,C=_.scaleY!==void 0||r.scaleY!==void 0,P=(_.scaleX??1)*(r.scaleX??1),R=(_.scaleY??1)*(r.scaleY??1);_=S.parse({state:{..._,...E?{scaleX:P}:{},...C?{scaleY:R}:{}},parserPlugins:e})}if(t==="horizontal"){let E=b<n.length-1?s:0;r.width&&_.width+x>r.width&&!i&&!r.anchorToBottom?(u=0,x=0,m+=d+o,d=_.height,_.x=0,_.y=m):d=Math.max(d,_.height),u+=_.width+E,x=_.x+_.width,l=Math.max(u,l),c=Math.max(_.height+_.y,c)}else if(t==="vertical"){let E=b<n.length-1?o:0;r.height&&_.height+y>r.height&&!i&&!r.anchorToBottom?(h=0,y=0,g+=f+s,f=_.width,_.x=g,_.y=0):f=Math.max(f,_.width),h+=_.height+E,y=_.y+_.height,l=Math.max(_.width+_.x,l),c=Math.max(h,c)}else l=Math.max(_.width+_.x,l),c=Math.max(_.height+_.y,c);a.push(_)}let p={...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)},...r.blur!==void 0&&{blur:hs(r.blur)},rotation:r.rotation??0};return r.rightClick&&(p.rightClick=r.rightClick),r.scrollUp&&(p.scrollUp=r.scrollUp),r.scrollDown&&(p.scrollDown=r.scrollDown),p};var tV=it({type:"container",add:fB,update:pB,delete:mB,parse:gB});var xB=async({parent:r,element:e,animations:t,animationBus:i,renderContext:s,completionTracker:o,zIndex:n,signal:a})=>{if(a?.aborted)return;let l=new ie;if(l.label=e.id,l.zIndex=n,e.x!==void 0&&(l.x=Math.round(e.x)),e.y!==void 0&&(l.y=Math.round(e.y)),e.alpha!==void 0&&(l.alpha=e.alpha),r.addChild(l),J({animations:t,targetId:e.id,animationBus:i,completionTracker:o,element:l,targetState:{x:e.x??l.x,y:e.y??l.y,alpha:e.alpha??l.alpha},renderContext:s}),s?.suppressAnimations&&!Ln(e)){await Bi({container:l,element:e,completionTracker:o,animationBus:i,zIndex:n,signal:a,playback:"paused-initial"}),xf(s,{container:l,element:e,completionTracker:o,animationBus:i,zIndex:n,signal:a});return}await Bi({container:l,element:e,completionTracker:o,animationBus:i,zIndex:n,signal:a,playback:"autoplay"})};var yB=(r={})=>JSON.stringify({content:r.content??null,revealEffect:r.revealEffect??"typewriter",softWipe:(r.revealEffect??"typewriter")==="softWipe"?Zs(r.softWipe):null,speed:r.speed??50,initialRevealedCharacters:r.initialRevealedCharacters??0,width:r.width??null,indicator:r.indicator??null,x:r.x??null,y:r.y??null,alpha:r.alpha??1}),rV=(r,e)=>yB(r)!==yB(e),_B=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),!rV(e,t)){o?.suppressAnimations!==!0&&!Ln(t)&&await Bi({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"resume"});return}if(o?.suppressAnimations===!0&&!Ln(t)){await Bi({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"paused-initial"}),xf(o,{container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l});return}await Bi({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"autoplay"})};J({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 bB=({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&&(g_(o),o.destroy({children:!0}))};J({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var iV=it({type:"text-revealing",add:xB,update:_B,delete:bB,parse:oI,shouldUpdateUnchanged:({parent:r,nextElement:e})=>vR(r.children.find(t=>t.label===e.id))});var Yf=(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},qf=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var vB=(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},eb=(r={})=>!r||typeof r!="object"?{}:Object.fromEntries(Object.entries(r).map(([e,t])=>[e,Array.isArray(t)?t.map(i=>String(i)):[]])),sV=(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<t)return[];let s=r.slice(t,i+1),o=String(e.direction??"forward").toLowerCase();if(o==="reverse"||o==="backward")return[...s].reverse();if(o==="pingpong")return[...s,...s.slice(1,-1).reverse()];if(o==="pingpong_reverse"){let n=[...s].reverse();return[...n,...n.slice(1,-1).reverse()]}return s},oV=(r=[],e=[])=>!Array.isArray(r)||e.length===0?{}:Object.fromEntries(r.map(t=>{let i=typeof t?.name=="string"?t.name:"";return i?[i,sV(e,t)]:null}).filter(Boolean)),Qn=(r={})=>{let e=r??{},t=eb(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,vB(s)]}).filter(Boolean)):Object.fromEntries(Object.entries(e.frames??{}).map(([s,o])=>[s,vB(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}}:{}}}},Jn=(r={},e={},t={},i=[])=>({...oV(t?.frameTags,i),...eb(e),...eb(r)}),nV=(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)},ao=({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=nV(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},Kf=({spritesheet:r,atlas:e,clips:t={},playback:i,legacyAnimation:s})=>{let o=ao({atlas:e,clips:t,playback:i,legacyAnimation:s});return{frameTextures:o.frames.map(a=>r.textures[a]),playback:o}},Zf=r=>typeof r=="number"?r/60:.5;var TB=async({app:r,parent:e,element:t,animations:i,animationBus:s,renderContext:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let{id:c,x:u,y:h,width:d,height:f,src:m,atlas:g,clips:x,playback:y,alpha:T}=t,p=Qn(g),b=Jn(x,g?.animations,g?.meta,Object.keys(p.frames??{})),_=ao({atlas:p,clips:b,playback:y}),S=n?.getVersion?.();n?.track?.(S);try{let E=new Ki(k.from(m),p);if(await E.parse(),l?.aborted||e.destroyed)return;let{frameTextures:C}=Kf({spritesheet:E,atlas:p,clips:b,playback:_}),P=new Uc(C);P.label=c,P.zIndex=a,P.animationSpeed=Zf(_.fps),P.loop=_.loop,r.debug?Yf(P,c,r.debug,()=>{typeof r.render=="function"&&r.render()}):_.autoplay&&CR(o,P),P.x=Math.round(u),P.y=Math.round(h),P.width=Math.round(d),P.height=Math.round(f),P.alpha=T;let R=Gt(i,c);ut(P,t.blur,{force:R}),e.addChild(P),J({animations:i,targetId:c,animationBus:s,completionTracker:n,element:P,targetState:{x:u,y:h,width:d,height:f,alpha:T,...Dt(t,{force:R})},renderContext:o}),typeof r.render=="function"&&r.render()}finally{n?.complete?.(S)}};var SB=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(T=>T.label===t.id);if(!c)return;c.zIndex=a;let u=Gt(s,t.id);u&&ut(c,t.blur,{force:!0});let h=async()=>{if(!(l?.aborted||c.destroyed)&&!pe(t,i)){let T=i.src,p=Qn(i.atlas),b=Jn(i.clips,i.atlas?.animations,i.atlas?.meta,Object.keys(p.frames??{})),_=ao({atlas:p,clips:b,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,ut(c,i.blur,{force:u});let S=!pe(t.playback,i.playback),E=!pe(t.clips,i.clips),C=t.src!==T||!pe(t.atlas,i.atlas);if(c.animationSpeed=Zf(_.fps),c.loop=_.loop,S||E||C){let P=n?.getVersion?.();n?.track?.(P);try{let R=new Ki(k.from(T),p);if(await R.parse(),l?.aborted||c.destroyed)return;let{frameTextures:I}=Kf({spritesheet:R,atlas:p,clips:b,playback:_});c.textures=I,typeof r.render=="function"&&r.render(),!r.debug&&_.autoplay?c.play():(r.debug||c.stop?.(),t.id!==i.id&&(qf(c),Yf(c,i.id,r.debug,()=>{typeof r.render=="function"&&r.render()})))}finally{n?.complete?.(P)}}}},{x:d,y:f,width:m,height:g,alpha:x}=i;J({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:d,y:f,width:m,height:g,alpha:x,...Dt(i,{force:u})},onComplete:()=>{h()}})||await h()};var wB=({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&&qf(n),n&&!n.destroyed&&(n.stop(),n.destroy())};J({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var EB=({state:r})=>{let e=yt(r),t=r.atlas,i=Qn(t),s=Jn(r.clips,t?.animations,t?.meta,Object.keys(i.frames??{})),o=ao({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,...r.blur!==void 0&&{blur:hs(r.blur)}}};var AB=it({type:"spritesheet-animation",add:TB,update:SB,delete:wB,parse:EB}),aV=AB;var lV=s_({type:"tween"});var lo=new Map,cV=r=>({id:r.id,url:r.src,loop:r.loop??!1,volume:ze(r.volume,100)}),CB=r=>lo.has(r),qc=r=>{let e=lo.get(r);e!==void 0&&(clearTimeout(e),lo.delete(r))},tb=({app:r,element:e})=>{let t=cV(e);if(qc(t.id),e.startDelayMs&&e.startDelayMs>0){let i=setTimeout(()=>{lo.delete(t.id),r.audioStage.add(t)},e.startDelayMs);lo.set(t.id,i);return}r.audioStage.add(t)},rb=()=>{for(let r of lo.values())clearTimeout(r);lo.clear()},PB=({app:r,element:e})=>{tb({app:r,element:e})};var MB=({app:r,prevElement:e,nextElement:t})=>{let i=e.id;if((t.startDelayMs??0)>0){r.audioStage.remove(i),tb({app:r,element:t});return}if(CB(i)){qc(i),r.audioStage.add({id:i,url:t.src,loop:t.loop??!1,volume:ze(t.volume,100)});return}let o=r.audioStage.getById(i);if(!o){r.audioStage.add({id:i,url:t.src,loop:t.loop??!1,volume:ze(t.volume,100)});return}o.url=t.src,o.loop=t.loop??!1,o.volume=ze(t.volume,100)};var RB=({app:r,element:e})=>{qc(e.id),r.audioStage.remove(e.id)};var uV=o_({type:"sound",add:PB,update:MB,delete:RB});var Kc=class extends Re{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(e){this.destroyed||(this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy(e))}};function ib(r){let e=new We;return e.circle(0,0,3),e.fill({color:16777215}),r.renderer.generateTexture(e)}function sb(r){let e=new We;return e.rect(0,0,1,8),e.fill({color:8965375}),r.renderer.generateTexture(e)}function ob(r){let e=new We;return e.circle(0,0,4),e.fill({color:16777215}),r.renderer.generateTexture(e)}function Zc(r,e,t){return r+(e-r)*t}function Jf(r){if(typeof r=="number")return r;let e=r.replace(/^(#|0x)/,"");return parseInt(e,16)}function IB(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(Zc(i,n,t)),u=Math.round(Zc(s,a,t)),h=Math.round(Zc(o,l,t));return c<<16|u<<8|h}var Qf=class r{constructor(e,t,i=!1){this.value=i?Jf(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<i.length;n++)o.next=new r(i[n].value,i[n].time,t),o=o.next;return s}},Nr=class{constructor(e=!1){this.first=null,this.isColor=e,this.ease=null}reset(e){Array.isArray(e)?this.first=Qf.createList(e,this.isColor):this.first=e}getValue(e){if(this.ease&&(e=this.ease(e)),!this.first.next||e<=this.first.time)return this.first.value;let t=this.first;for(;t.next&&t.next.time<e;)t=t.next;if(!t.next||e>=t.next.time)return t.next?t.next.value:t.value;let i=(e-t.time)/(t.next.time-t.time);return this.isColor?IB(t.value,t.next.value,i):Zc(t.value,t.next.value,i)}};var ep=class{static type="alpha";constructor(e){this.list=new Nr(!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)}},tp=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 BB(r,e,t){return Math.min(Math.max(r,e),t)}function Nt(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+hV(r,s)*(i-t):s.kind==="normal"?dV(r,t,i,s):t+r()*(i-t)}function hV(r,e){let t=e.toward??"min",i=BB(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 dV(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 BB(s+l*o,e,t)}var rp=class{static type="scale";constructor(e){this.list=new Nr(!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)}},ip=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=Nt(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 fV=Math.PI/180,sp=class{static type="speed";constructor(e){this.list=new Nr(!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}},op=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=Nt(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}},np=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=Nt(t.emitter.random.bind(t.emitter),this.speed),s=Nt(t.emitter.random.bind(t.emitter),this.direction)*fV;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 Y0e=Math.PI/180,ap=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))}},lp=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 Qc=Math.PI/180,cp=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)*Qc}initParticles(e){let t=e;for(;t;)t.rotation=Nt(t.emitter.random.bind(t.emitter),this.startRange)*Qc,t.rotationSpeed=Nt(t.emitter.random.bind(t.emitter),this.speedRange)*Qc,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}},up=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=Nt(t.emitter.random.bind(t.emitter),this.range)*Qc,t=t.next}updateParticle(e,t){}},hp=class{static type="noRotation";constructor(e){this.rotation=(e.rotation??0)*Qc}initParticles(e){let t=e;for(;t;)t.rotation=this.rotation,t=t.next}updateParticle(e,t){e.rotation=this.rotation}};var dp=class{static type="color";constructor(e){this.list=new Nr(!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)}},fp=class{static type="colorStatic";constructor(e){this.color=Jf(e.color)}initParticles(e){let t=e;for(;t;)t.tint=this.color,t=t.next}updateParticle(e,t){}};var pp=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}},mp=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)}},nb=class{constructor(e){this.x=e.x,this.y=e.y}getRandPos(e,t){e.x=this.x,e.y=this.y}},ab=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}},pV={rect:pp,rectangle:pp,torus:mp,circle:mp,point:nb,line:ab};var gp=class{static type="spawnShape";constructor(e){let t=pV[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){}},xp=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 kB=Math.PI/180,yp=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=Nt(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"?Nt(e,this.velocity.angle??{min:0,max:360})*kB:Nt(e,this.velocity.direction??0)*kB: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 FB=new Map,OB=new Map;function lb(r,e){FB.set(r,e)}function It(r){OB.set(r.type,r)}function UB(r,e){let t=FB.get(r);return t?t(e):null}function LB(r){return OB.get(r)}lb("circle",ob);lb("snowflake",ib);lb("raindrop",sb);It(ep);It(tp);It(rp);It(ip);It(sp);It(op);It(np);It(ap);It(lp);It(cp);It(up);It(hp);It(dp);It(fp);It(gp);It(xp);It(yp);var _p=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 mV(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r.mode=="string"&&Array.isArray(r.items)}var Jc=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 _p(e.seed):null,e.texture&&(mV(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=LB(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 Kc(this),e}_unlinkActiveParticle(e){return!e||!(e===this._activeFirst||e===this._activeLast||e.prev!==null||e.next!==null)?!1:(e.prev?e.prev.next=e.next:this._activeFirst=e.next,e.next?e.next.prev=e.prev:this._activeLast=e.prev,e.prev=null,e.next=null,this._activeFirst?this.particleCount=Math.max(0,this.particleCount-1):(this._activeLast=null,this.particleCount=0),!0)}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;n<e;n++){let a=this._createParticle();a.texture=i??this._pickTexture();let l=Nt(this.random.bind(this),this.lifetime);a.init(l),s||(s=a),o&&(o.next=a,a.prev=o),o=a,this.container.addChild(a)}for(let n of this.initBehaviors)n.initParticles(s);return this._activeLast?(this._activeLast.next=s,s.prev=this._activeLast):this._activeFirst=s,this._activeLast=o,this.particleCount+=e,s}emitNow(){this.spawn(this.particlesPerWave)}recycle(e){if(!e||e.destroyed){this._unlinkActiveParticle(e);return}for(let t of this.recycleBehaviors)t.recycleParticle(e);this._unlinkActiveParticle(e)&&(e.parent&&e.parent.removeChild(e),e.next=this._poolFirst,this._poolFirst=e)}update(e){if(this.destroyed)return;if(this.emitterLifetime>0&&(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.destroyed||!t.position){this._unlinkActiveParticle(t),t=i;continue}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.x<s.x||t.x>s.x+s.width||t.y<s.y||t.y>s.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 gV(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r.mode=="string"&&Array.isArray(r.items)}function xV(r,e){let t=new We,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 GB(r,e){if(typeof e=="object"&&e?.shape)return xV(r,e);let t=e??"circle",i=UB(t,r);if(!i)try{i=k.from(t)}catch{return console.warn(`Failed to load particle texture: ${t}`),null}return i}function yV(r,e){let t=[];for(let i of e.items){let s=i.src?i.src:i,o=GB(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 eu=({app:r,parent:e,element:t,animations:i,animationBus:s,completionTracker:o,renderContext:n,zIndex:a})=>{let l=new ie;l.label=t.id,l.zIndex=a,e.addChild(l);let c=t.width,u=t.height;l.x=t.x??0,l.y=t.y??0;let h={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},d=gV(t.texture)?yV(r,t.texture):GB(r,t.texture);if(!d)return;h.texture=d;let f=new Jc(l,h);l.emitter=f;let m=h.frequency<=0;if(m){f.emitNow(),f.emit=!1;let x=y=>{if(!y.length)return;let[T,...p]=y;(T===0&&typeof requestAnimationFrame=="function"?requestAnimationFrame:_=>setTimeout(_,T))(()=>{f.destroyed||f.particleCount>0||(f.emitNow(),x(p))})};x([0,50,150])}if(h.recycleOnBounds&&!m){let x=Math.min(t.count??100,h.maxParticles);f.spawn(x);let y=f._activeFirst;for(;y;)y.y=f.random()*u,y.age=f.random()*y.maxLife*.8,y=y.next}let g=x=>{if(f.destroyed){r.ticker.remove(g);return}let y=Math.min(typeof x.deltaMS=="number"?x.deltaMS/1e3:x.deltaTime/60,.1);f.update(y)};l.tickerCallback=g,MR(n,{app:r,emitter:f,container:l,tickerCallback:g}),t.alpha!==void 0&&(l.alpha=t.alpha),J({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:l,targetState:{x:t.x??0,y:t.y??0,alpha:t.alpha??l.alpha},renderContext:n})};var bp=({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&&(Z_({app:r,particleElement:n}),n.destroy({children:!0}))};J({animations:s,targetId:t.id,animationBus:i,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var DB=({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){eu({app:r,parent:e,element:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l});return}if(c.zIndex=l,_V(t,i))bp({app:r,parent:e,element:t,animations:s,animationBus:o,completionTracker:n}),eu({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)};J({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 _V(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 cb(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(Ks).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Ks).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 NB(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 VB(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;e<r.behaviors.length;e++){let t=r.behaviors[e];if(typeof t!="object"||t===null||Array.isArray(t))throw new Error(`Input Error: behaviors[${e}] must be an object`);if(!t.type||typeof t.type!="string")throw new Error(`Input Error: behaviors[${e}] must have a 'type' string property`)}}function HB(r){if(!r.emitter)throw new Error("Input Error: Particles require 'emitter'");if(typeof r.emitter!="object"||Array.isArray(r.emitter))throw new Error("Input Error: 'emitter' must be an object");if(!r.emitter.lifetime)throw new Error("Input Error: emitter.lifetime is required");if(typeof r.emitter.lifetime!="object"||Array.isArray(r.emitter.lifetime))throw new Error("Input Error: emitter.lifetime must be an object");if(typeof r.emitter.lifetime.min!="number"||typeof r.emitter.lifetime.max!="number")throw new Error("Input Error: emitter.lifetime.min and max must be numbers");if(r.emitter.lifetime.min<0||r.emitter.lifetime.max<0)throw new Error("Input Error: emitter.lifetime.min and max must be non-negative");if(r.emitter.lifetime.min>r.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function WB(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 zB(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 bV=new Set(["continuous","burst"]),vV=new Set(["point","rect","circle","line"]),TV=new Set(["single","random","cycle"]),SV=new Set(["perParticle","perWave"]),$B=new Set(["uniform","normal","bias"]),XB=new Set(["min","max","center"]),wV=new Set(["none","fixed","random","spin"]);function KB(r){if(EV(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");AV(e),PV(t,i),MV(i),FV(s)}function EV(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&&(de(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&&de(r.x,"x"),r.y!==void 0&&de(r.y,"y"),r.seed!==void 0&&de(r.seed,"seed")}function AV(r){if(!bV.has(r.mode))throw new Error("Input Error: modules.emission.mode must be 'continuous' or 'burst'");if(r.mode==="continuous"){if(de(r.rate,"modules.emission.rate"),r.rate<=0)throw new Error("Input Error: modules.emission.rate must be positive")}else if(qB(r.burstCount,"modules.emission.burstCount"),r.burstCount<=0)throw new Error("Input Error: modules.emission.burstCount must be positive");if(r.maxActive!==void 0&&(qB(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"&&(de(r.duration,"modules.emission.duration"),r.duration<0))throw new Error("Input Error: modules.emission.duration must be non-negative");if(gs(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(!vV.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");CV(r.source.kind,r.source.data)}function CV(r,e){if(r==="point"){de(e.x,"modules.emission.source.data.x"),de(e.y,"modules.emission.source.data.y");return}if(r==="rect"){if(de(e.x,"modules.emission.source.data.x"),de(e.y,"modules.emission.source.data.y"),de(e.width,"modules.emission.source.data.width"),de(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(de(e.x,"modules.emission.source.data.x"),de(e.y,"modules.emission.source.data.y"),de(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&&(de(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}de(e.x1,"modules.emission.source.data.x1"),de(e.y1,"modules.emission.source.data.y1"),de(e.x2,"modules.emission.source.data.x2"),de(e.y2,"modules.emission.source.data.y2")}function PV(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'");gs(t.speed,"modules.movement.velocity.speed",{allowNegative:!1}),t.kind==="directional"?gs(t.direction,"modules.movement.velocity.direction",{allowNegative:!0}):t.angle!==void 0&&gs(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");de(r.acceleration.x,"modules.movement.acceleration.x"),de(r.acceleration.y,"modules.movement.acceleration.y")}if(r.maxSpeed!==void 0&&(de(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 MV(r){RV(r.texture),r.scale!==void 0&&jB(r.scale,"modules.appearance.scale",{allowNegative:!1,modes:["single","range","curve"]}),r.alpha!==void 0&&jB(r.alpha,"modules.appearance.alpha",{min:0,max:1,modes:["single","curve"]}),r.color!==void 0&&BV(r.color,"modules.appearance.color"),r.rotation!==void 0&&kV(r.rotation)}function RV(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){ZB(r,"modules.appearance.texture");return}if(!TV.has(r.mode))throw new Error("Input Error: modules.appearance.texture.mode must be 'single', 'random', or 'cycle'");if(r.pick!==void 0&&!SV.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;e<r.items.length;e++){let t=r.items[e];IV(t,`modules.appearance.texture.items[${e}]`)}}}function IV(r,e){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(r.src!==void 0){if(typeof r.src!="string"||r.src.length===0)throw new Error(`Input Error: ${e}.src must be a non-empty string`)}else if(r.shape)ZB(r,e);else throw new Error(`Input Error: ${e} must define either 'src' or shape fields`);if(r.weight!==void 0&&(de(r.weight,`${e}.weight`),r.weight<=0))throw new Error(`Input Error: ${e}.weight must be positive`)}function ZB(r,e){if(!["circle","ellipse","rect"].includes(r.shape))throw new Error(`Input Error: ${e}.shape must be 'circle', 'ellipse', or 'rect'`);if(r.radius!==void 0&&de(r.radius,`${e}.radius`),r.width!==void 0&&de(r.width,`${e}.width`),r.height!==void 0&&de(r.height,`${e}.height`),r.color!==void 0&&typeof r.color!="string"&&typeof r.color!="number")throw new Error(`Input Error: ${e}.color must be a string or number`)}function jB(r,e,t){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(!t.modes.includes(r.mode))throw new Error(`Input Error: ${e}.mode must be one of ${t.modes.join(", ")}`);if(r.mode==="single"){tu(r.value,`${e}.value`,t);return}if(r.mode==="range"){gs(r,e,t);return}if(!Array.isArray(r.keys)||r.keys.length===0)throw new Error(`Input Error: ${e}.keys must be a non-empty array`);let i=-1/0;for(let s=0;s<r.keys.length;s++){let o=r.keys[s];if(!o||typeof o!="object"||Array.isArray(o))throw new Error(`Input Error: ${e}.keys[${s}] must be an object`);if(de(o.time,`${e}.keys[${s}].time`),o.time<0||o.time>1)throw new Error(`Input Error: ${e}.keys[${s}].time must be between 0 and 1`);if(o.time<i)throw new Error(`Input Error: ${e}.keys must be sorted by time`);i=o.time,tu(o.value,`${e}.keys[${s}].value`,t)}}function BV(r,e){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(r.mode==="single"){YB(r.value,`${e}.value`);return}if(r.mode!=="gradient")throw new Error("Input Error: modules.appearance.color.mode must be 'single' or 'gradient'");if(!Array.isArray(r.keys)||r.keys.length===0)throw new Error(`Input Error: ${e}.keys must be a non-empty array`);let t=-1/0;for(let i=0;i<r.keys.length;i++){let s=r.keys[i];if(!s||typeof s!="object"||Array.isArray(s))throw new Error(`Input Error: ${e}.keys[${i}] must be an object`);if(de(s.time,`${e}.keys[${i}].time`),s.time<0||s.time>1)throw new Error(`Input Error: ${e}.keys[${i}].time must be between 0 and 1`);if(s.time<t)throw new Error(`Input Error: ${e}.keys must be sorted by time`);t=s.time,YB(s.value,`${e}.keys[${i}].value`)}}function YB(r,e){if(typeof r!="string"&&typeof r!="number")throw new Error(`Input Error: ${e} must be a string or number`)}function kV(r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.appearance.rotation must be an object");if(!wV.has(r.mode))throw new Error("Input Error: modules.appearance.rotation.mode must be 'none', 'fixed', 'random', or 'spin'");if(r.mode!=="none"){if(r.mode==="fixed"){de(r.value,"modules.appearance.rotation.value");return}if(r.mode==="random"){gs(r,"modules.appearance.rotation",{allowNegative:!0});return}gs(r.start,"modules.appearance.rotation.start",{allowNegative:!0}),gs(r.speed,"modules.appearance.rotation.speed",{allowNegative:!0})}}function FV(r){if(r!==void 0){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.bounds must be an object");if(r.mode!=="none"&&r.mode!=="recycle")throw new Error("Input Error: modules.bounds.mode must be 'none' or 'recycle'");if(r.mode!=="none"){if(r.source!=="area"&&r.source!=="custom")throw new Error("Input Error: modules.bounds.source must be 'area' or 'custom'");if(r.padding!==void 0&&OV(r.padding,"modules.bounds.padding"),r.source==="custom"){if(!r.custom||typeof r.custom!="object"||Array.isArray(r.custom))throw new Error("Input Error: modules.bounds.custom must be an object");de(r.custom.x,"modules.bounds.custom.x"),de(r.custom.y,"modules.bounds.custom.y"),de(r.custom.width,"modules.bounds.custom.width"),de(r.custom.height,"modules.bounds.custom.height")}}}}function OV(r,e){if(typeof r!="number"){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be a number or object`);for(let t of["top","right","bottom","left"])de(r[t],`${e}.${t}`)}}function gs(r,e,t={}){if(typeof r=="number"){tu(r,e,t);return}if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be a number or range object`);if(de(r.min,`${e}.min`),de(r.max??r.min,`${e}.max`),tu(r.min,`${e}.min`,t),tu(r.max??r.min,`${e}.max`,t),r.min>(r.max??r.min))throw new Error(`Input Error: ${e}.min cannot be greater than max`);r.distribution!==void 0&&UV(r.distribution,`${e}.distribution`)}function tu(r,e,t={}){if(de(r,e),!t.allowNegative&&r<0)throw new Error(`Input Error: ${e} must be non-negative`);if(t.min!==void 0&&r<t.min)throw new Error(`Input Error: ${e} must be at least ${t.min}`);if(t.max!==void 0&&r>t.max)throw new Error(`Input Error: ${e} must be at most ${t.max}`)}function UV(r,e){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(!$B.has(r.kind))throw new Error(`Input Error: ${e}.kind must be one of ${[...$B].join(", ")}`);if(r.kind==="bias"){if(!XB.has(r.toward??"min"))throw new Error(`Input Error: ${e}.toward must be one of ${[...XB].join(", ")}`);r.strength!==void 0&&de(r.strength,`${e}.strength`)}r.kind==="normal"&&(r.mean!==void 0&&de(r.mean,`${e}.mean`),r.deviation!==void 0&&de(r.deviation,`${e}.deviation`))}function de(r,e){if(typeof r!="number"||Number.isNaN(r))throw new Error(`Input Error: ${e} must be a number`)}function qB(r,e){if(de(r,e),!Number.isInteger(r))throw new Error(`Input Error: ${e} must be an integer`)}function QB(r){let e=LV(r),t=[];t.push(GV(r.modules.emission.source));let i=NV(r.modules.movement);i&&t.push(i),t.push(...VV(r.modules.appearance));let s=YV(r.modules.bounds,r.width,r.height);s&&(e.spawnBounds=s.spawnBounds,e.recycleOnBounds=!0);let o=HV(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 LV(r){let{emission:e}=r.modules,t={lifetime:xs(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 GV(r){return{type:"spawnShape",config:{type:r.kind,data:DV(r.kind,r.data)}}}function DV(r,e){return r==="rect"?{x:e.x,y:e.y,w:e.width,h:e.height}:{...e}}function NV(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:xs(r.velocity.speed)},r.velocity.kind==="directional"?e.velocity.direction=xs(r.velocity.direction):e.velocity.angle=xs(r.velocity.angle??{min:0,max:360})),r.acceleration&&(e.acceleration={x:r.acceleration.x,y:r.acceleration.y}),{type:"movement",config:e}}function VV(r){let e=[];if(r.scale&&e.push(zV(r.scale)),r.alpha&&e.push($V(r.alpha)),r.color&&e.push(XV(r.color)),r.rotation){let t=jV(r.rotation);t&&e.push(t)}return e}function HV(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(WV)};if(e.mode==="single"&&e.items.length===1){let[t]=e.items;return t.src??JB(t)}return e}function WV(r){if(r.src)return r.weight===void 0?{src:r.src}:{src:r.src,weight:r.weight};let e=JB(r);return r.weight!==void 0&&(e.weight=r.weight),e}function JB(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 zV(r){return r.mode==="curve"?{type:"scale",config:{list:ub(r.keys)}}:{type:"scaleStatic",config:r.mode==="single"?{min:r.value,max:r.value}:xs(r)}}function $V(r){return r.mode==="curve"?{type:"alpha",config:{list:ub(r.keys)}}:{type:"alphaStatic",config:{alpha:r.value}}}function XV(r){return r.mode==="gradient"?{type:"color",config:{list:ub(r.keys)}}:{type:"colorStatic",config:{color:r.value}}}function jV(r){if(r.mode==="none")return null;if(r.mode==="fixed")return{type:"noRotation",config:{rotation:r.value}};if(r.mode==="random"){let i=xs(r);return{type:"rotationStatic",config:{min:i.min,max:i.max,distribution:i.distribution}}}let e=xs(r.start),t=xs(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 YV(r,e,t){if(!r||r.mode==="none")return null;if(r.source==="custom")return{spawnBounds:{...r.custom}};let i=qV(r.padding??0);return{spawnBounds:{x:-i.left,y:-i.top,width:e+i.left+i.right,height:t+i.top+i.bottom}}}function qV(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 ub(r){return r.map(e=>({time:e.time,value:e.value}))}function xs(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 ek=({state:r})=>{if(r.modules)return cb(r),KB(r),QB(r);cb(r),NB(r),VB(r),HB(r),WB(r),zB(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 KV=it({type:"particles",add:eu,update:DB,delete:bp,parse:ek});var tk=(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):pe(c,u)||a.push({prev:c,next:u})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var rk=new Set(["audio-channel","sound"]),ZV=new Set(["audioTransition"]),QV=new Set(["enter","exit","update"]),JV=new Set(["volume"]),eH=new Set(["linear"]),tH={enter:new Set(["from","duration","easing"]),exit:new Set(["to","duration","easing"]),update:new Set(["duration","easing"])},rH=r=>r!==null&&typeof r=="object"&&!Array.isArray(r),ta=(r,e)=>{if(!rH(r))throw new Error(`Input error: ${e} must be an object.`)},ra=(r,e)=>{if(typeof r!="string"||r.length===0)throw new Error(`Input error: ${e} must be a non-empty string.`)},ru=(r,e,{min:t,max:i}={})=>{if(typeof r!="number"||Number.isNaN(r))throw new Error(`Input error: ${e} must be a number.`);if(t!==void 0&&r<t)throw new Error(`Input error: ${e} must be greater than or equal to ${t}.`);if(i!==void 0&&r>i)throw new Error(`Input error: ${e} must be less than or equal to ${i}.`)},hb=(r,e)=>{if(r!==void 0&&typeof r!="boolean")throw new Error(`Input error: ${e} must be a boolean.`)},ea=(r,e,t)=>{r!=null&&ru(r,e,t)},ik=(r,e)=>r==null?100:(ru(r,e),Math.max(0,Math.min(100,r))),vp=(r,e,t)=>{if(r.has(e))throw new Error(`Input error: duplicate audio render-state id "${e}" at ${t}.`);r.add(e)},sk=(r,e,t,i,s=null)=>{if(ra(r.id,`${e}.id`),vp(t,r.id,`${e}.id`),ra(r.src,`${e}.src`),r.delay!==void 0)throw new Error(`Input error: ${e}.delay is not supported. Use ${e}.startDelayMs instead.`);let o=ik(r.volume,`${e}.volume`);if(hb(r.muted,`${e}.muted`),ea(r.pan,`${e}.pan`,{min:-1,max:1}),hb(r.loop,`${e}.loop`),ea(r.startDelayMs,`${e}.startDelayMs`,{min:0}),ea(r.playbackRate,`${e}.playbackRate`,{min:0}),ea(r.startAt,`${e}.startAt`,{min:0}),ea(r.endAt,`${e}.endAt`,{min:0}),r.endAt!==void 0&&r.endAt!==null&&r.startAt!==void 0&&r.endAt<r.startAt)throw new Error(`Input error: ${e}.endAt must be greater than or equal to startAt.`);i.push({id:r.id,type:"sound",src:r.src,volume:o,muted:r.muted??!1,pan:r.pan??0,loop:r.loop??!1,startDelayMs:r.startDelayMs??0,playbackRate:r.playbackRate??1,startAt:r.startAt??0,endAt:r.endAt??null,channelId:s})},iH=(r,e,t,i,s)=>{ra(r.id,`${e}.id`),vp(t,r.id,`${e}.id`);let o=ik(r.volume,`${e}.volume`);if(hb(r.muted,`${e}.muted`),ea(r.pan,`${e}.pan`,{min:-1,max:1}),r.children!==void 0&&!Array.isArray(r.children))throw new Error(`Input error: ${e}.children must be an array.`);i.push({id:r.id,type:"audio-channel",volume:o,muted:r.muted??!1,pan:r.pan??0});for(let[n,a]of(r.children??[]).entries()){let l=`${e}.children[${n}]`;if(ta(a,l),a.type==="audio-channel")throw new Error(`Input error: nested audio-channel nodes are not supported at ${l}.`);if(a.type!=="sound")throw new Error(`Input error: ${l}.type must be "sound".`);sk(a,l,t,s,r.id)}},sH=(r,e)=>{if(!Array.isArray(r))throw new Error("Input error: `audio` must be an array.");let t=[],i=[],s=new Set;for(let[o,n]of r.entries()){let a=`audio[${o}]`;if(ta(n,a),!rk.has(n.type)){ra(n.id,`${a}.id`),vp(e,n.id,`${a}.id`);continue}if(n.type==="audio-channel"){iH(n,a,e,t,i),s.add(n.id);for(let l of i)l.channelId===n.id&&s.add(l.id)}else sk(n,a,e,i),s.add(n.id)}return{channels:t,sounds:i,builtinNodeIds:s}},oH=(r,e,t,i)=>{ta(r,t);for(let s of Object.keys(r))if(!tH[e].has(s))throw new Error(`Input error: unsupported audio transition field "${s}" at ${t}.`);if(r.duration===void 0)throw new Error(`Input error: ${t}.duration is required.`);if(ru(r.duration,`${t}.duration`,{min:0}),r.easing===void 0)throw new Error(`Input error: ${t}.easing is required.`);if(!eH.has(r.easing))throw new Error(`Input error: ${t}.easing "${r.easing}" is not supported.`);if(e==="enter"){if(r.from===void 0)throw new Error(`Input error: ${t}.from is required.`);ru(r.from,`${t}.from`,{min:0,max:100})}if(e==="exit"){if(r.to===void 0)throw new Error(`Input error: ${t}.to is required.`);ru(r.to,`${t}.to`,{min:0,max:100})}if(i!=="volume")throw new Error(`Input error: unsupported audio transition property "${i}" at ${t}.`)},nH=(r,e,t)=>{if(ra(r.targetId,`${e}.targetId`),!t.has(r.targetId))throw new Error(`Input error: ${e}.targetId "${r.targetId}" does not resolve to an audio node.`);ta(r.properties,`${e}.properties`);for(let[i,s]of Object.entries(r.properties)){if(!JV.has(i))throw new Error(`Input error: unsupported audio transition property "${i}" at ${e}.properties.`);ta(s,`${e}.properties.${i}`);for(let[o,n]of Object.entries(s)){if(!QV.has(o))throw new Error(`Input error: unsupported audio transition phase "${o}" at ${e}.properties.${i}.`);oH(n,o,`${e}.properties.${i}.${o}`,i)}}},aH=(r,e,t)=>{if(!Array.isArray(r))throw new Error("Input error: `audioEffects` must be an array.");for(let[i,s]of r.entries()){let o=`audioEffects[${i}]`;if(ta(s,o),ra(s.id,`${o}.id`),vp(e,s.id,`${o}.id`),!ZV.has(s.type))throw new Error(`Input error: unsupported audio effect type "${s.type}" at ${o}.`);s.type==="audioTransition"&&nH(s,o,t)}};var ys=({audio:r=[],audioEffects:e=[]}={})=>{let t=new Set,i=sH(r,t);return aH(e,t,i.builtinNodeIds),{audio:r,audioEffects:e,channels:i.channels,sounds:i.sounds}},ok=r=>rk.has(r?.type),db=(r=[])=>r.filter(ok),fb=(r=[])=>r.filter(e=>!ok(e));var nk=({app:r,prevAudioTree:e,nextAudioTree:t,audioPlugins:i})=>{let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=tk(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})}},pb=({app:r,prevAudioTree:e,nextAudioTree:t,prevAudioEffects:i=[],nextAudioEffects:s=[],audioPlugins:o})=>{if(ys({audio:e,audioEffects:i}),ys({audio:t,audioEffects:s}),typeof r.audioStage?.renderGraph=="function"){r.audioStage.renderGraph({prevAudio:db(e),nextAudio:db(t),prevAudioEffects:i,nextAudioEffects:s}),nk({app:r,prevAudioTree:fb(e),nextAudioTree:fb(t),audioPlugins:o});return}nk({app:r,prevAudioTree:e,nextAudioTree:t,audioPlugins:o})};var pr=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(pr||{}),mb=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(mb||{}),Tp=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Tp||{}),ae=(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))(ae||{}),ia=(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))(ia||{}),z=(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))(z||{}),Fi=(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))(Fi||{}),ue=(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))(ue||{}),j=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(j||{}),Mr=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(Mr||{}),iu=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(iu||{}),Vr=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Vr||{}),mr=(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))(mr||{}),_s=(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))(_s||{}),Sp=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Sp||{}),qt=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(qt||{}),ht=(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))(ht||{});var Oe=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Oe||{}),nr=(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))(nr||{});var gb={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 te={ADAPTER:gb,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};tg();var lH=ji.default??ji,Hr=lH(globalThis.navigator);te.RETINA_PREFIX=/@([0-9\.]+)x/;te.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var go=As(lk(),1),JW=As(Yh(),1);var Kb=As(w2(),1);var E2={};function xe(r,e,t=3){if(E2[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}
1551
1551
  Deprecated since v${r}`):(i=i.split(`
1552
1552
  `).splice(t).join(`
1553
1553
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e}
@@ -2031,7 +2031,7 @@ void main(void)
2031
2031
  `)}}return o.push(`
2032
2032
  renderer.buffer.update(buffer);
2033
2033
  `),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join(`
2034
- `))}}var _z=0,cm={textureCount:0,uboCount:0},Ss=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=_z++}systemCheck(){if(!sm())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||(cm.textureCount=0,cm.uboCount=0,this.syncUniformGroup(e.uniformGroup,cm)),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]=pv(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,cm,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]=Sv(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=Tv(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}};Ss.extension={type:K.RendererSystem,name:"shader"};re.add(Ss);var Hi=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(){}};Hi.defaultOptions={hello:!1},Hi.extension={type:[K.RendererSystem,K.CanvasRendererSystem],name:"startup"};re.add(Hi);function iO(r,e=[]){return e[ae.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.ADD]=[r.ONE,r.ONE],e[ae.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.NONE]=[0,0],e[ae.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],e[ae.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.SRC_IN]=[r.DST_ALPHA,r.ZERO],e[ae.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],e[ae.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[ae.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],e[ae.DST_IN]=[r.ZERO,r.SRC_ALPHA],e[ae.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],e[ae.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],e[ae.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[ae.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],e}var bz=0,vz=1,Tz=2,Sz=3,wz=4,Ez=5,sO=class wv{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=ae.NONE,this._blendEq=!1,this.map=[],this.map[bz]=this.setBlend,this.map[vz]=this.setOffset,this.map[Tz]=this.setCullFace,this.map[Sz]=this.setDepthTest,this.map[wz]=this.setFrontFace,this.map[Ez]=this.setDepthMask,this.checks=[],this.defaultState=new mi,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=iO(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<<i)),t=t>>1,i++;this.stateId=e.data}for(let t=0;t<this.checks.length;t++)this.checks[t](this,e)}forceState(e){e=e||this.defaultState;for(let t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(let t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data}setBlend(e){this.updateCheck(wv.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this.updateCheck(wv.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this.gl[e?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(e){this.gl.frontFace(this.gl[e?"CW":"CCW"])}setBlendMode(e){if(e===this.blendMode)return;this.blendMode=e;let t=this.blendModes[e],i=this.gl;t.length===2?i.blendFunc(t[0],t[1]):i.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,i.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(e,t){this.gl.polygonOffset(e,t)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(e,t){let i=this.checks.indexOf(e);t&&i===-1?this.checks.push(e):!t&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(e,t){e.setBlendMode(t.blendMode)}static checkPolygonOffset(e,t){e.setPolygonOffset(1,t.polygonOffset)}destroy(){this.gl=null}};sO.extension={type:K.RendererSystem,name:"state"};var Ev=sO;re.add(Ev);var Ba=class extends go.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(e){this.addRunners(...e.runners);let t=(e.priority??[]).filter(s=>e.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 ot(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 Du=class um{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=um.defaultMaxIdle,this.checkCountMax=um.defaultCheckCountMax,this.mode=um.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Sp.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;s<t.length;s++){let o=t[s];o.resource&&this.count-o.touched>this.maxIdle&&(e.destroyTexture(o,!0),t[s]=null,i=!0)}if(i){let s=0;for(let o=0;o<t.length;o++)t[o]!==null&&(t[s++]=t[o]);t.length=s}}unload(e){let t=this.renderer.texture,i=e._texture;i&&!i.framebuffer&&t.destroyTexture(i);for(let s=e.children.length-1;s>=0;s--)this.unload(e.children[s])}destroy(){this.renderer=null}};Du.defaultMode=Sp.AUTO,Du.defaultMaxIdle=60*60,Du.defaultCheckCountMax=60*10,Du.extension={type:K.RendererSystem,name:"textureGC"};var yi=Du;re.add(yi);var Mo=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=ue.UNSIGNED_BYTE,this.internalFormat=z.RGBA,this.samplerType=0}};function oO(r){let e;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?e={[r.RGB]:j.FLOAT,[r.RGBA]:j.FLOAT,[r.ALPHA]:j.FLOAT,[r.LUMINANCE]:j.FLOAT,[r.LUMINANCE_ALPHA]:j.FLOAT,[r.R8]:j.FLOAT,[r.R8_SNORM]:j.FLOAT,[r.RG8]:j.FLOAT,[r.RG8_SNORM]:j.FLOAT,[r.RGB8]:j.FLOAT,[r.RGB8_SNORM]:j.FLOAT,[r.RGB565]:j.FLOAT,[r.RGBA4]:j.FLOAT,[r.RGB5_A1]:j.FLOAT,[r.RGBA8]:j.FLOAT,[r.RGBA8_SNORM]:j.FLOAT,[r.RGB10_A2]:j.FLOAT,[r.RGB10_A2UI]:j.FLOAT,[r.SRGB8]:j.FLOAT,[r.SRGB8_ALPHA8]:j.FLOAT,[r.R16F]:j.FLOAT,[r.RG16F]:j.FLOAT,[r.RGB16F]:j.FLOAT,[r.RGBA16F]:j.FLOAT,[r.R32F]:j.FLOAT,[r.RG32F]:j.FLOAT,[r.RGB32F]:j.FLOAT,[r.RGBA32F]:j.FLOAT,[r.R11F_G11F_B10F]:j.FLOAT,[r.RGB9_E5]:j.FLOAT,[r.R8I]:j.INT,[r.R8UI]:j.UINT,[r.R16I]:j.INT,[r.R16UI]:j.UINT,[r.R32I]:j.INT,[r.R32UI]:j.UINT,[r.RG8I]:j.INT,[r.RG8UI]:j.UINT,[r.RG16I]:j.INT,[r.RG16UI]:j.UINT,[r.RG32I]:j.INT,[r.RG32UI]:j.UINT,[r.RGB8I]:j.INT,[r.RGB8UI]:j.UINT,[r.RGB16I]:j.INT,[r.RGB16UI]:j.UINT,[r.RGB32I]:j.INT,[r.RGB32UI]:j.UINT,[r.RGBA8I]:j.INT,[r.RGBA8UI]:j.UINT,[r.RGBA16I]:j.INT,[r.RGBA16UI]:j.UINT,[r.RGBA32I]:j.INT,[r.RGBA32UI]:j.UINT,[r.DEPTH_COMPONENT16]:j.FLOAT,[r.DEPTH_COMPONENT24]:j.FLOAT,[r.DEPTH_COMPONENT32F]:j.FLOAT,[r.DEPTH_STENCIL]:j.FLOAT,[r.DEPTH24_STENCIL8]:j.FLOAT,[r.DEPTH32F_STENCIL8]:j.FLOAT}:e={[r.RGB]:j.FLOAT,[r.RGBA]:j.FLOAT,[r.ALPHA]:j.FLOAT,[r.LUMINANCE]:j.FLOAT,[r.LUMINANCE_ALPHA]:j.FLOAT,[r.DEPTH_STENCIL]:j.FLOAT},e}function nO(r){let e;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?e={[ue.UNSIGNED_BYTE]:{[z.RGBA]:r.RGBA8,[z.RGB]:r.RGB8,[z.RG]:r.RG8,[z.RED]:r.R8,[z.RGBA_INTEGER]:r.RGBA8UI,[z.RGB_INTEGER]:r.RGB8UI,[z.RG_INTEGER]:r.RG8UI,[z.RED_INTEGER]:r.R8UI,[z.ALPHA]:r.ALPHA,[z.LUMINANCE]:r.LUMINANCE,[z.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ue.BYTE]:{[z.RGBA]:r.RGBA8_SNORM,[z.RGB]:r.RGB8_SNORM,[z.RG]:r.RG8_SNORM,[z.RED]:r.R8_SNORM,[z.RGBA_INTEGER]:r.RGBA8I,[z.RGB_INTEGER]:r.RGB8I,[z.RG_INTEGER]:r.RG8I,[z.RED_INTEGER]:r.R8I},[ue.UNSIGNED_SHORT]:{[z.RGBA_INTEGER]:r.RGBA16UI,[z.RGB_INTEGER]:r.RGB16UI,[z.RG_INTEGER]:r.RG16UI,[z.RED_INTEGER]:r.R16UI,[z.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[ue.SHORT]:{[z.RGBA_INTEGER]:r.RGBA16I,[z.RGB_INTEGER]:r.RGB16I,[z.RG_INTEGER]:r.RG16I,[z.RED_INTEGER]:r.R16I},[ue.UNSIGNED_INT]:{[z.RGBA_INTEGER]:r.RGBA32UI,[z.RGB_INTEGER]:r.RGB32UI,[z.RG_INTEGER]:r.RG32UI,[z.RED_INTEGER]:r.R32UI,[z.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[ue.INT]:{[z.RGBA_INTEGER]:r.RGBA32I,[z.RGB_INTEGER]:r.RGB32I,[z.RG_INTEGER]:r.RG32I,[z.RED_INTEGER]:r.R32I},[ue.FLOAT]:{[z.RGBA]:r.RGBA32F,[z.RGB]:r.RGB32F,[z.RG]:r.RG32F,[z.RED]:r.R32F,[z.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[ue.HALF_FLOAT]:{[z.RGBA]:r.RGBA16F,[z.RGB]:r.RGB16F,[z.RG]:r.RG16F,[z.RED]:r.R16F},[ue.UNSIGNED_SHORT_5_6_5]:{[z.RGB]:r.RGB565},[ue.UNSIGNED_SHORT_4_4_4_4]:{[z.RGBA]:r.RGBA4},[ue.UNSIGNED_SHORT_5_5_5_1]:{[z.RGBA]:r.RGB5_A1},[ue.UNSIGNED_INT_2_10_10_10_REV]:{[z.RGBA]:r.RGB10_A2,[z.RGBA_INTEGER]:r.RGB10_A2UI},[ue.UNSIGNED_INT_10F_11F_11F_REV]:{[z.RGB]:r.R11F_G11F_B10F},[ue.UNSIGNED_INT_5_9_9_9_REV]:{[z.RGB]:r.RGB9_E5},[ue.UNSIGNED_INT_24_8]:{[z.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[ue.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[z.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:e={[ue.UNSIGNED_BYTE]:{[z.RGBA]:r.RGBA,[z.RGB]:r.RGB,[z.ALPHA]:r.ALPHA,[z.LUMINANCE]:r.LUMINANCE,[z.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ue.UNSIGNED_SHORT_5_6_5]:{[z.RGB]:r.RGB},[ue.UNSIGNED_SHORT_4_4_4_4]:{[z.RGBA]:r.RGBA},[ue.UNSIGNED_SHORT_5_5_5_1]:{[z.RGBA]:r.RGBA}},e}var ka=class{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new Te,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=nO(e),this.samplerTypes=oO(e);let t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(let s=0;s<t;s++)this.boundTextures[s]=null;this.emptyTextures={};let i=new Mo(e.createTexture());e.bindTexture(e.TEXTURE_2D,i.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[e.TEXTURE_2D]=i,this.emptyTextures[e.TEXTURE_CUBE_MAP]=new Mo(e.createTexture()),e.bindTexture(e.TEXTURE_CUBE_MAP,this.emptyTextures[e.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(e,t=0){let{gl:i}=this;if(e=e?.castToBaseTexture(),e?.valid&&!e.parentTextureArray){e.touched=this.renderer.textureGC.count;let s=e._glTextures[this.CONTEXT_UID]||this.initTexture(e);this.boundTextures[t]!==e&&(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(e.target,s.texture)),s.dirtyId!==e.dirtyId?(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),this.updateTexture(e)):s.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(e),this.boundTextures[t]=e}else this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[t]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let e=0;e<this.boundTextures.length;e++)this.boundTextures[e]=this.unknownTexture}unbind(e){let{gl:t,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===e&&(this.currentLocation!==s&&(t.activeTexture(t.TEXTURE0+s),this.currentLocation=s),t.bindTexture(e.target,this.emptyTextures[e.target].texture),i[s]=null)}ensureSamplerType(e){let{boundTextures:t,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let o=e-1;o>=0;--o){let n=t[o];n&&n._glTextures[s].samplerType!==j.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(e){let t=new Mo(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]??j.FLOAT,this.webGLVersion===2&&e.type===ue.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!==j.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&&ev(this.managedTextures,s,1)}}updateTextureStyle(e){let t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===Vr.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=iu.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!==Vr.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===Mr.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&e.anisotropicLevel>0&&e.scaleMode===Mr.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===Mr.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===Mr.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}};ka.extension={type:K.RendererSystem,name:"texture"};re.add(ka);var Fa=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<e.buffers.length;n++){let a=e.buffers[n];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,t.bindBufferBase(t.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[s].buffer||null))}return t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),e.disposeRunner.add(this),o}disposeTransformFeedback(e,t){let i=e._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;e.disposeRunner.remove(this);let o=this.renderer.buffer;if(o)for(let n=0;n<e.buffers.length;n++){let a=e.buffers[n];if(!a)continue;let l=a._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!t&&o.dispose(a,t))}i&&(t||s.deleteTransformFeedback(i),delete e._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};Fa.extension={type:K.RendererSystem,name:"transformFeedback"};re.add(Fa);var Wi=class{constructor(e){this.renderer=e}init(e){this.screen=new we(0,0,e.width,e.height),this.element=e.view||te.ADAPTER.createCanvas(),this.resolution=e.resolution||te.RESOLUTION,this.autoDensity=!!e.autoDensity}resizeView(e,t){this.element.width=Math.round(e*this.resolution),this.element.height=Math.round(t*this.resolution);let i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(e){e&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}};Wi.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Wi.extension={type:[K.RendererSystem,K.CanvasRendererSystem],name:"_view"};re.add(Wi);te.PREFER_ENV=pr.WEBGL2;te.STRICT_TEXTURE_CACHE=!1;te.RENDER_OPTIONS={...Vi.defaultOptions,...Ni.defaultOptions,...Wi.defaultOptions,...Hi.defaultOptions};Object.defineProperties(te,{WRAP_MODE:{get(){return Te.defaultOptions.wrapMode},set(r){xe("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),Te.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return Te.defaultOptions.scaleMode},set(r){xe("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),Te.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return Te.defaultOptions.mipmap},set(r){xe("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),Te.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return Te.defaultOptions.anisotropicLevel},set(r){xe("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),Te.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return xe("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),xi.defaultResolution},set(r){xi.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return xe("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),xi.defaultMultisample},set(r){xi.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return Di.defaultMaxTextures},set(r){xe("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Di.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return Di.defaultBatchSize},set(r){xe("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Di.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return Di.canUploadSameBuffer},set(r){xe("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Di.canUploadSameBuffer=r}},GC_MODE:{get(){return yi.defaultMode},set(r){xe("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),yi.defaultMode=r}},GC_MAX_IDLE:{get(){return yi.defaultMaxIdle},set(r){xe("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),yi.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return yi.defaultCheckCountMax},set(r){xe("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),yi.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return Br.defaultVertexPrecision},set(r){xe("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),Br.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return Br.defaultFragmentPrecision},set(r){xe("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),Br.defaultFragmentPrecision=r}}});var Ro=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(Ro||{});var Oa=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 aO=class _r{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 Oa(null,null,1/0),this.deltaMS=1/_r.targetFPMS,this.elapsedMS=1/_r.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=Ro.NORMAL){return this._addListener(new Oa(e,t,i))}addOnce(e,t,i=Ro.NORMAL){return this._addListener(new Oa(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._minElapsedMS)return;this._lastFrame=e-o%this._minElapsedMS}this.deltaMS=t,this.deltaTime=this.deltaMS*_r.targetFPMS;let i=this._head,s=i.next;for(;s;)s=s.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){let t=Math.min(this.maxFPS,e),i=Math.min(Math.max(0,t)/1e3,_r.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){if(e===0)this._minElapsedMS=0;else{let t=Math.max(this.minFPS,e);this._minElapsedMS=1/(t/1e3)}}static get shared(){if(!_r._shared){let e=_r._shared=new _r;e.autoStart=!0,e._protected=!0}return _r._shared}static get system(){if(!_r._system){let e=_r._system=new _r;e.autoStart=!0,e._protected=!0}return _r._system}};aO.targetFPMS=.06;var kr=aO;Object.defineProperties(te,{TARGET_FPMS:{get(){return kr.targetFPMS},set(r){xe("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),kr.targetFPMS=r}}});var Nu=class{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,Ro.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?kr.shared:new kr,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}};Nu.extension=K.Application;re.add(Nu);var Az=[];re.handleByList(K.Renderer,Az);var Vu=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>=Oe.HIGH?this.multisample=Oe.HIGH:t>=Oe.MEDIUM?this.multisample=Oe.MEDIUM:t>=Oe.LOW?this.multisample=Oe.LOW:this.multisample=Oe.NONE}destroy(){}};Vu.extension={type:K.RendererSystem,name:"_multisample"};re.add(Vu);var hm=class{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var Hu=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;i<t.length;i++)this.dispose(this.managedBuffers[t[i]],e)}createGLBuffer(e){let{CONTEXT_UID:t,gl:i}=this;return e._glBuffers[t]=new hm(i.createBuffer()),this.managedBuffers[e.id]=e,e.disposeRunner.add(this),e._glBuffers[t]}};Hu.extension={type:K.RendererSystem,name:"buffer"};re.add(Hu);var Wu=class{constructor(e){this.renderer=e}render(e,t){let i=this.renderer,s,o,n,a;if(t&&(s=t.renderTexture,o=t.clear,n=t.transform,a=t.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=n,!i.context.isLost){if(s||(this.lastObjectRendered=e),!a){let l=e.enableTempParent();e.updateTransform(),e.disableTempParent(l)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(o??i.background.clearBeforeRender)&&i.renderTexture.clear(),e.render(i),i.batch.currentRenderer.flush(),s&&(t.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}};Wu.extension={type:K.RendererSystem,name:"objectRenderer"};re.add(Wu);var dm=class Av extends Ba{constructor(e){super(),this.type=mb.WEBGL,e=Object.assign({},te.RENDER_OPTIONS,e),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new yr({projectionMatrix:new Ve},!0);let t={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Av.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(t),"useContextAlpha"in e&&(xe("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),e.premultipliedAlpha=e.useContextAlpha&&e.useContextAlpha!=="notMultiplied",e.backgroundAlpha=e.useContextAlpha===!1?1:e.backgroundAlpha),this._plugin.rendererPlugins=Av.__plugins,this.options=e,this.startup.run(this.options)}static test(e){return e?.forceCanvas?!1:Qb()}render(e,t){this.objectRenderer.render(e,t)}resize(e,t){this._view.resizeView(e,t)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(e=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:e}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(e){this._view.resolution=e,this.runners.resolutionChange.emit(e)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return xe("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return xe("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return xe("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return xe("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(e){xe("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=e}get backgroundAlpha(){return xe("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(e){xe("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=e}get powerPreference(){return xe("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(e,t){return this.textureGenerator.generateTexture(e,t)}};dm.extension={type:K.Renderer,priority:1},dm.__plugins={},dm.__systems={};var fm=dm;re.handleByMap(K.RendererPlugin,fm.__plugins);re.handleByMap(K.RendererSystem,fm.__systems);re.add(fm);var ws=class extends xr{constructor(e,t){let{width:i,height:s}=t||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<e;o++){let n=new Te;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=e,this._load=null,this.baseTexture=null}initFromArray(e,t){for(let i=0;i<this.length;i++)e[i]&&(e[i].castToBaseTexture?this.addBaseTextureAt(e[i].castToBaseTexture(),i):e[i]instanceof xr?this.addResourceAt(e[i],i):this.addResourceAt(ga(e[i],t),i))}dispose(){for(let e=0,t=this.length;e<t;e++)this.items[e].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(e,t){if(!this.items[t])throw new Error(`Index ${t} is out of bounds`);return e.valid&&!this.valid&&this.resize(e.width,e.height),this.items[t].setResource(e),this}bind(e){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(e);for(let t=0;t<this.length;t++)this.items[t].parentTextureArray=e,this.items[t].on("update",e.update,e)}unbind(e){super.unbind(e);for(let t=0;t<this.length;t++)this.items[t].parentTextureArray=null,this.items[t].off("update",e.update,e)}load(){if(this._load)return this._load;let e=this.items.map(t=>t.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 zu=class extends ws{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=Fi.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;l<s;l++){let c=n[l];o[l]<c.dirtyId&&(o[l]=c.dirtyId,c.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,l,c.resource.width,c.resource.height,1,t.format,i.type,c.resource.source))}return!0}};var $u=class extends bt{constructor(e){super(e)}static test(e){let{OffscreenCanvas:t}=globalThis;return t&&e instanceof t?!0:globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement}};var lO=class Xu extends ws{constructor(e,t){let{width:i,height:s,autoLoad:o,linkBaseTexture:n}=t||{};if(e&&e.length!==Xu.SIDES)throw new Error(`Invalid length. Got ${e.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<Xu.SIDES;a++)this.items[a].target=Fi.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=n!==!1,e&&this.initFromArray(e,t),o!==!1&&this.load()}bind(e){super.bind(e),e.target=Fi.TEXTURE_CUBE_MAP}addBaseTextureAt(e,t,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[t])throw new Error(`Index ${t} is out of bounds`);if(!this.linkBaseTexture||e.parentTextureArray||Object.keys(e._glTextures).length>0)if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=Fi.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<Xu.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||i.dirtyId<t.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(e,n,i),s[o]=n.dirtyId):s[o]<-1&&(e.gl.texImage2D(n.target,0,i.internalFormat,t.realWidth,t.realHeight,0,t.format,i.type,null),s[o]=-1))}return!0}static test(e){return Array.isArray(e)&&e.length===Xu.SIDES}};lO.SIDES=6;var Cv=lO;var ju=class r extends bt{constructor(e,t){t=t||{};let i,s,o;typeof e=="string"?(i=r.EMPTY,s=e,o=!0):(i=e,s=null,o=!1),super(i),this.url=s,this.crossOrigin=t.crossOrigin??!0,this.alphaMode=typeof t.alphaMode=="number"?t.alphaMode:null,this.ownsImageBitmap=t.ownsImageBitmap??o,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(e,t)=>{if(this.url===null){e(this);return}try{let i=await te.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===mr.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??te.ADAPTER.createCanvas(0,0),r._EMPTY}};var Pv=class pm extends bt{constructor(e,t){t=t||{},super(te.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)},pm.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;bt.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_${Ui()}`,n.getContext("2d").drawImage(e,0,0,t,i,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(e){let t=pm.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"&&pm.SVG_XML.test(e)}};Pv.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Pv.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var Mv=Pv;var mm=class extends bt{constructor(e){super(e)}static test(e){return!!globalThis.VideoFrame&&e instanceof globalThis.VideoFrame}};var Rv=class Iv extends bt{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];bt.crossOrigin(i,s,t.crossorigin);for(let o=0;o<e.length;++o){let n=document.createElement("source"),{src:a,mime:l}=e[o];if(a=a||e[o],a.startsWith("data:"))l=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){let c=a.split("?").shift().toLowerCase(),u=c.slice(c.lastIndexOf(".")+1);l=l||Iv.MIME_TYPES[u]||`video/${u}`}n.src=a,l&&(n.type=l),i.appendChild(n)}e=i}super(e),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}update(e=0){if(!this.destroyed){if(this._updateFPS){let t=kr.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;let e=this.source;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlay),e.addEventListener("error",this._onError,!0)),this._load=new Promise((t,i)=>{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&&(kr.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||(kr.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(kr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,t){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||Iv.TYPES.includes(t)}};Rv.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Rv.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var Bv=Rv;yu.push(ju,Eo,$u,Bv,mm,Mv,xo,Cv,zu);var Cz={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)}},Pz={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 cO(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?Cz:Pz)[u.type].call(null,l,d.location,d.value,h)}}function Mz(){Object.assign(Ss.prototype,{systemCheck(){},syncUniforms(r,e){let{shader:t,renderer:i}=this;cO(r,t.program.uniformData,e.uniformData,r.uniforms,i)}})}Mz();var kv="__route_graphics_audio_root__",Yu="__route_graphics_audio_direct__",gm,Xr=()=>{if(gm)return gm;let r=globalThis.window?.AudioContext??globalThis.window?.webkitAudioContext;if(!r)throw new Error("AudioContext is not available in this environment.");return gm=new r,gm},Bo=(r,e)=>{r&&e&&typeof r.connect=="function"&&r.connect(e)},Io=r=>{r&&typeof r.disconnect=="function"&&r.disconnect()},Rz=(r,e=0)=>typeof r?.value=="number"?r.value:e,pO=(r=Xr())=>{r.state==="suspended"&&typeof r.resume=="function"&&r.resume().catch(()=>{})},Es=(r,e,t=Xr())=>{r&&(typeof r.cancelScheduledValues=="function"&&r.cancelScheduledValues(t.currentTime),typeof r.setValueAtTime=="function"?r.setValueAtTime(e,t.currentTime):r.value=e)},Iz=(r,e,t,i=Xr())=>{if(!r)return;let s=i.currentTime,o=t/1e3,n=Rz(r);typeof r.cancelScheduledValues=="function"&&r.cancelScheduledValues(s),typeof r.setValueAtTime=="function"?r.setValueAtTime(n,s):r.value=n,o>0&&typeof r.linearRampToValueAtTime=="function"?r.linearRampToValueAtTime(e,s+o):typeof r.setValueAtTime=="function"?r.setValueAtTime(e,s+o):r.value=e},mO=(r=1)=>{let e=Xr(),t=e.createGain();return Es(t.gain,r,e),t},gO=(r=0)=>{let e=Xr();if(typeof e.createStereoPanner!="function")return null;let t=e.createStereoPanner();return Es(t.pan,r,e),t},$r=({volume:r,muted:e})=>e?0:ze(r,100),qu=(r=[],e,t,i)=>r.find(o=>o.type==="audioTransition"&&o.targetId===e)?.properties?.[t]?.[i]??null;var zi=({gainNode:r,targetValue:e,transition:t})=>{if(!t)return Es(r.gain,e),0;let i=t.from!==void 0?ze(t.from,100):void 0,s=t.to!==void 0?ze(t.to,100):e;return i!==void 0&&Es(r.gain,i),Iz(r.gain,s,t.duration),t.duration},Fv=(r,e)=>{let t=mO($r(r)),i=gO(r.pan??0);return Bo(t,i??e),i&&Bo(i,e),{id:r.id,gainNode:t,pannerNode:i,volume:r.volume??100,muted:r.muted??!1,pan:r.pan??0,outputNode:e,cleanupTimeoutId:null}},Bz=({sound:r,channelNode:e,internalId:t})=>{let i=mO($r(r)),s=gO(r.pan??0);return Bo(i,s??e),s&&Bo(s,e),{internalId:t,id:r.id,src:r.src,url:r.src,loop:r.loop??!1,volume:r.volume??100,muted:r.muted??!1,pan:r.pan??0,startDelayMs:r.startDelayMs??0,playbackRate:r.playbackRate??1,startAt:r.startAt??0,endAt:r.endAt??null,channelId:r.channelId??null,gainNode:i,pannerNode:s,source:null,pendingTimeoutId:null,cleanupTimeoutId:null}},kz=r=>{let e=Xr();pO(e);let t=Un.getAsset(r.src);if(!t)return console.warn("AudioStage: asset not found",r.src),null;let i=e.createBufferSource();i.buffer=t,i.loop=r.loop??!1,i.playbackRate&&Es(i.playbackRate,r.playbackRate??1,e),Bo(i,r.gainNode);let s=r.startAt??0,o=r.endAt!==null&&r.endAt!==void 0?Math.max(r.endAt-s,0):void 0;return i.loop&&r.endAt!==null&&r.endAt!==void 0?(i.loopStart=s,i.loopEnd=r.endAt,i.start(0,s)):o!==void 0?i.start(0,s,o):i.start(0,s),i},uO=r=>{r.pendingTimeoutId!==null&&(clearTimeout(r.pendingTimeoutId),r.pendingTimeoutId=null),pO(Xr());let e=()=>{r.pendingTimeoutId=null,r.source=kz(r)};if(r.startDelayMs>0){r.pendingTimeoutId=setTimeout(e,r.startDelayMs);return}e()},xO=(r,e=0)=>{if(r.pendingTimeoutId!==null&&(clearTimeout(r.pendingTimeoutId),r.pendingTimeoutId=null),!r.source)return;let t=Xr();try{r.source.stop(t.currentTime+e/1e3)}catch{}},hO=r=>{r.pendingTimeoutId!==null&&(clearTimeout(r.pendingTimeoutId),r.pendingTimeoutId=null),r.cleanupTimeoutId!==null&&(clearTimeout(r.cleanupTimeoutId),r.cleanupTimeoutId=null),xO(r),Io(r.source),Io(r.gainNode),Io(r.pannerNode)},dO=r=>{r.cleanupTimeoutId!==null&&(clearTimeout(r.cleanupTimeoutId),r.cleanupTimeoutId=null),Io(r.gainNode),Io(r.pannerNode)},fO=(r,e)=>e<=0?(r(),null):setTimeout(r,e);var yO=()=>{let r=new Map,e=new Map,t=new Map,i=new Map,s=0,o=p=>{let b=r.get(p);if(b)return b;let _=Fv({id:p,volume:100,muted:!1,pan:0},Xr().destination);return r.set(p,_),_},n=(p,b,_)=>{let S=r.get(p.id),E=qu(b,p.id,"volume",_);if(S&&S.cleanupTimeoutId!==null){let P=Fv(p,Xr().destination);return r.set(p.id,P),zi({gainNode:P.gainNode,targetValue:$r(p),transition:E}),P}if(S){let P=$r(S),M=$r(p),I=P!==M,U=S.pan!==(p.pan??0);return S.volume=p.volume,S.muted=p.muted,S.pan=p.pan,I&&E?zi({gainNode:S.gainNode,targetValue:M,transition:E}):I&&zi({gainNode:S.gainNode,targetValue:M,transition:null}),U&&S.pannerNode?.pan&&Es(S.pannerNode.pan,p.pan??0),S}let C=Fv(p,Xr().destination);return r.set(p.id,C),zi({gainNode:C.gainNode,targetValue:$r(p),transition:E}),C},a=p=>{let b=p.channelId!==null?r.get(p.channelId):o(kv);if(!b)throw new Error(`Input error: sound "${p.id}" references missing channel.`);return b},l=(p,b)=>{Io(p.gainNode),Io(p.pannerNode),Bo(p.gainNode,p.pannerNode??b),p.pannerNode&&Bo(p.pannerNode,b)},c=(p,b)=>{if(!p||p.id===kv||p.id===Yu)return 0;let _=qu(b,p.id,"volume","exit");return zi({gainNode:p.gainNode,targetValue:$r(p),transition:_})},u=({sound:p,effects:b,phase:_,internalId:S})=>{let E=a(p),C=Bz({sound:p,channelNode:E.gainNode,internalId:S});e.set(S,C),t.set(p.id,S);let P=qu(b,p.id,"volume",_);return zi({gainNode:C.gainNode,targetValue:$r(p),transition:P}),uO(C),C},h=(p,b,_=0)=>{if(!p)return 0;let S=qu(b,p.id,"volume","exit"),E=zi({gainNode:p.gainNode,targetValue:$r(p),transition:S}),C=Math.max(E,_);return xO(p,C),p.cleanupTimeoutId=fO(()=>{hO(p),e.delete(p.internalId)},C),C},d=({instance:p,sound:b,effects:_})=>{let S=$r(p),E=$r(b),C=S!==E,P=p.startDelayMs!==b.startDelayMs;if(p.channelId!==b.channelId){let I=a(b);l(p,I.gainNode)}p.loop=b.loop,p.volume=b.volume,p.muted=b.muted,p.pan=b.pan,p.startDelayMs=b.startDelayMs,p.playbackRate=b.playbackRate,p.startAt=b.startAt,p.endAt=b.endAt,p.channelId=b.channelId,p.source&&(p.source.loop=b.loop,p.source.playbackRate&&Es(p.source.playbackRate,b.playbackRate)),p.pannerNode?.pan&&Es(p.pannerNode.pan,b.pan);let M=qu(_,b.id,"volume","update");C&&M?zi({gainNode:p.gainNode,targetValue:E,transition:M}):C&&zi({gainNode:p.gainNode,targetValue:E,transition:null}),P&&p.pendingTimeoutId!==null&&uO(p)};return{add:p=>{let b={id:p.id,type:"sound",src:p.url??p.src,loop:p.loop??!1,volume:(p.volume??1)*100,startDelayMs:p.startDelayMs??0};i.set(p.id,b)},remove:p=>{i.delete(p),t.delete(p);let b=`direct:${p}`,_=e.get(b);_&&h(_,[],0)},getById:p=>i.get(p),tick:()=>{let p=o(Yu);for(let b of i.values()){let _=`direct:${b.id}`,S=e.get(_);if(!S){let E={...b,channelId:Yu};u({sound:E,effects:[],phase:"enter",internalId:_});continue}if(S.src!==b.src){h(S,[],0);let E={...b,channelId:Yu};u({sound:E,effects:[],phase:"enter",internalId:_});continue}d({instance:S,sound:{...b,channelId:Yu},effects:[]})}for(let[b,_]of e)b.startsWith("direct:")&&!i.has(_.id)&&(h(_,[],0),t.delete(_.id));return p},renderGraph:({prevAudio:p=[],nextAudio:b=[],prevAudioEffects:_=[],nextAudioEffects:S=[]}={})=>{let E=ys({audio:p,audioEffects:_}),C=ys({audio:b,audioEffects:S}),P=new Map(E.channels.map(F=>[F.id,F])),M=new Map(C.channels.map(F=>[F.id,F])),I=new Map(E.sounds.map(F=>[F.id,F])),U=new Map(C.sounds.map(F=>[F.id,F]));o(kv);let A=new Map,O=new Map;for(let[F,R]of P)if(!M.has(F)){let D=c(r.get(F),_);A.set(F,r.get(F)),O.set(F,D)}for(let[F,R]of M)n(R,S,P.has(F)?"update":"enter");for(let[F,R]of I){let D=U.get(F),G=t.get(F),N=G?e.get(G):null,W=R.channelId?O.get(R.channelId)??0:0;if(!D){let se=h(N,_,W);R.channelId&&O.set(R.channelId,Math.max(O.get(R.channelId)??0,se)),t.delete(F);continue}if(R.src!==D.src){let se=h(N,_,W);R.channelId&&O.set(R.channelId,Math.max(O.get(R.channelId)??0,se)),u({sound:D,effects:S,phase:"enter",internalId:`render:${F}:${++s}`})}}for(let[F,R]of U){if(!I.has(F)){u({sound:R,effects:S,phase:"enter",internalId:`render:${F}:${++s}`});continue}if(I.get(F).src!==R.src)continue;let G=t.get(F),N=G?e.get(G):null;N&&d({instance:N,sound:R,effects:S})}for(let[F,R]of A){if(!R)continue;let D=O.get(F)??0;R.cleanupTimeoutId=fO(()=>{dO(R),r.get(F)===R&&r.delete(F)},D)}},destroy:()=>{for(let p of e.values())hO(p);for(let p of r.values())dO(p);e.clear(),t.clear(),r.clear(),i.clear()},_inspect:()=>({channels:r,sounds:e,currentSoundKeyById:t,directAudios:i})}};var Fz=({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 Ov=Fz;var _O=({type:r,parse:e})=>({type:r,parse:e});var Uv=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function Lv(r,e,t,i){r.addEventListener?r.addEventListener(e,t,i):r.attachEvent&&r.attachEvent(`on${e}`,t)}function Ku(r,e,t,i){r&&(r.removeEventListener?r.removeEventListener(e,t,i):r.detachEvent&&r.detachEvent(`on${e}`,t))}function TO(r,e){let t=e.slice(0,e.length-1),i=[];for(let s=0;s<t.length;s++)i.push(r[t[s].toLowerCase()]);return i}function SO(r){typeof r!="string"&&(r=""),r=r.replace(/\s/g,"");let e=r.split(","),t=e.lastIndexOf("");for(;t>=0;)e[t-1]+=",",e.splice(t,1),t=e.lastIndexOf("");return e}function Oz(r,e){let t=r.length>=e.length?r:e,i=r.length>=e.length?e:r,s=!0;for(let o=0;o<t.length;o++)i.indexOf(t[o])===-1&&(s=!1);return s}function wO(r){let e=r.keyCode||r.which||r.charCode;return r.code&&/^Key[A-Z]$/.test(r.code)&&(e=r.code.charCodeAt(3)),e}var Ju={backspace:8,"\u232B":8,tab:9,clear:12,enter:13,"\u21A9":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,arrowup:38,arrowdown:40,arrowleft:37,arrowright:39,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"\u21EA":20,",":188,".":190,"/":191,"`":192,"-":Uv?173:189,"=":Uv?61:187,";":Uv?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},jr={"\u21E7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,meta:91,command:91},Zu={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},Bt={16:!1,18:!1,17:!1,91:!1},Qe={};for(let r=1;r<20;r++)Ju[`f${r}`]=111+r;var Ke=[],Qu=null,EO="all",$i=new Map,Ua=r=>Ju[r.toLowerCase()]||jr[r.toLowerCase()]||r.toUpperCase().charCodeAt(0),Uz=r=>Object.keys(Ju).find(e=>Ju[e]===r),Lz=r=>Object.keys(jr).find(e=>jr[e]===r),AO=r=>{EO=r||"all"},eh=()=>EO||"all",Gz=()=>Ke.slice(0),Dz=()=>Ke.map(r=>Uz(r)||Lz(r)||String.fromCharCode(r)),Nz=()=>{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=>Ua(n))})})}),r},CO=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},Vz=r=>(typeof r=="string"&&(r=Ua(r)),Ke.indexOf(r)!==-1),Hz=(r,e)=>{let t,i;r||(r=eh());for(let s in Qe)if(Object.prototype.hasOwnProperty.call(Qe,s))for(t=Qe[s],i=0;i<t.length;)t[i].scope===r?t.splice(i,1).forEach(({element:o})=>Dv(o)):i++;eh()===r&&AO(e||"all")};function Wz(r){let e=wO(r);r.key&&r.key.toLowerCase()==="capslock"&&(e=Ua(r.key));let t=Ke.indexOf(e);if(t>=0&&Ke.splice(t,1),r.key&&r.key.toLowerCase()==="meta"&&Ke.splice(0,Ke.length),(e===93||e===224)&&(e=91),e in Bt){Bt[e]=!1;for(let i in jr)jr[i]===e&&(pt[i]=!1)}}var PO=(r,...e)=>{if(typeof r>"u")Object.keys(Qe).forEach(t=>{Array.isArray(Qe[t])&&Qe[t].forEach(i=>xm(i)),delete Qe[t]}),Dv(null);else if(Array.isArray(r))r.forEach(t=>{t.key&&xm(t)});else if(typeof r=="object")r.key&&xm(r);else if(typeof r=="string"){let[t,i]=e;typeof t=="function"&&(i=t,t=""),xm({key:r,scope:t,method:i,splitKey:"+"})}},xm=({key:r,scope:e,method:t,splitKey:i="+"})=>{SO(r).forEach(s=>{let o=s.split(i),n=o.length,a=o[n-1],l=a==="*"?"*":Ua(a);if(!Qe[l])return;e||(e=eh());let c=n>1?TO(jr,o):[],u=[];Qe[l]=Qe[l].filter(h=>{let d=(t?h.method===t:!0)&&h.scope===e&&Oz(h.mods,c);return d&&u.push(h.element),!d}),u.forEach(h=>Dv(h))})};function bO(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 Bt)Object.prototype.hasOwnProperty.call(Bt,o)&&(!Bt[o]&&e.mods.indexOf(+o)>-1||Bt[o]&&e.mods.indexOf(+o)===-1)&&(s=!1);(e.mods.length===0&&!Bt[16]&&!Bt[18]&&!Bt[17]&&!Bt[91]||s||e.shortcut==="*")&&(e.keys=[],e.keys=e.keys.concat(Ke),e.method(r,e)===!1&&(r.preventDefault?r.preventDefault():r.returnValue=!1,r.stopPropagation&&r.stopPropagation(),r.cancelBubble&&(r.cancelBubble=!0)))}}function vO(r,e){let t=Qe["*"],i=wO(r);if(r.key&&r.key.toLowerCase()==="capslock"||!(pt.filter||CO).call(this,r))return;if((i===93||i===224)&&(i=91),Ke.indexOf(i)===-1&&i!==229&&Ke.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(a=>{let l=Zu[a];r[a]&&Ke.indexOf(l)===-1?Ke.push(l):!r[a]&&Ke.indexOf(l)>-1?Ke.splice(Ke.indexOf(l),1):a==="metaKey"&&r[a]&&(Ke=Ke.filter(c=>c in Zu||c===i))}),i in Bt){Bt[i]=!0;for(let a in jr)if(Object.prototype.hasOwnProperty.call(jr,a)){let l=Zu[jr[a]];pt[a]=r[l]}if(!t)return}for(let a in Bt)Object.prototype.hasOwnProperty.call(Bt,a)&&(Bt[a]=r[Zu[a]]);r.getModifierState&&!(r.altKey&&!r.ctrlKey)&&r.getModifierState("AltGraph")&&(Ke.indexOf(17)===-1&&Ke.push(17),Ke.indexOf(18)===-1&&Ke.push(18),Bt[17]=!0,Bt[18]=!0);let s=eh();if(t)for(let a=0;a<t.length;a++)t[a].scope===s&&(r.type==="keydown"&&t[a].keydown||r.type==="keyup"&&t[a].keyup)&&bO(r,t[a],s,e);if(!(i in Qe))return;let o=Qe[i],n=o.length;for(let a=0;a<n;a++)if((r.type==="keydown"&&o[a].keydown||r.type==="keyup"&&o[a].keyup)&&o[a].key){let l=o[a],{splitKey:c}=l,u=l.key.split(c),h=[];for(let d=0;d<u.length;d++)h.push(Ua(u[d]));h.sort().join("")===Ke.sort().join("")&&bO(r,l,s,e)}}var pt=function(r,e,t){Ke=[];let i=SO(r),s=[],o="all",n=document,a=0,l=!1,c=!0,u="+",h=!1,d=!1;if(t===void 0&&typeof e=="function"&&(t=e),Object.prototype.toString.call(e)==="[object Object]"){let f=e;f.scope&&(o=f.scope),f.element&&(n=f.element),f.keyup&&(l=f.keyup),f.keydown!==void 0&&(c=f.keydown),f.capture!==void 0&&(h=f.capture),typeof f.splitKey=="string"&&(u=f.splitKey),f.single===!0&&(d=!0)}for(typeof e=="string"&&(o=e),d&&PO(r,o);a<i.length;a++){let f=i[a].split(u);s=[],f.length>1&&(s=TO(jr,f));let m=f[f.length-1];m=m==="*"?"*":Ua(m),m in Qe||(Qe[m]=[]),Qe[m].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(!$i.has(n)){let f=(g=window.event)=>vO(g,n),m=(g=window.event)=>{vO(g,n),Wz(g)};$i.set(n,{keydownListener:f,keyupListenr:m,capture:h}),Lv(n,"keydown",f,h),Lv(n,"keyup",m,h)}if(!Qu){let f=()=>{Ke=[]};Qu={listener:f,capture:h},Lv(window,"focus",f,h)}}};function zz(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 Dv(r){let e=Object.values(Qe).flat();if(e.findIndex(({element:t})=>t===r)<0&&r){let{keydownListener:t,keyupListenr:i,capture:s}=$i.get(r)||{};t&&i&&(Ku(r,"keyup",i,s),Ku(r,"keydown",t,s),$i.delete(r))}if((e.length<=0||$i.size<=0)&&(Array.from($i.keys()).forEach(t=>{let{keydownListener:i,keyupListenr:s,capture:o}=$i.get(t)||{};i&&s&&(Ku(t,"keyup",s,o),Ku(t,"keydown",i,o),$i.delete(t))}),$i.clear(),Object.keys(Qe).forEach(t=>delete Qe[t]),Qu)){let{listener:t,capture:i}=Qu;Ku(window,"focus",t,i),Qu=null}}var Gv={getPressedKeyString:Dz,setScope:AO,getScope:eh,deleteScope:Hz,getPressedKeyCodes:Gz,getAllKeyCodes:Nz,isPressed:Vz,filter:CO,trigger:zz,unbind:PO,keyMap:Ju,modifier:jr,modifierMap:Zu};for(let r in Gv){let e=r;Object.prototype.hasOwnProperty.call(Gv,e)&&(pt[e]=Gv[e])}if(typeof window<"u"){let r=window.hotkeys;pt.noConflict=e=>(e&&window.hotkeys===pt&&(window.hotkeys=r),pt),window.hotkeys=pt}var MO=",",$z="+",Xz=new Set([93,224]),jz="\0",Nv=r=>r!==null&&typeof r=="object"&&!Array.isArray(r),RO=r=>Nv(r)?{payload:Nv(r.payload)?r.payload:{}}:null,kO=r=>{if(typeof r!="string"||r.length===0)return null;let e=r.toLowerCase();return typeof pt.modifier?.[e]=="number"?pt.modifier[e]:typeof pt.keyMap?.[e]=="number"?pt.keyMap[e]:r.length===1?r.toUpperCase().charCodeAt(0):null},FO=r=>Xz.has(r)?91:r,IO=r=>{let e=null;return typeof r?.keyCode=="number"&&r.keyCode>0?e=r.keyCode:typeof r?.which=="number"&&r.which>0?e=r.which:typeof r?.charCode=="number"&&r.charCode>0&&(e=r.charCode),typeof r?.code=="string"&&/^Key[A-Z]$/.test(r.code)&&(e=r.code.charCodeAt(3)),typeof e=="number"?FO(e):kO(r?.key??"")},Yz=r=>{if(typeof r!="string"||r.length===0)return[];let e=r.replace(/\s/g,"").split(MO),t=e.lastIndexOf("");for(;t>=0;)t>0&&(e[t-1]+=MO),e.splice(t,1),t=e.lastIndexOf("");return e.filter(Boolean)},qz=r=>typeof pt.modifierMap?.[r]=="string",Kz=r=>Yz(r).map(e=>{let t=new Set(e.split($z).map(i=>kO(i)).filter(i=>typeof i=="number").map(i=>FO(i)));return t.size===0?null:{shortcut:e,releaseCodes:t,isModifierOnly:[...t].every(qz)}}).filter(Boolean),Zz=(r,e)=>{for(let t of e)if(!r.has(t))return!1;return!0},BO=(r,e)=>`${r}${jz}${e.shortcut}`,Qz=r=>typeof pt.filter!="function"||pt.filter(r),Jz=r=>{if(!Nv(r))return null;let e={},t=RO(r.keydown),i=RO(r.keyup);return t&&(e.keydown=t),i&&(e.keyup=i),Object.keys(e).length>0?e:null},OO=r=>{let e=new Map,t=new Map,i=new Map,s=new Map,o=new Set,n=(x,y,T)=>{r&&r(x,{_event:{key:y},...T})},a=()=>{i.clear(),s.clear(),o.clear()},l=x=>{for(let[y,T]of[...i])T.binding===x&&i.delete(y);for(let[y,T]of[...s])T.binding===x&&s.delete(y);t.delete(x)},c=(x,y)=>{let T=t.get(x)??[],p=typeof y?.shortcut=="string"?y.shortcut:typeof y?.key=="string"?y.key:null;return T.find(b=>b.shortcut===p)??T[0]??null},u=(x,y)=>{!e.get(x)?.keyup||!y||i.set(BO(x,y),{binding:x,releaseCodes:new Set(y.releaseCodes)})},h=(x,y)=>{let T=BO(x,y),p=s.has(T);return s.set(T,{binding:x,releaseCodes:new Set(y.releaseCodes)}),p},d=x=>{if(!Qz(x))return;let y=IO(x);if(typeof y=="number"){o.add(y);for(let[T,p]of e)(t.get(T)??[]).filter(_=>_.isModifierOnly).forEach(_=>{if(!Zz(o,_.releaseCodes))return;let S=h(T,_);u(T,_),p.keydown&&!S&&n("keydown",T,p.keydown.payload)})}},f=x=>{let y=IO(x);if(typeof y=="number"){for(let[T,p]of[...i]){let b=e.get(p.binding);!p.releaseCodes.has(y)||!b?.keyup||(i.delete(T),n("keyup",p.binding,b.keyup.payload))}for(let[T,p]of[...s])p.releaseCodes.has(y)&&s.delete(T);o.delete(y)}};return typeof document<"u"&&(document.addEventListener("keydown",d),document.addEventListener("keyup",f)),typeof window<"u"&&window.addEventListener("blur",a),{registerHotkeys:(x={})=>{if(typeof x!="object"||x===null)return;let y=new Map,T=[],p=[],b=[];Object.keys(x).forEach(_=>{let S=Jz(x[_]);S&&y.set(_,S)}),y.forEach((_,S)=>{let E=e.get(S);E?pe(E,_)||(p.push(S),pt.unbind(S)):T.push(S)}),e.forEach((_,S)=>{y.has(S)||b.push(S)}),b.forEach(_=>{pt.unbind(_),e.delete(_),l(_)}),[...T,...p].forEach(_=>{let S=y.get(_),E=Kz(_);l(_),t.set(_,E),e.set(_,S),pt(_,(C,P)=>{let M=c(_,P);if(M?.isModifierOnly){let I=h(_,M);u(_,M),S.keydown&&!I&&n("keydown",_,S.keydown.payload);return}u(_,M),S.keydown&&n("keydown",_,S.keydown.payload)})})},destroy:()=>{typeof document<"u"&&(document.removeEventListener("keydown",d),document.removeEventListener("keyup",f)),typeof window<"u"&&window.removeEventListener("blur",a);for(let x of e.keys())pt.unbind(x);e.clear(),t.clear(),i.clear(),s.clear(),o.clear()}}};var LO=(r,e)=>typeof e!="string"?e:r[e]??e,e$=(r,e,t,i)=>{let s=LO(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},UO=(r,e,t,i)=>{let s=LO(t,e);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n<s.length-1;n++){let a=s[n];a in o||(o[a]={}),o=o[a]}return o[s[s.length-1]]=i,r},t$=(r,e,t)=>{if(!r||!Object.prototype.hasOwnProperty.call(r,e))throw new Error(`Animation "${t}" cannot auto-resolve property "${e}" from targetState.`);return r[e]},r$=(r,e,t,i,s)=>Object.entries(e).map(([o,n])=>{if(!hf[o])throw new Error(`${o} is not a supported property for animation.`);let a=e$(r,o,t,0);if(n.auto){let u=t$(i,o,s);if(a===u)return null;let h=Zn([{value:a},{duration:n.auto.duration,value:u,easing:n.auto.easing}]);return{property:o,timeline:h}}let l=n.initialValue??a,c=Zn([{value:l},...n.keyframes]);return{property:o,timeline:c}}).filter(Boolean),GO=()=>{let r=[],e=new Map,t=new Map,i=new Map,s=0,o=null,n=!1,a=(B,H)=>Math.min(Math.max(B,0),Math.max(H??0,0)),l=(B,H)=>{let q=a(H,B.duration);return B.currentTime=q,B.applyFrame(q),q>=B.duration},c=(B,H)=>{i.get(B)?.forEach(q=>{try{q(H)}catch{}})},u=B=>{if(c("completed",{id:B.id}),B.onComplete)try{B.onComplete()}catch{}},h=(B,H={})=>(B.animationType=H.animationType??B.animationType,B.targetId=H.targetId??B.targetId,B.signature=H.signature??B.signature,B.continuity=H.continuity??B.continuity??"render",B.onContinuationUpdate=H.onContinuationUpdate??B.onContinuationUpdate,B),d=B=>({id:B.id,type:B.animationType??null,targetId:B.targetId??null,signature:B.signature??null,continuity:B.continuity??"render",pending:B.pending===!0}),f=B=>{B.applyFrame(0),t.delete(B.id),e.set(B.id,B);let H=o!==null&&l(B,o);c("started",{id:B.id}),H&&(u(B),e.delete(B.id))},m=B=>{let{id:H,element:q,properties:be,targetState:Ge,onComplete:nt,onCancel:Et,propertyPathMap:at=df}=B,lt=r$(q,be,at,Ge,H);if(lt.length===0){u({id:H,onComplete:nt});return}let ar={id:H,kind:"property",element:q,timelines:lt,duration:jc(lt),currentTime:0,stateVersion:s,targetState:Ge,onComplete:nt,onCancel:Et,applyFrame:Fr=>{for(let{property:Na,timeline:Va}of lt){let ym=Yc(Va,Fr);try{UO(q,Na,at,ym)}catch{}}},applyTargetState:()=>{if(!(!q||q.destroyed)){if(Ge===null){q.destroy();return}if(Ge)for(let[Fr,Na]of Object.entries(Ge))try{UO(q,Fr,at,Na)}catch{}}},isValid:()=>!!q&&!q.destroyed};f(h(ar,B))},g=B=>{let H={id:B.id,kind:"custom",duration:B.duration??0,currentTime:0,stateVersion:s,onComplete:B.onComplete,onCancel:B.onCancel,applyFrame:B.applyFrame??(()=>{}),applyTargetState:B.applyTargetState??(()=>{}),isValid:B.isValid??(()=>!0)};f(h(H,B))},x=B=>{if(B.driver==="custom"){g(B);return}m(B)},y=B=>{try{B.applyTargetState?.()}catch{}if(B.onCancel)try{B.onCancel()}catch{}},T=B=>{let H=t.get(B);H&&(y(H),t.delete(B),c("cancelled",{id:B}))},p=B=>{switch(B.type){case"START":x(B.payload);break;case"CANCEL":S(B.id);break}},b=()=>{let B=r.splice(0);for(let H of B)p(H)},_=()=>{o===null||n||(n=!0,queueMicrotask(()=>{n=!1,o!==null&&b()}))},S=B=>{let H=e.get(B);if(!H){T(B);return}y(H),e.delete(B),c("cancelled",{id:B})},E=B=>{r.push(B),_()},C=()=>{for(let[B,H]of e)y(H),c("cancelled",{id:B});for(let[B,H]of t)y(H),c("cancelled",{id:B});e.clear(),t.clear(),s++},P=(B=new Set)=>{let H=B instanceof Set?B:new Set(B??[]);for(let[q,be]of e)H.has(q)||(y(be),e.delete(q),c("cancelled",{id:q}));for(let[q,be]of t)H.has(q)||(y(be),t.delete(q),c("cancelled",{id:q}))},M=B=>{b();let H=[];for(let[q,be]of e){if(be.stateVersion!==s){H.push(q);continue}if(!be.isValid()){H.push(q);continue}if(be.currentTime+=B,be.currentTime>=be.duration){be.applyFrame(be.duration),u(be),H.push(q);continue}be.applyFrame(be.currentTime)}for(let q of H)e.delete(q)},I=B=>{o=B,b();let H=[];for(let[q,be]of e){if(be.stateVersion!==s){H.push(q);continue}if(!be.isValid()){H.push(q);continue}l(be,B)&&(u(be),H.push(q))}for(let q of H)e.delete(q)},U=()=>{o=null},A=()=>{b()},O=(B,H)=>(i.has(B)||i.set(B,new Set),i.get(B).add(H),()=>F(B,H)),F=(B,H)=>{i.get(B)?.delete(H)};return{dispatch:E,cancelAll:C,cancelAllExcept:P,flush:A,tick:M,setTime:I,clearTime:U,on:O,off:F,registerPending:B=>{let H=h({id:B.id,kind:"pending",pending:!0,applyTargetState:B.applyTargetState??(()=>{}),onCancel:B.onCancel},B);t.set(H.id,H)},activatePending:(B,H)=>{let q=t.get(B);return q?(t.delete(B),x({...H,id:B,animationType:q.animationType,targetId:q.targetId,signature:q.signature,continuity:q.continuity,onContinuationUpdate:H.onContinuationUpdate??q.onContinuationUpdate}),!0):!1},removePending:B=>{t.delete(B)},getContinuableAnimations:()=>{let B=new Map;for(let[H,q]of t)q.continuity==="persistent"&&B.set(H,d(q));for(let[H,q]of e)q.continuity==="persistent"&&B.set(H,d(q));return B},getState:()=>({stateVersion:s,activeCount:e.size,pendingCount:t.size,animations:Array.from(e.entries()).map(([B,H])=>({id:B,currentTime:H.currentTime,duration:H.duration,progress:H.duration>0?H.currentTime/H.duration:0}))}),isAnimating:B=>e.has(B),hasContext:B=>e.has(B)||t.has(B),updateContinuation:(B,H)=>{let q=e.get(B)??t.get(B);if(q?.onContinuationUpdate)try{q.onContinuationUpdate(H)}catch{}},destroy:()=>{C(),i.clear()}}};var DO=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 NO=new Set(["update","transition"]),VO=new Set(["render","persistent"]),i$=new Set(["alpha","x","y","scaleX","scaleY","rotation","blurX","blurY"]),s$=new Set(["translateX","translateY","alpha","scaleX","scaleY","rotation"]),HO=new Set(["single","sequence"]),WO=new Set(["red","green","blue","alpha"]),zO=new Set(["hold","linear"]),XO=new Set(Wf),Yr=(r,e)=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`${e} must be an object.`)},La=(r,e)=>{if(typeof r!="string"||r.length===0)throw new Error(`${e} must be a non-empty string.`)},Ga=(r,e)=>{if(typeof r!="number"||Number.isNaN(r))throw new Error(`${e} must be a number.`)},o$=(r,e)=>{if(Yr(r,e),!VO.has(r.continuity))throw new Error(`${e}.continuity must be one of: ${Array.from(VO).join(", ")}.`);return{continuity:r.continuity}},n$=(r,e)=>{if(Yr(r,e),Ga(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&&!XO.has(r.easing))throw new Error(`${e}.easing must be one of: ${Wf.join(", ")}.`);return{duration:r.duration,easing:r.easing??"linear"}},Hv=(r,e)=>{Yr(r,e);let t={};if(r.initialValue!==void 0&&(Ga(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(Yr(i,o),Ga(i.value,`${o}.value`),Ga(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&&!XO.has(i.easing))throw new Error(`${o}.easing must be one of: ${Wf.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},a$=(r,e)=>{Yr(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:n$(r.auto,`${e}.auto`)}}return Hv(r,e)},jO=(r,e,t,i=Hv)=>{Yr(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)},l$=(r,e)=>{if(Yr(r,e),La(r.texture,`${e}.texture`),Ga(r.at,`${e}.at`),r.at<0||r.at>1)throw new Error(`${e}.at must be between 0 and 1.`);return{at:r.at,texture:r.texture}},c$=(r,e)=>{if(!Array.isArray(r)||r.length<2)throw new Error(`${e} must be an array with at least two frames.`);let t=r.map((s,o)=>l$(s,`${e}[${o}]`));if(t[0].at!==0)throw new Error(`${e}[0].at must be 0.`);let i=t.length-1;if(t[i].at!==1)throw new Error(`${e}[${i}].at must be 1.`);for(let s=1;s<t.length;s++)if(t[s].at<=t[s-1].at)throw new Error(`${e} must be sorted by ascending unique at values.`);return t},u$=(r,e)=>{if(Yr(r,e),!HO.has(r.kind))throw new Error(`${e}.kind must be one of: ${Array.from(HO).join(", ")}.`);let t={kind:r.kind};if(r.channel!==void 0){if(!WO.has(r.channel))throw new Error(`${e}.channel must be one of: ${Array.from(WO).join(", ")}.`);t.channel=r.channel}if(r.softness!==void 0&&(Ga(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=Hv(r.progress,`${e}.progress`)),r.kind==="single"){if(r.frames!==void 0)throw new Error(`${e}.frames is only valid for sequence masks.`);if(r.sample!==void 0)throw new Error(`${e}.sample is only valid for sequence masks.`);if(r.items!==void 0)throw new Error(`${e}.items is not supported.`);if(r.combine!==void 0)throw new Error(`${e}.combine is not supported.`);La(r.texture,`${e}.texture`),t.texture=r.texture}if(r.kind==="sequence"){if(r.texture!==void 0)throw new Error(`${e}.texture is not valid for sequence masks. Use ${e}.frames[].texture instead.`);if(r.items!==void 0)throw new Error(`${e}.items is not supported.`);if(r.combine!==void 0)throw new Error(`${e}.combine is not supported.`);if(r.textures!==void 0)throw new Error(`${e}.textures is no longer supported. Use ${e}.frames with texture and at entries instead.`);if(r.softness!==void 0)throw new Error(`${e}.softness is not valid for sequence masks. Author feathering into ${e}.frames[].texture instead.`);if(t.frames=c$(r.frames,`${e}.frames`),r.sample!==void 0&&(La(r.sample,`${e}.sample`),!zO.has(r.sample)))throw new Error(`${e}.sample must be one of: ${Array.from(zO).join(", ")}.`);t.sample=r.sample??"hold"}return t.progress||(t.progress={initialValue:0,keyframes:[{duration:0,value:1,easing:"linear"}]}),t},$O=(r,e)=>{if(Yr(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=jO(r.tween,`${e}.tween`,s$)),Object.keys(t).length===0)throw new Error(`${e} must define tween.`);return t},h$=(r,e)=>{let t={};if(r.shader!==void 0)throw new Error(`${e}.shader is not supported.`);if(r.prev!==void 0&&(t.prev=$O(r.prev,`${e}.prev`)),r.next!==void 0&&(t.next=$O(r.next,`${e}.next`)),r.mask!==void 0&&(t.mask=u$(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},Vv=(r,e,t)=>{if(r!==void 0)throw new Error(`${e} ${t}`)},YO=(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(Yr(i,o),La(i.id,`${o}.id`),La(i.targetId,`${o}.targetId`),La(i.type,`${o}.type`),!NO.has(i.type))throw new Error(`${o}.type must be one of: ${Array.from(NO).join(", ")}.`);let n={id:i.id,targetId:i.targetId,type:i.type};if(i.complete!==void 0&&(Yr(i.complete,`${o}.complete`),n.complete=i.complete),i.playback!==void 0&&(n.playback=o$(i.playback,`${o}.playback`)),Vv(i.operation,`${o}.operation`,"is no longer supported. Use `type: update | transition` instead."),Vv(i.properties,`${o}.properties`,"is no longer supported. Use `tween` instead."),Vv(i.subjects,`${o}.subjects`,"is no longer supported. Use `prev` / `next` instead."),i.type==="update"){if(n.tween=jO(i.tween,`${o}.tween`,i$,a$),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=h$(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 Wv=(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??[],audioEffects:r.audioEffects??[]};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.");if(!Array.isArray(e.audioEffects))throw new Error("Input error: `audioEffects` must be an array.");return e.animations=YO(e.animations),ys({audio:e.audio,audioEffects:e.audioEffects}),e};var d$="0",Da=(r,e)=>{let t=r?.[e];return typeof t=="number"?t:0},br=r=>({value:r.element.value??"",selectionStart:Da(r.element,"selectionStart"),selectionEnd:Da(r.element,"selectionEnd"),focused:document.activeElement===r.element,composing:r.composing===!0}),f$=(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,p$=r=>r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement,th=r=>{r.element.style.pointerEvents="none"},zv=(r,e,t)=>{if(typeof r?.setSelectionRange=="function")try{r.setSelectionRange(e,t)}catch{}},m$=({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}},g$=({app:r,entry:e,event:t})=>{let i=e.options.getGeometry?.(),s=m$({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},qO=({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 p=r.canvas?.parentNode??document.body;t.isConnected||p.appendChild(t)},o=(p,b=p.lastSnapshot)=>{let _=br(p);_.focused&&i!==p.id?i=p.id:!_.focused&&i===p.id&&(i=null),th(p,i),b?.value!==_.value&&p.callbacks.onValueChange?.(_),(b?.selectionStart!==_.selectionStart||b?.selectionEnd!==_.selectionEnd||b?.focused!==_.focused||b?.composing!==_.composing)&&p.callbacks.onSelectionChange?.(_),p.lastSnapshot=_},n=p=>{let{disabled:b=!1,multiline:_=!1,maxLength:S,textStyle:E,padding:C,placeholder:P="",autocomplete:M="off",autocapitalize:I="off",spellcheck:U=!1}=p.options,{element:A}=p;A instanceof HTMLInputElement&&(A.type="text"),A.disabled=b,A.placeholder=P,A.autocomplete=M,A.autocapitalize=I,A.spellcheck=!!U,A.style.opacity=d$,A.style.color="transparent",A.style.caretColor="transparent",A.style.background="transparent",A.style.paddingTop=`${C.top}px`,A.style.paddingRight=`${C.right}px`,A.style.paddingBottom=`${C.bottom}px`,A.style.paddingLeft=`${C.left}px`,A.style.fontFamily=E?.fontFamily??"Arial",A.style.fontSize=`${E?.fontSize??16}px`,A.style.fontWeight=E?.fontWeight??"400",A.style.textAlign=E?.align??"left",A.style.lineHeight=typeof E?.lineHeight=="number"?`${E.lineHeight}px`:"normal",A.style.whiteSpace=_?"pre":"nowrap",A.style.overflowWrap="normal",A.style.resize="none",A.style.overflow="hidden",typeof S=="number"?A.maxLength=S:A.removeAttribute("maxLength"),A.tabIndex=-1,_&&A instanceof HTMLTextAreaElement&&(A.wrap="off",A.rows=1),th(p,i)},a=p=>{s();let b=r.canvas,_=p.options.getGeometry?.();if(!b||!_||_.visible===!1){p.element.style.display="none";return}let S=b.getBoundingClientRect(),E=r.renderer?.width||S.width||1,C=r.renderer?.height||S.height||1,P=S.width/E,M=S.height/C,I=_.clipInsets??{top:0,right:0,bottom:0,left:0},U={top:I.top*M,right:I.right*P,bottom:I.bottom*M,left:I.left*P};p.element.style.display="block",p.element.style.left=`${S.left+_.x*P}px`,p.element.style.top=`${S.top+_.y*M}px`,p.element.style.width=`${_.width*P}px`,p.element.style.height=`${_.height*M}px`;let A=Object.values(U).some(O=>O>0);p.element.style.clipPath=A?`inset(${U.top}px ${U.right}px ${U.bottom}px ${U.left}px)`:"none"},l=p=>{if(!i)return;let b=e.get(i),_=p.target;!b||_===b.element||b.element.contains(_)||p$(_)&&t?.contains(_)||g$({app:r,entry:b,event:p})||b.element.blur()},c=()=>{for(let p of e.values()){if(a(p),!p.lastSnapshot){p.lastSnapshot=br(p);continue}let b=br(p);f$(b,p.lastSnapshot)||o(p,p.lastSnapshot)}},u=({id:p,options:b})=>{let _=b.multiline===!0?document.createElement("textarea"):document.createElement("input");return _.dataset.routeGraphicsInputId=p,_.style.position="fixed",_.style.border="none",_.style.outline="none",_.style.margin="0",_.style.boxSizing="border-box",_.style.borderRadius="0",_.style.transformOrigin="top left",_.style.appearance="none",_.style.boxShadow="none",_.style.userSelect="none",_.style.webkitUserSelect="none",_},h=p=>{let{id:b,element:_}=p,S=()=>{o(p)};_.addEventListener("focus",()=>{p.pendingBlurTimer&&(clearTimeout(p.pendingBlurTimer),p.pendingBlurTimer=null),i=b,th(p,i);let E=br(p);p.lastSnapshot=E,p.callbacks.onFocus?.(E),p.callbacks.onSelectionChange?.(E)}),_.addEventListener("blur",()=>{i===b&&(i=null),th(p,i),p.pendingBlurTimer=setTimeout(()=>{p.pendingBlurTimer=null;let E=br(p);if(E.focused){p.lastSnapshot=E;return}p.lastSnapshot=E,p.callbacks.onBlur?.(E),p.callbacks.onSelectionChange?.(E)},0)}),_.addEventListener("input",S),_.addEventListener("select",S),_.addEventListener("click",()=>queueMicrotask(S)),_.addEventListener("keyup",()=>queueMicrotask(S)),_.addEventListener("keydown",E=>{let C=E.key==="Enter"&&p.options.multiline!==!0&&!E.shiftKey,P=E.key==="Enter"&&p.options.multiline===!0&&(E.ctrlKey||E.metaKey);(C||P)&&(E.preventDefault(),p.callbacks.onSubmit?.(br(p),E)),E.key==="Escape"&&_.blur(),queueMicrotask(S)}),_.addEventListener("compositionstart",()=>{p.composing=!0;let E=br(p);p.lastSnapshot=E,p.callbacks.onCompositionStart?.(E),p.callbacks.onSelectionChange?.(E)}),_.addEventListener("compositionupdate",()=>{let E=br(p);p.lastSnapshot=E,p.callbacks.onCompositionUpdate?.(E),p.callbacks.onSelectionChange?.(E)}),_.addEventListener("compositionend",()=>{p.composing=!1,S(),p.callbacks.onCompositionEnd?.(br(p))})};document.addEventListener("pointerdown",l,!0),r.ticker?.add?.(c);let d=(p,b)=>{s();let _=e.get(p);if(_)return _.options=b,_.callbacks=b.callbacks??{},n(_),a(_),typeof b.value=="string"&&_.element.value!==b.value&&(_.element.value=b.value),_.lastSnapshot=br(_),_.element;let S={id:p,element:u({id:p,options:b}),options:b,callbacks:b.callbacks??{},composing:!1,pendingBlurTimer:null,lastSnapshot:null};return h(S),typeof b.value=="string"&&(S.element.value=b.value),n(S),t.appendChild(S.element),e.set(p,S),a(S),S.lastSnapshot=br(S),S.element};return{mount:d,update:(p,b)=>{let _=e.get(p);if(!_)return d(p,b);let S=b.multiline===!0!=_.element instanceof HTMLTextAreaElement;if(_.options=b,_.callbacks=b.callbacks??{},S){let E=_.element,C=document.activeElement===E,P=Da(E,"selectionStart"),M=Da(E,"selectionEnd");return _.element=u({id:p,options:b}),h(_),E.replaceWith(_.element),_.element.value=typeof b.value=="string"?b.value:E.value,n(_),a(_),_.lastSnapshot=br(_),C&&!b.disabled&&queueMicrotask(()=>{_.element.focus(),zv(_.element,P,M)}),_.element}return typeof b.value=="string"&&b.value!==_.element.value&&_.composing!==!0&&(_.element.value=b.value),n(_),a(_),_.lastSnapshot=br(_),_.element},focus:(p,{selectAll:b=!1,selectionStart:_,selectionEnd:S}={})=>{let E=e.get(p);if(!E||E.element.disabled)return;let C=document.activeElement===E.element;if(i=p,th(E,i),C||E.element.focus(),b){E.element.select?.(),o(E,E.lastSnapshot);return}if(typeof _=="number"||typeof S=="number"){let P=typeof _=="number"?_:Da(E.element,"selectionStart"),M=typeof S=="number"?S:typeof _=="number"?_:Da(E.element,"selectionEnd");zv(E.element,P,M)}o(E,E.lastSnapshot)},setSelection:(p,b,_=b,{focus:S=!1}={})=>{let E=e.get(p);if(!E||E.element.disabled)return;let C=()=>{zv(E.element,b,_),o(E,E.lastSnapshot)};if(S&&document.activeElement!==E.element){E.element.focus(),C();return}C()},blur:p=>{e.get(p)?.element.blur()},unmount:p=>{let b=e.get(p);b&&(i===p&&(i=null),b.pendingBlurTimer&&(clearTimeout(b.pendingBlurTimer),b.pendingBlurTimer=null),b.element.remove(),e.delete(p),e.size===0&&t?.remove())},destroy:()=>{document.removeEventListener("pointerdown",l,!0),r.ticker?.remove?.(c);for(let p of e.values())p.pendingBlurTimer&&(clearTimeout(p.pendingBlurTimer),p.pendingBlurTimer=null),p.element.remove();e.clear(),i=null,t?.remove(),t=void 0}}};var x$=()=>{let r=A=>{if(A!=="auto"&&A!=="manual")throw new Error(`Invalid animation playback mode "${A}". Expected "auto" or "manual".`)},e,t=yO(),i={elements:[],animations:[],audio:[],audioEffects:[]},s,o={animations:[],elements:[],audio:[],parsers:[]},n,a,l,c,u=!1,h,d,f,m="auto",g=null,x=[],y,T=new Map,p,b=(A,O,F,R)=>{A.clear(),A.rect(0,0,O,F),A.fill(R??0)},_=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",S=(A,O,{revokable:F=!1}={})=>{T.set(A,{url:O,revokable:F})},E=()=>{for(let A of T.values())A?.revokable===!0&&typeof A?.url=="string"&&URL.revokeObjectURL(A.url);T.clear()},C=(A,O)=>new Promise((F,R)=>{let D=window.HTMLMediaElement?.HAVE_CURRENT_DATA??2;if(A.readyState>=D){F();return}let G,N=()=>{window.clearTimeout(G),A.removeEventListener("loadeddata",W),A.removeEventListener("canplay",W),A.removeEventListener("error",se)},W=()=>{N(),F()},se=()=>{N();let fe=[A.error?.code?`code=${A.error.code}`:null,A.error?.message?`message=${A.error.message}`:null,`networkState=${A.networkState}`,`readyState=${A.readyState}`,A.currentSrc?`src=${A.currentSrc}`:null].filter(Boolean).join(", ");R(new Error(`Failed to load video asset "${O}"${fe?` (${fe})`:""}.`))};G=window.setTimeout(()=>{N(),R(new Error(`Timed out loading video asset "${O}".`))},5e3),A.addEventListener("loadeddata",W,{once:!0}),A.addEventListener("canplay",W,{once:!0}),A.addEventListener("error",se,{once:!0})}),P=async({key:A,sourceUrl:O,mimeType:F})=>{if(Lt.cache.has(A))return Lt.cache.get(A);let R=document.createElement("video");R.preload="auto",R.playsInline=!0,R.setAttribute("playsinline",""),typeof F=="string"&&F.length>0&&(R.type=F);let D=C(R,A);R.src=O,R.load(),await D;let G=k.from(R);return Lt.cache.set(A,G),G},M=(A,O,F)=>{n&&n.registerHotkeys(F?.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 R=O?.cursorStyles,D=F?.cursorStyles;pe(R,D)||(D?(D.default&&(A.renderer.events.cursorStyles.default=D.default,A.canvas.style.cursor=D.default),D.hover&&(A.renderer.events.cursorStyles.hover=D.hover)):R&&(A.renderer.events.cursorStyles.default="default",A.renderer.events.cursorStyles.hover="pointer"))},I=(A,O,F,R)=>{if(pe(i,F)){typeof A.render=="function"&&A.render();return}let D=FR({prevState:i,nextState:F,activeAnimations:a.getContinuableAnimations()});h&&h.abort(),h=new AbortController;let G=h.signal;l.reset(F.id),M(A,i.global,F.global),a.cancelAllExcept(D.continuedAnimationIds),no({app:A,parent:O,prevComputedTree:i.elements,nextComputedTree:F.elements,animations:F.animations,elementPlugins:o.elements,animationBus:a,completionTracker:l,eventHandler:R,signal:G}),a.flush(),m==="manual"&&g!==null&&a.setTime(g),pb({app:A,prevAudioTree:i.audio,nextAudioTree:F.audio,prevAudioEffects:i.audioEffects,nextAudioEffects:F.audioEffects,audioPlugins:o.audio}),i=F,typeof A.render=="function"&&A.render(),l.completeIfEmpty(),u||(u=!0,c&&c())},U={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 O=new ee(0,0,e.renderer.width,e.renderer.height);if(!A)return await e.renderer.extract.base64({target:e.stage,frame:O});let F=e.stage.getChildByLabel(A,!0);if(!F)throw new Error(`Element with label '${A}' not found`);return await e.renderer.extract.base64({target:F,frame:O})},assignStageEvent:(A,O)=>{e.stage.eventMode="static",e.stage.on(A,O)},setAnimationPlaybackMode:A=>{r(A),m=A,m!=="manual"&&(g=null,a?.clearTime?.())},setAnimationTime:A=>{let O=Number(A);if(!Number.isFinite(O))throw new Error("Animation time must be a finite number.");m==="manual"&&(g=O),a.flush(),a.setTime(O),m!=="manual"&&(g=null,a.clearTime()),typeof e.render=="function"&&e.render()},init:async A=>{let{eventHandler:O,plugins:F,width:R,height:D,backgroundColor:G,debug:N=!1,onFirstRender:W,animationPlaybackMode:se="auto"}=A;c=W,r(se),m=se,g=null,x.forEach(ye=>ye()),x=[];let fe=[];F?.elements?.forEach(ye=>{ye?.parse&&fe.push(_O({type:ye.type,parse:ye.parse}))}),o={animations:F?.animations??[],elements:F?.elements??[],audio:F?.audio??[],parsers:fe},s=O,n=OO(O),l=DO(O),e=new kc,e.audioStage=t,await e.init({width:R,height:D,backgroundColor:G,preference:"webgl",preserveDrawingBuffer:N===!0}),typeof e.ticker?.remove=="function"&&e.ticker.remove(e.render,e),e.debug=N,e.inputDomBridge=qO({app:e}),y=ye=>{ye.preventDefault()},e.canvas.addEventListener("contextmenu",y),p=new We,p.label="__route_graphics_background__",b(p,R,D,G),e.stage.addChild(p),e.stage.width=R,e.stage.height=D,e.ticker.add(e.audioStage.tick),a=GO();let Ee=()=>{m==="manual"&&typeof e.render=="function"&&e.render()};return x=[a.on("started",Ee),a.on("completed",Ee),a.on("cancelled",Ee)],N?(d=ye=>{m==="auto"&&ye?.detail?.deltaMS&&(a.tick(Number(ye.detail.deltaMS)),typeof e.render=="function"&&e.render())},window.addEventListener("snapShotKeyFrame",d)):(f=ye=>{m==="auto"&&(a.tick(ye.deltaMS),typeof e.render=="function"&&e.render())},e.ticker.add(f)),U},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),y&&e?.canvas&&(e.canvas.removeEventListener("contextmenu",y),y=void 0),e?.inputDomBridge?.destroy?.(),n?.destroy(),rb(),x.forEach(O=>O()),x=[],a&&a.destroy(),e?.audioStage&&e.audioStage.destroy();let A=O=>{for(let F of O.children){let R=F.texture?.source?.resource;R instanceof HTMLVideoElement&&R.pause(),F.children&&A(F)}};e?.stage&&(A(e.stage),fr({app:e,root:e.stage})),e&&e.destroy(),m="auto",g=null,p=void 0,E()},loadAssets:async A=>{if(!A)throw new Error("assetBufferMap is required");let O={audio:{},font:{},video:{},texture:{}};for(let[D,G]of Object.entries(A)){let N=_(G.type);O[N][D]=G}await Promise.all(Object.entries(O.audio).map(([D,G])=>Un.load(D,G.buffer))),await Promise.all(Object.entries(O.font).map(async([D,G])=>{let N=new Blob([G.buffer],{type:G.type}),W=URL.createObjectURL(N),se=new FontFace(D,`url(${W})`);try{await se.load(),document.fonts.add(se)}catch(fe){console.error(`Failed to load font ${D}:`,fe)}finally{URL.revokeObjectURL(W)}}));let F=Object.entries(O.texture).map(async([D,G])=>{if(Lt.cache.has(D))return Lt.cache.get(D);if(G?.source==="url"&&typeof G?.url=="string")return Lt.load({alias:D,src:G.url});let N=new Blob([G.buffer],{type:G.type}),W=await createImageBitmap(N),se=k.from(W);return Lt.cache.set(D,se),se}),R=Object.entries(O.video).map(async([D,G])=>{if(Lt.cache.has(D))return Lt.cache.get(D);let N=G?.source==="url"&&typeof G?.url=="string"?G.url:URL.createObjectURL(new Blob([G.buffer],{type:G.type})),W=G?.source!=="url";S(D,N,{revokable:W});try{return await P({key:D,sourceUrl:N,mimeType:G?.type})}catch(se){throw T.delete(D),W&&URL.revokeObjectURL(N),se}});return Promise.all([...F,...R])},loadAudioAssets:async A=>Promise.all(A.map(async O=>{let R=await(await fetch(O)).arrayBuffer();return Un.load(O,R)})),updatedBackgroundColor:A=>{e.renderer.background.color=A,p&&b(p,e.renderer.width,e.renderer.height,A),typeof e.render=="function"&&e.render()},render:A=>{let O=Wv(A),F=Ov({JSONObject:O.elements,parserPlugins:o.parsers}),R={...O,elements:F};I(e,e.stage,R,s)},parse:A=>{let O=Wv(A),F=Ov({JSONObject:O.elements,parserPlugins:o.parsers});return{...O,elements:F}}};return U},KO=x$;var COe=KO;export{kc as Application,Lt as Assets,Un as AudioAsset,aV as animatedSpritePlugin,tV as containerPlugin,s_ as createAnimationPlugin,sU as createAssetBufferManager,o_ as createAudioPlugin,it as createElementPlugin,COe as default,_3 as inputPlugin,KV as particlesPlugin,kN as rectPlugin,pb as renderAudio,no as renderElements,n3 as sliderPlugin,uV as soundPlugin,WN as spritePlugin,AB as spritesheetAnimationPlugin,RN as textPlugin,iV as textRevealingPlugin,lV as tweenPlugin,$N as videoPlugin};
2034
+ `))}}var _z=0,cm={textureCount:0,uboCount:0},Ss=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=_z++}systemCheck(){if(!sm())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||(cm.textureCount=0,cm.uboCount=0,this.syncUniformGroup(e.uniformGroup,cm)),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]=pv(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,cm,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]=Sv(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=Tv(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}};Ss.extension={type:K.RendererSystem,name:"shader"};re.add(Ss);var Hi=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(){}};Hi.defaultOptions={hello:!1},Hi.extension={type:[K.RendererSystem,K.CanvasRendererSystem],name:"startup"};re.add(Hi);function iO(r,e=[]){return e[ae.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.ADD]=[r.ONE,r.ONE],e[ae.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.NONE]=[0,0],e[ae.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],e[ae.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[ae.SRC_IN]=[r.DST_ALPHA,r.ZERO],e[ae.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],e[ae.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[ae.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],e[ae.DST_IN]=[r.ZERO,r.SRC_ALPHA],e[ae.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],e[ae.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],e[ae.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[ae.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],e}var bz=0,vz=1,Tz=2,Sz=3,wz=4,Ez=5,sO=class wv{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=ae.NONE,this._blendEq=!1,this.map=[],this.map[bz]=this.setBlend,this.map[vz]=this.setOffset,this.map[Tz]=this.setCullFace,this.map[Sz]=this.setDepthTest,this.map[wz]=this.setFrontFace,this.map[Ez]=this.setDepthMask,this.checks=[],this.defaultState=new mi,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=iO(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<<i)),t=t>>1,i++;this.stateId=e.data}for(let t=0;t<this.checks.length;t++)this.checks[t](this,e)}forceState(e){e=e||this.defaultState;for(let t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(let t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data}setBlend(e){this.updateCheck(wv.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this.updateCheck(wv.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this.gl[e?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(e){this.gl.frontFace(this.gl[e?"CW":"CCW"])}setBlendMode(e){if(e===this.blendMode)return;this.blendMode=e;let t=this.blendModes[e],i=this.gl;t.length===2?i.blendFunc(t[0],t[1]):i.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,i.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(e,t){this.gl.polygonOffset(e,t)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(e,t){let i=this.checks.indexOf(e);t&&i===-1?this.checks.push(e):!t&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(e,t){e.setBlendMode(t.blendMode)}static checkPolygonOffset(e,t){e.setPolygonOffset(1,t.polygonOffset)}destroy(){this.gl=null}};sO.extension={type:K.RendererSystem,name:"state"};var Ev=sO;re.add(Ev);var Ba=class extends go.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(e){this.addRunners(...e.runners);let t=(e.priority??[]).filter(s=>e.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 ot(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 Du=class um{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=um.defaultMaxIdle,this.checkCountMax=um.defaultCheckCountMax,this.mode=um.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Sp.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;s<t.length;s++){let o=t[s];o.resource&&this.count-o.touched>this.maxIdle&&(e.destroyTexture(o,!0),t[s]=null,i=!0)}if(i){let s=0;for(let o=0;o<t.length;o++)t[o]!==null&&(t[s++]=t[o]);t.length=s}}unload(e){let t=this.renderer.texture,i=e._texture;i&&!i.framebuffer&&t.destroyTexture(i);for(let s=e.children.length-1;s>=0;s--)this.unload(e.children[s])}destroy(){this.renderer=null}};Du.defaultMode=Sp.AUTO,Du.defaultMaxIdle=60*60,Du.defaultCheckCountMax=60*10,Du.extension={type:K.RendererSystem,name:"textureGC"};var yi=Du;re.add(yi);var Mo=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=ue.UNSIGNED_BYTE,this.internalFormat=z.RGBA,this.samplerType=0}};function oO(r){let e;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?e={[r.RGB]:j.FLOAT,[r.RGBA]:j.FLOAT,[r.ALPHA]:j.FLOAT,[r.LUMINANCE]:j.FLOAT,[r.LUMINANCE_ALPHA]:j.FLOAT,[r.R8]:j.FLOAT,[r.R8_SNORM]:j.FLOAT,[r.RG8]:j.FLOAT,[r.RG8_SNORM]:j.FLOAT,[r.RGB8]:j.FLOAT,[r.RGB8_SNORM]:j.FLOAT,[r.RGB565]:j.FLOAT,[r.RGBA4]:j.FLOAT,[r.RGB5_A1]:j.FLOAT,[r.RGBA8]:j.FLOAT,[r.RGBA8_SNORM]:j.FLOAT,[r.RGB10_A2]:j.FLOAT,[r.RGB10_A2UI]:j.FLOAT,[r.SRGB8]:j.FLOAT,[r.SRGB8_ALPHA8]:j.FLOAT,[r.R16F]:j.FLOAT,[r.RG16F]:j.FLOAT,[r.RGB16F]:j.FLOAT,[r.RGBA16F]:j.FLOAT,[r.R32F]:j.FLOAT,[r.RG32F]:j.FLOAT,[r.RGB32F]:j.FLOAT,[r.RGBA32F]:j.FLOAT,[r.R11F_G11F_B10F]:j.FLOAT,[r.RGB9_E5]:j.FLOAT,[r.R8I]:j.INT,[r.R8UI]:j.UINT,[r.R16I]:j.INT,[r.R16UI]:j.UINT,[r.R32I]:j.INT,[r.R32UI]:j.UINT,[r.RG8I]:j.INT,[r.RG8UI]:j.UINT,[r.RG16I]:j.INT,[r.RG16UI]:j.UINT,[r.RG32I]:j.INT,[r.RG32UI]:j.UINT,[r.RGB8I]:j.INT,[r.RGB8UI]:j.UINT,[r.RGB16I]:j.INT,[r.RGB16UI]:j.UINT,[r.RGB32I]:j.INT,[r.RGB32UI]:j.UINT,[r.RGBA8I]:j.INT,[r.RGBA8UI]:j.UINT,[r.RGBA16I]:j.INT,[r.RGBA16UI]:j.UINT,[r.RGBA32I]:j.INT,[r.RGBA32UI]:j.UINT,[r.DEPTH_COMPONENT16]:j.FLOAT,[r.DEPTH_COMPONENT24]:j.FLOAT,[r.DEPTH_COMPONENT32F]:j.FLOAT,[r.DEPTH_STENCIL]:j.FLOAT,[r.DEPTH24_STENCIL8]:j.FLOAT,[r.DEPTH32F_STENCIL8]:j.FLOAT}:e={[r.RGB]:j.FLOAT,[r.RGBA]:j.FLOAT,[r.ALPHA]:j.FLOAT,[r.LUMINANCE]:j.FLOAT,[r.LUMINANCE_ALPHA]:j.FLOAT,[r.DEPTH_STENCIL]:j.FLOAT},e}function nO(r){let e;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?e={[ue.UNSIGNED_BYTE]:{[z.RGBA]:r.RGBA8,[z.RGB]:r.RGB8,[z.RG]:r.RG8,[z.RED]:r.R8,[z.RGBA_INTEGER]:r.RGBA8UI,[z.RGB_INTEGER]:r.RGB8UI,[z.RG_INTEGER]:r.RG8UI,[z.RED_INTEGER]:r.R8UI,[z.ALPHA]:r.ALPHA,[z.LUMINANCE]:r.LUMINANCE,[z.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ue.BYTE]:{[z.RGBA]:r.RGBA8_SNORM,[z.RGB]:r.RGB8_SNORM,[z.RG]:r.RG8_SNORM,[z.RED]:r.R8_SNORM,[z.RGBA_INTEGER]:r.RGBA8I,[z.RGB_INTEGER]:r.RGB8I,[z.RG_INTEGER]:r.RG8I,[z.RED_INTEGER]:r.R8I},[ue.UNSIGNED_SHORT]:{[z.RGBA_INTEGER]:r.RGBA16UI,[z.RGB_INTEGER]:r.RGB16UI,[z.RG_INTEGER]:r.RG16UI,[z.RED_INTEGER]:r.R16UI,[z.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[ue.SHORT]:{[z.RGBA_INTEGER]:r.RGBA16I,[z.RGB_INTEGER]:r.RGB16I,[z.RG_INTEGER]:r.RG16I,[z.RED_INTEGER]:r.R16I},[ue.UNSIGNED_INT]:{[z.RGBA_INTEGER]:r.RGBA32UI,[z.RGB_INTEGER]:r.RGB32UI,[z.RG_INTEGER]:r.RG32UI,[z.RED_INTEGER]:r.R32UI,[z.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[ue.INT]:{[z.RGBA_INTEGER]:r.RGBA32I,[z.RGB_INTEGER]:r.RGB32I,[z.RG_INTEGER]:r.RG32I,[z.RED_INTEGER]:r.R32I},[ue.FLOAT]:{[z.RGBA]:r.RGBA32F,[z.RGB]:r.RGB32F,[z.RG]:r.RG32F,[z.RED]:r.R32F,[z.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[ue.HALF_FLOAT]:{[z.RGBA]:r.RGBA16F,[z.RGB]:r.RGB16F,[z.RG]:r.RG16F,[z.RED]:r.R16F},[ue.UNSIGNED_SHORT_5_6_5]:{[z.RGB]:r.RGB565},[ue.UNSIGNED_SHORT_4_4_4_4]:{[z.RGBA]:r.RGBA4},[ue.UNSIGNED_SHORT_5_5_5_1]:{[z.RGBA]:r.RGB5_A1},[ue.UNSIGNED_INT_2_10_10_10_REV]:{[z.RGBA]:r.RGB10_A2,[z.RGBA_INTEGER]:r.RGB10_A2UI},[ue.UNSIGNED_INT_10F_11F_11F_REV]:{[z.RGB]:r.R11F_G11F_B10F},[ue.UNSIGNED_INT_5_9_9_9_REV]:{[z.RGB]:r.RGB9_E5},[ue.UNSIGNED_INT_24_8]:{[z.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[ue.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[z.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:e={[ue.UNSIGNED_BYTE]:{[z.RGBA]:r.RGBA,[z.RGB]:r.RGB,[z.ALPHA]:r.ALPHA,[z.LUMINANCE]:r.LUMINANCE,[z.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ue.UNSIGNED_SHORT_5_6_5]:{[z.RGB]:r.RGB},[ue.UNSIGNED_SHORT_4_4_4_4]:{[z.RGBA]:r.RGBA},[ue.UNSIGNED_SHORT_5_5_5_1]:{[z.RGBA]:r.RGBA}},e}var ka=class{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new Te,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=nO(e),this.samplerTypes=oO(e);let t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(let s=0;s<t;s++)this.boundTextures[s]=null;this.emptyTextures={};let i=new Mo(e.createTexture());e.bindTexture(e.TEXTURE_2D,i.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[e.TEXTURE_2D]=i,this.emptyTextures[e.TEXTURE_CUBE_MAP]=new Mo(e.createTexture()),e.bindTexture(e.TEXTURE_CUBE_MAP,this.emptyTextures[e.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(e,t=0){let{gl:i}=this;if(e=e?.castToBaseTexture(),e?.valid&&!e.parentTextureArray){e.touched=this.renderer.textureGC.count;let s=e._glTextures[this.CONTEXT_UID]||this.initTexture(e);this.boundTextures[t]!==e&&(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(e.target,s.texture)),s.dirtyId!==e.dirtyId?(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),this.updateTexture(e)):s.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(e),this.boundTextures[t]=e}else this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[t]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let e=0;e<this.boundTextures.length;e++)this.boundTextures[e]=this.unknownTexture}unbind(e){let{gl:t,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===e&&(this.currentLocation!==s&&(t.activeTexture(t.TEXTURE0+s),this.currentLocation=s),t.bindTexture(e.target,this.emptyTextures[e.target].texture),i[s]=null)}ensureSamplerType(e){let{boundTextures:t,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let o=e-1;o>=0;--o){let n=t[o];n&&n._glTextures[s].samplerType!==j.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(e){let t=new Mo(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]??j.FLOAT,this.webGLVersion===2&&e.type===ue.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!==j.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&&ev(this.managedTextures,s,1)}}updateTextureStyle(e){let t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===Vr.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=iu.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!==Vr.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===Mr.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&e.anisotropicLevel>0&&e.scaleMode===Mr.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===Mr.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===Mr.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}};ka.extension={type:K.RendererSystem,name:"texture"};re.add(ka);var Fa=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<e.buffers.length;n++){let a=e.buffers[n];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,t.bindBufferBase(t.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[s].buffer||null))}return t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),e.disposeRunner.add(this),o}disposeTransformFeedback(e,t){let i=e._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;e.disposeRunner.remove(this);let o=this.renderer.buffer;if(o)for(let n=0;n<e.buffers.length;n++){let a=e.buffers[n];if(!a)continue;let l=a._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!t&&o.dispose(a,t))}i&&(t||s.deleteTransformFeedback(i),delete e._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};Fa.extension={type:K.RendererSystem,name:"transformFeedback"};re.add(Fa);var Wi=class{constructor(e){this.renderer=e}init(e){this.screen=new we(0,0,e.width,e.height),this.element=e.view||te.ADAPTER.createCanvas(),this.resolution=e.resolution||te.RESOLUTION,this.autoDensity=!!e.autoDensity}resizeView(e,t){this.element.width=Math.round(e*this.resolution),this.element.height=Math.round(t*this.resolution);let i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(e){e&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}};Wi.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Wi.extension={type:[K.RendererSystem,K.CanvasRendererSystem],name:"_view"};re.add(Wi);te.PREFER_ENV=pr.WEBGL2;te.STRICT_TEXTURE_CACHE=!1;te.RENDER_OPTIONS={...Vi.defaultOptions,...Ni.defaultOptions,...Wi.defaultOptions,...Hi.defaultOptions};Object.defineProperties(te,{WRAP_MODE:{get(){return Te.defaultOptions.wrapMode},set(r){xe("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),Te.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return Te.defaultOptions.scaleMode},set(r){xe("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),Te.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return Te.defaultOptions.mipmap},set(r){xe("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),Te.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return Te.defaultOptions.anisotropicLevel},set(r){xe("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),Te.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return xe("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),xi.defaultResolution},set(r){xi.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return xe("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),xi.defaultMultisample},set(r){xi.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return Di.defaultMaxTextures},set(r){xe("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Di.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return Di.defaultBatchSize},set(r){xe("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Di.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return Di.canUploadSameBuffer},set(r){xe("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Di.canUploadSameBuffer=r}},GC_MODE:{get(){return yi.defaultMode},set(r){xe("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),yi.defaultMode=r}},GC_MAX_IDLE:{get(){return yi.defaultMaxIdle},set(r){xe("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),yi.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return yi.defaultCheckCountMax},set(r){xe("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),yi.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return Br.defaultVertexPrecision},set(r){xe("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),Br.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return Br.defaultFragmentPrecision},set(r){xe("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),Br.defaultFragmentPrecision=r}}});var Ro=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(Ro||{});var Oa=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 aO=class _r{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 Oa(null,null,1/0),this.deltaMS=1/_r.targetFPMS,this.elapsedMS=1/_r.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=Ro.NORMAL){return this._addListener(new Oa(e,t,i))}addOnce(e,t,i=Ro.NORMAL){return this._addListener(new Oa(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._minElapsedMS)return;this._lastFrame=e-o%this._minElapsedMS}this.deltaMS=t,this.deltaTime=this.deltaMS*_r.targetFPMS;let i=this._head,s=i.next;for(;s;)s=s.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){let t=Math.min(this.maxFPS,e),i=Math.min(Math.max(0,t)/1e3,_r.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){if(e===0)this._minElapsedMS=0;else{let t=Math.max(this.minFPS,e);this._minElapsedMS=1/(t/1e3)}}static get shared(){if(!_r._shared){let e=_r._shared=new _r;e.autoStart=!0,e._protected=!0}return _r._shared}static get system(){if(!_r._system){let e=_r._system=new _r;e.autoStart=!0,e._protected=!0}return _r._system}};aO.targetFPMS=.06;var kr=aO;Object.defineProperties(te,{TARGET_FPMS:{get(){return kr.targetFPMS},set(r){xe("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),kr.targetFPMS=r}}});var Nu=class{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,Ro.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?kr.shared:new kr,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}};Nu.extension=K.Application;re.add(Nu);var Az=[];re.handleByList(K.Renderer,Az);var Vu=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>=Oe.HIGH?this.multisample=Oe.HIGH:t>=Oe.MEDIUM?this.multisample=Oe.MEDIUM:t>=Oe.LOW?this.multisample=Oe.LOW:this.multisample=Oe.NONE}destroy(){}};Vu.extension={type:K.RendererSystem,name:"_multisample"};re.add(Vu);var hm=class{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var Hu=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;i<t.length;i++)this.dispose(this.managedBuffers[t[i]],e)}createGLBuffer(e){let{CONTEXT_UID:t,gl:i}=this;return e._glBuffers[t]=new hm(i.createBuffer()),this.managedBuffers[e.id]=e,e.disposeRunner.add(this),e._glBuffers[t]}};Hu.extension={type:K.RendererSystem,name:"buffer"};re.add(Hu);var Wu=class{constructor(e){this.renderer=e}render(e,t){let i=this.renderer,s,o,n,a;if(t&&(s=t.renderTexture,o=t.clear,n=t.transform,a=t.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=n,!i.context.isLost){if(s||(this.lastObjectRendered=e),!a){let l=e.enableTempParent();e.updateTransform(),e.disableTempParent(l)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(o??i.background.clearBeforeRender)&&i.renderTexture.clear(),e.render(i),i.batch.currentRenderer.flush(),s&&(t.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}};Wu.extension={type:K.RendererSystem,name:"objectRenderer"};re.add(Wu);var dm=class Av extends Ba{constructor(e){super(),this.type=mb.WEBGL,e=Object.assign({},te.RENDER_OPTIONS,e),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new yr({projectionMatrix:new Ve},!0);let t={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Av.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(t),"useContextAlpha"in e&&(xe("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),e.premultipliedAlpha=e.useContextAlpha&&e.useContextAlpha!=="notMultiplied",e.backgroundAlpha=e.useContextAlpha===!1?1:e.backgroundAlpha),this._plugin.rendererPlugins=Av.__plugins,this.options=e,this.startup.run(this.options)}static test(e){return e?.forceCanvas?!1:Qb()}render(e,t){this.objectRenderer.render(e,t)}resize(e,t){this._view.resizeView(e,t)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(e=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:e}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(e){this._view.resolution=e,this.runners.resolutionChange.emit(e)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return xe("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return xe("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return xe("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return xe("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(e){xe("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=e}get backgroundAlpha(){return xe("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(e){xe("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=e}get powerPreference(){return xe("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(e,t){return this.textureGenerator.generateTexture(e,t)}};dm.extension={type:K.Renderer,priority:1},dm.__plugins={},dm.__systems={};var fm=dm;re.handleByMap(K.RendererPlugin,fm.__plugins);re.handleByMap(K.RendererSystem,fm.__systems);re.add(fm);var ws=class extends xr{constructor(e,t){let{width:i,height:s}=t||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<e;o++){let n=new Te;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=e,this._load=null,this.baseTexture=null}initFromArray(e,t){for(let i=0;i<this.length;i++)e[i]&&(e[i].castToBaseTexture?this.addBaseTextureAt(e[i].castToBaseTexture(),i):e[i]instanceof xr?this.addResourceAt(e[i],i):this.addResourceAt(ga(e[i],t),i))}dispose(){for(let e=0,t=this.length;e<t;e++)this.items[e].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(e,t){if(!this.items[t])throw new Error(`Index ${t} is out of bounds`);return e.valid&&!this.valid&&this.resize(e.width,e.height),this.items[t].setResource(e),this}bind(e){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(e);for(let t=0;t<this.length;t++)this.items[t].parentTextureArray=e,this.items[t].on("update",e.update,e)}unbind(e){super.unbind(e);for(let t=0;t<this.length;t++)this.items[t].parentTextureArray=null,this.items[t].off("update",e.update,e)}load(){if(this._load)return this._load;let e=this.items.map(t=>t.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 zu=class extends ws{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=Fi.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;l<s;l++){let c=n[l];o[l]<c.dirtyId&&(o[l]=c.dirtyId,c.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,l,c.resource.width,c.resource.height,1,t.format,i.type,c.resource.source))}return!0}};var $u=class extends bt{constructor(e){super(e)}static test(e){let{OffscreenCanvas:t}=globalThis;return t&&e instanceof t?!0:globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement}};var lO=class Xu extends ws{constructor(e,t){let{width:i,height:s,autoLoad:o,linkBaseTexture:n}=t||{};if(e&&e.length!==Xu.SIDES)throw new Error(`Invalid length. Got ${e.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<Xu.SIDES;a++)this.items[a].target=Fi.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=n!==!1,e&&this.initFromArray(e,t),o!==!1&&this.load()}bind(e){super.bind(e),e.target=Fi.TEXTURE_CUBE_MAP}addBaseTextureAt(e,t,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[t])throw new Error(`Index ${t} is out of bounds`);if(!this.linkBaseTexture||e.parentTextureArray||Object.keys(e._glTextures).length>0)if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=Fi.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<Xu.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||i.dirtyId<t.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(e,n,i),s[o]=n.dirtyId):s[o]<-1&&(e.gl.texImage2D(n.target,0,i.internalFormat,t.realWidth,t.realHeight,0,t.format,i.type,null),s[o]=-1))}return!0}static test(e){return Array.isArray(e)&&e.length===Xu.SIDES}};lO.SIDES=6;var Cv=lO;var ju=class r extends bt{constructor(e,t){t=t||{};let i,s,o;typeof e=="string"?(i=r.EMPTY,s=e,o=!0):(i=e,s=null,o=!1),super(i),this.url=s,this.crossOrigin=t.crossOrigin??!0,this.alphaMode=typeof t.alphaMode=="number"?t.alphaMode:null,this.ownsImageBitmap=t.ownsImageBitmap??o,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(e,t)=>{if(this.url===null){e(this);return}try{let i=await te.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===mr.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??te.ADAPTER.createCanvas(0,0),r._EMPTY}};var Pv=class pm extends bt{constructor(e,t){t=t||{},super(te.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)},pm.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;bt.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_${Ui()}`,n.getContext("2d").drawImage(e,0,0,t,i,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(e){let t=pm.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"&&pm.SVG_XML.test(e)}};Pv.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Pv.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var Mv=Pv;var mm=class extends bt{constructor(e){super(e)}static test(e){return!!globalThis.VideoFrame&&e instanceof globalThis.VideoFrame}};var Rv=class Iv extends bt{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];bt.crossOrigin(i,s,t.crossorigin);for(let o=0;o<e.length;++o){let n=document.createElement("source"),{src:a,mime:l}=e[o];if(a=a||e[o],a.startsWith("data:"))l=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){let c=a.split("?").shift().toLowerCase(),u=c.slice(c.lastIndexOf(".")+1);l=l||Iv.MIME_TYPES[u]||`video/${u}`}n.src=a,l&&(n.type=l),i.appendChild(n)}e=i}super(e),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}update(e=0){if(!this.destroyed){if(this._updateFPS){let t=kr.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;let e=this.source;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlay),e.addEventListener("error",this._onError,!0)),this._load=new Promise((t,i)=>{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&&(kr.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||(kr.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(kr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,t){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||Iv.TYPES.includes(t)}};Rv.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Rv.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var Bv=Rv;yu.push(ju,Eo,$u,Bv,mm,Mv,xo,Cv,zu);var Cz={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)}},Pz={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 cO(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?Cz:Pz)[u.type].call(null,l,d.location,d.value,h)}}function Mz(){Object.assign(Ss.prototype,{systemCheck(){},syncUniforms(r,e){let{shader:t,renderer:i}=this;cO(r,t.program.uniformData,e.uniformData,r.uniforms,i)}})}Mz();var kv="__route_graphics_audio_root__",Yu="__route_graphics_audio_direct__",gm,Xr=()=>{if(gm)return gm;let r=globalThis.window?.AudioContext??globalThis.window?.webkitAudioContext;if(!r)throw new Error("AudioContext is not available in this environment.");return gm=new r,gm},Bo=(r,e)=>{r&&e&&typeof r.connect=="function"&&r.connect(e)},Io=r=>{r&&typeof r.disconnect=="function"&&r.disconnect()},Rz=(r,e=0)=>typeof r?.value=="number"?r.value:e,pO=(r=Xr())=>{r.state==="suspended"&&typeof r.resume=="function"&&r.resume().catch(()=>{})},Es=(r,e,t=Xr())=>{r&&(typeof r.cancelScheduledValues=="function"&&r.cancelScheduledValues(t.currentTime),typeof r.setValueAtTime=="function"?r.setValueAtTime(e,t.currentTime):r.value=e)},Iz=(r,e,t,i=Xr())=>{if(!r)return;let s=i.currentTime,o=t/1e3,n=Rz(r);typeof r.cancelScheduledValues=="function"&&r.cancelScheduledValues(s),typeof r.setValueAtTime=="function"?r.setValueAtTime(n,s):r.value=n,o>0&&typeof r.linearRampToValueAtTime=="function"?r.linearRampToValueAtTime(e,s+o):typeof r.setValueAtTime=="function"?r.setValueAtTime(e,s+o):r.value=e},mO=(r=1)=>{let e=Xr(),t=e.createGain();return Es(t.gain,r,e),t},gO=(r=0)=>{let e=Xr();if(typeof e.createStereoPanner!="function")return null;let t=e.createStereoPanner();return Es(t.pan,r,e),t},$r=({volume:r,muted:e})=>e?0:ze(r,100),qu=(r=[],e,t,i)=>r.find(o=>o.type==="audioTransition"&&o.targetId===e)?.properties?.[t]?.[i]??null;var zi=({gainNode:r,targetValue:e,transition:t})=>{if(!t)return Es(r.gain,e),0;let i=t.from!==void 0?ze(t.from,100):void 0,s=t.to!==void 0?ze(t.to,100):e;return i!==void 0&&Es(r.gain,i),Iz(r.gain,s,t.duration),t.duration},Fv=(r,e)=>{let t=mO($r(r)),i=gO(r.pan??0);return Bo(t,i??e),i&&Bo(i,e),{id:r.id,gainNode:t,pannerNode:i,volume:r.volume??100,muted:r.muted??!1,pan:r.pan??0,outputNode:e,cleanupTimeoutId:null}},Bz=({sound:r,channelNode:e,internalId:t})=>{let i=mO($r(r)),s=gO(r.pan??0);return Bo(i,s??e),s&&Bo(s,e),{internalId:t,id:r.id,src:r.src,url:r.src,loop:r.loop??!1,volume:r.volume??100,muted:r.muted??!1,pan:r.pan??0,startDelayMs:r.startDelayMs??0,playbackRate:r.playbackRate??1,startAt:r.startAt??0,endAt:r.endAt??null,channelId:r.channelId??null,gainNode:i,pannerNode:s,source:null,pendingTimeoutId:null,cleanupTimeoutId:null}},kz=r=>{let e=Xr();pO(e);let t=Un.getAsset(r.src);if(!t)return console.warn("AudioStage: asset not found",r.src),null;let i=e.createBufferSource();i.buffer=t,i.loop=r.loop??!1,i.playbackRate&&Es(i.playbackRate,r.playbackRate??1,e),Bo(i,r.gainNode);let s=r.startAt??0,o=r.endAt!==null&&r.endAt!==void 0?Math.max(r.endAt-s,0):void 0;return i.loop&&r.endAt!==null&&r.endAt!==void 0?(i.loopStart=s,i.loopEnd=r.endAt,i.start(0,s)):o!==void 0?i.start(0,s,o):i.start(0,s),i},uO=r=>{r.pendingTimeoutId!==null&&(clearTimeout(r.pendingTimeoutId),r.pendingTimeoutId=null),pO(Xr());let e=()=>{r.pendingTimeoutId=null,r.source=kz(r)};if(r.startDelayMs>0){r.pendingTimeoutId=setTimeout(e,r.startDelayMs);return}e()},xO=(r,e=0)=>{if(r.pendingTimeoutId!==null&&(clearTimeout(r.pendingTimeoutId),r.pendingTimeoutId=null),!r.source)return;let t=Xr();try{r.source.stop(t.currentTime+e/1e3)}catch{}},hO=r=>{r.pendingTimeoutId!==null&&(clearTimeout(r.pendingTimeoutId),r.pendingTimeoutId=null),r.cleanupTimeoutId!==null&&(clearTimeout(r.cleanupTimeoutId),r.cleanupTimeoutId=null),xO(r),Io(r.source),Io(r.gainNode),Io(r.pannerNode)},dO=r=>{r.cleanupTimeoutId!==null&&(clearTimeout(r.cleanupTimeoutId),r.cleanupTimeoutId=null),Io(r.gainNode),Io(r.pannerNode)},fO=(r,e)=>e<=0?(r(),null):setTimeout(r,e);var yO=()=>{let r=new Map,e=new Map,t=new Map,i=new Map,s=0,o=p=>{let b=r.get(p);if(b)return b;let _=Fv({id:p,volume:100,muted:!1,pan:0},Xr().destination);return r.set(p,_),_},n=(p,b,_)=>{let S=r.get(p.id),E=qu(b,p.id,"volume",_);if(S&&S.cleanupTimeoutId!==null){let P=Fv(p,Xr().destination);return r.set(p.id,P),zi({gainNode:P.gainNode,targetValue:$r(p),transition:E}),P}if(S){let P=$r(S),R=$r(p),I=P!==R,U=S.pan!==(p.pan??0);return S.volume=p.volume,S.muted=p.muted,S.pan=p.pan,I&&E?zi({gainNode:S.gainNode,targetValue:R,transition:E}):I&&zi({gainNode:S.gainNode,targetValue:R,transition:null}),U&&S.pannerNode?.pan&&Es(S.pannerNode.pan,p.pan??0),S}let C=Fv(p,Xr().destination);return r.set(p.id,C),zi({gainNode:C.gainNode,targetValue:$r(p),transition:E}),C},a=p=>{let b=p.channelId!==null?r.get(p.channelId):o(kv);if(!b)throw new Error(`Input error: sound "${p.id}" references missing channel.`);return b},l=(p,b)=>{Io(p.gainNode),Io(p.pannerNode),Bo(p.gainNode,p.pannerNode??b),p.pannerNode&&Bo(p.pannerNode,b)},c=(p,b)=>{if(!p||p.id===kv||p.id===Yu)return 0;let _=qu(b,p.id,"volume","exit");return zi({gainNode:p.gainNode,targetValue:$r(p),transition:_})},u=({sound:p,effects:b,phase:_,internalId:S})=>{let E=a(p),C=Bz({sound:p,channelNode:E.gainNode,internalId:S});e.set(S,C),t.set(p.id,S);let P=qu(b,p.id,"volume",_);return zi({gainNode:C.gainNode,targetValue:$r(p),transition:P}),uO(C),C},h=(p,b,_=0)=>{if(!p)return 0;let S=qu(b,p.id,"volume","exit"),E=zi({gainNode:p.gainNode,targetValue:$r(p),transition:S}),C=Math.max(E,_);return xO(p,C),p.cleanupTimeoutId=fO(()=>{hO(p),e.delete(p.internalId)},C),C},d=({instance:p,sound:b,effects:_})=>{let S=$r(p),E=$r(b),C=S!==E,P=p.startDelayMs!==b.startDelayMs;if(p.channelId!==b.channelId){let I=a(b);l(p,I.gainNode)}p.loop=b.loop,p.volume=b.volume,p.muted=b.muted,p.pan=b.pan,p.startDelayMs=b.startDelayMs,p.playbackRate=b.playbackRate,p.startAt=b.startAt,p.endAt=b.endAt,p.channelId=b.channelId,p.source&&(p.source.loop=b.loop,p.source.playbackRate&&Es(p.source.playbackRate,b.playbackRate)),p.pannerNode?.pan&&Es(p.pannerNode.pan,b.pan);let R=qu(_,b.id,"volume","update");C&&R?zi({gainNode:p.gainNode,targetValue:E,transition:R}):C&&zi({gainNode:p.gainNode,targetValue:E,transition:null}),P&&p.pendingTimeoutId!==null&&uO(p)};return{add:p=>{let b={id:p.id,type:"sound",src:p.url??p.src,loop:p.loop??!1,volume:(p.volume??1)*100,startDelayMs:p.startDelayMs??0};i.set(p.id,b)},remove:p=>{i.delete(p),t.delete(p);let b=`direct:${p}`,_=e.get(b);_&&h(_,[],0)},getById:p=>i.get(p),tick:()=>{let p=o(Yu);for(let b of i.values()){let _=`direct:${b.id}`,S=e.get(_);if(!S){let E={...b,channelId:Yu};u({sound:E,effects:[],phase:"enter",internalId:_});continue}if(S.src!==b.src){h(S,[],0);let E={...b,channelId:Yu};u({sound:E,effects:[],phase:"enter",internalId:_});continue}d({instance:S,sound:{...b,channelId:Yu},effects:[]})}for(let[b,_]of e)b.startsWith("direct:")&&!i.has(_.id)&&(h(_,[],0),t.delete(_.id));return p},renderGraph:({prevAudio:p=[],nextAudio:b=[],prevAudioEffects:_=[],nextAudioEffects:S=[]}={})=>{let E=ys({audio:p,audioEffects:_}),C=ys({audio:b,audioEffects:S}),P=new Map(E.channels.map(F=>[F.id,F])),R=new Map(C.channels.map(F=>[F.id,F])),I=new Map(E.sounds.map(F=>[F.id,F])),U=new Map(C.sounds.map(F=>[F.id,F]));o(kv);let A=new Map,O=new Map;for(let[F,M]of P)if(!R.has(F)){let D=c(r.get(F),_);A.set(F,r.get(F)),O.set(F,D)}for(let[F,M]of R)n(M,S,P.has(F)?"update":"enter");for(let[F,M]of I){let D=U.get(F),G=t.get(F),N=G?e.get(G):null,W=M.channelId?O.get(M.channelId)??0:0;if(!D){let se=h(N,_,W);M.channelId&&O.set(M.channelId,Math.max(O.get(M.channelId)??0,se)),t.delete(F);continue}if(M.src!==D.src){let se=h(N,_,W);M.channelId&&O.set(M.channelId,Math.max(O.get(M.channelId)??0,se)),u({sound:D,effects:S,phase:"enter",internalId:`render:${F}:${++s}`})}}for(let[F,M]of U){if(!I.has(F)){u({sound:M,effects:S,phase:"enter",internalId:`render:${F}:${++s}`});continue}if(I.get(F).src!==M.src)continue;let G=t.get(F),N=G?e.get(G):null;N&&d({instance:N,sound:M,effects:S})}for(let[F,M]of A){if(!M)continue;let D=O.get(F)??0;M.cleanupTimeoutId=fO(()=>{dO(M),r.get(F)===M&&r.delete(F)},D)}},destroy:()=>{for(let p of e.values())hO(p);for(let p of r.values())dO(p);e.clear(),t.clear(),r.clear(),i.clear()},_inspect:()=>({channels:r,sounds:e,currentSoundKeyById:t,directAudios:i})}};var Fz=({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 Ov=Fz;var _O=({type:r,parse:e})=>({type:r,parse:e});var Uv=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function Lv(r,e,t,i){r.addEventListener?r.addEventListener(e,t,i):r.attachEvent&&r.attachEvent(`on${e}`,t)}function Ku(r,e,t,i){r&&(r.removeEventListener?r.removeEventListener(e,t,i):r.detachEvent&&r.detachEvent(`on${e}`,t))}function TO(r,e){let t=e.slice(0,e.length-1),i=[];for(let s=0;s<t.length;s++)i.push(r[t[s].toLowerCase()]);return i}function SO(r){typeof r!="string"&&(r=""),r=r.replace(/\s/g,"");let e=r.split(","),t=e.lastIndexOf("");for(;t>=0;)e[t-1]+=",",e.splice(t,1),t=e.lastIndexOf("");return e}function Oz(r,e){let t=r.length>=e.length?r:e,i=r.length>=e.length?e:r,s=!0;for(let o=0;o<t.length;o++)i.indexOf(t[o])===-1&&(s=!1);return s}function wO(r){let e=r.keyCode||r.which||r.charCode;return r.code&&/^Key[A-Z]$/.test(r.code)&&(e=r.code.charCodeAt(3)),e}var Ju={backspace:8,"\u232B":8,tab:9,clear:12,enter:13,"\u21A9":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,arrowup:38,arrowdown:40,arrowleft:37,arrowright:39,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"\u21EA":20,",":188,".":190,"/":191,"`":192,"-":Uv?173:189,"=":Uv?61:187,";":Uv?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},jr={"\u21E7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,meta:91,command:91},Zu={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},Bt={16:!1,18:!1,17:!1,91:!1},Qe={};for(let r=1;r<20;r++)Ju[`f${r}`]=111+r;var Ke=[],Qu=null,EO="all",$i=new Map,Ua=r=>Ju[r.toLowerCase()]||jr[r.toLowerCase()]||r.toUpperCase().charCodeAt(0),Uz=r=>Object.keys(Ju).find(e=>Ju[e]===r),Lz=r=>Object.keys(jr).find(e=>jr[e]===r),AO=r=>{EO=r||"all"},eh=()=>EO||"all",Gz=()=>Ke.slice(0),Dz=()=>Ke.map(r=>Uz(r)||Lz(r)||String.fromCharCode(r)),Nz=()=>{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=>Ua(n))})})}),r},CO=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},Vz=r=>(typeof r=="string"&&(r=Ua(r)),Ke.indexOf(r)!==-1),Hz=(r,e)=>{let t,i;r||(r=eh());for(let s in Qe)if(Object.prototype.hasOwnProperty.call(Qe,s))for(t=Qe[s],i=0;i<t.length;)t[i].scope===r?t.splice(i,1).forEach(({element:o})=>Dv(o)):i++;eh()===r&&AO(e||"all")};function Wz(r){let e=wO(r);r.key&&r.key.toLowerCase()==="capslock"&&(e=Ua(r.key));let t=Ke.indexOf(e);if(t>=0&&Ke.splice(t,1),r.key&&r.key.toLowerCase()==="meta"&&Ke.splice(0,Ke.length),(e===93||e===224)&&(e=91),e in Bt){Bt[e]=!1;for(let i in jr)jr[i]===e&&(pt[i]=!1)}}var PO=(r,...e)=>{if(typeof r>"u")Object.keys(Qe).forEach(t=>{Array.isArray(Qe[t])&&Qe[t].forEach(i=>xm(i)),delete Qe[t]}),Dv(null);else if(Array.isArray(r))r.forEach(t=>{t.key&&xm(t)});else if(typeof r=="object")r.key&&xm(r);else if(typeof r=="string"){let[t,i]=e;typeof t=="function"&&(i=t,t=""),xm({key:r,scope:t,method:i,splitKey:"+"})}},xm=({key:r,scope:e,method:t,splitKey:i="+"})=>{SO(r).forEach(s=>{let o=s.split(i),n=o.length,a=o[n-1],l=a==="*"?"*":Ua(a);if(!Qe[l])return;e||(e=eh());let c=n>1?TO(jr,o):[],u=[];Qe[l]=Qe[l].filter(h=>{let d=(t?h.method===t:!0)&&h.scope===e&&Oz(h.mods,c);return d&&u.push(h.element),!d}),u.forEach(h=>Dv(h))})};function bO(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 Bt)Object.prototype.hasOwnProperty.call(Bt,o)&&(!Bt[o]&&e.mods.indexOf(+o)>-1||Bt[o]&&e.mods.indexOf(+o)===-1)&&(s=!1);(e.mods.length===0&&!Bt[16]&&!Bt[18]&&!Bt[17]&&!Bt[91]||s||e.shortcut==="*")&&(e.keys=[],e.keys=e.keys.concat(Ke),e.method(r,e)===!1&&(r.preventDefault?r.preventDefault():r.returnValue=!1,r.stopPropagation&&r.stopPropagation(),r.cancelBubble&&(r.cancelBubble=!0)))}}function vO(r,e){let t=Qe["*"],i=wO(r);if(r.key&&r.key.toLowerCase()==="capslock"||!(pt.filter||CO).call(this,r))return;if((i===93||i===224)&&(i=91),Ke.indexOf(i)===-1&&i!==229&&Ke.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(a=>{let l=Zu[a];r[a]&&Ke.indexOf(l)===-1?Ke.push(l):!r[a]&&Ke.indexOf(l)>-1?Ke.splice(Ke.indexOf(l),1):a==="metaKey"&&r[a]&&(Ke=Ke.filter(c=>c in Zu||c===i))}),i in Bt){Bt[i]=!0;for(let a in jr)if(Object.prototype.hasOwnProperty.call(jr,a)){let l=Zu[jr[a]];pt[a]=r[l]}if(!t)return}for(let a in Bt)Object.prototype.hasOwnProperty.call(Bt,a)&&(Bt[a]=r[Zu[a]]);r.getModifierState&&!(r.altKey&&!r.ctrlKey)&&r.getModifierState("AltGraph")&&(Ke.indexOf(17)===-1&&Ke.push(17),Ke.indexOf(18)===-1&&Ke.push(18),Bt[17]=!0,Bt[18]=!0);let s=eh();if(t)for(let a=0;a<t.length;a++)t[a].scope===s&&(r.type==="keydown"&&t[a].keydown||r.type==="keyup"&&t[a].keyup)&&bO(r,t[a],s,e);if(!(i in Qe))return;let o=Qe[i],n=o.length;for(let a=0;a<n;a++)if((r.type==="keydown"&&o[a].keydown||r.type==="keyup"&&o[a].keyup)&&o[a].key){let l=o[a],{splitKey:c}=l,u=l.key.split(c),h=[];for(let d=0;d<u.length;d++)h.push(Ua(u[d]));h.sort().join("")===Ke.sort().join("")&&bO(r,l,s,e)}}var pt=function(r,e,t){Ke=[];let i=SO(r),s=[],o="all",n=document,a=0,l=!1,c=!0,u="+",h=!1,d=!1;if(t===void 0&&typeof e=="function"&&(t=e),Object.prototype.toString.call(e)==="[object Object]"){let f=e;f.scope&&(o=f.scope),f.element&&(n=f.element),f.keyup&&(l=f.keyup),f.keydown!==void 0&&(c=f.keydown),f.capture!==void 0&&(h=f.capture),typeof f.splitKey=="string"&&(u=f.splitKey),f.single===!0&&(d=!0)}for(typeof e=="string"&&(o=e),d&&PO(r,o);a<i.length;a++){let f=i[a].split(u);s=[],f.length>1&&(s=TO(jr,f));let m=f[f.length-1];m=m==="*"?"*":Ua(m),m in Qe||(Qe[m]=[]),Qe[m].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(!$i.has(n)){let f=(g=window.event)=>vO(g,n),m=(g=window.event)=>{vO(g,n),Wz(g)};$i.set(n,{keydownListener:f,keyupListenr:m,capture:h}),Lv(n,"keydown",f,h),Lv(n,"keyup",m,h)}if(!Qu){let f=()=>{Ke=[]};Qu={listener:f,capture:h},Lv(window,"focus",f,h)}}};function zz(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 Dv(r){let e=Object.values(Qe).flat();if(e.findIndex(({element:t})=>t===r)<0&&r){let{keydownListener:t,keyupListenr:i,capture:s}=$i.get(r)||{};t&&i&&(Ku(r,"keyup",i,s),Ku(r,"keydown",t,s),$i.delete(r))}if((e.length<=0||$i.size<=0)&&(Array.from($i.keys()).forEach(t=>{let{keydownListener:i,keyupListenr:s,capture:o}=$i.get(t)||{};i&&s&&(Ku(t,"keyup",s,o),Ku(t,"keydown",i,o),$i.delete(t))}),$i.clear(),Object.keys(Qe).forEach(t=>delete Qe[t]),Qu)){let{listener:t,capture:i}=Qu;Ku(window,"focus",t,i),Qu=null}}var Gv={getPressedKeyString:Dz,setScope:AO,getScope:eh,deleteScope:Hz,getPressedKeyCodes:Gz,getAllKeyCodes:Nz,isPressed:Vz,filter:CO,trigger:zz,unbind:PO,keyMap:Ju,modifier:jr,modifierMap:Zu};for(let r in Gv){let e=r;Object.prototype.hasOwnProperty.call(Gv,e)&&(pt[e]=Gv[e])}if(typeof window<"u"){let r=window.hotkeys;pt.noConflict=e=>(e&&window.hotkeys===pt&&(window.hotkeys=r),pt),window.hotkeys=pt}var MO=",",$z="+",Xz=new Set([93,224]),jz="\0",Nv=r=>r!==null&&typeof r=="object"&&!Array.isArray(r),RO=r=>Nv(r)?{payload:Nv(r.payload)?r.payload:{}}:null,kO=r=>{if(typeof r!="string"||r.length===0)return null;let e=r.toLowerCase();return typeof pt.modifier?.[e]=="number"?pt.modifier[e]:typeof pt.keyMap?.[e]=="number"?pt.keyMap[e]:r.length===1?r.toUpperCase().charCodeAt(0):null},FO=r=>Xz.has(r)?91:r,IO=r=>{let e=null;return typeof r?.keyCode=="number"&&r.keyCode>0?e=r.keyCode:typeof r?.which=="number"&&r.which>0?e=r.which:typeof r?.charCode=="number"&&r.charCode>0&&(e=r.charCode),typeof r?.code=="string"&&/^Key[A-Z]$/.test(r.code)&&(e=r.code.charCodeAt(3)),typeof e=="number"?FO(e):kO(r?.key??"")},Yz=r=>{if(typeof r!="string"||r.length===0)return[];let e=r.replace(/\s/g,"").split(MO),t=e.lastIndexOf("");for(;t>=0;)t>0&&(e[t-1]+=MO),e.splice(t,1),t=e.lastIndexOf("");return e.filter(Boolean)},qz=r=>typeof pt.modifierMap?.[r]=="string",Kz=r=>Yz(r).map(e=>{let t=new Set(e.split($z).map(i=>kO(i)).filter(i=>typeof i=="number").map(i=>FO(i)));return t.size===0?null:{shortcut:e,releaseCodes:t,isModifierOnly:[...t].every(qz)}}).filter(Boolean),Zz=(r,e)=>{for(let t of e)if(!r.has(t))return!1;return!0},BO=(r,e)=>`${r}${jz}${e.shortcut}`,Qz=r=>typeof pt.filter!="function"||pt.filter(r),Jz=r=>{if(!Nv(r))return null;let e={},t=RO(r.keydown),i=RO(r.keyup);return t&&(e.keydown=t),i&&(e.keyup=i),Object.keys(e).length>0?e:null},OO=r=>{let e=new Map,t=new Map,i=new Map,s=new Map,o=new Set,n=(x,y,T)=>{r&&r(x,{_event:{key:y},...T})},a=()=>{i.clear(),s.clear(),o.clear()},l=x=>{for(let[y,T]of[...i])T.binding===x&&i.delete(y);for(let[y,T]of[...s])T.binding===x&&s.delete(y);t.delete(x)},c=(x,y)=>{let T=t.get(x)??[],p=typeof y?.shortcut=="string"?y.shortcut:typeof y?.key=="string"?y.key:null;return T.find(b=>b.shortcut===p)??T[0]??null},u=(x,y)=>{!e.get(x)?.keyup||!y||i.set(BO(x,y),{binding:x,releaseCodes:new Set(y.releaseCodes)})},h=(x,y)=>{let T=BO(x,y),p=s.has(T);return s.set(T,{binding:x,releaseCodes:new Set(y.releaseCodes)}),p},d=x=>{if(!Qz(x))return;let y=IO(x);if(typeof y=="number"){o.add(y);for(let[T,p]of e)(t.get(T)??[]).filter(_=>_.isModifierOnly).forEach(_=>{if(!Zz(o,_.releaseCodes))return;let S=h(T,_);u(T,_),p.keydown&&!S&&n("keydown",T,p.keydown.payload)})}},f=x=>{let y=IO(x);if(typeof y=="number"){for(let[T,p]of[...i]){let b=e.get(p.binding);!p.releaseCodes.has(y)||!b?.keyup||(i.delete(T),n("keyup",p.binding,b.keyup.payload))}for(let[T,p]of[...s])p.releaseCodes.has(y)&&s.delete(T);o.delete(y)}};return typeof document<"u"&&(document.addEventListener("keydown",d),document.addEventListener("keyup",f)),typeof window<"u"&&window.addEventListener("blur",a),{registerHotkeys:(x={})=>{if(typeof x!="object"||x===null)return;let y=new Map,T=[],p=[],b=[];Object.keys(x).forEach(_=>{let S=Jz(x[_]);S&&y.set(_,S)}),y.forEach((_,S)=>{let E=e.get(S);E?pe(E,_)||(p.push(S),pt.unbind(S)):T.push(S)}),e.forEach((_,S)=>{y.has(S)||b.push(S)}),b.forEach(_=>{pt.unbind(_),e.delete(_),l(_)}),[...T,...p].forEach(_=>{let S=y.get(_),E=Kz(_);l(_),t.set(_,E),e.set(_,S),pt(_,(C,P)=>{let R=c(_,P);if(R?.isModifierOnly){let I=h(_,R);u(_,R),S.keydown&&!I&&n("keydown",_,S.keydown.payload);return}u(_,R),S.keydown&&n("keydown",_,S.keydown.payload)})})},destroy:()=>{typeof document<"u"&&(document.removeEventListener("keydown",d),document.removeEventListener("keyup",f)),typeof window<"u"&&window.removeEventListener("blur",a);for(let x of e.keys())pt.unbind(x);e.clear(),t.clear(),i.clear(),s.clear(),o.clear()}}};var LO=(r,e)=>typeof e!="string"?e:r[e]??e,e$=(r,e,t,i)=>{let s=LO(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},UO=(r,e,t,i)=>{let s=LO(t,e);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n<s.length-1;n++){let a=s[n];a in o||(o[a]={}),o=o[a]}return o[s[s.length-1]]=i,r},t$=(r,e,t)=>{if(!r||!Object.prototype.hasOwnProperty.call(r,e))throw new Error(`Animation "${t}" cannot auto-resolve property "${e}" from targetState.`);return r[e]},r$=(r,e,t,i,s)=>Object.entries(e).map(([o,n])=>{if(!hf[o])throw new Error(`${o} is not a supported property for animation.`);let a=e$(r,o,t,0);if(n.auto){let u=t$(i,o,s);if(a===u)return null;let h=Zn([{value:a},{duration:n.auto.duration,value:u,easing:n.auto.easing}]);return{property:o,timeline:h}}let l=n.initialValue??a,c=Zn([{value:l},...n.keyframes]);return{property:o,timeline:c}}).filter(Boolean),GO=()=>{let r=[],e=new Map,t=new Map,i=new Map,s=0,o=null,n=!1,a=(B,H)=>Math.min(Math.max(B,0),Math.max(H??0,0)),l=(B,H)=>{let q=a(H,B.duration);return B.currentTime=q,B.applyFrame(q),q>=B.duration},c=(B,H)=>{i.get(B)?.forEach(q=>{try{q(H)}catch{}})},u=B=>{if(c("completed",{id:B.id}),B.onComplete)try{B.onComplete()}catch{}},h=(B,H={})=>(B.animationType=H.animationType??B.animationType,B.targetId=H.targetId??B.targetId,B.signature=H.signature??B.signature,B.continuity=H.continuity??B.continuity??"render",B.onContinuationUpdate=H.onContinuationUpdate??B.onContinuationUpdate,B),d=B=>({id:B.id,type:B.animationType??null,targetId:B.targetId??null,signature:B.signature??null,continuity:B.continuity??"render",pending:B.pending===!0}),f=B=>{B.applyFrame(0),t.delete(B.id),e.set(B.id,B);let H=o!==null&&l(B,o);c("started",{id:B.id}),H&&(u(B),e.delete(B.id))},m=B=>{let{id:H,element:q,properties:be,targetState:Ge,onComplete:nt,onCancel:Et,propertyPathMap:at=df}=B,lt=r$(q,be,at,Ge,H);if(lt.length===0){u({id:H,onComplete:nt});return}let ar={id:H,kind:"property",element:q,timelines:lt,duration:jc(lt),currentTime:0,stateVersion:s,targetState:Ge,onComplete:nt,onCancel:Et,applyFrame:Fr=>{for(let{property:Na,timeline:Va}of lt){let ym=Yc(Va,Fr);try{UO(q,Na,at,ym)}catch{}}},applyTargetState:()=>{if(!(!q||q.destroyed)){if(Ge===null){q.destroy();return}if(Ge)for(let[Fr,Na]of Object.entries(Ge))try{UO(q,Fr,at,Na)}catch{}}},isValid:()=>!!q&&!q.destroyed};f(h(ar,B))},g=B=>{let H={id:B.id,kind:"custom",duration:B.duration??0,currentTime:0,stateVersion:s,onComplete:B.onComplete,onCancel:B.onCancel,applyFrame:B.applyFrame??(()=>{}),applyTargetState:B.applyTargetState??(()=>{}),isValid:B.isValid??(()=>!0)};f(h(H,B))},x=B=>{if(B.driver==="custom"){g(B);return}m(B)},y=B=>{try{B.applyTargetState?.()}catch{}if(B.onCancel)try{B.onCancel()}catch{}},T=B=>{let H=t.get(B);H&&(y(H),t.delete(B),c("cancelled",{id:B}))},p=B=>{switch(B.type){case"START":x(B.payload);break;case"CANCEL":S(B.id);break}},b=()=>{let B=r.splice(0);for(let H of B)p(H)},_=()=>{o===null||n||(n=!0,queueMicrotask(()=>{n=!1,o!==null&&b()}))},S=B=>{let H=e.get(B);if(!H){T(B);return}y(H),e.delete(B),c("cancelled",{id:B})},E=B=>{r.push(B),_()},C=()=>{for(let[B,H]of e)y(H),c("cancelled",{id:B});for(let[B,H]of t)y(H),c("cancelled",{id:B});e.clear(),t.clear(),s++},P=(B=new Set)=>{let H=B instanceof Set?B:new Set(B??[]);for(let[q,be]of e)H.has(q)||(y(be),e.delete(q),c("cancelled",{id:q}));for(let[q,be]of t)H.has(q)||(y(be),t.delete(q),c("cancelled",{id:q}))},R=B=>{b();let H=[];for(let[q,be]of e){if(be.stateVersion!==s){H.push(q);continue}if(!be.isValid()){H.push(q);continue}if(be.currentTime+=B,be.currentTime>=be.duration){be.applyFrame(be.duration),u(be),H.push(q);continue}be.applyFrame(be.currentTime)}for(let q of H)e.delete(q)},I=B=>{o=B,b();let H=[];for(let[q,be]of e){if(be.stateVersion!==s){H.push(q);continue}if(!be.isValid()){H.push(q);continue}l(be,B)&&(u(be),H.push(q))}for(let q of H)e.delete(q)},U=()=>{o=null},A=()=>{b()},O=(B,H)=>(i.has(B)||i.set(B,new Set),i.get(B).add(H),()=>F(B,H)),F=(B,H)=>{i.get(B)?.delete(H)};return{dispatch:E,cancelAll:C,cancelAllExcept:P,flush:A,tick:R,setTime:I,clearTime:U,on:O,off:F,registerPending:B=>{let H=h({id:B.id,kind:"pending",pending:!0,applyTargetState:B.applyTargetState??(()=>{}),onCancel:B.onCancel},B);t.set(H.id,H)},activatePending:(B,H)=>{let q=t.get(B);return q?(t.delete(B),x({...H,id:B,animationType:q.animationType,targetId:q.targetId,signature:q.signature,continuity:q.continuity,onContinuationUpdate:H.onContinuationUpdate??q.onContinuationUpdate}),!0):!1},removePending:B=>{t.delete(B)},getContinuableAnimations:()=>{let B=new Map;for(let[H,q]of t)q.continuity==="persistent"&&B.set(H,d(q));for(let[H,q]of e)q.continuity==="persistent"&&B.set(H,d(q));return B},getState:()=>({stateVersion:s,activeCount:e.size,pendingCount:t.size,animations:Array.from(e.entries()).map(([B,H])=>({id:B,currentTime:H.currentTime,duration:H.duration,progress:H.duration>0?H.currentTime/H.duration:0}))}),isAnimating:B=>e.has(B),hasContext:B=>e.has(B)||t.has(B),updateContinuation:(B,H)=>{let q=e.get(B)??t.get(B);if(q?.onContinuationUpdate)try{q.onContinuationUpdate(H)}catch{}},destroy:()=>{C(),i.clear()}}};var DO=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 NO=new Set(["update","transition"]),VO=new Set(["render","persistent"]),i$=new Set(["alpha","x","y","scaleX","scaleY","rotation","blurX","blurY"]),s$=new Set(["translateX","translateY","alpha","scaleX","scaleY","rotation"]),HO=new Set(["single","sequence"]),WO=new Set(["red","green","blue","alpha"]),zO=new Set(["hold","linear"]),XO=new Set(Wf),Yr=(r,e)=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`${e} must be an object.`)},La=(r,e)=>{if(typeof r!="string"||r.length===0)throw new Error(`${e} must be a non-empty string.`)},Ga=(r,e)=>{if(typeof r!="number"||Number.isNaN(r))throw new Error(`${e} must be a number.`)},o$=(r,e)=>{if(Yr(r,e),!VO.has(r.continuity))throw new Error(`${e}.continuity must be one of: ${Array.from(VO).join(", ")}.`);return{continuity:r.continuity}},n$=(r,e)=>{if(Yr(r,e),Ga(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&&!XO.has(r.easing))throw new Error(`${e}.easing must be one of: ${Wf.join(", ")}.`);return{duration:r.duration,easing:r.easing??"linear"}},Hv=(r,e)=>{Yr(r,e);let t={};if(r.initialValue!==void 0&&(Ga(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(Yr(i,o),Ga(i.value,`${o}.value`),Ga(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&&!XO.has(i.easing))throw new Error(`${o}.easing must be one of: ${Wf.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},a$=(r,e)=>{Yr(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:n$(r.auto,`${e}.auto`)}}return Hv(r,e)},jO=(r,e,t,i=Hv)=>{Yr(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)},l$=(r,e)=>{if(Yr(r,e),La(r.texture,`${e}.texture`),Ga(r.at,`${e}.at`),r.at<0||r.at>1)throw new Error(`${e}.at must be between 0 and 1.`);return{at:r.at,texture:r.texture}},c$=(r,e)=>{if(!Array.isArray(r)||r.length<2)throw new Error(`${e} must be an array with at least two frames.`);let t=r.map((s,o)=>l$(s,`${e}[${o}]`));if(t[0].at!==0)throw new Error(`${e}[0].at must be 0.`);let i=t.length-1;if(t[i].at!==1)throw new Error(`${e}[${i}].at must be 1.`);for(let s=1;s<t.length;s++)if(t[s].at<=t[s-1].at)throw new Error(`${e} must be sorted by ascending unique at values.`);return t},u$=(r,e)=>{if(Yr(r,e),!HO.has(r.kind))throw new Error(`${e}.kind must be one of: ${Array.from(HO).join(", ")}.`);let t={kind:r.kind};if(r.channel!==void 0){if(!WO.has(r.channel))throw new Error(`${e}.channel must be one of: ${Array.from(WO).join(", ")}.`);t.channel=r.channel}if(r.softness!==void 0&&(Ga(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=Hv(r.progress,`${e}.progress`)),r.kind==="single"){if(r.frames!==void 0)throw new Error(`${e}.frames is only valid for sequence masks.`);if(r.sample!==void 0)throw new Error(`${e}.sample is only valid for sequence masks.`);if(r.items!==void 0)throw new Error(`${e}.items is not supported.`);if(r.combine!==void 0)throw new Error(`${e}.combine is not supported.`);La(r.texture,`${e}.texture`),t.texture=r.texture}if(r.kind==="sequence"){if(r.texture!==void 0)throw new Error(`${e}.texture is not valid for sequence masks. Use ${e}.frames[].texture instead.`);if(r.items!==void 0)throw new Error(`${e}.items is not supported.`);if(r.combine!==void 0)throw new Error(`${e}.combine is not supported.`);if(r.textures!==void 0)throw new Error(`${e}.textures is no longer supported. Use ${e}.frames with texture and at entries instead.`);if(r.softness!==void 0)throw new Error(`${e}.softness is not valid for sequence masks. Author feathering into ${e}.frames[].texture instead.`);if(t.frames=c$(r.frames,`${e}.frames`),r.sample!==void 0&&(La(r.sample,`${e}.sample`),!zO.has(r.sample)))throw new Error(`${e}.sample must be one of: ${Array.from(zO).join(", ")}.`);t.sample=r.sample??"hold"}return t.progress||(t.progress={initialValue:0,keyframes:[{duration:0,value:1,easing:"linear"}]}),t},$O=(r,e)=>{if(Yr(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=jO(r.tween,`${e}.tween`,s$)),Object.keys(t).length===0)throw new Error(`${e} must define tween.`);return t},h$=(r,e)=>{let t={};if(r.shader!==void 0)throw new Error(`${e}.shader is not supported.`);if(r.prev!==void 0&&(t.prev=$O(r.prev,`${e}.prev`)),r.next!==void 0&&(t.next=$O(r.next,`${e}.next`)),r.mask!==void 0&&(t.mask=u$(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},Vv=(r,e,t)=>{if(r!==void 0)throw new Error(`${e} ${t}`)},YO=(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(Yr(i,o),La(i.id,`${o}.id`),La(i.targetId,`${o}.targetId`),La(i.type,`${o}.type`),!NO.has(i.type))throw new Error(`${o}.type must be one of: ${Array.from(NO).join(", ")}.`);let n={id:i.id,targetId:i.targetId,type:i.type};if(i.complete!==void 0&&(Yr(i.complete,`${o}.complete`),n.complete=i.complete),i.playback!==void 0&&(n.playback=o$(i.playback,`${o}.playback`)),Vv(i.operation,`${o}.operation`,"is no longer supported. Use `type: update | transition` instead."),Vv(i.properties,`${o}.properties`,"is no longer supported. Use `tween` instead."),Vv(i.subjects,`${o}.subjects`,"is no longer supported. Use `prev` / `next` instead."),i.type==="update"){if(n.tween=jO(i.tween,`${o}.tween`,i$,a$),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=h$(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 Wv=(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??[],audioEffects:r.audioEffects??[]};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.");if(!Array.isArray(e.audioEffects))throw new Error("Input error: `audioEffects` must be an array.");return e.animations=YO(e.animations),ys({audio:e.audio,audioEffects:e.audioEffects}),e};var d$="0",Da=(r,e)=>{let t=r?.[e];return typeof t=="number"?t:0},br=r=>({value:r.element.value??"",selectionStart:Da(r.element,"selectionStart"),selectionEnd:Da(r.element,"selectionEnd"),focused:document.activeElement===r.element,composing:r.composing===!0}),f$=(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,p$=r=>r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement,th=r=>{r.element.style.pointerEvents="none"},zv=(r,e,t)=>{if(typeof r?.setSelectionRange=="function")try{r.setSelectionRange(e,t)}catch{}},m$=({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}},g$=({app:r,entry:e,event:t})=>{let i=e.options.getGeometry?.(),s=m$({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},qO=({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 p=r.canvas?.parentNode??document.body;t.isConnected||p.appendChild(t)},o=(p,b=p.lastSnapshot)=>{let _=br(p);_.focused&&i!==p.id?i=p.id:!_.focused&&i===p.id&&(i=null),th(p,i),b?.value!==_.value&&p.callbacks.onValueChange?.(_),(b?.selectionStart!==_.selectionStart||b?.selectionEnd!==_.selectionEnd||b?.focused!==_.focused||b?.composing!==_.composing)&&p.callbacks.onSelectionChange?.(_),p.lastSnapshot=_},n=p=>{let{disabled:b=!1,multiline:_=!1,maxLength:S,textStyle:E,padding:C,placeholder:P="",autocomplete:R="off",autocapitalize:I="off",spellcheck:U=!1}=p.options,{element:A}=p;A instanceof HTMLInputElement&&(A.type="text"),A.disabled=b,A.placeholder=P,A.autocomplete=R,A.autocapitalize=I,A.spellcheck=!!U,A.style.opacity=d$,A.style.color="transparent",A.style.caretColor="transparent",A.style.background="transparent",A.style.paddingTop=`${C.top}px`,A.style.paddingRight=`${C.right}px`,A.style.paddingBottom=`${C.bottom}px`,A.style.paddingLeft=`${C.left}px`,A.style.fontFamily=E?.fontFamily??"Arial",A.style.fontSize=`${E?.fontSize??16}px`,A.style.fontWeight=E?.fontWeight??"400",A.style.textAlign=E?.align??"left",A.style.lineHeight=typeof E?.lineHeight=="number"?`${E.lineHeight}px`:"normal",A.style.whiteSpace=_?"pre":"nowrap",A.style.overflowWrap="normal",A.style.resize="none",A.style.overflow="hidden",typeof S=="number"?A.maxLength=S:A.removeAttribute("maxLength"),A.tabIndex=-1,_&&A instanceof HTMLTextAreaElement&&(A.wrap="off",A.rows=1),th(p,i)},a=p=>{s();let b=r.canvas,_=p.options.getGeometry?.();if(!b||!_||_.visible===!1){p.element.style.display="none";return}let S=b.getBoundingClientRect(),E=r.renderer?.width||S.width||1,C=r.renderer?.height||S.height||1,P=S.width/E,R=S.height/C,I=_.clipInsets??{top:0,right:0,bottom:0,left:0},U={top:I.top*R,right:I.right*P,bottom:I.bottom*R,left:I.left*P};p.element.style.display="block",p.element.style.left=`${S.left+_.x*P}px`,p.element.style.top=`${S.top+_.y*R}px`,p.element.style.width=`${_.width*P}px`,p.element.style.height=`${_.height*R}px`;let A=Object.values(U).some(O=>O>0);p.element.style.clipPath=A?`inset(${U.top}px ${U.right}px ${U.bottom}px ${U.left}px)`:"none"},l=p=>{if(!i)return;let b=e.get(i),_=p.target;!b||_===b.element||b.element.contains(_)||p$(_)&&t?.contains(_)||g$({app:r,entry:b,event:p})||b.element.blur()},c=()=>{for(let p of e.values()){if(a(p),!p.lastSnapshot){p.lastSnapshot=br(p);continue}let b=br(p);f$(b,p.lastSnapshot)||o(p,p.lastSnapshot)}},u=({id:p,options:b})=>{let _=b.multiline===!0?document.createElement("textarea"):document.createElement("input");return _.dataset.routeGraphicsInputId=p,_.style.position="fixed",_.style.border="none",_.style.outline="none",_.style.margin="0",_.style.boxSizing="border-box",_.style.borderRadius="0",_.style.transformOrigin="top left",_.style.appearance="none",_.style.boxShadow="none",_.style.userSelect="none",_.style.webkitUserSelect="none",_},h=p=>{let{id:b,element:_}=p,S=()=>{o(p)};_.addEventListener("focus",()=>{p.pendingBlurTimer&&(clearTimeout(p.pendingBlurTimer),p.pendingBlurTimer=null),i=b,th(p,i);let E=br(p);p.lastSnapshot=E,p.callbacks.onFocus?.(E),p.callbacks.onSelectionChange?.(E)}),_.addEventListener("blur",()=>{i===b&&(i=null),th(p,i),p.pendingBlurTimer=setTimeout(()=>{p.pendingBlurTimer=null;let E=br(p);if(E.focused){p.lastSnapshot=E;return}p.lastSnapshot=E,p.callbacks.onBlur?.(E),p.callbacks.onSelectionChange?.(E)},0)}),_.addEventListener("input",S),_.addEventListener("select",S),_.addEventListener("click",()=>queueMicrotask(S)),_.addEventListener("keyup",()=>queueMicrotask(S)),_.addEventListener("keydown",E=>{let C=E.key==="Enter"&&p.options.multiline!==!0&&!E.shiftKey,P=E.key==="Enter"&&p.options.multiline===!0&&(E.ctrlKey||E.metaKey);(C||P)&&(E.preventDefault(),p.callbacks.onSubmit?.(br(p),E)),E.key==="Escape"&&_.blur(),queueMicrotask(S)}),_.addEventListener("compositionstart",()=>{p.composing=!0;let E=br(p);p.lastSnapshot=E,p.callbacks.onCompositionStart?.(E),p.callbacks.onSelectionChange?.(E)}),_.addEventListener("compositionupdate",()=>{let E=br(p);p.lastSnapshot=E,p.callbacks.onCompositionUpdate?.(E),p.callbacks.onSelectionChange?.(E)}),_.addEventListener("compositionend",()=>{p.composing=!1,S(),p.callbacks.onCompositionEnd?.(br(p))})};document.addEventListener("pointerdown",l,!0),r.ticker?.add?.(c);let d=(p,b)=>{s();let _=e.get(p);if(_)return _.options=b,_.callbacks=b.callbacks??{},n(_),a(_),typeof b.value=="string"&&_.element.value!==b.value&&(_.element.value=b.value),_.lastSnapshot=br(_),_.element;let S={id:p,element:u({id:p,options:b}),options:b,callbacks:b.callbacks??{},composing:!1,pendingBlurTimer:null,lastSnapshot:null};return h(S),typeof b.value=="string"&&(S.element.value=b.value),n(S),t.appendChild(S.element),e.set(p,S),a(S),S.lastSnapshot=br(S),S.element};return{mount:d,update:(p,b)=>{let _=e.get(p);if(!_)return d(p,b);let S=b.multiline===!0!=_.element instanceof HTMLTextAreaElement;if(_.options=b,_.callbacks=b.callbacks??{},S){let E=_.element,C=document.activeElement===E,P=Da(E,"selectionStart"),R=Da(E,"selectionEnd");return _.element=u({id:p,options:b}),h(_),E.replaceWith(_.element),_.element.value=typeof b.value=="string"?b.value:E.value,n(_),a(_),_.lastSnapshot=br(_),C&&!b.disabled&&queueMicrotask(()=>{_.element.focus(),zv(_.element,P,R)}),_.element}return typeof b.value=="string"&&b.value!==_.element.value&&_.composing!==!0&&(_.element.value=b.value),n(_),a(_),_.lastSnapshot=br(_),_.element},focus:(p,{selectAll:b=!1,selectionStart:_,selectionEnd:S}={})=>{let E=e.get(p);if(!E||E.element.disabled)return;let C=document.activeElement===E.element;if(i=p,th(E,i),C||E.element.focus(),b){E.element.select?.(),o(E,E.lastSnapshot);return}if(typeof _=="number"||typeof S=="number"){let P=typeof _=="number"?_:Da(E.element,"selectionStart"),R=typeof S=="number"?S:typeof _=="number"?_:Da(E.element,"selectionEnd");zv(E.element,P,R)}o(E,E.lastSnapshot)},setSelection:(p,b,_=b,{focus:S=!1}={})=>{let E=e.get(p);if(!E||E.element.disabled)return;let C=()=>{zv(E.element,b,_),o(E,E.lastSnapshot)};if(S&&document.activeElement!==E.element){E.element.focus(),C();return}C()},blur:p=>{e.get(p)?.element.blur()},unmount:p=>{let b=e.get(p);b&&(i===p&&(i=null),b.pendingBlurTimer&&(clearTimeout(b.pendingBlurTimer),b.pendingBlurTimer=null),b.element.remove(),e.delete(p),e.size===0&&t?.remove())},destroy:()=>{document.removeEventListener("pointerdown",l,!0),r.ticker?.remove?.(c);for(let p of e.values())p.pendingBlurTimer&&(clearTimeout(p.pendingBlurTimer),p.pendingBlurTimer=null),p.element.remove();e.clear(),i=null,t?.remove(),t=void 0}}};var x$=()=>{let r=A=>{if(A!=="auto"&&A!=="manual")throw new Error(`Invalid animation playback mode "${A}". Expected "auto" or "manual".`)},e,t=yO(),i={elements:[],animations:[],audio:[],audioEffects:[]},s,o={animations:[],elements:[],audio:[],parsers:[]},n,a,l,c,u=!1,h,d,f,m="auto",g=null,x=[],y,T=new Map,p,b=(A,O,F,M)=>{A.clear(),A.rect(0,0,O,F),A.fill(M??0)},_=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",S=(A,O,{revokable:F=!1}={})=>{T.set(A,{url:O,revokable:F})},E=()=>{for(let A of T.values())A?.revokable===!0&&typeof A?.url=="string"&&URL.revokeObjectURL(A.url);T.clear()},C=(A,O)=>new Promise((F,M)=>{let D=window.HTMLMediaElement?.HAVE_CURRENT_DATA??2;if(A.readyState>=D){F();return}let G,N=()=>{window.clearTimeout(G),A.removeEventListener("loadeddata",W),A.removeEventListener("canplay",W),A.removeEventListener("error",se)},W=()=>{N(),F()},se=()=>{N();let fe=[A.error?.code?`code=${A.error.code}`:null,A.error?.message?`message=${A.error.message}`:null,`networkState=${A.networkState}`,`readyState=${A.readyState}`,A.currentSrc?`src=${A.currentSrc}`:null].filter(Boolean).join(", ");M(new Error(`Failed to load video asset "${O}"${fe?` (${fe})`:""}.`))};G=window.setTimeout(()=>{N(),M(new Error(`Timed out loading video asset "${O}".`))},5e3),A.addEventListener("loadeddata",W,{once:!0}),A.addEventListener("canplay",W,{once:!0}),A.addEventListener("error",se,{once:!0})}),P=async({key:A,sourceUrl:O,mimeType:F})=>{if(Lt.cache.has(A))return Lt.cache.get(A);let M=document.createElement("video");M.crossOrigin="anonymous",M.preload="auto",M.playsInline=!0,M.setAttribute("playsinline",""),typeof F=="string"&&F.length>0&&(M.type=F);let D=C(M,A);M.src=O,M.load(),await D;let G=k.from(M);return Lt.cache.set(A,G),G},R=(A,O,F)=>{n&&n.registerHotkeys(F?.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=O?.cursorStyles,D=F?.cursorStyles;pe(M,D)||(D?(D.default&&(A.renderer.events.cursorStyles.default=D.default,A.canvas.style.cursor=D.default),D.hover&&(A.renderer.events.cursorStyles.hover=D.hover)):M&&(A.renderer.events.cursorStyles.default="default",A.renderer.events.cursorStyles.hover="pointer"))},I=(A,O,F,M)=>{if(pe(i,F)){typeof A.render=="function"&&A.render();return}let D=FR({prevState:i,nextState:F,activeAnimations:a.getContinuableAnimations()});h&&h.abort(),h=new AbortController;let G=h.signal;l.reset(F.id),R(A,i.global,F.global),a.cancelAllExcept(D.continuedAnimationIds),no({app:A,parent:O,prevComputedTree:i.elements,nextComputedTree:F.elements,animations:F.animations,elementPlugins:o.elements,animationBus:a,completionTracker:l,eventHandler:M,signal:G}),a.flush(),m==="manual"&&g!==null&&a.setTime(g),pb({app:A,prevAudioTree:i.audio,nextAudioTree:F.audio,prevAudioEffects:i.audioEffects,nextAudioEffects:F.audioEffects,audioPlugins:o.audio}),i=F,typeof A.render=="function"&&A.render(),l.completeIfEmpty(),u||(u=!0,c&&c())},U={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 O=new ee(0,0,e.renderer.width,e.renderer.height);if(!A)return await e.renderer.extract.base64({target:e.stage,frame:O});let F=e.stage.getChildByLabel(A,!0);if(!F)throw new Error(`Element with label '${A}' not found`);return await e.renderer.extract.base64({target:F,frame:O})},assignStageEvent:(A,O)=>{e.stage.eventMode="static",e.stage.on(A,O)},setAnimationPlaybackMode:A=>{r(A),m=A,m!=="manual"&&(g=null,a?.clearTime?.())},setAnimationTime:A=>{let O=Number(A);if(!Number.isFinite(O))throw new Error("Animation time must be a finite number.");m==="manual"&&(g=O),a.flush(),a.setTime(O),m!=="manual"&&(g=null,a.clearTime()),typeof e.render=="function"&&e.render()},init:async A=>{let{eventHandler:O,plugins:F,width:M,height:D,backgroundColor:G,debug:N=!1,onFirstRender:W,animationPlaybackMode:se="auto"}=A;c=W,r(se),m=se,g=null,x.forEach(ye=>ye()),x=[];let fe=[];F?.elements?.forEach(ye=>{ye?.parse&&fe.push(_O({type:ye.type,parse:ye.parse}))}),o={animations:F?.animations??[],elements:F?.elements??[],audio:F?.audio??[],parsers:fe},s=O,n=OO(O),l=DO(O),e=new kc,e.audioStage=t,await e.init({width:M,height:D,backgroundColor:G,preference:"webgl",preserveDrawingBuffer:N===!0}),typeof e.ticker?.remove=="function"&&e.ticker.remove(e.render,e),e.debug=N,e.inputDomBridge=qO({app:e}),y=ye=>{ye.preventDefault()},e.canvas.addEventListener("contextmenu",y),p=new We,p.label="__route_graphics_background__",b(p,M,D,G),e.stage.addChild(p),e.stage.width=M,e.stage.height=D,e.ticker.add(e.audioStage.tick),a=GO();let Ee=()=>{m==="manual"&&typeof e.render=="function"&&e.render()};return x=[a.on("started",Ee),a.on("completed",Ee),a.on("cancelled",Ee)],N?(d=ye=>{m==="auto"&&ye?.detail?.deltaMS&&(a.tick(Number(ye.detail.deltaMS)),typeof e.render=="function"&&e.render())},window.addEventListener("snapShotKeyFrame",d)):(f=ye=>{m==="auto"&&(a.tick(ye.deltaMS),typeof e.render=="function"&&e.render())},e.ticker.add(f)),U},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),y&&e?.canvas&&(e.canvas.removeEventListener("contextmenu",y),y=void 0),e?.inputDomBridge?.destroy?.(),n?.destroy(),rb(),x.forEach(O=>O()),x=[],a&&a.destroy(),e?.audioStage&&e.audioStage.destroy();let A=O=>{for(let F of O.children){let M=F.texture?.source?.resource;M instanceof HTMLVideoElement&&M.pause(),F.children&&A(F)}};e?.stage&&(A(e.stage),fr({app:e,root:e.stage})),e&&e.destroy(),m="auto",g=null,p=void 0,E()},loadAssets:async A=>{if(!A)throw new Error("assetBufferMap is required");let O={audio:{},font:{},video:{},texture:{}};for(let[D,G]of Object.entries(A)){let N=_(G.type);O[N][D]=G}await Promise.all(Object.entries(O.audio).map(([D,G])=>Un.load(D,G.buffer))),await Promise.all(Object.entries(O.font).map(async([D,G])=>{let N=new Blob([G.buffer],{type:G.type}),W=URL.createObjectURL(N),se=new FontFace(D,`url(${W})`);try{await se.load(),document.fonts.add(se)}catch(fe){console.error(`Failed to load font ${D}:`,fe)}finally{URL.revokeObjectURL(W)}}));let F=Object.entries(O.texture).map(async([D,G])=>{if(Lt.cache.has(D))return Lt.cache.get(D);if(G?.source==="url"&&typeof G?.url=="string")return Lt.load({alias:D,src:G.url});let N=new Blob([G.buffer],{type:G.type}),W=await createImageBitmap(N),se=k.from(W);return Lt.cache.set(D,se),se}),M=Object.entries(O.video).map(async([D,G])=>{if(Lt.cache.has(D))return Lt.cache.get(D);let N=G?.source==="url"&&typeof G?.url=="string"?G.url:URL.createObjectURL(new Blob([G.buffer],{type:G.type})),W=G?.source!=="url";S(D,N,{revokable:W});try{return await P({key:D,sourceUrl:N,mimeType:G?.type})}catch(se){throw T.delete(D),W&&URL.revokeObjectURL(N),se}});return Promise.all([...F,...M])},loadAudioAssets:async A=>Promise.all(A.map(async O=>{let M=await(await fetch(O)).arrayBuffer();return Un.load(O,M)})),updatedBackgroundColor:A=>{e.renderer.background.color=A,p&&b(p,e.renderer.width,e.renderer.height,A),typeof e.render=="function"&&e.render()},render:A=>{let O=Wv(A),F=Ov({JSONObject:O.elements,parserPlugins:o.parsers}),M={...O,elements:F};I(e,e.stage,M,s)},parse:A=>{let O=Wv(A),F=Ov({JSONObject:O.elements,parserPlugins:o.parsers});return{...O,elements:F}}};return U},KO=x$;var COe=KO;export{kc as Application,Lt as Assets,Un as AudioAsset,aV as animatedSpritePlugin,tV as containerPlugin,s_ as createAnimationPlugin,sU as createAssetBufferManager,o_ as createAudioPlugin,it as createElementPlugin,COe as default,_3 as inputPlugin,KV as particlesPlugin,kN as rectPlugin,pb as renderAudio,no as renderElements,n3 as sliderPlugin,uV as soundPlugin,WN as spritePlugin,AB as spritesheetAnimationPlugin,RN as textPlugin,iV as textRevealingPlugin,lV as tweenPlugin,$N as videoPlugin};
2035
2035
  /*! Bundled license information:
2036
2036
 
2037
2037
  punycode/punycode.js: