t.right?t.right:this.right)<=Q)return!1;let Y=this.yt.bottom?t.bottom:this.bottom)>Y}let r=this.left,n=this.right,s=this.top,a=this.bottom;if(n<=r||a<=s)return!1;let o=Hi[0].set(t.left,t.top),l=Hi[1].set(t.left,t.bottom),h=Hi[2].set(t.right,t.top),u=Hi[3].set(t.right,t.bottom);if(h.x<=o.x||l.y<=o.y)return!1;let d=Math.sign(i.a*i.d-i.b*i.c);if(d===0||(i.apply(o,o),i.apply(l,l),i.apply(h,h),i.apply(u,u),Math.max(o.x,l.x,h.x,u.x)<=r||Math.min(o.x,l.x,h.x,u.x)>=n||Math.max(o.y,l.y,h.y,u.y)<=s||Math.min(o.y,l.y,h.y,u.y)>=a))return!1;let p=d*(l.y-o.y),f=d*(o.x-l.x),y=p*r+f*s,b=p*n+f*s,_=p*r+f*a,T=p*n+f*a;if(Math.max(y,b,_,T)<=p*o.x+f*o.y||Math.min(y,b,_,T)>=p*u.x+f*u.y)return!1;let C=d*(o.y-h.y),O=d*(h.x-o.x),R=C*r+O*s,z=C*n+O*s,ee=C*r+O*a,ne=C*n+O*a;return!(Math.max(R,z,ee,ne)<=C*o.x+O*o.y||Math.min(R,z,ee,ne)>=C*u.x+O*u.y)}pad(t=0,i=t){return this.x-=t,this.y-=i,this.width+=t*2,this.height+=i*2,this}fit(t){let i=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),n=Math.max(this.y,t.y),s=Math.min(this.y+this.height,t.y+t.height);return this.x=i,this.width=Math.max(r-i,0),this.y=n,this.height=Math.max(s-n,0),this}ceil(t=1,i=.001){let r=Math.ceil((this.x+this.width-i)*t)/t,n=Math.ceil((this.y+this.height-i)*t)/t;return this.x=Math.floor((this.x+i)*t)/t,this.y=Math.floor((this.y+i)*t)/t,this.width=r-this.x,this.height=n-this.y,this}enlarge(t){let i=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),n=Math.min(this.y,t.y),s=Math.max(this.y+this.height,t.y+t.height);return this.x=i,this.width=r-i,this.y=n,this.height=s-n,this}getBounds(t){return t=t||new Po,t.copyFrom(this),t}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}}),c,g,m=v(()=>{We(),E(),c=new ke,g=class q_{constructor(t=1/0,i=1/0,r=-1/0,n=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=c,this.minX=t,this.minY=i,this.maxX=r,this.maxY=n}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new ot);let t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=c,this}set(t,i,r,n){this.minX=t,this.minY=i,this.maxX=r,this.maxY=n}addFrame(t,i,r,n,s){s||(s=this.matrix);let a=s.a,o=s.b,l=s.c,h=s.d,u=s.tx,d=s.ty,p=this.minX,f=this.minY,y=this.maxX,b=this.maxY,_=a*t+l*i+u,T=o*t+h*i+d;_y&&(y=_),T>b&&(b=T),_=a*r+l*i+u,T=o*r+h*i+d,_
y&&(y=_),T>b&&(b=T),_=a*t+l*n+u,T=o*t+h*n+d,_
y&&(y=_),T>b&&(b=T),_=a*r+l*n+u,T=o*r+h*n+d,_
y&&(y=_),T>b&&(b=T),this.minX=p,this.minY=f,this.maxX=y,this.maxY=b}addRect(t,i){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,i)}addBounds(t,i){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,i)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxXthis.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY,p=a*i+l*s+u,f=o*i+h*s+d,this.minX=pthis.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY,p=a*n+l*s+u,f=o*n+h*s+d,this.minX=pthis.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minXt.right&&(this.maxX=t.right),this.minYt.bottom&&(this.maxY=t.bottom),this}fitBounds(t,i,r,n){return this.minXi&&(this.maxX=i),this.minYn&&(this.maxY=n),this}pad(t,i=t){return this.minX-=t,this.maxX+=t,this.minY-=i,this.maxY+=i,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 q_(this.minX,this.minY,this.maxX,this.maxY)}scale(t,i=t){return this.minX*=t,this.minY*=i,this.maxX*=t,this.maxY*=i,this}get x(){return this.minX}set x(t){let i=this.maxX-this.minX;this.minX=t,this.maxX=t+i}get y(){return this.minY}set y(t){let i=this.maxY-this.minY;this.minY=t,this.maxY=t+i}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}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(t,i,r,n){let s=this.minX,a=this.minY,o=this.maxX,l=this.maxY;n||(n=this.matrix);let h=n.a,u=n.b,d=n.c,p=n.d,f=n.tx,y=n.ty;for(let b=i;bo?C:o,l=O>l?O:l}this.minX=s,this.minY=a,this.maxX=o,this.maxY=l}containsPoint(t,i){return this.minX<=t&&this.minY<=i&&this.maxX>=t&&this.maxY>=i}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}}}),x,w,S=v(()=>{We(),Kr(),m(),x=new tr(ke),w=new tr(g)});function k(e,t,i){i.clear();let r,n;return e.parent?t?r=e.parent.worldTransform:(n=x.get().identity(),r=N(e,n)):r=ke.IDENTITY,B(e,i,r,t),n&&x.return(n),i.isValid||i.set(0,0,0,0),i}function B(e,t,i,r){if(!e.visible||!e.measurable)return;let n;r?n=e.worldTransform:(e.updateLocalTransform(),n=x.get(),n.appendFrom(e.localTransform,i));let s=t,a=!!e.effects.length;if(a&&(t=w.get().clear()),e.boundsArea)t.addRect(e.boundsArea,n);else{e.addBounds&&(t.matrix=n,e.addBounds(t));for(let o=0;o{We(),S()});function F(...e){V!==L&&(V++,V===L?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...e))}var V,L,I=v(()=>{"use strict";V=0,L=500});function D(e,t,i){return t.clear(),i||(i=ke.IDENTITY),$(e,t,i,e,!0),t.isValid||t.set(0,0,0,0),t}function $(e,t,i,r,n){let s;if(n)s=x.get(),s=i.copyTo(s);else{if(!e.visible||!e.measurable)return;e.updateLocalTransform();let l=e.localTransform;s=x.get(),s.appendFrom(l,i)}let a=t,o=!!e.effects.length;if(o&&(t=w.get().clear()),e.boundsArea)t.addRect(e.boundsArea,s);else{e.renderPipeId&&(t.matrix=s,e.addBounds(t));let l=e.children;for(let h=0;h{We(),S()});function xe(e,t){let i=e.children;for(let r=0;r{"use strict"}),Ge,ct,Qt=v(()=>{We(),m(),X(),se(),Me(),Ge=new ke,ct={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(e,t){let i=Math.sign(this.scale.x)||1;t!==0?this.scale.x=e/t*i:this.scale.x=i},_setHeight(e,t){let i=Math.sign(this.scale.y)||1;t!==0?this.scale.y=e/t*i:this.scale.y=i},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new g});let e=this._localBoundsCacheData;return e.index=1,e.didChange=!1,e.data[0]!==this._didViewChangeTick&&(e.didChange=!0,e.data[0]=this._didViewChangeTick),xe(this,e),e.didChange&&D(this,e.localBounds,Ge),e.localBounds},getBounds(e,t){return k(this,e,t||new g)}}}),ei,qt=v(()=>{"use strict";ei={_onRender:null,set onRender(e){let t=this.renderGroup||this.parentRenderGroup;if(!e){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=e},get onRender(){return this._onRender}}});function di(e,t){return e._zIndex-t._zIndex}var Ut,Ae=v(()=>{"use strict";Ut={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(e){this._zIndex!==e&&(this._zIndex=e,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(di))}}}),Be,He=v(()=>{We(),At(),X(),Be={getGlobalPosition(e=new De,t=!1){return this.parent?this.parent.toGlobal(this._position,e,t):(e.x=this._position.x,e.y=this._position.y),e},toGlobal(e,t,i=!1){if(!i){this.updateLocalTransform();let r=N(this,new ke);return r.append(this.localTransform),r.apply(e,t)}return this.worldTransform.apply(e,t)},toLocal(e,t,i,r){if(t&&(e=t.toGlobal(e,i,r)),!r){this.updateLocalTransform();let n=N(this,new ke);return n.append(this.localTransform),n.applyInverse(e,i)}return this.worldTransform.applyInverse(e,i)}}}),ft,et,lt=v(()=>{bt(),ft=0,et=class{constructor(){this.uid=at("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.tick=0}reset(){this.instructionSize=0,this.tick=ft++}add(e){this.instructions[this.instructionSize++]=e}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}}),zt,Ci=v(()=>{We(),lt(),zt=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new ke,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new et,this._onRenderContainers=[]}init(e){this.root=e,e._onRender&&this.addOnRender(e),e.didChange=!0;let t=e.children;for(let i=0;i-1&&this.renderGroupChildren.splice(t,1),e.renderGroupParent=null}addChild(e){if(this.structureDidChange=!0,e.parentRenderGroup=this,e.updateTick=-1,e.parent===this.root?e.relativeRenderGroupDepth=1:e.relativeRenderGroupDepth=e.parent.relativeRenderGroupDepth+1,e.didChange=!0,this.onChildUpdate(e),e.renderGroup){this.addRenderGroupChild(e.renderGroup);return}e._onRender&&this.addOnRender(e);let t=e.children;for(let i=0;i0}addOnRender(e){this._onRenderContainers.push(e)}removeOnRender(e){this._onRenderContainers.splice(this._onRenderContainers.indexOf(e),1)}runOnRender(){for(let e=0;e{"use strict"}),Ms,Ps,Rs,Mn,ks,rn,Tt,zi=v(()=>{xt(),Ie(),Se(),We(),Jt(),kr(),bt(),wt(),Ht(),xi(),Gr(),tn(),Qt(),qt(),Ae(),He(),Ci(),ko(),Ms=new $t(null),Ps=new $t(null),Rs=new $t(null,1,1),Mn=1,ks=2,rn=4,Tt=class K_ extends Je{constructor(t={}){super(),this.uid=at("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 ke,this.relativeGroupTransform=new ke,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new $t(this,0,0),this._scale=Rs,this._pivot=Ps,this._skew=Ms,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=[],oi(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(i=>this.addChild(i)),t.parent?.addChild(this)}static mixin(t){Object.defineProperties(K_.prototype,Object.getOwnPropertyDescriptors(t))}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||Xe(Ve,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let n=0;n1){for(let n=0;n-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(i):this.parentRenderGroup&&this.parentRenderGroup.removeChild(i),i.parent=null,this.emit("childRemoved",i,this,r),i.emit("removed",this)),i}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=Le.get(zt,this),this.groupTransform=ke.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),Le.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new ke),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(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*Fe}set angle(t){this.rotation=t*st}get pivot(){return this._pivot===Ps&&(this._pivot=new $t(this,0,0)),this._pivot}set pivot(t){this._pivot===Ps&&(this._pivot=new $t(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Ms&&(this._skew=new $t(this,0,0)),this._skew}set skew(t){this._skew===Ms&&(this._skew=new $t(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Rs&&(this._scale=new $t(this,1,1)),this._scale}set scale(t){this._scale===Rs&&(this._scale=new $t(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let i=this.getLocalBounds().width;this._setWidth(t,i)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let i=this.getLocalBounds().height;this._setHeight(t,i)}getSize(t){t||(t={});let i=this.getLocalBounds();return t.width=Math.abs(this.scale.x*i.width),t.height=Math.abs(this.scale.y*i.height),t}setSize(t,i){let r=this.getLocalBounds(),n,s;typeof t!="object"?(n=t,s=i??t):(n=t.width,s=t.height??t.width),n!==void 0&&this._setWidth(n,r.width),s!==void 0&&this._setHeight(s,r.height)}_updateSkew(){let t=this._rotation,i=this._skew;this._cx=Math.cos(t+i._y),this._sx=Math.sin(t+i._y),this._cy=-Math.sin(t-i._x),this._sy=Math.cos(t-i._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let i=this.localTransform,r=this._scale,n=this._pivot,s=this._position,a=r._x,o=r._y,l=n._x,h=n._y;i.a=this._cx*a,i.b=this._sx*a,i.c=this._cy*o,i.d=this._sy*o,i.tx=s._x-(l*i.a+h*i.c),i.ty=s._y-(l*i.b+h*i.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Mn,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let i=ue.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=Mn,this._onUpdate())}get tint(){let t=this.localColor;return((t&255)<<16)+(t&65280)+(t>>16&255)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ks,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){let i=t?2:0;(this.localDisplayStatus&2)!==i&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=rn,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){let i=t?0:4;(this.localDisplayStatus&4)!==i&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=rn,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){let i=t?1:0;(this.localDisplayStatus&1)!==i&&(this._updateFlags|=rn,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0;let i=this.removeChildren(0,this.children.length);if(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 t=="boolean"?t:t?.children)for(let r=0;r{At(),Bs=class Z_{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Z_.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new De,this.page=new De,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,i,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,i,r,n,s){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 Ev(e){return function(t){return t.test(e)}}function Rc(e){var t={userAgent:"",platform:"",maxTouchPoints:0};!e&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof e=="string"?t.userAgent=e:e&&e.userAgent&&(t={userAgent:e.userAgent,platform:e.platform,maxTouchPoints:e.maxTouchPoints||0});var i=t.userAgent,r=i.split("[FBAN");typeof r[1]<"u"&&(i=r[0]),r=i.split("Twitter"),typeof r[1]<"u"&&(i=r[0]);var n=Ev(i),s={apple:{phone:n(Is)&&!n(Wi),ipod:n(Io),tablet:!n(Is)&&(n(Go)||Wo(t))&&!n(Wi),universal:n(Oo),device:(n(Is)||n(Io)||n(Go)||n(Oo)||Wo(t))&&!n(Wi)},amazon:{phone:n(Ur),tablet:!n(Ur)&&n(Pn),device:n(Ur)||n(Pn)},android:{phone:!n(Wi)&&n(Ur)||!n(Wi)&&n(Gs),tablet:!n(Wi)&&!n(Ur)&&!n(Gs)&&(n(Pn)||n(Uo)),device:!n(Wi)&&(n(Ur)||n(Pn)||n(Gs)||n(Uo))||n(/\bokhttp\b/i)},windows:{phone:n(Wi),tablet:n(Fo),device:n(Wi)||n(Fo)},other:{blackberry:n(Do),blackberry10:n(Lo),opera:n(No),firefox:n(zo),chrome:n(Ho),device:n(Do)||n(Lo)||n(No)||n(zo)||n(Ho)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}var Is,Io,Go,Oo,Gs,Uo,Ur,Pn,Wi,Fo,Do,Lo,No,Ho,zo,Wo,kc=v(()=>{Is=/iPhone/i,Io=/iPod/i,Go=/iPad/i,Oo=/\biOS-universal(?:.+)Mac\b/i,Gs=/\bAndroid(?:.+)Mobile\b/i,Uo=/Android/i,Ur=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Pn=/Silk/i,Wi=/Windows Phone/i,Fo=/\bWindows(?:.+)ARM\b/i,Do=/BlackBerry/i,Lo=/BB10/i,No=/Opera Mini/i,Ho=/\b(CriOS|Chrome)(?:.+)Mobile/i,zo=/Mobile(?:.+)Firefox\b/i,Wo=function(e){return typeof e<"u"&&e.platform==="MacIntel"&&typeof e.maxTouchPoints=="number"&&e.maxTouchPoints>1&&typeof MSStream>"u"}}),Av=v(()=>{kc(),kc()}),Bc,Ic,Cv=v(()=>{Av(),Bc=Rc.default??Rc,Ic=Bc(globalThis.navigator)}),Gc,Rn,Oc,Uc,Vo,jo,Fc,Dc,Lc,$o,Mv=v(()=>{Bo(),te(),Cv(),Jr(),Gc=9,Rn=100,Oc=0,Uc=0,Vo=2,jo=1,Fc=-1e3,Dc=-1e3,Lc=2,$o=class{constructor(e,t=Ic){this._mobileInfo=t,this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook();let i=document.createElement("div");i.style.width=`${Rn}px`,i.style.height=`${Rn}px`,i.style.position="absolute",i.style.top=`${Oc}px`,i.style.left=`${Uc}px`,i.style.zIndex=Vo.toString(),this._div=i,this._renderer=e,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let e=document.createElement("button");e.style.width=`${jo}px`,e.style.height=`${jo}px`,e.style.position="absolute",e.style.top=`${Fc}px`,e.style.left=`${Dc}px`,e.style.zIndex=Lc.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(){this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.add(this),this._renderer.view.canvas.parentNode?.appendChild(this._div))}_deactivate(){!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this),this._div.parentNode?.removeChild(this._div))}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&e.isInteractive()&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);let t=e.children;if(t)for(let i=0;i title : ${e.title} tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);let{width:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let t=this._pool.pop();t||(t=document.createElement("button"),t.style.width=`${Rn}px`,t.style.height=`${Rn}px`,t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=Vo.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?t.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(t.title=`container ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this._updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.container=e,this._children.push(e),this._div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex}_dispatchEvent(e,t){let{container:i}=e.target,r=this._renderer.events.rootBoundary,n=Object.assign(new Bs(r),{target:i});r.rootTarget=this._renderer.lastObjectRendered,t.forEach(s=>r.dispatchEvent(n,s))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode===Gc&&this._activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this._deactivate()}destroy(){this._destroyTouchHook(),this._div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this._pool=null,this._children=null,this._renderer=null}},$o.extension={type:[G.WebGLSystem,G.WebGPUSystem],name:"accessibility"}}),Nc,Pv=v(()=>{"use strict";Nc={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}}),Rv=v(()=>{te(),zi(),Mv(),Pv(),pe.add($o),Tt.mixin(Nc)}),Xo,kv=v(()=>{te(),Xo=class{static init(e){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let t,i;if(this._resizeTo===globalThis.window)t=globalThis.innerWidth,i=globalThis.innerHeight;else{let{clientWidth:r,clientHeight:n}=this._resizeTo;t=r,i=n}this.renderer.resize(t,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}},Xo.extension=G.Application}),nn,Yo=v(()=>{"use strict";nn=(e=>(e[e.INTERACTION=50]="INTERACTION",e[e.HIGH=25]="HIGH",e[e.NORMAL=0]="NORMAL",e[e.LOW=-25]="LOW",e[e.UTILITY=-50]="UTILITY",e))(nn||{})}),Os,Bv=v(()=>{"use strict";Os=class{constructor(e,t=null,i=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=e,this._context=t,this.priority=i,this._once=r}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}}}),qo,Mi,Us=v(()=>{Yo(),Bv(),qo=class vi{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 Os(null,null,1/0),this.deltaMS=1/vi.targetFPMS,this.elapsedMS=1/vi.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,i,r=nn.NORMAL){return this._addListener(new Os(t,i,r))}addOnce(t,i,r=nn.NORMAL){return this._addListener(new Os(t,i,r,!0))}_addListener(t){let i=this._head.next,r=this._head;if(!i)t.connect(r);else{for(;i;){if(t.priority>i.priority){t.connect(r);break}r=i,i=i.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,i){let r=this._head.next;for(;r;)r.match(t,i)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,i=this._head;for(;i=i.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let i;if(t>this.lastTime){if(i=this.elapsedMS=t-this.lastTime,i>this._maxElapsedMS&&(i=this._maxElapsedMS),i*=this.speed,this._minElapsedMS){let s=t-this._lastFrame|0;if(s{te(),Yo(),Us(),Ko=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,nn.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?Mi.shared:new Mi,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}},Ko.extension=G.Application}),Hc=v(()=>{te(),kv(),Iv(),pe.add(Xo),pe.add(Ko)}),zc,rr,Wc=v(()=>{Yo(),Us(),zc=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(e){this.removeTickerListener(),this.events=e,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(e){this._pauseUpdate=e}addTickerListener(){this._tickerAdded||!this.domElement||(Mi.system.add(this._tickerUpdate,this,nn.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Mi.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let e=this.events._rootPointerEvent;this.events.supportsTouchEvents&&e.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,pointerId:e.pointerId}))}_tickerUpdate(e){this._deltaTime+=e.deltaTime,!(this._deltaTime{At(),Bo(),kn=class extends Bs{constructor(){super(...arguments),this.client=new De,this.movement=new De,this.offset=new De,this.global=new De,this.screen=new De}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(e,t,i){return e.worldTransform.applyInverse(i||this.global,t)}getModifierState(e){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(e,t,i,r,n,s,a,o,l,h,u,d,p,f,y){throw new Error("Method not implemented.")}}}),bi,Vc=v(()=>{Zo(),bi=class extends kn{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}}),Fr,jc=v(()=>{Zo(),Fr=class extends kn{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}},Fr.DOM_DELTA_PIXEL=0,Fr.DOM_DELTA_LINE=1,Fr.DOM_DELTA_PAGE=2}),$c,Xc,sn,Yc,Gv=v(()=>{xt(),At(),I(),Wc(),Zo(),Vc(),jc(),$c=2048,Xc=new De,sn=new De,Yc=class{constructor(e){this.dispatch=new Je,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(e,t){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:t,priority:0}),this.mappingTable[e].sort((i,r)=>i.priority-r.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;let t=this.mappingTable[e.type];if(t)for(let i=0,r=t.length;i=0;r--)if(e.currentTarget=i[r],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,i=this._allInteractiveElements){if(i.length===0)return;e.eventPhase=e.BUBBLING_PHASE;let r=Array.isArray(t)?t:[t];for(let n=i.length-1;n>=0;n--)r.forEach(s=>{e.currentTarget=i[n],this.notifyTarget(e,s)})}propagationPath(e){let t=[e];for(let i=0;i<$c&&e!==this.rootTarget&&e.parent;i++){if(!e.parent)throw new Error("Cannot find propagation path to disconnected target");t.push(e.parent),e=e.parent}return t.reverse(),t}hitTestMoveRecursive(e,t,i,r,n,s=!1){let a=!1;if(this._interactivePrune(e))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(rr.pauseUpdate=!1),e.interactiveChildren&&e.children){let h=e.children;for(let u=h.length-1;u>=0;u--){let d=h[u],p=this.hitTestMoveRecursive(d,this._isInteractive(t)?t:d.eventMode,i,r,n,s||n(e,i));if(p){if(p.length>0&&!p[p.length-1].parent)continue;let f=e.isInteractive();(p.length>0||f)&&(f&&this._allInteractiveElements.push(e),p.push(e)),this._hitElements.length===0&&(this._hitElements=p),a=!0}}}let o=this._isInteractive(t),l=e.isInteractive();return l&&l&&this._allInteractiveElements.push(e),s||this._hitElements.length>0?null:a?this._hitElements:o&&!n(e,i)&&r(e,i)?l?[e]:[]:null}hitTestRecursive(e,t,i,r,n){if(this._interactivePrune(e)||n(e,i))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(rr.pauseUpdate=!1),e.interactiveChildren&&e.children){let o=e.children,l=i;for(let h=o.length-1;h>=0;h--){let u=o[h],d=this.hitTestRecursive(u,this._isInteractive(t)?t:u.eventMode,l,r,n);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let p=e.isInteractive();return(d.length>0||p)&&d.push(e),d}}}let s=this._isInteractive(t),a=e.isInteractive();return s&&r(e,i)?a?[e]:[]:null}_isInteractive(e){return e==="static"||e==="dynamic"}_interactivePrune(e){return!e||!e.visible||!e.renderable||!e.includeInBuild||!e.measurable||e.eventMode==="none"||e.eventMode==="passive"&&!e.interactiveChildren}hitPruneFn(e,t){if(e.hitArea&&(e.worldTransform.applyInverse(t,sn),!e.hitArea.contains(sn.x,sn.y)))return!0;if(e.effects&&e.effects.length)for(let i=0;i0&&n!==t.target){let o=e.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(e,o,n);if(this.dispatchEvent(l,"pointerout"),i&&this.dispatchEvent(l,"mouseout"),!t.composedPath().includes(n)){let h=this.createPointerEvent(e,"pointerleave",n);for(h.eventPhase=h.AT_TARGET;h.target&&!t.composedPath().includes(h.target);)h.currentTarget=h.target,this.notifyTarget(h),i&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;this.freeEvent(h)}this.freeEvent(l)}if(n!==t.target){let o=e.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(t,o);this.dispatchEvent(l,"pointerover"),i&&this.dispatchEvent(l,"mouseover");let h=n?.parent;for(;h&&h!==this.rootTarget.parent&&h!==t.target;)h=h.parent;if(!h||h===this.rootTarget.parent){let u=this.clonePointerEvent(t,"pointerenter");for(u.eventPhase=u.AT_TARGET;u.target&&u.target!==n&&u.target!==this.rootTarget.parent;)u.currentTarget=u.target,this.notifyTarget(u),i&&this.notifyTarget(u,"mouseenter"),u.target=u.target.parent;this.freeEvent(u)}this.freeEvent(l)}let s=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?s.push("pointermove"):this.dispatchEvent(t,"pointermove"),a&&s.push("globalpointermove"),t.pointerType==="touch"&&(this.moveOnAll?s.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),a&&s.push("globaltouchmove")),i&&(this.moveOnAll?s.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),a&&s.push("globalmousemove"),this.cursor=t.target?.cursor),s.length>0&&this.all(t,s),this._allInteractiveElements.length=0,this._hitElements.length=0,r.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){if(!(e instanceof bi)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=this.trackingData(e.pointerId),i=this.createPointerEvent(e),r=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=i.target?.cursor);let n=this.clonePointerEvent(i,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;t.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(e){if(!(e instanceof bi)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=this.trackingData(e.pointerId);if(t.overTargets){let i=e.pointerType==="mouse"||e.pointerType==="pen",r=this.findMountedTarget(t.overTargets),n=this.createPointerEvent(e,"pointerout",r);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");let s=this.createPointerEvent(e,"pointerleave",r);for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),i&&this.notifyTarget(s,"mouseleave"),s.target=s.target.parent;t.overTargets=null,this.freeEvent(n),this.freeEvent(s)}this.cursor=null}mapPointerUp(e){if(!(e instanceof bi)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=performance.now(),i=this.createPointerEvent(e);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}let r=this.trackingData(e.pointerId),n=this.findMountedTarget(r.pressTargetsByButton[e.button]),s=n;if(n&&!i.composedPath().includes(n)){let a=n;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let o=i.button===2;this.notifyTarget(i,o?"rightupoutside":"mouseupoutside")}a=a.parent}delete r.pressTargetsByButton[e.button],s=a}if(s){let a=this.clonePointerEvent(i,"click");a.target=s,a.path=null,r.clicksByButton[e.button]||(r.clicksByButton[e.button]={clickCount:0,target:a.target,timeStamp:t});let o=r.clicksByButton[e.button];if(o.target===a.target&&t-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=a.target,o.timeStamp=t,a.detail=o.clickCount,a.pointerType==="mouse"){let l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(e){if(!(e instanceof bi)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=this.trackingData(e.pointerId),i=this.findMountedTarget(t.pressTargetsByButton[e.button]),r=this.createPointerEvent(e);if(i){let n=i;for(;n;)r.currentTarget=n,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch"?this.notifyTarget(r,"touchendoutside"):(r.pointerType==="mouse"||r.pointerType==="pen")&&this.notifyTarget(r,r.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(r)}mapWheel(e){if(!(e instanceof Fr)){F("EventBoundary cannot map a non-wheel event as a wheel event");return}let t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let i=1;i{te(),Gv(),Wc(),Vc(),jc(),qc=1,Kc={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Fs=class bc{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Yc(null),rr.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new bi(null),this._rootWheelEvent=new Fr(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...bc.defaultEventFeatures},{set:(i,r,n)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=n),i[r]=n,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:i,resolution:r}=this.renderer;this.setTargetElement(i),this.resolution=r,bc._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(t){t=t||"default";let i=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(i=!1),this._currentCursor===t)return;this._currentCursor=t;let r=this.cursorStyles[t];if(r)switch(typeof r){case"string":i&&(this.domElement.style.cursor=r);break;case"function":r(t);break;case"object":i&&Object.assign(this.domElement.style,r);break}else i&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let i=this._normalizeToPointerData(t);this.autoPreventDefault&&i[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let r=0,n=i.length;r0&&(i=t.composedPath()[0]);let r=i!==this.domElement?"outside":"",n=this._normalizeToPointerData(t);for(let s=0,a=n.length;s"u"&&(s.button=0),typeof s.buttons>"u"&&(s.buttons=1),typeof s.isPrimary>"u"&&(s.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof s.width>"u"&&(s.width=s.radiusX||1),typeof s.height>"u"&&(s.height=s.radiusY||1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="touch"),typeof s.pointerId>"u"&&(s.pointerId=s.identifier||0),typeof s.pressure>"u"&&(s.pressure=s.force||.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),typeof s.layerX>"u"&&(s.layerX=s.offsetX=s.clientX),typeof s.layerY>"u"&&(s.layerY=s.offsetY=s.clientY),s.isNormalized=!0,s.type=t.type,i.push(s)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let r=t;typeof r.isPrimary>"u"&&(r.isPrimary=!0),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=qc),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=!0,i.push(r)}else i.push(t);return i}normalizeWheelEvent(t){let i=this._rootWheelEvent;return this._transferMouseData(i,t),i.deltaX=t.deltaX,i.deltaY=t.deltaY,i.deltaZ=t.deltaZ,i.deltaMode=t.deltaMode,this.mapPositionToPoint(i.screen,t.clientX,t.clientY),i.global.copyFrom(i.screen),i.offset.copyFrom(i.screen),i.nativeEvent=t,i.type=t.type,i}_bootstrapEvent(t,i){return t.originalEvent=null,t.nativeEvent=i,t.pointerId=i.pointerId,t.width=i.width,t.height=i.height,t.isPrimary=i.isPrimary,t.pointerType=i.pointerType,t.pressure=i.pressure,t.tangentialPressure=i.tangentialPressure,t.tiltX=i.tiltX,t.tiltY=i.tiltY,t.twist=i.twist,this._transferMouseData(t,i),this.mapPositionToPoint(t.screen,i.clientX,i.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=i.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=Kc[t.type]||t.type),t}_transferMouseData(t,i){t.isTrusted=i.isTrusted,t.srcElement=i.srcElement,t.timeStamp=performance.now(),t.type=i.type,t.altKey=i.altKey,t.button=i.button,t.buttons=i.buttons,t.client.x=i.clientX,t.client.y=i.clientY,t.ctrlKey=i.ctrlKey,t.metaKey=i.metaKey,t.movement.x=i.movementX,t.movement.y=i.movementY,t.page.x=i.pageX,t.page.y=i.pageY,t.relatedTarget=null,t.shiftKey=i.shiftKey}},Fs.extension={name:"events",type:[G.WebGLSystem,G.CanvasSystem,G.WebGPUSystem],priority:-1},Fs.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0},Jo=Fs}),Jc,Ov=v(()=>{Zc(),Bo(),Jc={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(e){this.eventMode=e?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Jo.defaultEventMode},set eventMode(e){this._internalEventMode=e},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(e,t,i){let r=typeof i=="boolean"&&i||typeof i=="object"&&i.capture,n=typeof i=="object"?i.signal:void 0,s=typeof i=="object"?i.once===!0:!1,a=typeof t=="function"?void 0:t;e=r?`${e}capture`:e;let o=typeof t=="function"?t:t.handleEvent,l=this;n&&n.addEventListener("abort",()=>{l.off(e,o,a)}),s?l.once(e,o,a):l.on(e,o,a)},removeEventListener(e,t,i){let r=typeof i=="boolean"&&i||typeof i=="object"&&i.capture,n=typeof t=="function"?void 0:t;e=r?`${e}capture`:e,t=typeof t=="function"?t:t.handleEvent,this.off(e,t,n)},dispatchEvent(e){if(!(e instanceof Bs))throw new Error("Container cannot propagate events outside of the Federated Events API");return e.defaultPrevented=!1,e.path=null,e.target=this,e.manager.dispatchEvent(e),!e.defaultPrevented}}}),Uv=v(()=>{te(),zi(),Zc(),Ov(),pe.add(Jo),Tt.mixin(Jc)}),Qo,Fv=v(()=>{"use strict";Qo=(e=>(e[e.Low=0]="Low",e[e.Normal=1]="Normal",e[e.High=2]="High",e))(Qo||{})}),Qc,Dv=v(()=>{"use strict";Qc={createCanvas:(e,t)=>{let i=document.createElement("canvas");return i.width=e,i.height=t,i},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(e,t)=>fetch(e,t),parseXML:e=>new DOMParser().parseFromString(e,"text/xml")}}),el,vt,Ft=v(()=>{Dv(),el=Qc,vt={get(){return el},set(e){el=e}}});function Pi(e){if(typeof e!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(e)}`)}function Bn(e){return e.split("?")[0].split("#")[0]}function Lv(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Nv(e,t,i){return e.replace(new RegExp(Lv(t),"g"),i)}function Hv(e,t){let i="",r=0,n=-1,s=0,a=-1;for(let o=0;o<=e.length;++o){if(o2){let l=i.lastIndexOf("/");if(l!==i.length-1){l===-1?(i="",r=0):(i=i.slice(0,l),r=i.length-1-i.lastIndexOf("/")),n=o,s=0;continue}}else if(i.length===2||i.length===1){i="",r=0,n=o,s=0;continue}}t&&(i.length>0?i+="/..":i="..",r=2)}else i.length>0?i+=`/${e.slice(n+1,o)}`:i=e.slice(n+1,o),r=o-n-1;n=o,s=0}else a===46&&s!==-1?++s:s=-1}return i}var an,ed=v(()=>{Ft(),an={toPosix(e){return Nv(e,"\\","/")},isUrl(e){return/^https?:/.test(this.toPosix(e))},isDataUrl(e){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(e)},isBlobUrl(e){return e.startsWith("blob:")},hasProtocol(e){return/^[^/:]+:/.test(this.toPosix(e))},getProtocol(e){Pi(e),e=this.toPosix(e);let t=/^file:\/\/\//.exec(e);if(t)return t[0];let i=/^[^/:]+:\/{0,2}/.exec(e);return i?i[0]:""},toAbsolute(e,t,i){if(Pi(e),this.isDataUrl(e)||this.isBlobUrl(e))return e;let r=Bn(this.toPosix(t??vt.get().getBaseUrl())),n=Bn(this.toPosix(i??this.rootname(r)));return e=this.toPosix(e),e.startsWith("/")?an.join(n,e.slice(1)):this.isAbsolute(e)?e:this.join(r,e)},normalize(e){if(Pi(e),e.length===0)return".";if(this.isDataUrl(e)||this.isBlobUrl(e))return e;e=this.toPosix(e);let t="",i=e.startsWith("/");this.hasProtocol(e)&&(t=this.rootname(e),e=e.slice(t.length));let r=e.endsWith("/");return e=Hv(e,!1),e.length>0&&r&&(e+="/"),i?`/${e}`:t+e},isAbsolute(e){return Pi(e),e=this.toPosix(e),this.hasProtocol(e)?!0:e.startsWith("/")},join(...e){if(e.length===0)return".";let t;for(let i=0;i0)if(t===void 0)t=r;else{let n=e[i-1]??"";this.joinExtensions.includes(this.extname(n).toLowerCase())?t+=`/../${r}`:t+=`/${r}`}}return t===void 0?".":this.normalize(t)},dirname(e){if(Pi(e),e.length===0)return".";e=this.toPosix(e);let t=e.charCodeAt(0),i=t===47,r=-1,n=!0,s=this.getProtocol(e),a=e;e=e.slice(s.length);for(let o=e.length-1;o>=1;--o)if(t=e.charCodeAt(o),t===47){if(!n){r=o;break}}else n=!1;return r===-1?i?"/":this.isUrl(a)?s+e:s:i&&r===1?"//":s+e.slice(0,r)},rootname(e){Pi(e),e=this.toPosix(e);let t="";if(e.startsWith("/")?t="/":t=this.getProtocol(e),this.isUrl(e)){let i=e.indexOf("/",t.length);i!==-1?t=e.slice(0,i):t=e,t.endsWith("/")||(t+="/")}return t},basename(e,t){Pi(e),t&&Pi(t),e=Bn(this.toPosix(e));let i=0,r=-1,n=!0,s;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";let a=t.length-1,o=-1;for(s=e.length-1;s>=0;--s){let l=e.charCodeAt(s);if(l===47){if(!n){i=s+1;break}}else o===-1&&(n=!1,o=s+1),a>=0&&(l===t.charCodeAt(a)?--a===-1&&(r=s):(a=-1,r=o))}return i===r?r=o:r===-1&&(r=e.length),e.slice(i,r)}for(s=e.length-1;s>=0;--s)if(e.charCodeAt(s)===47){if(!n){i=s+1;break}}else r===-1&&(n=!1,r=s+1);return r===-1?"":e.slice(i,r)},extname(e){Pi(e),e=Bn(this.toPosix(e));let t=-1,i=0,r=-1,n=!0,s=0;for(let a=e.length-1;a>=0;--a){let o=e.charCodeAt(a);if(o===47){if(!n){i=a+1;break}continue}r===-1&&(n=!1,r=a+1),o===46?t===-1?t=a:s!==1&&(s=1):t!==-1&&(s=-1)}return t===-1||r===-1||s===0||s===1&&t===r-1&&t===i+1?"":e.slice(t,r)},parse(e){Pi(e);let t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;e=Bn(this.toPosix(e));let i=e.charCodeAt(0),r=this.isAbsolute(e),n,s="";t.root=this.rootname(e),r||this.hasProtocol(e)?n=1:n=0;let a=-1,o=0,l=-1,h=!0,u=e.length-1,d=0;for(;u>=n;--u){if(i=e.charCodeAt(u),i===47){if(!h){o=u+1;break}continue}l===-1&&(h=!1,l=u+1),i===46?a===-1?a=u:d!==1&&(d=1):a!==-1&&(d=-1)}return a===-1||l===-1||d===0||d===1&&a===l-1&&a===o+1?l!==-1&&(o===0&&r?t.base=t.name=e.slice(1,l):t.base=t.name=e.slice(o,l)):(o===0&&r?(t.name=e.slice(1,a),t.base=e.slice(1,l)):(t.name=e.slice(o,a),t.base=e.slice(o,l)),t.ext=e.slice(a,l)),t.dir=this.dirname(e),s&&(t.dir=s+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}}),Dr,td=v(()=>{"use strict";Dr=(e,t,i=!1)=>(Array.isArray(e)||(e=[e]),t?e.map(r=>typeof r=="string"||i?t(r):r):e)});function id(e,t,i,r,n){let s=t[i];for(let a=0;a{let a=s.substring(1,s.length-1).split(",");n.push(a)}),id(e,n,0,i,r)}else r.push(e);return r}var Wv=v(()=>{"use strict"}),tl,Vv=v(()=>{"use strict";tl=e=>!Array.isArray(e)});function jv(e){return e.split(".").pop().split("?").shift().split("#").shift()}var il,$v=v(()=>{I(),ed(),td(),Wv(),Vv(),il=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(e,t)=>`${e}${this._bundleIdConnector}${t}`,extractAssetIdFromBundle:(e,t)=>t.replace(`${e}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...e){e.forEach(t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(e){if(typeof e=="string")this._defaultSearchParams=e;else{let t=e;this._defaultSearchParams=Object.keys(t).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(t[i])}`).join("&")}}getAlias(e){let{alias:t,src:i}=e;return Dr(t||i,r=>typeof r=="string"?r:Array.isArray(r)?r.map(n=>n?.src??n):r?.src?r.src:r,!0)}addManifest(e){this._manifest&&F("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=e,e.bundles.forEach(t=>{this.addBundle(t.name,t.assets)})}addBundle(e,t){let i=[],r=t;Array.isArray(t)||(r=Object.entries(t).map(([n,s])=>typeof s=="string"||Array.isArray(s)?{alias:n,src:s}:{alias:n,...s})),r.forEach(n=>{let s=n.src,a=n.alias,o;if(typeof a=="string"){let l=this._createBundleAssetId(e,a);i.push(l),o=[a,l]}else{let l=a.map(h=>this._createBundleAssetId(e,h));i.push(...l),o=[...a,...l]}this.add({...n,alias:o,src:s})}),this._bundles[e]=i}add(e){let t=[];Array.isArray(e)?t.push(...e):t.push(e);let i;i=r=>{this.hasKey(r)&&F(`[Resolver] already has key: ${r} overwriting`)},Dr(t).forEach(r=>{let{src:n}=r,{data:s,format:a,loadParser:o}=r,l=Dr(n).map(d=>typeof d=="string"?zv(d):Array.isArray(d)?d:[d]),h=this.getAlias(r);Array.isArray(h)?h.forEach(i):i(h);let u=[];l.forEach(d=>{d.forEach(p=>{let f={};if(typeof p!="object"){f.src=p;for(let y=0;y{this._assetMap[d]=u})})}resolveBundle(e){let t=tl(e);e=Dr(e);let i={};return e.forEach(r=>{let n=this._bundles[r];if(n){let s=this.resolve(n),a={};for(let o in s){let l=s[o];a[this._extractAssetIdFromBundle(r,o)]=l}i[r]=a}}),t?i[e[0]]:i}resolveUrl(e){let t=this.resolve(e);if(typeof e!="string"){let i={};for(let r in t)i[r]=t[r].src;return i}return t.src}resolve(e){let t=tl(e);e=Dr(e);let i={};return e.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r],s=this._getPreferredOrder(n);s?.priority.forEach(a=>{s.params[a].forEach(o=>{let l=n.filter(h=>h[a]?h[a]===o:!1);l.length&&(n=l)})}),this._resolverHash[r]=n[0]}else this._resolverHash[r]=this._buildResolvedAsset({alias:[r],src:r},{});i[r]=this._resolverHash[r]}),t?i[e[0]]:i}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;tn.params.format.includes(i.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;let t=/\?/.test(e)?"&":"?";return`${e}${t}${this._defaultSearchParams}`}_buildResolvedAsset(e,t){let{aliases:i,data:r,loadParser:n,format:s}=t;return(this._basePath||this._rootPath)&&(e.src=an.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=i??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...r||{},...e.data},e.loadParser=n??e.loadParser,e.format=s??e.format??jv(e.src),e}},il.RETINA_PREFIX=/@([0-9\.]+)x/}),rl,Xv=v(()=>{"use strict";rl=(e,t)=>{let i=t.split("?")[1];return i&&(e+=`?${i}`),e}});function Yv(){for(let e=0;e<16;e++){let t=[];Ds.push(t);for(let i=0;i<16;i++){let r=In(gr[e]*gr[i]+_r[e]*mr[i]),n=In(mr[e]*gr[i]+vr[e]*mr[i]),s=In(gr[e]*_r[i]+_r[e]*vr[i]),a=In(mr[e]*_r[i]+vr[e]*vr[i]);for(let o=0;o<16;o++)if(gr[o]===r&&mr[o]===n&&_r[o]===s&&vr[o]===a){t.push(o);break}}}for(let e=0;e<16;e++){let t=new ke;t.set(gr[e],mr[e],_r[e],vr[e],0,0),nl.push(t)}}var gr,mr,_r,vr,Ds,nl,In,yt,qv=v(()=>{We(),gr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],mr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],_r=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],vr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ds=[],nl=[],In=Math.sign,Yv(),yt={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:e=>gr[e],uY:e=>mr[e],vX:e=>_r[e],vY:e=>vr[e],inv:e=>e&8?e&15:-e&7,add:(e,t)=>Ds[e][t],sub:(e,t)=>Ds[e][yt.inv(t)],rotate180:e=>e^4,isVertical:e=>(e&3)===2,byDirection:(e,t)=>Math.abs(e)*2<=Math.abs(t)?t>=0?yt.S:yt.N:Math.abs(t)*2<=Math.abs(e)?e>0?yt.E:yt.W:t>0?e>0?yt.SE:yt.SW:e>0?yt.NE:yt.NW,matrixAppendRotationInv:(e,t,i=0,r=0)=>{let n=nl[yt.inv(t)];n.tx=i,n.ty=r,e.append(n)}}}),sl,Kv=v(()=>{"use strict";sl=()=>{}});function on(e){return e+=e===0?1:0,--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e+1}function rd(e){return!(e&e-1)&&!!e}var Ls=v(()=>{"use strict"});function Zv(e){let t={};for(let i in e)e[i]!==void 0&&(t[i]=e[i]);return t}var Jv=v(()=>{"use strict"});function Qv(e){let t=al[e];return t===void 0&&(al[e]=at("resource")),t}var al,ol,nd,ey=v(()=>{xt(),bt(),wt(),al=Object.create(null),ol=class J_ extends Je{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...J_.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){Xe(Ve,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,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 t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=Qv(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}},ol.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"},nd=ol}),ll,Dt,fi=v(()=>{xt(),Ls(),Jv(),bt(),ey(),ll=class Q_ extends Je{constructor(t={}){super(),this.options=t,this.uid=at("textureSource"),this._resourceType="textureSource",this._resourceId=at("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,t={...Q_.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.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=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new nd(Zv(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))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=at("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,i,r){r=r||this._resolution,t=t||this.width,i=i||this.height;let n=Math.round(t*r),s=Math.round(i*r);return this.width=n/r,this.height=s/r,this._resolution=r,this.pixelWidth===n&&this.pixelHeight===s?!1:(this._refreshPOT(),this.pixelWidth=n,this.pixelHeight=s,this.emit("resize",this),this._resourceId=at("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=rd(this.pixelWidth)&&rd(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}},ll.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1},Dt=ll}),Ns,sd=v(()=>{te(),fi(),Ns=class extends Dt{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}},Ns.extension=G.TextureSource}),hl,ul,ad=v(()=>{We(),hl=new ke,ul=class{constructor(e,t){this.mapCoord=new ke,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 r=0;r{xt(),qv(),E(),bt(),wt(),Kv(),sd(),fi(),ad(),Re=class extends Je{constructor({source:e,label:t,frame:i,orig:r,trim:n,defaultAnchor:s,defaultBorders:a,rotate:o,dynamic:l}={}){if(super(),this.uid=at("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new ot,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=t,this.source=e?.source??new Dt,this.noFrame=!i,i)this.frame.copyFrom(i);else{let{width:h,height:u}=this._source;this.frame.width=h,this.frame.height=u}this.orig=r||this.frame,this.trim=n,this.rotate=o??0,this.defaultAnchor=s,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!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 ul(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:r}=this._source,n=t.x/i,s=t.y/r,a=t.width/i,o=t.height/r,l=this.rotate;if(l){let h=a/2,u=o/2,d=n+h,p=s+u;l=yt.add(l,yt.NW),e.x0=d+h*yt.uX(l),e.y0=p+u*yt.uY(l),l=yt.add(l,2),e.x1=d+h*yt.uX(l),e.y1=p+u*yt.uY(l),l=yt.add(l,2),e.x2=d+h*yt.uX(l),e.y2=p+u*yt.uY(l),l=yt.add(l,2),e.x3=d+h*yt.uX(l),e.y3=p+u*yt.uY(l)}else e.x0=n,e.y0=s,e.x1=n+a,e.y1=s,e.x2=n+a,e.y2=s+o,e.x3=n,e.y3=s+o}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 Xe(Ve,"Texture.baseTexture is now Texture.source"),this._source}},Re.EMPTY=new Re({label:"EMPTY",source:new Dt({label:"EMPTY"})}),Re.EMPTY.destroy=sl,Re.WHITE=new Re({source:new Ns({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),Re.WHITE.destroy=sl}),cl,dl,ty=v(()=>{E(),pt(),cl=class Cs{constructor(t,i){this.linkedSheets=[],this._texture=t instanceof Re?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=i;let r=parseFloat(i.meta.scale);r?(this.resolution=r,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Cs.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let i=t,r=Cs.BATCH_SIZE;for(;i-t{this._batchIndex*Cs.BATCH_SIZE{r[n]=t}),Object.keys(t.textures).forEach(n=>{r[n]=t.textures[n]}),!i){let n=an.dirname(e[0]);t.linkedSheets.forEach((s,a)=>{let o=od([`${n}/${t.data.meta.related_multi_packs[a]}`],s,!0);Object.assign(r,o)})}return r}var ld,hd,iy=v(()=>{Fv(),$v(),Xv(),te(),pt(),ed(),ty(),ld=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"],hd={extension:G.Asset,cache:{test:e=>e instanceof dl,getCacheableAssets:(e,t)=>od(e,t,!1)},resolver:{extension:{type:G.ResolveParser,name:"resolveSpritesheet"},test:e=>{let t=e.split("?")[0].split("."),i=t.pop(),r=t.pop();return i==="json"&&ld.includes(r)},parse:e=>{let t=e.split(".");return{resolution:parseFloat(il.RETINA_PREFIX.exec(e)?.[1]??"1"),format:t[t.length-2],src:e}}},loader:{name:"spritesheetLoader",extension:{type:G.LoadParser,priority:Qo.Normal,name:"spritesheetLoader"},async testParse(e,t){return an.extname(t.src).toLowerCase()===".json"&&!!e.frames},async parse(e,t,i){let{texture:r,imageFilename:n}=t?.data??{},s=an.dirname(t.src);s&&s.lastIndexOf("/")!==s.length-1&&(s+="/");let a;if(r instanceof Re)a=r;else{let h=rl(s+(n??e.meta.image),t.src);a=(await i.load([h]))[h]}let o=new dl(a.source,e);await o.parse();let l=e?.meta?.related_multi_packs;if(Array.isArray(l)){let h=[];for(let d of l){if(typeof d!="string")continue;let p=s+d;t.data?.ignoreMultiPack||(p=rl(p,t.src),h.push(i.load({src:p,data:{ignoreMultiPack:!0}})))}let u=await Promise.all(h);o.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[o].concat(o.linkedSheets.filter(p=>p!==d))})}return o},async unload(e,t,i){await i.unload(e.textureSource._sourceOrigin),e.destroy(!1)}}}}),fl=v(()=>{te(),iy(),pe.add(hd)});function Hs(e,t,i,r){let{width:n,height:s}=i.orig,a=i.trim;if(a){let o=a.width,l=a.height;e.minX=a.x-t._x*n-r,e.maxX=e.minX+o,e.minY=a.y-t._y*s-r,e.maxY=e.minY+l}else e.minX=-t._x*n-r,e.maxX=e.minX+n,e.minY=-t._y*s-r,e.maxY=e.minY+s}var pl=v(()=>{"use strict"}),zs,gl=v(()=>{m(),zi(),zs=class extends Tt{constructor(){super(...arguments),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=0,this._lastInstructionTick=-1,this._bounds=new g(0,1,0,0),this._boundsDirty=!0}_updateBounds(){}get roundPixels(){return!!this._roundPixels}set roundPixels(e){this._roundPixels=e?1:0}containsPoint(e){let t=this.bounds,{x:i,y:r}=e;return i>=t.minX&&i<=t.maxX&&r>=t.minY&&r<=t.maxY}destroy(e){super.destroy(e),this._bounds=null}}}),Ws,ud=v(()=>{kr(),pt(),pl(),gl(),Ws=class wc extends zs{constructor(t=Re.EMPTY){t instanceof Re&&(t={texture:t});let{texture:i=Re.EMPTY,anchor:r,roundPixels:n,width:s,height:a,...o}=t;super({label:"Sprite",...o}),this.renderPipeId="sprite",this.batched=!0,this._didSpriteUpdate=!1,this._sourceBounds={minX:0,maxX:1,minY:0,maxY:0},this._sourceBoundsDirty=!0,this._anchor=new $t({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:i.defaultAnchor&&(this.anchor=i.defaultAnchor),this.texture=i,this.allowChildren=!1,this.roundPixels=n??!1,s!==void 0&&(this.width=s),a!==void 0&&(this.height=a)}static from(t,i=!1){return t instanceof Re?new wc(t):new wc(Re.from(t,i))}set texture(t){t||(t=Re.EMPTY);let i=this._texture;i!==t&&(i&&i.dynamic&&i.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}get sourceBounds(){return this._sourceBoundsDirty&&(this._updateSourceBounds(),this._sourceBoundsDirty=!1),this._sourceBounds}containsPoint(t){let i=this.sourceBounds;return t.x>=i.maxX&&t.x<=i.minX&&t.y>=i.maxY&&t.y<=i.minY}addBounds(t){let i=this._texture.trim?this.sourceBounds:this.bounds;t.addFrame(i.minX,i.minY,i.maxX,i.maxY)}onViewUpdate(){if(this._didViewChangeTick++,this._didSpriteUpdate=!0,this._sourceBoundsDirty=this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}_updateBounds(){Hs(this._bounds,this._anchor,this._texture,0)}_updateSourceBounds(){let t=this._anchor,i=this._texture,r=this._sourceBounds,{width:n,height:s}=i.orig;r.maxX=-t._x*n,r.minX=r.maxX+n,r.maxY=-t._y*s,r.minY=r.maxY+s}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(i)}this._texture=null,this._bounds=null,this._sourceBounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,i){let r,n;typeof t!="object"?(r=t,n=i??t):(r=t.width,n=t.height??t.width),r!==void 0&&this._setWidth(r,this._texture.orig.width),n!==void 0&&this._setHeight(n,this._texture.orig.height)}}});function cd(e,t,i){let r=dd;e.measurable=!0,k(e,i,r),t.addBoundsMask(r),e.measurable=!1}var dd,fd=v(()=>{m(),X(),dd=new g});function pd(e,t,i){let r=w.get();e.measurable=!0;let n=x.get().identity(),s=gd(e,i,n);D(e,r,s),e.measurable=!1,t.addBoundsMask(r),x.return(n),w.return(r)}function gd(e,t,i){return e?(e!==t&&(gd(e.parent,t,i),e.updateLocalTransform(),i.append(e.localTransform)),i):(F("Mask bounds, renderable is not inside the root container"),i)}var md=v(()=>{se(),S(),I()}),ml,ry=v(()=>{te(),ud(),fd(),md(),ml=class{constructor(e){this.priority=0,this.pipe="alphaMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.renderMaskToTexture=!(e instanceof Ws),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(e,t){cd(this.mask,e,t)}addLocalBounds(e,t){pd(this.mask,e,t)}containsPoint(e,t){let i=this.mask;return t(i,e)}destroy(){this.reset()}static test(e){return e instanceof Ws}},ml.extension=G.MaskEffect}),_l,ny=v(()=>{te(),_l=class{constructor(e){this.priority=0,this.pipe="colorMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e}destroy(){}static test(e){return typeof e=="number"}},_l.extension=G.MaskEffect}),vl,sy=v(()=>{te(),zi(),fd(),md(),vl=class{constructor(e){this.priority=0,this.pipe="stencilMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(e,t){cd(this.mask,e,t)}addLocalBounds(e,t){pd(this.mask,e,t)}containsPoint(e,t){let i=this.mask;return t(i,e)}destroy(){this.reset()}static test(e){return e instanceof Tt}},vl.extension=G.MaskEffect}),Lr,Vs=v(()=>{Ft(),te(),fi(),Lr=class extends Dt{constructor(e){e.resource||(e.resource=vt.get().createCanvas()),e.width||(e.width=e.resource.width,e.autoDensity||(e.width/=e.resolution)),e.height||(e.height=e.resource.height,e.autoDensity||(e.height/=e.resolution)),super(e),this.uploadMethodId="image",this.autoDensity=e.autoDensity;let t=e.resource;(this.pixelWidth!==t.width||this.pixelWidth!==t.height)&&this.resizeCanvas(),this.transparent=!!e.transparent}resizeCanvas(){this.autoDensity&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(e=this.width,t=this.height,i=this._resolution){let r=super.resize(e,t,i);return r&&this.resizeCanvas(),r}static test(e){return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&e instanceof OffscreenCanvas}},Lr.extension=G.TextureSource}),Gn,yl=v(()=>{Ft(),te(),I(),fi(),Gn=class extends Dt{constructor(e){if(e.resource&&globalThis.HTMLImageElement&&e.resource instanceof HTMLImageElement){let t=vt.get().createCanvas(e.resource.width,e.resource.height);t.getContext("2d").drawImage(e.resource,0,0,e.resource.width,e.resource.height),e.resource=t,F("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(e),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(e){return globalThis.HTMLImageElement&&e instanceof HTMLImageElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||globalThis.VideoFrame&&e instanceof VideoFrame}},Gn.extension=G.TextureSource});async function ay(){return xl??(xl=(async()=>{let e=document.createElement("canvas").getContext("webgl");if(!e)return"premultiply-alpha-on-upload";let t=await new Promise(s=>{let a=document.createElement("video");a.onloadeddata=()=>s(a),a.onerror=()=>s(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!t)return"premultiply-alpha-on-upload";let i=e.createTexture();e.bindTexture(e.TEXTURE_2D,i);let r=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,i,0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t);let n=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,n),e.deleteFramebuffer(r),e.deleteTexture(i),e.getExtension("WEBGL_lose_context")?.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),xl}var xl,oy=v(()=>{"use strict"}),On,_d,ly=v(()=>{te(),Us(),oy(),fi(),On=class ev extends Dt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...ev.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",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._onCanPlayThrough=this._onCanPlayThrough.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()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=Mi.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let t=this.resource,i=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(i.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await ay(),this._load=new Promise((r,n)=>{this.isValid?r(this):(this._resolve=r,this._reject=n,i.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${i.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Mi.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Mi.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Mi.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}},On.extension=G.TextureSource,On.defaultOptions={...Dt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1},On.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},_d=On}),vd,Wt,js=v(()=>{I(),td(),vd=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){let t=this._cache.get(e);return t||F(`[Assets] Asset id ${e} was not found in the Cache`),t}set(e,t){let i=Dr(e),r;for(let o=0;o{n.set(o,t)});let s=[...n.keys()],a={cacheKeys:s,keys:i};i.forEach(o=>{this._cacheMap.set(o,a)}),s.forEach(o=>{let l=r?r[o]:t;this._cache.has(o)&&this._cache.get(o)!==l&&F("[Cache] already has key:",o),this._cache.set(o,n.get(o))})}remove(e){if(!this._cacheMap.has(e)){F(`[Assets] Asset id ${e} was not found in the Cache`);return}let t=this._cacheMap.get(e);t.cacheKeys.forEach(i=>{this._cache.delete(i)}),t.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}},Wt=new vd});function yd(e={}){let t=e&&e.resource,i=t?e.resource:e,r=t?e:{resource:e};for(let n=0;n<$s.length;n++){let s=$s[n];if(s.test(i))return new s(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function hy(e={},t=!1){let i=e&&e.resource,r=i?e.resource:e,n=i?e:{resource:e};if(!t&&Wt.has(r))return Wt.get(r);let s=new Re({source:yd(n)});return s.on("destroy",()=>{Wt.has(r)&&Wt.remove(r)}),t||Wt.set(r,s),s}function uy(e,t=!1){return typeof e=="string"?Wt.get(e):e instanceof Dt?new Re({source:e}):hy(e,t)}var $s,xd=v(()=>{js(),te(),fi(),pt(),$s=[],pe.handleByList(G.TextureSource,$s),Re.from=uy,Dt.from=yd}),bl=v(()=>{te(),ry(),ny(),sy(),sd(),Vs(),yl(),ly(),xd(),pe.add(ml,_l,vl,_d,Gn,Lr,Ns)}),Vi,Nr=v(()=>{"use strict";Vi=class{constructor(e){this.resources=Object.create(null),this._dirty=!0;let t=0;for(let i in e){let r=e[i];this.setResource(r,t++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let e=[],t=0;for(let i in this.resources)e[t++]=this.resources[i]._resourceId;this._key=e.join("|")}setResource(e,t){let i=this.resources[t];e!==i&&(i&&e.off?.("change",this.onResourceChange,this),e.on?.("change",this.onResourceChange,this),this.resources[t]=e,this._dirty=!0)}getResource(e){return this.resources[e]}_touch(e){let t=this.resources;for(let i in t)t[i]._touched=e}destroy(){let e=this.resources;for(let t in e)e[t].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(e){if(this._dirty=!0,e.destroyed){let t=this.resources;for(let i in t)t[i]===e&&(t[i]=null)}else this._updateKey()}}});function bd(){return(!Xs||Xs?.isContextLost())&&(Xs=vt.get().createCanvas().getContext("webgl",{})),Xs}var Xs,wd=v(()=>{Ft()});function cy(e){let t="";for(let i=0;i0&&(t+=`
else `),i{"use strict";Td=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
`)});function yr(){if(Hr)return Hr;let e=bd();return Hr=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),Hr=dy(Hr,e),e.getExtension("WEBGL_lose_context")?.loseContext(),Hr}var Hr,xr=v(()=>{wd(),fy(),Hr=null});function wl(e,t){let i=2166136261;for(let r=0;r>>=0;return Tl[i]||py(e,t,i)}function py(e,t,i){let r={},n=0;Ys||(Ys=yr());for(let a=0;a{Nr(),pt(),xr(),Tl={},Ys=0}),El,gy=v(()=>{"use strict";El=class{constructor(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(e){return this[`${e}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}}});function Al(e,t){let i=e.byteLength/8|0,r=new Float64Array(e,0,i);new Float64Array(t,0,i).set(r);let n=e.byteLength-i*8;if(n>0){let s=new Uint8Array(e,i*8,n);new Uint8Array(t,i*8,n).set(s)}}var Sd=v(()=>{"use strict"}),Ed,Lt,ln=v(()=>{"use strict";Ed={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},Lt=(e=>(e[e.DISABLED=0]="DISABLED",e[e.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",e[e.MASK_ACTIVE=2]="MASK_ACTIVE",e[e.RENDERING_MASK_REMOVE=3]="RENDERING_MASK_REMOVE",e[e.NONE=4]="NONE",e))(Lt||{})});function qs(e,t){return t.alphaMode==="no-premultiply-alpha"&&Ed[e]||e}var Cl=v(()=>{ln()}),Ad,my=v(()=>{"use strict";Ad=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let e=0;e0?Ml[--Ks]:new Pd}function Md(e){Ml[Ks++]=e}var Pd,Ml,Ks,hn,Pl,Rl,Rd=v(()=>{bt(),gy(),Sd(),Cl(),xr(),my(),Pd=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Ad,this.blendMode="normal",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},Ml=[],Ks=0,hn=0,Pl=class Ro{constructor(t={}){this.uid=at("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._vertexSize=6,this._elements=[],Ro.defaultOptions.maxTextures=Ro.defaultOptions.maxTextures??yr(),t={...Ro.defaultOptions,...t};let{vertexSize:i,indexSize:r,maxTextures:n}=t;this.attributeBuffer=new El(i*this._vertexSize*4),this.indexBuffer=new Uint16Array(r),this.maxTextures=n}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;tthis.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let o=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,h=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,p="startBatch",f=this.maxTextures;for(let y=this.elementStart;y=f||C)&&(this._finishBatch(r,d,u-d,n,a,t,p),p="renderBatch",d=u,a=T,r=Cd(),n=r.textures,n.clear(),++hn),b.textureId=_._textureBindLocation=n.count,n.ids[_.uid]=n.count,n.textures[n.count++]=_,b.batch=r,u+=b.indexSize,b.packAttributes(o,l,b.location,b.textureId),b.packIndex(h,b.indexStart,b.location/this._vertexSize)}n.count>0&&(this._finishBatch(r,d,u-d,n,a,t,p),d=u,++hn),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,i,r,n,s,a,o){t.gpuBindGroup=null,t.bindGroup=null,t.action=o,t.batcher=this,t.textures=n,t.blendMode=s,t.start=i,t.size=r,++hn,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){let i=Math.max(t,this.attributeBuffer.size*2),r=new El(i);Al(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(t){let i=this.indexBuffer,r=Math.max(t,i.length*1.5);r+=r%2;let n=r>65535?new Uint32Array(r):new Uint16Array(r);if(n.BYTES_PER_ELEMENT!==i.BYTES_PER_ELEMENT)for(let s=0;s{"use strict";tt=(e=>(e[e.MAP_READ=1]="MAP_READ",e[e.MAP_WRITE=2]="MAP_WRITE",e[e.COPY_SRC=4]="COPY_SRC",e[e.COPY_DST=8]="COPY_DST",e[e.INDEX=16]="INDEX",e[e.VERTEX=32]="VERTEX",e[e.UNIFORM=64]="UNIFORM",e[e.STORAGE=128]="STORAGE",e[e.INDIRECT=256]="INDIRECT",e[e.QUERY_RESOLVE=512]="QUERY_RESOLVE",e[e.STATIC=1024]="STATIC",e))(tt||{})}),wi,un=v(()=>{xt(),bt(),zr(),wi=class extends Je{constructor(e){let{data:t,size:i}=e,{usage:r,label:n,shrinkToFit:s}=e;super(),this.uid=at("buffer"),this._resourceType="buffer",this._resourceId=at("resource"),this._touched=0,this._updateID=1,this.shrinkToFit=!0,this.destroyed=!1,t instanceof Array&&(t=new Float32Array(t)),this._data=t,i=i??t?.byteLength;let a=!!t;this.descriptor={size:i,usage:r,mappedAtCreation:a,label:n},this.shrinkToFit=s??!0}get data(){return this._data}set data(e){this.setDataWithSize(e,e.length,!0)}get static(){return!!(this.descriptor.usage&tt.STATIC)}set static(e){e?this.descriptor.usage|=tt.STATIC:this.descriptor.usage&=~tt.STATIC}setDataWithSize(e,t,i){if(this._updateID++,this._updateSize=t*e.BYTES_PER_ELEMENT,this._data===e){i&&this.emit("update",this);return}let r=this._data;if(this._data=e,r.length!==e.length){!this.shrinkToFit&&e.byteLength{un(),zr()});function vy(e,t,i){let r=e.getAttribute(t);if(!r)return i.minX=0,i.minY=0,i.maxX=0,i.maxY=0,i;let n=r.buffer.data,s=1/0,a=1/0,o=-1/0,l=-1/0,h=n.BYTES_PER_ELEMENT,u=(r.offset||0)/h,d=(r.stride||2*4)/h;for(let p=u;po&&(o=f),y>l&&(l=y),f{"use strict"});function xy(e){return(e instanceof wi||Array.isArray(e)||e.BYTES_PER_ELEMENT)&&(e={buffer:e}),e.buffer=kd(e.buffer,!1),e}var Un,Zs=v(()=>{xt(),m(),bt(),un(),_y(),yy(),Un=class extends Je{constructor(e){let{attributes:t,indexBuffer:i,topology:r}=e;super(),this.uid=at("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new g,this._boundsDirty=!0,this.attributes=t,this.buffers=[],this.instanceCount=e.instanceCount||1;for(let n in t){let s=t[n]=xy(t[n]);this.buffers.indexOf(s.buffer)===-1&&(this.buffers.push(s.buffer),s.buffer.on("update",this.onBufferUpdate,this),s.buffer.on("change",this.onBufferUpdate,this))}i&&(this.indexBuffer=kd(i,!0),this.buffers.push(this.indexBuffer)),this.topology=r||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(e){return this.attributes[e]}getIndex(){return this.indexBuffer}getBuffer(e){return this.getAttribute(e).buffer}getSize(){for(let e in this.attributes){let t=this.attributes[e];return t.buffer.data.length/(t.stride/4||t.size)}return 0}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,vy(this,"aPosition",this._bounds)):this._bounds}destroy(e=!1){this.emit("destroy",this),this.removeAllListeners(),e&&this.buffers.forEach(t=>t.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}}),Bd,Id,kl,Gd=v(()=>{un(),zr(),Zs(),Bd=new Float32Array(1),Id=new Uint32Array(1),kl=class extends Un{constructor(){let e=new wi({data:Bd,label:"attribute-batch-buffer",usage:tt.VERTEX|tt.COPY_DST,shrinkToFit:!1}),t=new wi({data:Id,label:"index-batch-buffer",usage:tt.INDEX|tt.COPY_DST,shrinkToFit:!1}),i=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:i,offset:0},aUV:{buffer:e,format:"float32x2",stride:i,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:i,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:i,offset:5*4}},indexBuffer:t})}}});function by(e,t,i,r,n,s,a,o=null){let l=0;i*=t,n*=s;let h=o.a,u=o.b,d=o.c,p=o.d,f=o.tx,y=o.ty;for(;l{"use strict"});function Od(e,t,i,r,n){let s=t.a,a=t.b,o=t.c,l=t.d,h=t.tx,u=t.ty;i=i||0,r=r||2,n=n||e.length/r-i;let d=i*r;for(let p=0;p{"use strict"});function Ey(e,t){if(e===16777215||!t)return t;if(t===16777215||!e)return e;let i=e>>16&255,r=e>>8&255,n=e&255,s=t>>16&255,a=t>>8&255,o=t&255,l=i*s/255,h=r*a/255,u=n*o/255;return(l<<16)+(h<<8)+u}var Ay=v(()=>{"use strict"}),Js,Ud=v(()=>{Ay(),Js=class{constructor(){this.batcher=null,this.batch=null,this.applyTransform=!0,this.roundPixels=0}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}packIndex(e,t,i){let r=this.geometryData.indices;for(let n=0;n>16|u&65280|(u&255)<<16;if(this.applyTransform){let p=Ey(d,s.groupColor)+(this.alpha*s.groupAlpha*255<<24),f=s.groupTransform,y=r<<16|this.roundPixels&65535,b=f.a,_=f.b,T=f.c,C=f.d,O=f.tx,R=f.ty;for(let z=l;z{te(),cn={extension:{type:G.ShapeBuilder,name:"circle"},build(e,t){let i,r,n,s,a,o;if(e.type==="circle"){let R=e;i=R.x,r=R.y,a=o=R.radius,n=s=0}else if(e.type==="ellipse"){let R=e;i=R.x,r=R.y,a=R.halfWidth,o=R.halfHeight,n=s=0}else{let R=e,z=R.width/2,ee=R.height/2;i=R.x+z,r=R.y+ee,a=o=Math.max(0,Math.min(R.radius,Math.min(z,ee))),n=z-a,s=ee-o}if(!(a>=0&&o>=0&&n>=0&&s>=0))return t;let l=Math.ceil(2.3*Math.sqrt(a+o)),h=l*8+(n?4:0)+(s?4:0);if(h===0)return t;if(l===0)return t[0]=t[6]=i+n,t[1]=t[3]=r+s,t[2]=t[4]=i-n,t[5]=t[7]=r-s,t;let u=0,d=l*4+(n?2:0)+2,p=d,f=h,y=n+a,b=s,_=i+y,T=i-y,C=r+b;if(t[u++]=_,t[u++]=C,t[--d]=C,t[--d]=T,s){let R=r-b;t[p++]=T,t[p++]=R,t[--f]=R,t[--f]=_}for(let R=1;R0&&(n[s++]=l,n[s++]=h,n[s++]=l-1),l++;n[s++]=h+1,n[s++]=h,n[s++]=l-1}},Fd={...cn,extension:{...cn.extension,name:"ellipse"}},Dd={...cn,extension:{...cn.extension,name:"roundedRectangle"}}});function My(e){let t=e.length;if(t<6)return 1;let i=0;for(let r=0,n=e[t-2],s=e[t-1];r{"use strict"});function Ld(e,t,i,r,n,s,a,o){let l=e-i*n,h=t-r*n,u=e+i*s,d=t+r*s,p,f;a?(p=r,f=-i):(p=-r,f=i);let y=l+p,b=h+f,_=u+p,T=d+f;return o.push(y,b),o.push(_,T),2}function Wr(e,t,i,r,n,s,a,o){let l=i-e,h=r-t,u=Math.atan2(l,h),d=Math.atan2(n-e,s-t);o&&ud&&(d+=Math.PI*2);let p=u,f=d-u,y=Math.abs(f),b=Math.sqrt(l*l+h*h),_=(15*y*Math.sqrt(b)/Math.PI>>0)+1,T=f/_;if(p+=T,o){a.push(e,t),a.push(i,r);for(let C=1,O=p;C<_;C++,O+=T)a.push(e,t),a.push(e+Math.sin(O)*b,t+Math.cos(O)*b);a.push(e,t),a.push(n,s)}else{a.push(i,r),a.push(e,t);for(let C=1,O=p;C<_;C++,O+=T)a.push(e+Math.sin(O)*b,t+Math.cos(O)*b),a.push(e,t);a.push(n,s),a.push(e,t)}return _*2}function Ry(e,t,i,r,n,s,a,o,l){let h=1e-4;if(e.length===0)return;let u=t,d=u.alignment;if(t.alignment!==.5){let H=My(e);i&&(H*=-1),d=(d-.5)*H+.5}let p=new De(e[0],e[1]),f=new De(e[e.length-2],e[e.length-1]),y=r,b=Math.abs(p.x-f.x)=0&&(u.join==="round"?C+=Wr(Y,ie,Y-ce*P,ie-U*P,Y-ae*P,ie-K*P,_,!1)+4:C+=2,_.push(Y-ae*A,ie-K*A),_.push(Y+ae*P,ie+K*P));continue}let Ye=(-ce+ne)*(-U+ie)-(-ce+Y)*(-U+Q),St=(-ae+Te)*(-K+ie)-(-ae+Y)*(-K+Pe),Ze=(J*St-oe*Ye)/Oe,_i=(be*Ye-Z*St)/Oe,Oi=(Ze-Y)*(Ze-Y)+(_i-ie)*(_i-ie),q=Y+(Ze-Y)*P,le=ie+(_i-ie)*P,he=Y-(Ze-Y)*A,ge=ie-(_i-ie)*A,Mt=Math.min(J*J+Z*Z,oe*oe+be*be),Es=Ne?P:A,xc=Mt+Es*Es*z;Oi<=xc?u.join==="bevel"||Oi/z>ee?(Ne?(_.push(q,le),_.push(Y+ce*A,ie+U*A),_.push(q,le),_.push(Y+ae*A,ie+K*A)):(_.push(Y-ce*P,ie-U*P),_.push(he,ge),_.push(Y-ae*P,ie-K*P),_.push(he,ge)),C+=2):u.join==="round"?Ne?(_.push(q,le),_.push(Y+ce*A,ie+U*A),C+=Wr(Y,ie,Y+ce*A,ie+U*A,Y+ae*A,ie+K*A,_,!0)+4,_.push(q,le),_.push(Y+ae*A,ie+K*A)):(_.push(Y-ce*P,ie-U*P),_.push(he,ge),C+=Wr(Y,ie,Y-ce*P,ie-U*P,Y-ae*P,ie-K*P,_,!1)+4,_.push(Y-ae*P,ie-K*P),_.push(he,ge)):(_.push(q,le),_.push(he,ge)):(_.push(Y-ce*P,ie-U*P),_.push(Y+ce*A,ie+U*A),u.join==="round"?Ne?C+=Wr(Y,ie,Y+ce*A,ie+U*A,Y+ae*A,ie+K*A,_,!0)+2:C+=Wr(Y,ie,Y-ce*P,ie-U*P,Y-ae*P,ie-K*P,_,!1)+2:u.join==="miter"&&Oi/z<=ee&&(Ne?(_.push(he,ge),_.push(he,ge)):(_.push(q,le),_.push(q,le)),C+=2),_.push(Y-ae*P,ie-K*P),_.push(Y+ae*A,ie+K*A),C+=2)}ne=e[(T-2)*2],Q=e[(T-2)*2+1],Y=e[(T-1)*2],ie=e[(T-1)*2+1],ce=-(Q-ie),U=ne-Y,de=Math.sqrt(ce*ce+U*U),ce/=de,U/=de,ce*=R,U*=R,_.push(Y-ce*P,ie-U*P),_.push(Y+ce*A,ie+U*A),y||(u.cap==="round"?C+=Wr(Y-ce*(P-A)*.5,ie-U*(P-A)*.5,Y-ce*P,ie-U*P,Y+ce*A,ie+U*A,_,!1)+2:u.cap==="square"&&(C+=Ld(Y,ie,ce,U,P,A,!1,_)));let j=1e-4*1e-4;for(let H=O;H{At(),Py()}),Nd=Ue((e,t)=>{"use strict";t.exports=i,t.exports.default=i;function i(M,P,A){A=A||2;var j=P&&P.length,H=j?P[0]*A:M.length,J=r(M,0,H,A,!0),Z=[];if(!J||J.next===J.prev)return Z;var oe,be,me,Oe,Ne,Ye,St;if(j&&(J=u(M,P,J,A)),M.length>80*A){oe=me=M[0],be=Oe=M[1];for(var Ze=A;Zeme&&(me=Ne),Ye>Oe&&(Oe=Ye);St=Math.max(me-oe,Oe-be),St=St!==0?32767/St:0}return s(J,Z,A,oe,be,St,0),Z}function r(M,P,A,j,H){var J,Z;if(H===de(M,P,A,j)>0)for(J=P;J=P;J-=j)Z=U(J,M[J],M[J+1],Z);return Z&&ee(Z,Z.next)&&(ae(Z),Z=Z.next),Z}function n(M,P){if(!M)return M;P||(P=M);var A=M,j;do if(j=!1,!A.steiner&&(ee(A,A.next)||z(A.prev,A,A.next)===0)){if(ae(A),A=P=A.prev,A===A.next)break;j=!0}else A=A.next;while(j||A!==P);return P}function s(M,P,A,j,H,J,Z){if(M){!Z&&J&&b(M,j,H,J);for(var oe=M,be,me;M.prev!==M.next;){if(be=M.prev,me=M.next,J?o(M,j,H,J):a(M)){P.push(be.i/A|0),P.push(M.i/A|0),P.push(me.i/A|0),ae(M),M=me.next,oe=me.next;continue}if(M=me,M===oe){Z?Z===1?(M=l(n(M),P,A),s(M,P,A,j,H,J,2)):Z===2&&h(M,P,A,j,H,J):s(n(M),P,A,j,H,J,1);break}}}}function a(M){var P=M.prev,A=M,j=M.next;if(z(P,A,j)>=0)return!1;for(var H=P.x,J=A.x,Z=j.x,oe=P.y,be=A.y,me=j.y,Oe=HJ?H>Z?H:Z:J>Z?J:Z,St=oe>be?oe>me?oe:me:be>me?be:me,Ze=j.next;Ze!==P;){if(Ze.x>=Oe&&Ze.x<=Ye&&Ze.y>=Ne&&Ze.y<=St&&O(H,oe,J,be,Z,me,Ze.x,Ze.y)&&z(Ze.prev,Ze,Ze.next)>=0)return!1;Ze=Ze.next}return!0}function o(M,P,A,j){var H=M.prev,J=M,Z=M.next;if(z(H,J,Z)>=0)return!1;for(var oe=H.x,be=J.x,me=Z.x,Oe=H.y,Ne=J.y,Ye=Z.y,St=oebe?oe>me?oe:me:be>me?be:me,Oi=Oe>Ne?Oe>Ye?Oe:Ye:Ne>Ye?Ne:Ye,q=T(St,Ze,P,A,j),le=T(_i,Oi,P,A,j),he=M.prevZ,ge=M.nextZ;he&&he.z>=q&&ge&&ge.z<=le;){if(he.x>=St&&he.x<=_i&&he.y>=Ze&&he.y<=Oi&&he!==H&&he!==Z&&O(oe,Oe,be,Ne,me,Ye,he.x,he.y)&&z(he.prev,he,he.next)>=0||(he=he.prevZ,ge.x>=St&&ge.x<=_i&&ge.y>=Ze&&ge.y<=Oi&&ge!==H&&ge!==Z&&O(oe,Oe,be,Ne,me,Ye,ge.x,ge.y)&&z(ge.prev,ge,ge.next)>=0))return!1;ge=ge.nextZ}for(;he&&he.z>=q;){if(he.x>=St&&he.x<=_i&&he.y>=Ze&&he.y<=Oi&&he!==H&&he!==Z&&O(oe,Oe,be,Ne,me,Ye,he.x,he.y)&&z(he.prev,he,he.next)>=0)return!1;he=he.prevZ}for(;ge&&ge.z<=le;){if(ge.x>=St&&ge.x<=_i&&ge.y>=Ze&&ge.y<=Oi&&ge!==H&&ge!==Z&&O(oe,Oe,be,Ne,me,Ye,ge.x,ge.y)&&z(ge.prev,ge,ge.next)>=0)return!1;ge=ge.nextZ}return!0}function l(M,P,A){var j=M;do{var H=j.prev,J=j.next.next;!ee(H,J)&&ne(H,j,j.next,J)&&Te(H,J)&&Te(J,H)&&(P.push(H.i/A|0),P.push(j.i/A|0),P.push(J.i/A|0),ae(j),ae(j.next),j=M=J),j=j.next}while(j!==M);return n(j)}function h(M,P,A,j,H,J){var Z=M;do{for(var oe=Z.next.next;oe!==Z.prev;){if(Z.i!==oe.i&&R(Z,oe)){var be=ce(Z,oe);Z=n(Z,Z.next),be=n(be,be.next),s(Z,P,A,j,H,J,0),s(be,P,A,j,H,J,0);return}oe=oe.next}Z=Z.next}while(Z!==M)}function u(M,P,A,j){var H=[],J,Z,oe,be,me;for(J=0,Z=P.length;J=A.next.y&&A.next.y!==A.y){var oe=A.x+(H-A.y)*(A.next.x-A.x)/(A.next.y-A.y);if(oe<=j&&oe>J&&(J=oe,Z=A.x=A.x&&A.x>=me&&j!==A.x&&O(HZ.x||A.x===Z.x&&y(Z,A)))&&(Z=A,Ne=Ye)),A=A.next;while(A!==be);return Z}function y(M,P){return z(M.prev,M,P.prev)<0&&z(P.next,M,M.next)<0}function b(M,P,A,j){var H=M;do H.z===0&&(H.z=T(H.x,H.y,P,A,j)),H.prevZ=H.prev,H.nextZ=H.next,H=H.next;while(H!==M);H.prevZ.nextZ=null,H.prevZ=null,_(H)}function _(M){var P,A,j,H,J,Z,oe,be,me=1;do{for(A=M,M=null,J=null,Z=0;A;){for(Z++,j=A,oe=0,P=0;P0||be>0&&j;)oe!==0&&(be===0||!j||A.z<=j.z)?(H=A,A=A.nextZ,oe--):(H=j,j=j.nextZ,be--),J?J.nextZ=H:M=H,H.prevZ=J,J=H;A=j}J.nextZ=null,me*=2}while(Z>1);return M}function T(M,P,A,j,H){return M=(M-A)*H|0,P=(P-j)*H|0,M=(M|M<<8)&16711935,M=(M|M<<4)&252645135,M=(M|M<<2)&858993459,M=(M|M<<1)&1431655765,P=(P|P<<8)&16711935,P=(P|P<<4)&252645135,P=(P|P<<2)&858993459,P=(P|P<<1)&1431655765,M|P<<1}function C(M){var P=M,A=M;do(P.x=(M-Z)*(J-oe)&&(M-Z)*(j-oe)>=(A-Z)*(P-oe)&&(A-Z)*(J-oe)>=(H-Z)*(j-oe)}function R(M,P){return M.next.i!==P.i&&M.prev.i!==P.i&&!ie(M,P)&&(Te(M,P)&&Te(P,M)&&Pe(M,P)&&(z(M.prev,M,P.prev)||z(M,P.prev,P))||ee(M,P)&&z(M.prev,M,M.next)>0&&z(P.prev,P,P.next)>0)}function z(M,P,A){return(P.y-M.y)*(A.x-P.x)-(P.x-M.x)*(A.y-P.y)}function ee(M,P){return M.x===P.x&&M.y===P.y}function ne(M,P,A,j){var H=Y(z(M,P,A)),J=Y(z(M,P,j)),Z=Y(z(A,j,M)),oe=Y(z(A,j,P));return!!(H!==J&&Z!==oe||H===0&&Q(M,A,P)||J===0&&Q(M,j,P)||Z===0&&Q(A,M,j)||oe===0&&Q(A,P,j))}function Q(M,P,A){return P.x<=Math.max(M.x,A.x)&&P.x>=Math.min(M.x,A.x)&&P.y<=Math.max(M.y,A.y)&&P.y>=Math.min(M.y,A.y)}function Y(M){return M>0?1:M<0?-1:0}function ie(M,P){var A=M;do{if(A.i!==M.i&&A.next.i!==M.i&&A.i!==P.i&&A.next.i!==P.i&&ne(A,A.next,M,P))return!0;A=A.next}while(A!==M);return!1}function Te(M,P){return z(M.prev,M,M.next)<0?z(M,P,M.next)>=0&&z(M,M.prev,P)>=0:z(M,P,M.prev)<0||z(M,M.next,P)<0}function Pe(M,P){var A=M,j=!1,H=(M.x+P.x)/2,J=(M.y+P.y)/2;do A.y>J!=A.next.y>J&&A.next.y!==A.y&&H<(A.next.x-A.x)*(J-A.y)/(A.next.y-A.y)+A.x&&(j=!j),A=A.next;while(A!==M);return j}function ce(M,P){var A=new K(M.i,M.x,M.y),j=new K(P.i,P.x,P.y),H=M.next,J=P.prev;return M.next=P,P.prev=M,A.next=H,H.prev=A,j.next=A,A.prev=j,J.next=j,j.prev=J,j}function U(M,P,A,j){var H=new K(M,P,A);return j?(H.next=j.next,H.prev=j,j.next.prev=H,j.next=H):(H.prev=H,H.next=H),H}function ae(M){M.next.prev=M.prev,M.prev.next=M.next,M.prevZ&&(M.prevZ.nextZ=M.nextZ),M.nextZ&&(M.nextZ.prevZ=M.prevZ)}function K(M,P,A){this.i=M,this.x=P,this.y=A,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}i.deviation=function(M,P,A,j){var H=P&&P.length,J=H?P[0]*A:M.length,Z=Math.abs(de(M,0,J,A));if(H)for(var oe=0,be=P.length;oe0&&(j+=M[H-1].length,A.holes.push(j))}return A}});function Hd(e,t,i,r,n,s,a){let o=(0,zd.default)(e,t,2);if(!o)return;for(let h=0;h{zd=ht(Nd(),1)}),Vd,jd,By=v(()=>{te(),Wd(),Vd=[],jd={extension:{type:G.ShapeBuilder,name:"polygon"},build(e,t){for(let i=0;i{te(),$d={extension:{type:G.ShapeBuilder,name:"rectangle"},build(e,t){let i=e,r=i.x,n=i.y,s=i.width,a=i.height;return s>=0&&a>=0&&(t[0]=r,t[1]=n,t[2]=r+s,t[3]=n,t[4]=r+s,t[5]=n+a,t[6]=r,t[7]=n+a),t},triangulate(e,t,i,r,n,s){let a=0;r*=i,t[r+a]=e[0],t[r+a+1]=e[1],a+=i,t[r+a]=e[2],t[r+a+1]=e[3],a+=i,t[r+a]=e[6],t[r+a+1]=e[7],a+=i,t[r+a]=e[4],t[r+a+1]=e[5],a+=i;let o=r/i;n[s++]=o,n[s++]=o+1,n[s++]=o+2,n[s++]=o+1,n[s++]=o+3,n[s++]=o+2}}}),Xd,Gy=v(()=>{te(),Xd={extension:{type:G.ShapeBuilder,name:"triangle"},build(e,t){return t[0]=e.x,t[1]=e.y,t[2]=e.x2,t[3]=e.y2,t[4]=e.x3,t[5]=e.y3,t},triangulate(e,t,i,r,n,s){let a=0;r*=i,t[r+a]=e[0],t[r+a+1]=e[1],a+=i,t[r+a]=e[2],t[r+a+1]=e[3],a+=i,t[r+a]=e[4],t[r+a+1]=e[5];let o=r/i;n[s++]=o,n[s++]=o+1,n[s++]=o+2}}});function Oy(e,t){let{geometryData:i,batches:r}=t;r.length=0,i.indices.length=0,i.vertices.length=0,i.uvs.length=0;for(let n=0;n{let f=l.length,y=a.length/2,b=[],_=Fn[u.type];if(_.build(u,b),d&&Od(b,d),r){let R=u.closePath??!0;Ry(b,t,!1,R,a,2,y,l,f)}else if(i&&h===p){h!==0&&console.warn("[Pixi Graphics] only the last shape have be cut out");let R=[],z=b.slice();Fy(i.shapePath).forEach(ee=>{R.push(z.length/2),z.push(...ee)}),Hd(z,R,a,2,y,l,f)}else _.triangulate(b,a,2,y,l,f);let T=o.length/2,C=t.texture;if(C!==Re.WHITE){let R=t.matrix;R&&(d&&R.append(d.clone().invert()),by(a,2,y,o,T,2,a.length/2-y,R))}else wy(o,T,2,a.length/2-y);let O=Le.get(Js);O.indexOffset=f,O.indexSize=l.length-f,O.vertexOffset=y,O.vertexSize=a.length/2-y,O.color=t.color,O.alpha=t.alpha,O.texture=C,O.geometryData=s,n.push(O)})}function Fy(e){if(!e)return[];let t=e.shapePrimitives,i=[];for(let r=0;r{te(),E(),Ty(),Sy(),pt(),Ht(),Ud(),Cy(),ky(),By(),Iy(),Gy(),Wd(),Fn={},pe.handleByMap(G.ShapeBuilder,Fn),pe.add($d,jd,Xd,cn,Fd,Dd),qd=new ot}),Kd,Zd,Qs,ea,Bl=v(()=>{te(),Sl(),Rd(),Gd(),lt(),Ht(),Dy(),Kd=class{constructor(){this.batcher=new Rl,this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Zd=class{constructor(){this.geometry=new kl,this.instructions=new et}init(){this.instructions.reset()}},Qs=class Tc{constructor(){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null)}init(t){Tc.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Tc.defaultOptions.bezierSmoothness}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let i=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){i?this._cleanGraphicsContextData(t):i=this._initContext(t),Oy(t,i);let r=t.batchMode;t.customShader||r==="no-batch"?i.isBatchable=!1:r==="auto"&&(i.isBatchable=i.geometryData.vertices.length<400),t.dirty=!1}return i}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let i=Le.get(Zd),{batches:r,geometryData:n,batcher:s}=this._gpuContextHash[t.uid],a=n.vertices.length,o=n.indices.length;for(let u=0;u{Le.return(r)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}},Qs.extension={type:[G.WebGLSystem,G.WebGPUSystem,G.CanvasSystem],name:"graphicsContext"},Qs.defaultOptions={bezierSmoothness:.5},ea=Qs}),Jd,ta,ia,ra,na,sa,aa,oa,ji,nr=v(()=>{"use strict";Jd={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},ta=0,ia=1,ra=2,na=3,sa=4,aa=5,oa=class tv{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<>24&255)/255;t[i++]=(e&255)/255*r,t[i++]=(e>>8&255)/255*r,t[i++]=(e>>16&255)/255*r,t[i++]=r}var ha=v(()=>{"use strict"}),Il,Ly=v(()=>{te(),nr(),Ht(),ha(),Ud(),Il=class{constructor(e,t){this.state=ji.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init()}validateRenderable(e){let t=e.context,i=!!this._graphicsBatchesHash[e.uid],r=this.renderer.graphicsContext.updateGpuContext(t);return!!(r.isBatchable||i!==r.isBatchable)}addRenderable(e,t){let i=this.renderer.graphicsContext.updateGpuContext(e.context);e._didGraphicsUpdate&&(e._didGraphicsUpdate=!1,this._rebuild(e)),i.isBatchable?this._addToBatcher(e):(this.renderer.renderPipes.batch.break(t),t.add(e))}updateRenderable(e){let t=this._graphicsBatchesHash[e.uid];if(t)for(let i=0;i{let a=Le.get(Js);return s.copyTo(a),a.renderable=e,a.roundPixels=r,a});return this._graphicsBatchesHash[e.uid]===void 0&&e.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[e.uid]=n,n}_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}},Il.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"graphics"}}),Qd=v(()=>{te(),Bl(),Ly(),pe.add(Il),pe.add(ea)});function Dn(e,t){let i=Gl[e];return i===void 0&&(ua[t]===void 0&&(ua[t]=1),Gl[e]=i=ua[t]++),i}var ua,Gl,ca=v(()=>{"use strict";ua=Object.create(null),Gl=Object.create(null)}),Ol,ef,Ny=v(()=>{"use strict";Ol=["f32","i32","vec2","vec3","vec4","mat2x2","mat3x3","mat4x4","mat3x2","mat4x2","mat2x3","mat4x3","mat2x4","mat3x4"],ef=Ol.reduce((e,t)=>(e[t]=!0,e),{})});function Hy(e,t){switch(e){case"f32":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"mat2x2":return new Float32Array([1,0,0,1]);case"mat3x3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var zy=v(()=>{"use strict"}),Ul,ti,pi=v(()=>{bt(),ca(),Ny(),zy(),Ul=class iv{constructor(t,i){this._touched=0,this.uid=at("uniform"),this._resourceType="uniformGroup",this._resourceId=at("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,i={...iv.defaultOptions,...i},this.uniformStructures=t;let r={};for(let n in t){let s=t[n];if(s.name=n,s.size=s.size??1,!ef[s.type])throw new Error(`Uniform type ${s.type} is not supported. Supported uniform types are: ${Ol.join(", ")}`);s.value??(s.value=Hy(s.type,s.size)),r[n]=s.value}this.uniforms=r,this._dirtyId=1,this.ubo=i.ubo,this.isStatic=i.isStatic,this._signature=Dn(Object.keys(r).map(n=>`${n}-${t[n].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}},Ul.defaultOptions={ubo:!1,isStatic:!1},ti=Ul}),da,Fl=v(()=>{"use strict";da=class{constructor(){this.batcher=null,this.batch=null,this.roundPixels=0,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get blendMode(){return this.mesh.groupBlendMode}reset(){this.mesh=null,this.texture=null,this.batcher=null,this.batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}packIndex(e,t,i){let r=this.geometry.indices;for(let n=0;n{te(),We(),Nr(),pi(),Cl(),Ht(),ha(),Fl(),Dl=class{constructor(e,t){this.localUniforms=new ti({uTransformMatrix:{value:new ke,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Vi({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()}validateRenderable(e){let t=this._getMeshData(e),i=t.batched,r=e.batched;if(t.batched=r,i!==r)return!0;if(r){let n=e._geometry;if(n.indices.length!==t.indexSize||n.positions.length!==t.vertexSize)return t.indexSize=n.indices.length,t.vertexSize=n.positions.length,!0;let s=this._getBatchableMesh(e),a=e.texture;if(s.texture._source!==a._source&&s.texture._source!==a._source)return!s.batcher.checkAndUpdateTexture(s,a)}return!1}addRenderable(e,t){let i=this.renderer.renderPipes.batch,{batched:r}=this._getMeshData(e);if(r){let n=this._getBatchableMesh(e);n.texture=e._texture,n.geometry=e._geometry,i.addToBatch(n)}else i.break(t),t.add(e)}updateRenderable(e){if(e.batched){let t=this._gpuBatchableMeshHash[e.uid];t.texture=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=qs(e.groupBlendMode,e.texture._source);let t=this.localUniforms;t.uniforms.uTransformMatrix=e.groupTransform,t.uniforms.uRound=this.renderer._roundPixels|e._roundPixels,t.update(),la(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(da);return t.mesh=e,t.texture=e._texture,t.roundPixels=this.renderer._roundPixels|e._roundPixels,this._gpuBatchableMeshHash[e.uid]=t,t.mesh=e,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}},Dl.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"mesh"}}),tf=v(()=>{te(),Wy(),pe.add(Dl)}),fa,Ll=v(()=>{"use strict";fa=class{constructor(){this.vertexSize=4,this.indexSize=6,this.location=0,this.batcher=null,this.batch=null,this.roundPixels=0}get blendMode(){return this.renderable.groupBlendMode}packAttributes(e,t,i,r){let n=this.renderable,s=this.texture,a=n.groupTransform,o=a.a,l=a.b,h=a.c,u=a.d,d=a.tx,p=a.ty,f=this.bounds,y=f.maxX,b=f.minX,_=f.maxY,T=f.minY,C=s.uvs,O=n.groupColorAlpha,R=r<<16|this.roundPixels&65535;e[i+0]=o*b+h*T+d,e[i+1]=u*T+l*b+p,e[i+2]=C.x0,e[i+3]=C.y0,t[i+4]=O,t[i+5]=R,e[i+6]=o*y+h*T+d,e[i+7]=u*T+l*y+p,e[i+8]=C.x1,e[i+9]=C.y1,t[i+10]=O,t[i+11]=R,e[i+12]=o*y+h*_+d,e[i+13]=u*_+l*y+p,e[i+14]=C.x2,e[i+15]=C.y2,t[i+16]=O,t[i+17]=R,e[i+18]=o*b+h*_+d,e[i+19]=u*_+l*b+p,e[i+20]=C.x3,e[i+21]=C.y3,t[i+22]=O,t[i+23]=R}packIndex(e,t,i){e[t]=i+0,e[t+1]=i+1,e[t+2]=i+2,e[t+3]=i+0,e[t+4]=i+2,e[t+5]=i+3}reset(){this.renderable=null,this.texture=null,this.batcher=null,this.batch=null,this.bounds=null}}}),Nl,Vy=v(()=>{te(),pl(),Ht(),Ll(),Nl=class{constructor(e){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.runners.resolutionChange.add(this)}resolutionChange(){for(let e in this._gpuText){let t=this._gpuText[e].batchableSprite.renderable;t._autoResolution&&(t._resolution=this._renderer.resolution,t.onViewUpdate())}}validateRenderable(e){let t=this._getGpuText(e),i=e._getKey();if(t.currentKey!==i){let{width:r,height:n}=this._renderer.canvasText.getTextureSize(e.text,e.resolution,e._style);return!(this._renderer.canvasText.getReferenceCount(t.currentKey)===1&&r===t.texture._source.width&&n===t.texture._source.height)}return!1}addRenderable(e,t){let i=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),this._renderer.renderPipes.batch.addToBatch(i)}updateRenderable(e){let t=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),t.batcher.updateElement(t)}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),r=i.batchableSprite;i.currentKey!==t&&this._updateGpuText(e),e._didTextUpdate=!1;let n=e._style.padding;Hs(r.bounds,e._anchor,r.texture,n)}_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(fa)};return t.batchableSprite.renderable=e,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}},Nl.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"text"}}),rf,$i,pa=v(()=>{Ft(),Ls(),rf=class{constructor(e){this._canvasPool=Object.create(null),this.canvasOptions=e||{},this.enableFullScreen=!1}_createCanvasAndContext(e,t){let i=vt.get().createCanvas();i.width=e,i.height=t;let r=i.getContext("2d");return{canvas:i,context:r}}getOptimalCanvasAndContext(e,t,i=1){e=Math.ceil(e*i-1e-6),t=Math.ceil(t*i-1e-6),e=on(e),t=on(t);let r=(e<<17)+(t<<1);this._canvasPool[r]||(this._canvasPool[r]=[]);let n=this._canvasPool[r].pop();return n||(n=this._createCanvasAndContext(e,t)),n}returnCanvasAndContext(e){let t=e.canvas,{width:i,height:r}=t,n=(i<<17)+(r<<1);this._canvasPool[n].push(e)}clear(){this._canvasPool={}}},$i=new rf}),nf,sf,gi,Ln=v(()=>{Ls(),fi(),pt(),nf=0,sf=class{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1}createTexture(e,t,i){let r=new Dt({...this.textureOptions,width:e,height:t,resolution:1,antialias:i,autoGarbageCollect:!0});return new Re({source:r,label:`texturePool_${nf++}`})}getOptimalTexture(e,t,i=1,r){let n=Math.ceil(e*i-1e-6),s=Math.ceil(t*i-1e-6);n=on(n),s=on(s);let a=(n<<17)+(s<<1)+(r?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let o=this._texturePool[a].pop();return o||(o=this.createTexture(n,s,r)),o.source._resolution=i,o.source.width=n/i,o.source.height=s/i,o.source.pixelWidth=n,o.source.pixelHeight=s,o.frame.x=0,o.frame.y=0,o.frame.width=e,o.frame.height=t,o.updateUvs(),this._poolKeyHash[o.uid]=a,o}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 r=0;r{E()}),Hl,dn,zl=v(()=>{Ie(),Ft(),We(),yl(),pt(),bt(),Hl=class Sc{constructor(t,i,r,n){this.uid=at("fillGradient"),this.type="linear",this.gradientStops=[],this._styleKey=null,this.x0=t,this.y0=i,this.x1=r,this.y1=n}addColorStop(t,i){return this.gradientStops.push({offset:t,color:ue.shared.setValue(i).toHexa()}),this._styleKey=null,this}buildLinearGradient(){let t=Sc.defaultTextureSize,{gradientStops:i}=this,r=vt.get().createCanvas();r.width=t,r.height=t;let n=r.getContext("2d"),s=n.createLinearGradient(0,0,Sc.defaultTextureSize,1);for(let b=0;b`${n.offset}-${n.color}`).join("-"),i=this.texture.uid,r=this.transform.toArray().join("-");return`fill-gradient-${this.uid}-${t}-${i}-${r}-${this.x0}-${this.y0}-${this.x1}-${this.y1}`}},Hl.defaultTextureSize=256,dn=Hl}),Wl,Nn,Vl=v(()=>{We(),bt(),Wl={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"}},Nn=class{constructor(e,t){this.uid=at("fillPattern"),this.transform=new ke,this._styleKey=null,this.texture=e,this.transform.scale(1/e.frame.width,1/e.frame.height),t&&(e.source.style.addressModeU=Wl[t].addressModeU,e.source.style.addressModeV=Wl[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)}}}),Xy=Ue((e,t)=>{t.exports=n;var i={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},r=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function n(o){var l=[];return o.replace(r,function(h,u,d){var p=u.toLowerCase();for(d=a(d),p=="m"&&d.length>2&&(l.push([u].concat(d.splice(0,2))),p="l",u=u=="m"?"l":"L");;){if(d.length==i[p])return d.unshift(u),l.push(d);if(d.length0&&(n=r.pop(),n?(s=n.startX,a=n.startY):(s=0,a=0)),n=null;break;default:F(`Unknown SVG path command: ${h}`)}h!=="Z"&&h!=="z"&&n===null&&(n={startX:s,startY:a},r.push(n))}return t}var lf,qy=v(()=>{lf=ht(Xy(),1),I()}),jl,hf=v(()=>{E(),jl=class rv{constructor(t=0,i=0,r=0){this.type="circle",this.x=t,this.y=i,this.radius=r}clone(){return new rv(this.x,this.y,this.radius)}contains(t,i){if(this.radius<=0)return!1;let r=this.radius*this.radius,n=this.x-t,s=this.y-i;return n*=n,s*=s,n+s<=r}strokeContains(t,i,r){if(this.radius===0)return!1;let n=this.x-t,s=this.y-i,a=this.radius,o=r/2,l=Math.sqrt(n*n+s*s);return la-o}getBounds(t){return t=t||new ot,t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}}),uf,Ky=v(()=>{E(),uf=class nv{constructor(t=0,i=0,r=0,n=0){this.type="ellipse",this.x=t,this.y=i,this.halfWidth=r,this.halfHeight=n}clone(){return new nv(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,i){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(t-this.x)/this.halfWidth,n=(i-this.y)/this.halfHeight;return r*=r,n*=n,r+n<=1}strokeContains(t,i,r){let{halfWidth:n,halfHeight:s}=this;if(n<=0||s<=0)return!1;let a=r/2,o=n-a,l=s-a,h=n+a,u=s+a,d=t-this.x,p=i-this.y,f=d*d/(o*o)+p*p/(l*l),y=d*d/(h*h)+p*p/(u*u);return f>1&&y<=1}getBounds(t){return t=t||new ot,t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function Zy(e,t,i,r,n,s){let a=e-i,o=t-r,l=n-i,h=s-r,u=a*l+o*h,d=l*l+h*h,p=-1;d!==0&&(p=u/d);let f,y;p<0?(f=i,y=r):p>1?(f=n,y=s):(f=i+p*l,y=r+p*h);let b=e-f,_=t-y;return b*b+_*_}var Jy=v(()=>{"use strict"}),ga,Qy=v(()=>{Jy(),E(),ga=class sv{constructor(...t){this.type="polygon";let i=Array.isArray(t[0])?t[0]:t;if(typeof i[0]!="number"){let r=[];for(let n=0,s=i.length;ni!=u>i&&t<(h-o)*((i-l)/(u-l))+o&&(r=!r)}return r}strokeContains(t,i,r){let n=r/2,s=n*n,{points:a}=this,o=a.length-(this.closePath?0:2);for(let l=0;ln?h:n,s=ua?u:a}return t.x=r,t.width=n-r,t.y=s,t.height=a-s,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,i)=>`${t}, ${i}`,"")}]`}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]}}}),Hn,cf,ex=v(()=>{E(),Hn=(e,t,i,r,n,s)=>{let a=e-i,o=t-r,l=Math.sqrt(a*a+o*o);return l>=n-s&&l<=n+s},cf=class av{constructor(t=0,i=0,r=0,n=0,s=20){this.type="roundedRectangle",this.x=t,this.y=i,this.width=r,this.height=n,this.radius=s}getBounds(t){return t=t||new ot,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new av(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,i){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&i>=this.y&&i<=this.y+this.height){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(i>=this.y+r&&i<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let n=t-(this.x+r),s=i-(this.y+r),a=r*r;if(n*n+s*s<=a||(n=t-(this.x+this.width-r),n*n+s*s<=a)||(s=i-(this.y+this.height-r),n*n+s*s<=a)||(n=t-(this.x+r),n*n+s*s<=a))return!0}return!1}strokeContains(t,i,r){let{x:n,y:s,width:a,height:o,radius:l}=this,h=r/2,u=n+l,d=s+l,p=a-l*2,f=o-l*2,y=n+a,b=s+o;return(t>=n-h&&t<=n+h||t>=y-h&&t<=y+h)&&i>=d&&i<=d+f||(i>=s-h&&i<=s+h||i>=b-h&&i<=b+h)&&t>=u&&t<=u+p?!0:ty-l&&iy-l&&i>b-l&&Hn(t,i,y-l,b-l,l,h)||tb-l&&Hn(t,i,u,b-l,l,h)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function df(e,t,i,r,n,s,a,o,l,h){let u=Math.min(.99,Math.max(0,h??ea.defaultOptions.bezierSmoothness)),d=(pf-u)/1;return d*=d,tx(t,i,r,n,s,a,o,l,e,d),e}function tx(e,t,i,r,n,s,a,o,l,h){$l(e,t,i,r,n,s,a,o,l,h,0),l.push(a,o)}function $l(e,t,i,r,n,s,a,o,l,h,u){if(u>ff)return;let d=Math.PI,p=(e+i)/2,f=(t+r)/2,y=(i+n)/2,b=(r+s)/2,_=(n+a)/2,T=(s+o)/2,C=(p+y)/2,O=(f+b)/2,R=(y+_)/2,z=(b+T)/2,ee=(C+R)/2,ne=(O+z)/2;if(u>0){let Q=a-e,Y=o-t,ie=Math.abs((i-a)*Y-(r-o)*Q),Te=Math.abs((n-a)*Y-(s-o)*Q),Pe,ce;if(ie>zn&&Te>zn){if((ie+Te)*(ie+Te)<=h*(Q*Q+Y*Y)){if(Vr=d&&(Pe=2*d-Pe),ce>=d&&(ce=2*d-ce),Pe+cebr){l.push(i,r);return}if(ce>br){l.push(n,s);return}}}}else if(ie>zn){if(ie*ie<=h*(Q*Q+Y*Y)){if(Vr=d&&(Pe=2*d-Pe),Pebr){l.push(i,r);return}}}else if(Te>zn){if(Te*Te<=h*(Q*Q+Y*Y)){if(Vr=d&&(Pe=2*d-Pe),Pebr){l.push(n,s);return}}}else if(Q=ee-(e+a)/2,Y=ne-(t+o)/2,Q*Q+Y*Y<=h){l.push(ee,ne);return}}$l(e,t,p,f,C,O,ee,ne,l,h,u+1),$l(ee,ne,R,z,_,T,a,o,l,h,u+1)}var ff,zn,pf,ma,Vr,br,gf=v(()=>{Bl(),ff=8,zn=11920929e-14,pf=1,ma=.01,Vr=0,br=0});function ix(e,t,i,r,n,s,a,o){let l=Math.min(.99,Math.max(0,o??ea.defaultOptions.bezierSmoothness)),h=(vf-l)/1;return h*=h,rx(t,i,r,n,s,a,e,h),e}function rx(e,t,i,r,n,s,a,o){Xl(a,e,t,i,r,n,s,o,0),a.push(n,s)}function Xl(e,t,i,r,n,s,a,o,l){if(l>mf)return;let h=Math.PI,u=(t+r)/2,d=(i+n)/2,p=(r+s)/2,f=(n+a)/2,y=(u+p)/2,b=(d+f)/2,_=s-t,T=a-i,C=Math.abs((r-s)*T-(n-a)*_);if(C>_f){if(C*C<=o*(_*_+T*T)){if(Yl=h&&(O=2*h-O),O{Bl(),mf=8,_f=11920929e-14,vf=1,yf=.01,Yl=0});function xf(e,t,i,r,n,s,a,o){let l=Math.abs(n-s);(!a&&n>s||a&&s>n)&&(l=2*Math.PI-l),o=o||Math.max(6,Math.floor(6*Math.pow(r,1/3)*(l/Math.PI))),o=Math.max(o,3);let h=l/o,u=n;h*=a?-1:1;for(let d=0;d{"use strict"});function sx(e,t,i,r,n,s){let a=e[e.length-2],o=e[e.length-1]-i,l=a-t,h=n-i,u=r-t,d=Math.abs(o*u-l*h);if(d<1e-8||s===0){(e[e.length-2]!==t||e[e.length-1]!==i)&&e.push(t,i);return}let p=o*o+l*l,f=h*h+u*u,y=o*h+l*u,b=s*Math.sqrt(p)/d,_=s*Math.sqrt(f)/d,T=b*y/p,C=_*y/f,O=b*u+_*l,R=b*h+_*o,z=l*(_+T),ee=o*(_+T),ne=u*(b+C),Q=h*(b+C),Y=Math.atan2(ee-R,z-O),ie=Math.atan2(Q-R,ne-O);xf(e,O+t,R+i,s,Y,ie,l*h>u*o)}var ax=v(()=>{bf()});function ox(e,t){let i=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:i,n=Math.cos(e),s=Math.sin(e),a=Math.cos(e+t),o=Math.sin(e+t);return[{x:n-s*r,y:s+n*r},{x:a+o*r,y:o-a*r},{x:a,y:o}]}function lx(e,t,i,r,n,s,a,o=0,l=0,h=0){if(s===0||a===0)return;let u=Math.sin(o*fn/360),d=Math.cos(o*fn/360),p=d*(t-r)/2+u*(i-n)/2,f=-u*(t-r)/2+d*(i-n)/2;if(p===0&&f===0)return;s=Math.abs(s),a=Math.abs(a);let y=Math.pow(p,2)/Math.pow(s,2)+Math.pow(f,2)/Math.pow(a,2);y>1&&(s*=Math.sqrt(y),a*=Math.sqrt(y)),wf(t,i,r,n,s,a,l,h,u,d,p,f,_a);let{ang1:b,ang2:_}=_a,{centerX:T,centerY:C}=_a,O=Math.abs(_)/(fn/4);Math.abs(1-O)<1e-7&&(O=1);let R=Math.max(Math.ceil(O),1);_/=R;let z=e[e.length-2],ee=e[e.length-1],ne={x:0,y:0};for(let Q=0;Q{gf(),fn=Math.PI*2,_a={centerX:0,centerY:0,ang1:0,ang2:0},va=({x:e,y:t},i,r,n,s,a,o,l)=>{e*=i,t*=r;let h=n*e-s*t,u=s*e+n*t;return l.x=h+a,l.y=u+o,l},ql=(e,t,i,r)=>{let n=e*r-t*i<0?-1:1,s=e*i+t*r;return s>1&&(s=1),s<-1&&(s=-1),n*Math.acos(s)},wf=(e,t,i,r,n,s,a,o,l,h,u,d,p)=>{let f=Math.pow(n,2),y=Math.pow(s,2),b=Math.pow(u,2),_=Math.pow(d,2),T=f*y-f*_-y*b;T<0&&(T=0),T/=f*_+y*b,T=Math.sqrt(T)*(a===o?-1:1);let C=T*n/s*d,O=T*-s/n*u,R=h*C-l*O+(e+i)/2,z=l*C+h*O+(t+r)/2,ee=(u-C)/n,ne=(d-O)/s,Q=(-u-C)/n,Y=(-d-O)/s,ie=ql(1,0,ee,ne),Te=ql(ee,ne,Q,Y);o===0&&Te>0&&(Te-=fn),o===1&&Te<0&&(Te+=fn),p.centerX=R,p.centerY=z,p.ang1=ie,p.ang2=Te}});function ux(e,t,i){let r=(a,o)=>{let l=o.x-a.x,h=o.y-a.y,u=Math.sqrt(l*l+h*h),d=l/u,p=h/u;return{len:u,nx:d,ny:p}},n=(a,o)=>{a===0?e.moveTo(o.x,o.y):e.lineTo(o.x,o.y)},s=t[t.length-1];for(let a=0;a0&&(f=-1,y=!0);let b=p/2,_,T=Math.abs(Math.cos(b)*l/Math.sin(b));T>Math.min(u.len/2,d.len/2)?(T=Math.min(u.len/2,d.len/2),_=Math.abs(T*Math.sin(b)/Math.cos(b))):_=l;let C=o.x+d.nx*T+-d.ny*_*f,O=o.y+d.ny*T+d.nx*_*f,R=Math.atan2(u.ny,u.nx)+Math.PI/2*f,z=Math.atan2(d.ny,d.nx)-Math.PI/2*f;a===0&&e.moveTo(C+Math.cos(R)*_,O+Math.sin(R)*_),e.arc(C,O,_,R,z,y),s=o}}function cx(e,t,i,r){let n=(o,l)=>Math.sqrt((o.x-l.x)**2+(o.y-l.y)**2),s=(o,l,h)=>({x:o.x+(l.x-o.x)*h,y:o.y+(l.y-o.y)*h}),a=t.length;for(let o=0;o{"use strict"}),Tf,Sf,fx=v(()=>{hf(),Ky(),Qy(),E(),ex(),m(),gf(),nx(),bf(),ax(),hx(),dx(),Tf=new ot,Sf=class{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new g,this._graphicsPath2D=e}moveTo(e,t){return this.startPoly(e,t),this}lineTo(e,t){this._ensurePoly();let i=this._currentPoly.points,r=i[i.length-2],n=i[i.length-1];return(r!==e||n!==t)&&i.push(e,t),this}arc(e,t,i,r,n,s){this._ensurePoly(!1);let a=this._currentPoly.points;return xf(a,e,t,i,r,n,s),this}arcTo(e,t,i,r,n){this._ensurePoly();let s=this._currentPoly.points;return sx(s,e,t,i,r,n),this}arcToSvg(e,t,i,r,n,s,a){let o=this._currentPoly.points;return lx(o,this._currentPoly.lastX,this._currentPoly.lastY,s,a,e,t,i,r,n),this}bezierCurveTo(e,t,i,r,n,s,a){this._ensurePoly();let o=this._currentPoly;return df(this._currentPoly.points,o.lastX,o.lastY,e,t,i,r,n,s,a),this}quadraticCurveTo(e,t,i,r,n){this._ensurePoly();let s=this._currentPoly;return ix(this._currentPoly.points,s.lastX,s.lastY,e,t,i,r,n),this}closePath(){return this.endPoly(!0),this}addPath(e,t){this.endPoly(),t&&!t.isIdentity()&&(e=e.clone(!0),e.transform(t));for(let i=0;i=2;u-=2)h[u]===h[u-2]&&h[u-1]===h[u-3]&&h.splice(u-1,2);return this.poly(h,!0,s)}ellipse(e,t,i,r,n){return this.drawShape(new uf(e,t,i,r),n),this}roundRect(e,t,i,r,n,s){return this.drawShape(new cf(e,t,i,r,n),s),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 ga,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 ga,e)){let t=this.shapePrimitives[this.shapePrimitives.length-1];if(t){let i=t.shape.x,r=t.shape.y;if(t.transform&&!t.transform.isIdentity()){let n=t.transform,s=i;i=n.a*i+n.c*r+n.tx,r=n.b*s+n.d*r+n.ty}this._currentPoly.points.push(i,r)}else this._currentPoly.points.push(0,0)}}buildPath(){let e=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let t=0;t{At(),bt(),I(),qy(),fx(),Vn=class ov{constructor(t){this.instructions=[],this.uid=at("graphicsPath"),this._dirty=!0,typeof t=="string"?Yy(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Sf(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,i){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,i]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,i,r,n,s){let a=this.instructions[this.instructions.length-1],o=this.getLastPoint(De.shared),l=0,h=0;if(!a||a.action!=="bezierCurveTo")l=o.x,h=o.y;else{l=a.data[2],h=a.data[3];let u=o.x,d=o.y;l=u+(u-l),h=d+(d-h)}return this.instructions.push({action:"bezierCurveTo",data:[l,h,t,i,r,n,s]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,i,r){let n=this.instructions[this.instructions.length-1],s=this.getLastPoint(De.shared),a=0,o=0;if(!n||n.action!=="quadraticCurveTo")a=s.x,o=s.y;else{a=n.data[0],o=n.data[1];let l=s.x,h=s.y;a=l+(l-a),o=h+(h-o)}return this.instructions.push({action:"quadraticCurveTo",data:[a,o,t,i,r]}),this._dirty=!0,this}rect(t,i,r,n,s){return this.instructions.push({action:"rect",data:[t,i,r,n,s]}),this._dirty=!0,this}circle(t,i,r,n){return this.instructions.push({action:"circle",data:[t,i,r,n]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,i,r,n,s,a,o){s=s||n/2;let l=-1*Math.PI/2+a,h=r*2,u=Math.PI*2/h,d=[];for(let p=0;pparseInt(Q,10)),t.context.poly(C,!0),i&&t.context.fill(),r&&t.context.stroke();break;case"polyline":O=e.getAttribute("points"),C=O.match(/\d+/g).map(Q=>parseInt(Q,10)),t.context.poly(C,!1),r&&t.context.stroke();break;case"g":case"svg":break;default:{console.info(`[SVG parser] <${e.nodeName}> elements unsupported`);break}}for(let Q=0;Q{Ie(),Ef()});function _x(e){return ue.isColorLike(e)}function Cf(e){return e instanceof Nn}function Mf(e){return e instanceof dn}function vx(e,t,i){let r=ue.shared.setValue(t??0);return e.color=r.toNumber(),e.alpha=r.alpha===1?i.alpha:r.alpha,e.texture=Re.WHITE,{...i,...e}}function Pf(e,t,i){return e.fill=t,e.color=16777215,e.texture=t.texture,e.matrix=t.transform,{...i,...e}}function Rf(e,t,i){return t.buildLinearGradient(),e.fill=t,e.color=16777215,e.texture=t.texture,e.matrix=t.transform,{...i,...e}}function yx(e,t){let i={...t,...e};if(i.texture){if(i.texture!==Re.WHITE){let s=i.matrix?.invert()||new ke;s.translate(i.texture.frame.x,i.texture.frame.y),s.scale(1/i.texture.source.width,1/i.texture.source.height),i.matrix=s}let n=i.texture.source.style;n.addressMode==="clamp-to-edge"&&(n.addressMode="repeat",n.update())}let r=ue.shared.setValue(i.color);return i.alpha*=r.alpha,i.color=r.toNumber(),i.matrix=i.matrix?i.matrix.clone():null,i}function jr(e,t){if(e==null)return null;let i={},r=e;return _x(e)?vx(i,e,t):Cf(e)?Pf(i,e,t):Mf(e)?Rf(i,e,t):r.fill&&Cf(r.fill)?Pf(r,r.fill,t):r.fill&&Mf(r.fill)?Rf(r,r.fill,t):yx(r,t)}function ya(e,t){let{width:i,alignment:r,miterLimit:n,cap:s,join:a,...o}=t,l=jr(e,o);return l?{width:i,alignment:r,miterLimit:n,cap:s,join:a,...l}:null}var kf=v(()=>{Ie(),We(),pt(),zl(),Vl()}),Bf,Kl,xa,Ti,If=v(()=>{xt(),Ie(),We(),At(),pt(),bt(),wt(),m(),Ef(),mx(),kf(),Bf=new De,Kl=new ke,xa=class Ji extends Je{constructor(){super(...arguments),this.uid=at("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Vn,this._transform=new ke,this._fillStyle={...Ji.defaultFillStyle},this._strokeStyle={...Ji.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new g,this._boundsDirty=!0}clone(){let t=new Ji;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=jr(t,Ji.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=ya(t,Ji.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=jr(t,Ji.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=jr(t,Ji.defaultStrokeStyle),this}texture(t,i,r,n,s,a){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:n||0,dw:s||t.frame.width,dh:a||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:i?ue.shared.setValue(i).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Vn,this}fill(t,i){let r,n=this.instructions[this.instructions.length-1];return this._tick===0&&n&&n.action==="stroke"?r=n.data.path:r=this._activePath.clone(),r?(t!=null&&(i!==void 0&&typeof t=="number"&&(Xe(Ve,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:i}),this._fillStyle=jr(t,Ji.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:i}=this._activePath.getLastPoint(De.shared);this._activePath.clear(),this._activePath.moveTo(t,i)}stroke(t){let i,r=this.instructions[this.instructions.length-1];return this._tick===0&&r&&r.action==="fill"?i=r.data.path:i=this._activePath.clone(),i?(t!=null&&(this._strokeStyle=ya(t,Ji.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let i=this.instructions[this.instructions.length-1-t],r=this._activePath.clone();if(i&&(i.action==="stroke"||i.action==="fill"))if(i.data.hole)i.data.hole.addPath(r);else{i.data.hole=r;break}}return this._initNextPathLocation(),this}arc(t,i,r,n,s,a){this._tick++;let o=this._transform;return this._activePath.arc(o.a*t+o.c*i+o.tx,o.b*t+o.d*i+o.ty,r,n,s,a),this}arcTo(t,i,r,n,s){this._tick++;let a=this._transform;return this._activePath.arcTo(a.a*t+a.c*i+a.tx,a.b*t+a.d*i+a.ty,a.a*r+a.c*n+a.tx,a.b*r+a.d*n+a.ty,s),this}arcToSvg(t,i,r,n,s,a,o){this._tick++;let l=this._transform;return this._activePath.arcToSvg(t,i,r,n,s,l.a*a+l.c*o+l.tx,l.b*a+l.d*o+l.ty),this}bezierCurveTo(t,i,r,n,s,a,o){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*i+l.tx,l.b*t+l.d*i+l.ty,l.a*r+l.c*n+l.tx,l.b*r+l.d*n+l.ty,l.a*s+l.c*a+l.tx,l.b*s+l.d*a+l.ty,o),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,i,r,n){return this._tick++,this._activePath.ellipse(t,i,r,n,this._transform.clone()),this}circle(t,i,r){return this._tick++,this._activePath.circle(t,i,r,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,i){this._tick++;let r=this._transform;return this._activePath.lineTo(r.a*t+r.c*i+r.tx,r.b*t+r.d*i+r.ty),this}moveTo(t,i){this._tick++;let r=this._transform,n=this._activePath.instructions,s=r.a*t+r.c*i+r.tx,a=r.b*t+r.d*i+r.ty;return n.length===1&&n[0].action==="moveTo"?(n[0].data[0]=s,n[0].data[1]=a,this):(this._activePath.moveTo(s,a),this)}quadraticCurveTo(t,i,r,n,s){this._tick++;let a=this._transform;return this._activePath.quadraticCurveTo(a.a*t+a.c*i+a.tx,a.b*t+a.d*i+a.ty,a.a*r+a.c*n+a.tx,a.b*r+a.d*n+a.ty,s),this}rect(t,i,r,n){return this._tick++,this._activePath.rect(t,i,r,n,this._transform.clone()),this}roundRect(t,i,r,n,s){return this._tick++,this._activePath.roundRect(t,i,r,n,s,this._transform.clone()),this}poly(t,i){return this._tick++,this._activePath.poly(t,i,this._transform.clone()),this}regularPoly(t,i,r,n,s=0,a){return this._tick++,this._activePath.regularPoly(t,i,r,n,s,a),this}roundPoly(t,i,r,n,s,a){return this._tick++,this._activePath.roundPoly(t,i,r,n,s,a),this}roundShape(t,i,r,n){return this._tick++,this._activePath.roundShape(t,i,r,n),this}filletRect(t,i,r,n,s){return this._tick++,this._activePath.filletRect(t,i,r,n,s),this}chamferRect(t,i,r,n,s,a){return this._tick++,this._activePath.chamferRect(t,i,r,n,s,a),this}star(t,i,r,n,s=0,a=0){return this._tick++,this._activePath.star(t,i,r,n,s,a,this._transform.clone()),this}svg(t){return this._tick++,px(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.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(t){return this._transform.rotate(t),this}scale(t,i=t){return this._transform.scale(t,i),this}setTransform(t,i,r,n,s,a){return t instanceof ke?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,i,r,n,s,a),this)}transform(t,i,r,n,s,a){return t instanceof ke?(this._transform.append(t),this):(Kl.set(t,i,r,n,s,a),this._transform.append(Kl),this)}translate(t,i=t){return this._transform.translate(t,i),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 t=this._bounds;t.clear();for(let i=0;i{Ie(),Zl=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function wx(e){let t=e;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let i=Xi.defaultDropShadow;e.dropShadow={alpha:t.dropShadowAlpha??i.alpha,angle:t.dropShadowAngle??i.angle,blur:t.dropShadowBlur??i.blur,color:t.dropShadowColor??i.color,distance:t.dropShadowDistance??i.distance}}if(t.strokeThickness!==void 0){Xe(Ve,"strokeThickness is now a part of stroke");let i=t.stroke,r={};if(ue.isColorLike(i))r.color=i;else if(i instanceof dn||i instanceof Nn)r.fill=i;else if(Object.hasOwnProperty.call(i,"color")||Object.hasOwnProperty.call(i,"fill"))r=i;else throw new Error("Invalid stroke value.");e.stroke={...r,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){Xe(Ve,"gradient fill is now a fill pattern: `new FillGradient(...)`");let i;e.fontSize==null?e.fontSize=Xi.defaultTextStyle.fontSize:typeof e.fontSize=="string"?i=parseInt(e.fontSize,10):i=e.fontSize;let r=new dn(0,0,0,i*1.7),n=t.fillGradientStops.map(s=>ue.shared.setValue(s).toNumber());n.forEach((s,a)=>{let o=a/(n.length-1);r.addColorStop(o,s)}),e.fill={fill:r}}}var ba,Xi,jn=v(()=>{xt(),Ie(),wt(),zl(),Vl(),If(),kf(),Uf(),ba=class Cn extends Je{constructor(t={}){super(),wx(t);let i={...Cn.defaultTextStyle,...t};for(let r in i){let n=r;this[n]=i[r]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...Cn.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...Cn.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update()}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t,this.update()}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update()}get leading(){return this._leading}set leading(t){this._leading=t,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update()}get padding(){return this._padding}set padding(t){this._padding=t,this.update()}get trim(){return this._trim}set trim(t){this._trim=t,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update()}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...Ti.defaultFillStyle,...t},()=>{this._fill=jr({...this._originalFill},Ti.defaultFillStyle)})),this._fill=jr(t===0?"black":t,Ti.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Ti.defaultStrokeStyle,...t},()=>{this._stroke=ya({...this._originalStroke},Ti.defaultStrokeStyle)})),this._stroke=ya(t,Ti.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Gf(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=Cn.defaultTextStyle;for(let i in t)this[i]=t[i]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new Cn({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(t=!1){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.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(t,i){return new Proxy(t,{set:(r,n,s)=>(r[n]=s,i?.(n,s),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(ue.isColorLike(t)||t instanceof dn||t instanceof Nn)}},ba.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},ba.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},Xi=ba});function Ff(e,t,i,r){let n=Df;n.minX=0,n.minY=0,n.maxX=e.width/r|0,n.maxY=e.height/r|0;let s=gi.getOptimalTexture(n.width,n.height,r,!1);return s.source.uploadMethodId="image",s.source.resource=e,s.source.alphaMode="premultiply-alpha-on-upload",s.frame.width=t/r,s.frame.height=i/r,s.source.emit("update",s.source),s.updateUvs(),s}var Df,Lf=v(()=>{Ln(),m(),Df=new g});function wa(e){let t=typeof e.fontSize=="number"?`${e.fontSize}px`:e.fontSize,i=e.fontFamily;Array.isArray(e.fontFamily)||(i=e.fontFamily.split(","));for(let r=i.length-1;r>=0;r--){let n=i[r].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&!Nf.includes(n)&&(n=`"${n}"`),i[r]=n}return`${e.fontStyle} ${e.fontVariant} ${e.fontWeight} ${t} ${i.join(",")}`}var Nf,Jl=v(()=>{"use strict";Nf=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]}),Ta,Si,Ri,Sa=v(()=>{Ft(),Jl(),Ta={willReadFrequently:!0},Si=class Ee{static get experimentalLetterSpacingSupported(){let t=Ee._experimentalLetterSpacingSupported;if(t!==void 0){let i=vt.get().getCanvasRenderingContext2D().prototype;t=Ee._experimentalLetterSpacingSupported="letterSpacing"in i||"textLetterSpacing"in i}return t}constructor(t,i,r,n,s,a,o,l,h){this.text=t,this.style=i,this.width=r,this.height=n,this.lines=s,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=l,this.fontProperties=h}static measureText(t=" ",i,r=Ee._canvas,n=i.wordWrap){let s=`${t}:${i.styleKey}`;if(Ee._measurementCache[s])return Ee._measurementCache[s];let a=wa(i),o=Ee.measureFont(a);o.fontSize===0&&(o.fontSize=i.fontSize,o.ascent=i.fontSize);let l=Ee.__context;l.font=a;let h=(n?Ee._wordWrap(t,i,r):t).split(/(?:\r\n|\r|\n)/),u=new Array(h.length),d=0;for(let _=0;_0&&(n?s-=i:s+=(Ee.graphemeSegmenter(t).length-1)*i),s}static _wordWrap(t,i,r=Ee._canvas){let n=r.getContext("2d",Ta),s=0,a="",o="",l=Object.create(null),{letterSpacing:h,whiteSpace:u}=i,d=Ee._collapseSpaces(u),p=Ee._collapseNewlines(u),f=!d,y=i.wordWrapWidth+h,b=Ee._tokenize(t);for(let _=0;_y)if(a!==""&&(o+=Ee._addLine(a),a="",s=0),Ee.canBreakWords(T,i.breakWords)){let O=Ee.wordWrapSplit(T);for(let R=0;Ry&&(o+=Ee._addLine(a),f=!1,a="",s=0),a+=z,s+=Q}}else{a.length>0&&(o+=Ee._addLine(a),a="",s=0);let O=_===b.length-1;o+=Ee._addLine(T,!O),f=!1,a="",s=0}else C+s>y&&(f=!1,o+=Ee._addLine(a),a="",s=0),(a.length>0||!Ee.isBreakingSpace(T)||f)&&(a+=T,s+=C)}return o+=Ee._addLine(a,!1),o}static _addLine(t,i=!0){return t=Ee._trimRight(t),t=i?`${t}
`:t,t}static _getFromCache(t,i,r,n){let s=r[t];return typeof s!="number"&&(s=Ee._measureText(t,i,n)+i,r[t]=s),s}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let i=t.length-1;i>=0;i--){let r=t[i];if(!Ee.isBreakingSpace(r))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:Ee._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,i){return typeof t!="string"?!1:Ee._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let i=[],r="";if(typeof t!="string")return i;for(let n=0;n{if(typeof Intl?.Segmenter=="function"){let e=new Intl.Segmenter;return t=>[...e.segment(t)].map(i=>i.segment)}return e=>[...e]})(),Si.experimentalLetterSpacing=!1,Si._fonts={},Si._newlines=[10,13],Si._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],Si._measurementCache={},Ri=Si});function Ea(e,t){if(e.texture===Re.WHITE&&!e.fill)return ue.shared.setValue(e.color).setAlpha(e.alpha??1).toHexa();if(e.fill){if(e.fill instanceof Nn){let i=e.fill,r=t.createPattern(i.texture.source.resource,"repeat"),n=i.transform.copyTo(ke.shared);return n.scale(i.texture.frame.width,i.texture.frame.height),r.setTransform(n),r}else if(e.fill instanceof dn){let i=e.fill;if(i.type==="linear"){let r=t.createLinearGradient(i.x0,i.y0,i.x1,i.y1);return i.gradientStops.forEach(n=>{r.addColorStop(n.offset,ue.shared.setValue(n.color).toHex())}),r}}}else{let i=t.createPattern(e.texture.source.resource,"repeat"),r=e.matrix.copyTo(ke.shared);return r.scale(e.texture.frame.width,e.texture.frame.height),i.setTransform(r),i}return F("FillStyle not recognised",e),"red"}var Hf=v(()=>{Ie(),We(),pt(),I(),zl(),Vl()}),Ql,Tx=v(()=>{Ie(),te(),Ls(),pa(),Ln(),$y(),wt(),jn(),Lf(),Sa(),Jl(),Hf(),Ql=class{constructor(e){this._activeTextures={},this._renderer=e}getTextureSize(e,t,i){let r=Ri.measureText(e||" ",i),n=Math.ceil(Math.ceil(Math.max(1,r.width)+i.padding*2)*t),s=Math.ceil(Math.ceil(Math.max(1,r.height)+i.padding*2)*t);return n=Math.ceil(n-1e-6),s=Math.ceil(s-1e-6),n=on(n),s=on(s),{width:n,height:s}}getTexture(e,t,i,r){typeof e=="string"&&(Xe("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),e={text:e,style:i,resolution:t}),e.style instanceof Xi||(e.style=new Xi(e.style));let{texture:n,canvasAndContext:s}=this.createTextureAndCanvas(e);return this._renderer.texture.initSource(n._source),$i.returnCanvasAndContext(s),n}createTextureAndCanvas(e){let{text:t,style:i}=e,r=e.resolution??this._renderer.resolution,n=Ri.measureText(t||" ",i),s=Math.ceil(Math.ceil(Math.max(1,n.width)+i.padding*2)*r),a=Math.ceil(Math.ceil(Math.max(1,n.height)+i.padding*2)*r),o=$i.getOptimalCanvasAndContext(s,a),{canvas:l}=o;this.renderTextToCanvas(t,i,r,o);let h=Ff(l,s,a,r);if(i.trim){let u=jy(l,r);h.frame.copyFrom(u),h.updateUvs()}return{texture:h,canvasAndContext:o}}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:r}=this.createTextureAndCanvas(e);return this._activeTextures[t]={canvasAndContext:r,texture:i,usageCount:1},i}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}decreaseReferenceCount(e){let t=this._activeTextures[e];if(t.usageCount--,t.usageCount===0){$i.returnCanvasAndContext(t.canvasAndContext),gi.returnTexture(t.texture);let i=t.texture.source;i.resource=null,i.uploadMethodId="unknown",i.alphaMode="no-premultiply-alpha",this._activeTextures[e]=null}}getReferenceCount(e){return this._activeTextures[e].usageCount}renderTextToCanvas(e,t,i,r){let{canvas:n,context:s}=r,a=wa(t),o=Ri.measureText(e||" ",t),l=o.lines,h=o.lineHeight,u=o.lineWidths,d=o.maxLineWidth,p=o.fontProperties,f=n.height;s.resetTransform(),s.scale(i,i);let y=t.padding*2;if(s.clearRect(0,0,o.width+4+y,o.height+4+y),t._stroke?.width){let C=t._stroke;s.lineWidth=C.width,s.miterLimit=C.miterLimit,s.lineJoin=C.join,s.lineCap=C.cap}s.font=a;let b,_,T=t.dropShadow?2:1;for(let C=0;C{te(),Vy(),Tx(),pe.add(Ql),pe.add(Nl)}),Aa,Wf=v(()=>{wt(),gl(),If(),Aa=class Ec extends zs{constructor(t){t instanceof Ti&&(t={context:t});let{context:i,roundPixels:r,...n}=t||{};super({label:"Graphics",...n}),this.renderPipeId="graphics",i?this._context=i:this._context=this._ownedContext=new Ti,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=r??!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}addBounds(t){t.addBounds(this._context.bounds)}containsPoint(t){return this._context.containsPoint(t)}onViewUpdate(){if(this._didViewChangeTick++,this._didGraphicsUpdate=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||t?.context===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,i){return this.context[t](...i),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new Ec(this._context.clone()):(this._ownedContext=null,new Ec(this._context))}lineStyle(t,i,r){Xe(Ve,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let n={};return t&&(n.width=t),i&&(n.color=i),r&&(n.alpha=r),this.context.strokeStyle=n,this}beginFill(t,i){Xe(Ve,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t&&(r.color=t),i&&(r.alpha=i),this.context.fillStyle=r,this}endFill(){Xe(Ve,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return(t.width!==Ti.defaultStrokeStyle.width||t.color!==Ti.defaultStrokeStyle.color||t.alpha!==Ti.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return Xe(Ve,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return Xe(Ve,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return Xe(Ve,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return Xe(Ve,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return Xe(Ve,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return Xe(Ve,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});function Sx(){if(!Ca){Ca="mediump";let e=bd();e&&e.getShaderPrecisionFormat&&(Ca=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision?"highp":"mediump")}return Ca}var Ca,Ex=v(()=>{wd()});function Ax(e,t,i){return t?e:i?(e=e.replace("out vec4 finalColor;",""),`
#ifdef GL_ES // This checks if it is WebGL1
#define in varying
#define finalColor gl_FragColor
#define texture texture2D
#endif
${e}
`):`
#ifdef GL_ES // This checks if it is WebGL1
#define in attribute
#define out varying
#endif
${e}
`}var Cx=v(()=>{"use strict"});function Mx(e,t,i){let r=i?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(e.substring(0,9)!=="precision"){let n=i?t.requestedFragmentPrecision:t.requestedVertexPrecision;return n==="highp"&&r!=="highp"&&(n="mediump"),`precision ${n} float;
${e}`}else if(r!=="highp"&&e.substring(0,15)==="precision highp")return e.replace("precision highp","precision mediump");return e}var Px=v(()=>{"use strict"});function Rx(e,t){return t?`#version 300 es
${e}`:e}var kx=v(()=>{"use strict"});function Bx(e,{name:t="pixi-program"},i=!0){t=t.replace(/\s+/g,"-"),t+=i?"-fragment":"-vertex";let r=i?Vf:jf;return r[t]?(r[t]++,t+=`-${r[t]}`):r[t]=1,e.indexOf("#define SHADER_NAME")!==-1?e:`${`#define SHADER_NAME ${t}`}
${e}`}var Vf,jf,Ix=v(()=>{"use strict";Vf={},jf={}});function Gx(e,t){return t?e.replace("#version 300 es",""):e}var Ox=v(()=>{"use strict"}),Ma,Pa,eh,pn,$n=v(()=>{ca(),Ex(),Cx(),Px(),kx(),Ix(),Ox(),Ma={stripVersion:Gx,ensurePrecision:Mx,addProgramDefines:Ax,setProgramName:Bx,insertVersion:Rx},Pa=Object.create(null),eh=class Ac{constructor(t){t={...Ac.defaultOptions,...t};let i=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:i,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Sx()},setProgramName:{name:t.name},addProgramDefines:i,insertVersion:i},n=t.fragment,s=t.vertex;Object.keys(Ma).forEach(a=>{let o=r[a];n=Ma[a](n,o,!0),s=Ma[a](s,o,!1)}),this.fragment=n,this.vertex=s,this._key=Dn(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null}static from(t){let i=`${t.vertex}:${t.fragment}`;return Pa[i]||(Pa[i]=new Ac(t)),Pa[i]}},eh.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"},pn=eh});function Xn(e){return th[e]??th.float32}var th,Ra=v(()=>{"use strict";th={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}}});function Ux({source:e,entryPoint:t}){let i={},r=e.indexOf(`fn ${t}`);if(r!==-1){let n=e.indexOf("->",r);if(n!==-1){let s=e.substring(r,n),a=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g,o;for(;(o=a.exec(s))!==null;){let l=$f[o[3]]??"float32";i[o[2]]={location:parseInt(o[1],10),format:l,stride:Xn(l).stride,offset:0,instance:!1,start:0}}}}return i}var $f,Fx=v(()=>{Ra(),$f={f32:"float32","vec2":"float32x2","vec3":"float32x3","vec4":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2":"sint32x2","vec3":"sint32x3","vec4":"sint32x4",u32:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4",bool:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4"}});function ih(e){let t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,i=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,n=/var(<[^>]+>)? (\w+)/,s=/:\s*(\w+)/,a=/struct\s+(\w+)\s*{([^}]+)}/g,o=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,h=e.match(t)?.map(d=>({group:parseInt(d.match(i)[1],10),binding:parseInt(d.match(r)[1],10),name:d.match(n)[2],isUniform:d.match(n)[1]==="",type:d.match(s)[1]}));if(!h)return{groups:[],structs:[]};let u=e.match(a)?.map(d=>{let p=d.match(l)[1],f=d.match(o).reduce((y,b)=>{let[_,T]=b.split(":");return y[_.trim()]=T.trim(),y},{});return f?{name:p,members:f}:null}).filter(({name:d})=>h.some(p=>p.type===d))??[];return{groups:h,structs:u}}var Dx=v(()=>{"use strict"}),gn,Lx=v(()=>{"use strict";gn=(e=>(e[e.VERTEX=1]="VERTEX",e[e.FRAGMENT=2]="FRAGMENT",e[e.COMPUTE=4]="COMPUTE",e))(gn||{})});function Nx({groups:e}){let t=[];for(let i=0;i{Lx()});function zx({groups:e}){let t=[];for(let i=0;i{"use strict"});function Vx(e,t){let i=new Set,r=new Set,n=[...e.structs,...t.structs].filter(a=>i.has(a.name)?!1:(i.add(a.name),!0)),s=[...e.groups,...t.groups].filter(a=>{let o=`${a.name}-${a.binding}`;return r.has(o)?!1:(r.add(o),!0)});return{structs:n,groups:s}}var jx=v(()=>{"use strict"}),ka,Yn,Ba=v(()=>{ca(),Fx(),Dx(),Hx(),Wx(),jx(),ka=Object.create(null),Yn=class lv{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:i,vertex:r,layout:n,gpuLayout:s,name:a}=t;if(this.name=a,this.fragment=i,this.vertex=r,i.source===r.source){let o=ih(i.source);this.structsAndGroups=o}else{let o=ih(r.source),l=ih(i.source);this.structsAndGroups=Vx(o,l)}this.layout=n??zx(this.structsAndGroups),this.gpuLayout=s??Nx(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){let{vertex:t,fragment:i}=this,r=t.source+i.source+t.entryPoint+i.entryPoint;this._layoutKey=Dn(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=Ux(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(t){let i=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return ka[i]||(ka[i]=new lv(t)),ka[i]}}});function Xf(e,t,i){if(e)for(let r in e){let n=r.toLocaleLowerCase(),s=t[n];if(s){let a=e[r];r==="header"&&(a=a.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),i&&s.push(`//----${i}----//`),s.push(a)}else F(`${r} placement hook does not exist in shader`)}}var $x=v(()=>{I()});function Yf(e){let t={};return(e.match(qf)?.map(i=>i.replace(/[{()}]/g,""))??[]).forEach(i=>{t[i]=[]}),t}var qf,Xx=v(()=>{"use strict";qf=/\{\{(.*?)\}\}/g});function Kf(e,t){let i,r=/@in\s+([^;]+);/g;for(;(i=r.exec(e))!==null;)t.push(i[1])}function Zf(e,t,i=!1){let r=[];Kf(t,r),e.forEach(o=>{o.header&&Kf(o.header,r)});let n=r;i&&n.sort();let s=n.map((o,l)=>` @location(${l}) ${o},`).join(`
`),a=t.replace(/@in\s+[^;]+;\s*/g,"");return a=a.replace("{{in}}",`
${s}
`),a}var Yx=v(()=>{"use strict"});function Jf(e,t){let i,r=/@out\s+([^;]+);/g;for(;(i=r.exec(e))!==null;)t.push(i[1])}function qx(e){let t=/\b(\w+)\s*:/g.exec(e);return t?t[1]:""}function Kx(e){let t=/@.*?\s+/g;return e.replace(t,"")}function Zx(e,t){let i=[];Jf(t,i),e.forEach(l=>{l.header&&Jf(l.header,i)});let r=0,n=i.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${r++}) ${l}`).join(`,
`),s=i.sort().map(l=>` var ${Kx(l)};`).join(`
`),a=`return VSOutput(
${i.sort().map(l=>` ${qx(l)}`).join(`,
`)});`,o=t.replace(/@out\s+[^;]+;\s*/g,"");return o=o.replace("{{struct}}",`
${n}
`),o=o.replace("{{start}}",`
${s}
`),o=o.replace("{{return}}",`
${a}
`),o}var Jx=v(()=>{"use strict"});function Qf(e,t){let i=e;for(let r in t){let n=t[r];n.join(`
`).length?i=i.replace(`{{${r}}}`,`//-----${r} START-----//
${n.join(`
`)}
//----${r} FINISH----//`):i=i.replace(`{{${r}}}`,"")}return i}var Qx=v(()=>{"use strict"});function e0({template:e,bits:t}){let i=ep(e,t);if(wr[i])return wr[i];let{vertex:r,fragment:n}=i0(e,t);return wr[i]=tp(r,n,t),wr[i]}function t0({template:e,bits:t}){let i=ep(e,t);return wr[i]||(wr[i]=tp(e.vertex,e.fragment,t)),wr[i]}function i0(e,t){let i=t.map(a=>a.vertex).filter(a=>!!a),r=t.map(a=>a.fragment).filter(a=>!!a),n=Zf(i,e.vertex,!0);n=Zx(i,n);let s=Zf(r,e.fragment,!0);return{vertex:n,fragment:s}}function ep(e,t){return t.map(i=>(Ia.has(i)||Ia.set(i,ip++),Ia.get(i))).sort((i,r)=>i-r).join("-")+e.vertex+e.fragment}function tp(e,t,i){let r=Yf(e),n=Yf(t);return i.forEach(s=>{Xf(s.vertex,r,s.name),Xf(s.fragment,n,s.name)}),{vertex:Qf(e,r),fragment:Qf(t,n)}}var wr,Ia,ip,r0=v(()=>{$x(),Xx(),Yx(),Jx(),Qx(),wr=Object.create(null),Ia=new Map,ip=0}),rp,np,sp,ap,n0=v(()=>{"use strict";rp=`
@in aPosition: vec2;
@in aUV: vec2;
@out @builtin(position) vPosition: vec4;
@out vUV : vec2;
@out vColor : vec4;
{{header}}
struct VSOutput {
{{struct}}
};
@vertex
fn main( {{in}} ) -> VSOutput {
var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
var modelMatrix = mat3x3(
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0
);
var position = aPosition;
var uv = aUV;
{{start}}
vColor = vec4(1., 1., 1., 1.);
{{main}}
vUV = uv;
var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
vPosition = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
vColor *= globalUniforms.uWorldColorAlpha;
{{end}}
{{return}}
};
`,np=`
@in vUV : vec2;
@in vColor : vec4;
{{header}}
@fragment
fn main(
{{in}}
) -> @location(0) vec4 {
{{start}}
var outColor:vec4;
{{main}}
return outColor * vColor;
};
`,sp=`
in vec2 aPosition;
in vec2 aUV;
out vec4 vColor;
out vec2 vUV;
{{header}}
void main(void){
mat3 worldTransformMatrix = uWorldTransformMatrix;
mat3 modelMatrix = mat3(
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0
);
vec2 position = aPosition;
vec2 uv = aUV;
{{start}}
vColor = vec4(1.);
{{main}}
vUV = uv;
mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;
gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
vColor *= uWorldColorAlpha;
{{end}}
}
`,ap=`
in vec4 vColor;
in vec2 vUV;
out vec4 finalColor;
{{header}}
void main(void) {
{{start}}
vec4 outColor;
{{main}}
finalColor = outColor * vColor;
}
`}),op,lp,s0=v(()=>{"use strict";op={name:"global-uniforms-bit",vertex:{header:`
struct GlobalUniforms {
uProjectionMatrix:mat3x3,
uWorldTransformMatrix:mat3x3,
uWorldColorAlpha: vec4,
uResolution: vec2,
}
@group(0) @binding(0) var globalUniforms : GlobalUniforms;
`}},lp={name:"global-uniforms-bit",vertex:{header:`
uniform mat3 uProjectionMatrix;
uniform mat3 uWorldTransformMatrix;
uniform vec4 uWorldColorAlpha;
uniform vec2 uResolution;
`}}});function qn({bits:e,name:t}){let i=e0({template:{fragment:np,vertex:rp},bits:[op,...e]});return Yn.from({name:t,vertex:{source:i.vertex,entryPoint:"main"},fragment:{source:i.fragment,entryPoint:"main"}})}function Kn({bits:e,name:t}){return new pn({name:t,...t0({template:{vertex:sp,fragment:ap},bits:[lp,...e]})})}var Tr=v(()=>{$n(),Ba(),r0(),n0(),s0()}),Ga,Oa,Zn=v(()=>{"use strict";Ga={name:"color-bit",vertex:{header:`
@in aColor: vec4;
`,main:`
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
`}},Oa={name:"color-bit",vertex:{header:`
in vec4 aColor;
`,main:`
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
`}}});function a0(e){let t=[];if(e===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let i=0;for(let r=0;r;`),t.push(`@group(1) @binding(${i++}) var textureSampler${r+1}: sampler;`)}return t.join(`
`)}function o0(e){let t=[];if(e===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let i=0;i;
@out @interpolate(flat) vTextureId : u32;
`,main:`
vTextureId = aTextureIdAndRound.y;
`,end:`
if(aTextureIdAndRound.x == 1)
{
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
}
`},fragment:{header:`
@in @interpolate(flat) vTextureId: u32;
${a0(e)}
`,main:`
var uvDx = dpdx(vUV);
var uvDy = dpdy(vUV);
${o0(e)}
`}}),Ua[e]}function l0(e){let t=[];for(let i=0;i0&&t.push("else"),i{"use strict";Ua={},Fa={}}),mn,_n,Sr=v(()=>{"use strict";mn={name:"round-pixels-bit",vertex:{header:`
fn roundPixels(position: vec2, targetSize: vec2) -> vec2
{
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
}
`}},_n={name:"round-pixels-bit",vertex:{header:`
vec2 roundPixels(vec2 position, vec2 targetSize)
{
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
}
`}}});function sh(e){let t=ah[e];if(t)return t;let i=new Int32Array(e);for(let r=0;r{pi(),ah={}}),Ei,sr=v(()=>{"use strict";Ei=(e=>(e[e.WEBGL=1]="WEBGL",e[e.WEBGPU=2]="WEBGPU",e[e.BOTH=3]="BOTH",e))(Ei||{})}),ki,Yi=v(()=>{xt(),$n(),Nr(),Ba(),sr(),pi(),ki=class hv extends Je{constructor(t){super(),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:i,glProgram:r,groups:n,resources:s,compatibleRenderers:a,groupMap:o}=t;this.gpuProgram=i,this.glProgram=r,a===void 0&&(a=0,i&&(a|=Ei.WEBGPU),r&&(a|=Ei.WEBGL)),this.compatibleRenderers=a;let l={};if(!s&&!n&&(s={}),s&&n)throw new Error("[Shader] Cannot have both resources and groups");if(!i&&n&&!o)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!i&&n&&o)for(let h in o)for(let u in o[h]){let d=o[h][u];l[d]={group:h,binding:u,name:d}}else if(i&&n&&!o){let h=i.structsAndGroups.groups;o={},h.forEach(u=>{o[u.group]=o[u.group]||{},o[u.group][u.binding]=u.name,l[u.name]=u})}else if(s){n={},o={},i&&i.structsAndGroups.groups.forEach(u=>{o[u.group]=o[u.group]||{},o[u.group][u.binding]=u.name,l[u.name]=u});let h=0;for(let u in s)l[u]||(n[99]||(n[99]=new Vi,this._ownedBindGroups.push(n[99])),l[u]={group:99,binding:h,name:u},o[99]=o[99]||{},o[99][h]=u,h++);for(let u in s){let d=u,p=s[u];!p.source&&!p._resourceType&&(p=new ti(p));let f=l[d];f&&(n[f.group]||(n[f.group]=new Vi,this._ownedBindGroups.push(n[f.group])),n[f.group].setResource(p,f.binding))}}this.groups=n,this._uniformBindMap=o,this.resources=this._buildResourceAccessor(n,l)}addResource(t,i,r){var n,s;(n=this._uniformBindMap)[i]||(n[i]={}),(s=this._uniformBindMap[i])[r]||(s[r]=t),this.groups[i]||(this.groups[i]=new Vi,this._ownedBindGroups.push(this.groups[i]))}_buildResourceAccessor(t,i){let r={};for(let n in i){let s=i[n];Object.defineProperty(r,s.name,{get(){return t[s.group].getResource(s.binding)},set(a){t[s.group].setResource(a,s.binding)}})}return r}destroy(t=!1){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(i=>{i.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){let{gpu:i,gl:r,...n}=t,s,a;return i&&(s=Yn.from(i)),r&&(a=pn.from(r)),new hv({gpuProgram:s,glProgram:a,...n})}}}),hp,up,h0=v(()=>{"use strict";hp={name:"local-uniform-msdf-bit",vertex:{header:`
struct LocalUniforms {
uColor:vec4,
uTransformMatrix:mat3x3,
uDistance: f32,
uRound:f32,
}
@group(2) @binding(0) var localUniforms : LocalUniforms;
`,main:`
vColor *= localUniforms.uColor;
modelMatrix *= localUniforms.uTransformMatrix;
`,end:`
if(localUniforms.uRound == 1)
{
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
}
`},fragment:{header:`
struct LocalUniforms {
uColor:vec4,
uTransformMatrix:mat3x3,
uDistance: f32
}
@group(2) @binding(0) var localUniforms : LocalUniforms;
`,main:`
outColor = vec4(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance));
`}},up={name:"local-uniform-msdf-bit",vertex:{header:`
uniform mat3 uTransformMatrix;
uniform vec4 uColor;
uniform float uRound;
`,main:`
vColor *= uColor;
modelMatrix *= uTransformMatrix;
`,end:`
if(uRound == 1.)
{
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
}
`},fragment:{header:`
uniform float uDistance;
`,main:`
outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));
`}}}),cp,dp,u0=v(()=>{"use strict";cp={name:"msdf-bit",fragment:{header:`
fn calculateMSDFAlpha(msdfColor:vec4, shapeColor:vec4, distance:f32) -> f32 {
// MSDF
var median = msdfColor.r + msdfColor.g + msdfColor.b -
min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
max(msdfColor.r, max(msdfColor.g, msdfColor.b));
// SDF
median = min(median, msdfColor.a);
var screenPxDistance = distance * (median - 0.5);
var alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
if (median < 0.01) {
alpha = 0.0;
} else if (median > 0.99) {
alpha = 1.0;
}
// Gamma correction for coverage-like alpha
var luma: f32 = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114));
var gamma: f32 = mix(1.0, 1.0 / 2.2, luma);
var coverage: f32 = pow(shapeColor.a * alpha, gamma);
return coverage;
}
`}},dp={name:"msdf-bit",fragment:{header:`
float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {
// MSDF
float median = msdfColor.r + msdfColor.g + msdfColor.b -
min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
max(msdfColor.r, max(msdfColor.g, msdfColor.b));
// SDF
median = min(median, msdfColor.a);
float screenPxDistance = distance * (median - 0.5);
float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
if (median < 0.01) {
alpha = 0.0;
} else if (median > 0.99) {
alpha = 1.0;
}
// Gamma correction for coverage-like alpha
float luma = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114));
float gamma = mix(1.0, 1.0 / 2.2, luma);
float coverage = pow(shapeColor.a * alpha, gamma);
return coverage;
}
`}}}),lh,hh,fp,c0=v(()=>{We(),xr(),Tr(),Zn(),Jn(),Sr(),oh(),Yi(),pi(),h0(),u0(),fp=class extends ki{constructor(){let e=new ti({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new ke,type:"mat3x3"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),t=yr();lh??(lh=qn({name:"sdf-shader",bits:[Ga,rh(t),hp,cp,mn]})),hh??(hh=Kn({name:"sdf-shader",bits:[Oa,nh(t),up,dp,_n]})),super({glProgram:hh,gpuProgram:lh,resources:{localUniforms:e,batchSamplers:sh(t)}})}}}),pp,d0=v(()=>{xt(),wt(),pp=class extends Je{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 Xe(Ve,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return Xe(Ve,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return Xe(Ve,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return Xe(Ve,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return Xe(Ve,"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 gp(e){if(e==="")return[];typeof e=="string"&&(e=[e]);let t=[];for(let i=0,r=e.length;i{"use strict"}),uh,ch,f0=v(()=>{Ie(),E(),pa(),yl(),pt(),wt(),Sa(),Jl(),Hf(),jn(),d0(),mp(),uh=class uv extends pp{constructor(t){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 i={...uv.defaultOptions,...t};this._textureSize=i.textureSize,this._mipmap=i.mipmap;let r=i.style.clone();i.overrideFill&&(r._fill.color=16777215,r._fill.alpha=1,r._fill.texture=Re.WHITE,r._fill.fill=null),this.applyFillAsTint=i.overrideFill;let n=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let s=wa(r);i.overrideSize?r._stroke&&(r._stroke.width*=this.baseRenderedFontSize/n):r.fontSize=this.baseRenderedFontSize=n,this._style=r,this._skipKerning=i.skipKerning??!1,this.resolution=i.resolution??1,this._padding=i.padding??4,this.fontMetrics=Ri.measureFont(s),this.lineHeight=r.lineHeight||this.fontMetrics.fontSize||r.fontSize}ensureCharacters(t){let i=gp(t).filter(b=>!this._currentChars.includes(b)).filter((b,_,T)=>T.indexOf(b)===_);if(!i.length)return;this._currentChars=[...this._currentChars,...i];let r;this._currentPageIndex===-1?r=this._nextPage():r=this.pages[this._currentPageIndex];let{canvas:n,context:s}=r.canvasAndContext,a=r.texture.source,o=this._style,l=this._currentX,h=this._currentY,u=this.baseRenderedFontSize/this.baseMeasurementFontSize,d=this._padding*u,p=o.fontStyle==="italic"?2:1,f=0,y=!1;for(let b=0;bthis._textureSize&&(h+=f,f=z,l=0,h+f>this._textureSize)){a.update();let ne=this._nextPage();n=ne.canvasAndContext.canvas,s=ne.canvasAndContext.context,a=ne.texture.source,h=0}let ee=C/u-(o.dropShadow?.distance??0)-(o._stroke?.width??0);if(this.chars[_]={id:_.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:ee,kerning:{}},y){this._drawGlyph(s,T,l+d,h+d,u,o);let ne=a.width*u,Q=a.height*u,Y=new ot(l/ne*a.width,h/Q*a.height,R/ne*a.width,z/Q*a.height);this.chars[_].texture=new Re({source:a,frame:Y}),l+=Math.ceil(R)}}a.update(),this._currentX=l,this._currentY=h,this._skipKerning&&this._applyKerning(i,s)}get pageTextures(){return Xe(Ve,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,i){let r=this._measureCache;for(let n=0;n{let y=n.width;for(let b=0;b{let f=n.chars.length-1,y=n.chars[f];for(;y===" ";)n.width-=i.chars[y].xAdvance,y=n.chars[--f];r.width=Math.max(r.width,n.width),n={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,r.lines.push(n),r.height+=i.lineHeight},u=i.baseMeasurementFontSize/t.fontSize,d=t.letterSpacing*u,p=t.wordWrapWidth*u;for(let f=0;fp?(h(),l(o),b||n.charPositions.push(0)):(o.start=n.width,l(o),b||n.charPositions.push(0)),y==="\r"||y===`
`)n.width!==0&&h();else if(!b){let T=_.xAdvance+(_.kerning[s]||0)+d;n.width+=T,n.spaceWidth=T,n.spacesIndex.push(n.charPositions.length),n.chars.push(y)}}else{let T=_.kerning[s]||0,C=_.xAdvance+T+d;o.positions[o.index++]=o.width+T,o.chars.push(y),o.width+=C}s=y}return h(),t.align==="center"?p0(r):t.align==="right"?g0(r):t.align==="justify"&&m0(r),r}function p0(e){for(let t=0;t{"use strict"}),Qn,yp,xp,_0=v(()=>{js(),wt(),I(),jn(),f0(),vp(),mp(),Qn=0,yp=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`,r=!0;if(t._fill.fill&&!t._stroke)i+=t._fill.fill.styleKey,r=!1;else if(t._stroke||t.dropShadow){let s=t.styleKey;s=s.substring(0,s.lastIndexOf("-")),i=`${s}-bitmap`,r=!1}if(!Wt.has(i)){let s=new ch({style:t,overrideFill:r,overrideSize:!0,...this.defaultOptions});Qn++,Qn>50&&F("BitmapText",`You have dynamically created ${Qn} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),s.once("destroy",()=>{Qn--,Wt.remove(i)}),Wt.set(i,s)}let n=Wt.get(i);return n.ensureCharacters?.(e),n}getLayout(e,t){let i=this.getFont(e,t);return _p([...e],t,i)}measureText(e,t){return this.getLayout(e,t)}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},Xe(Ve,"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 r=t.style,n=r instanceof Xi?r:new Xi(r),s=n._fill.fill!==null&&n._fill.fill!==void 0,a=new ch({style:n,overrideFill:s,skipKerning:t.skipKerning,padding:t.padding,resolution:t.resolution,overrideSize:!1}),o=gp(t.chars);return a.ensureCharacters(o.join("")),Wt.set(`${i}-bitmap`,a),a.once("destroy",()=>Wt.remove(`${i}-bitmap`)),a}uninstall(e){let t=`${e}-bitmap`,i=Wt.get(t);i&&(Wt.remove(t),i.destroy())}},xp=new yp});function bp(e,t){t.groupTransform=e.groupTransform,t.groupColorAlpha=e.groupColorAlpha,t.groupColor=e.groupColor,t.groupBlendMode=e.groupBlendMode,t.globalDisplayStatus=e.globalDisplayStatus,t.groupTransform=e.groupTransform,t.localDisplayStatus=e.localDisplayStatus,t.groupAlpha=e.groupAlpha,t._roundPixels=e._roundPixels}var dh,v0=v(()=>{js(),te(),Ht(),Wf(),c0(),_0(),vp(),dh=class{constructor(e){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e}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);bp(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);bp(e,t),this._renderer.renderPipes.graphics.updateRenderable(t),t.context.customShader&&this._updateDistanceField(e)}_updateContext(e,t){let{context:i}=t,r=xp.getFont(e.text,e._style);i.clear(),r.distanceField.type!=="none"&&(i.customShader||(i.customShader=Le.get(fp)));let n=Array.from(e.text),s=e._style,a=r.baseLineOffset,o=_p(n,s,r),l=0,h=s.padding,u=o.scale,d=o.width,p=o.height+o.offsetY;s._stroke&&(d+=s._stroke.width/u,p+=s._stroke.width/u),i.translate(-e._anchor._x*d-h,-e._anchor._y*p-h).scale(u,u);let f=r.applyFillAsTint?s._fill.color:16777215;for(let y=0;y{te(),v0(),pe.add(dh)}),fh,y0=v(()=>{te(),pt(),pl(),Ht(),Ll(),fh=class{constructor(e){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.runners.resolutionChange.add(this)}resolutionChange(){for(let e in this._gpuText){let t=this._gpuText[e].batchableSprite.renderable;t._autoResolution&&(t._resolution=this._renderer.resolution,t.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 i=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),this._renderer.renderPipes.batch.addToBatch(i)}updateRenderable(e){let t=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),t.batcher.updateElement(t)}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),r=i.batchableSprite;i.currentKey!==t&&this._updateGpuText(e).catch(s=>{console.error(s)}),e._didTextUpdate=!1;let n=e._style.padding;Hs(r.bounds,e._anchor,r.texture,n)}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 r=e.resolution??this._renderer.resolution,n=await this._renderer.htmlText.getManagedTexture(e.text,r,e._style,e._getKey()),s=t.batchableSprite;s.texture=t.texture=n,t.generatingTexture=!1,t.textureNeedsUploading=!0,e.onViewUpdate();let a=e._style.padding;Hs(s.bounds,e._anchor,s.texture,a)}_getGpuText(e){return this._gpuText[e.uid]||this.initGpuText(e)}initGpuText(e){let t={texture:Re.EMPTY,currentKey:"--",batchableSprite:Le.get(fa),textureNeedsUploading:!1,generatingTexture:!1},i=t.batchableSprite;return i.renderable=e,i.texture=Re.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}},fh.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"htmlText"}});function x0(){let{userAgent:e}=vt.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(e)}var b0=v(()=>{Ft()}),ph,gh,mh,Tp=v(()=>{"use strict";ph="http://www.w3.org/2000/svg",gh="http://www.w3.org/1999/xhtml",mh=class{constructor(){this.svgRoot=document.createElementNS(ph,"svg"),this.foreignObject=document.createElementNS(ph,"foreignObject"),this.domElement=document.createElementNS(gh,"div"),this.styleElement=document.createElementNS(gh,"style"),this.image=new Image;let{foreignObject:e,svgRoot:t,styleElement:i,domElement:r}=this;e.setAttribute("width","10000"),e.setAttribute("height","10000"),e.style.overflow="hidden",t.appendChild(e),e.appendChild(i),e.appendChild(r)}}});function w0(e){let t=e._stroke,i=e._fill,r=[`div { ${[`color: ${ue.shared.setValue(i.color).toHex()}`,`font-size: ${e.fontSize}px`,`font-family: ${e.fontFamily}`,`font-weight: ${e.fontWeight}`,`font-style: ${e.fontStyle}`,`font-variant: ${e.fontVariant}`,`letter-spacing: ${e.letterSpacing}px`,`text-align: ${e.align}`,`padding: ${e.padding}px`,`white-space: ${e.whiteSpace==="pre"&&e.wordWrap?"pre-wrap":e.whiteSpace}`,...e.lineHeight?[`line-height: ${e.lineHeight}px`]:[],...e.wordWrap?[`word-wrap: ${e.breakWords?"break-all":"break-word"}`,`max-width: ${e.wordWrapWidth}px`]:[],...t?[Ep(t)]:[],...e.dropShadow?[Sp(e.dropShadow)]:[],...e.cssOverrides].join(";")} }`];return T0(e.tagStyles,r),r.join(" ")}function Sp(e){let t=ue.shared.setValue(e.color).setAlpha(e.alpha).toHexa(),i=Math.round(Math.cos(e.angle)*e.distance),r=Math.round(Math.sin(e.angle)*e.distance),n=`${i}px ${r}px`;return e.blur>0?`text-shadow: ${n} ${e.blur}px ${t}`:`text-shadow: ${n} ${t}`}function Ep(e){return[`-webkit-text-stroke-width: ${e.width}px`,`-webkit-text-stroke-color: ${ue.shared.setValue(e.color).toHex()}`,`text-stroke-width: ${e.width}px`,`text-stroke-color: ${ue.shared.setValue(e.color).toHex()}`,"paint-order: stroke"].join(";")}function T0(e,t){for(let i in e){let r=e[i],n=[];for(let s in r)vh[s]?n.push(vh[s](r[s])):_h[s]&&n.push(_h[s].replace("{{VALUE}}",r[s]));t.push(`${i} { ${n.join(";")} }`)}}var _h,vh,S0=v(()=>{Ie(),_h={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"},vh={fill:e=>`color: ${ue.shared.setValue(e).toHex()}`,breakWords:e=>`word-wrap: ${e?"break-all":"break-word"}`,stroke:Ep,dropShadow:Sp}}),Ap,E0=v(()=>{I(),jn(),Uf(),S0(),Ap=class cv extends Xi{constructor(t={}){super(t),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=t.cssOverrides),this.tagStyles=t.tagStyles??{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Gf(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new cv({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=w0(this)),this._cssStyle}addOverride(...t){let i=t.filter(r=>!this.cssOverrides.includes(r));i.length>0&&(this.cssOverrides.push(...i),this.update())}removeOverride(...t){let i=t.filter(r=>this.cssOverrides.includes(r));i.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!i.includes(r)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&F("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&F("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function A0(e,t){let i=t.fontFamily,r=[],n={},s=/font-family:([^;"\s]+)/g,a=e.match(s);function o(l){n[l]||(r.push(l),n[l]=!0)}if(Array.isArray(i))for(let l=0;l{let h=l.split(":")[1].trim();o(h)});for(let l in t.tagStyles){let h=t.tagStyles[l].fontFamily;o(h)}return r}var C0=v(()=>{"use strict"});async function M0(e){let t=await(await vt.get().fetch(e)).blob(),i=new FileReader;return await new Promise((r,n)=>{i.onloadend=()=>r(i.result),i.onerror=n,i.readAsDataURL(t)})}var P0=v(()=>{Ft()});async function Cp(e,t){let i=await M0(t);return`@font-face {
font-family: "${e.fontFamily}";
src: url('${i}');
font-weight: ${e.fontWeight};
font-style: ${e.fontStyle};
}`}var R0=v(()=>{P0()});async function k0(e,t,i){let r=e.filter(n=>Wt.has(`${n}-and-url`)).map((n,s)=>{if(!es.has(n)){let{url:a}=Wt.get(`${n}-and-url`);s===0?es.set(n,Cp({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:n},a)):es.set(n,Cp({fontWeight:i.fontWeight,fontStyle:i.fontStyle,fontFamily:n},a))}return es.get(n)});return(await Promise.all(r)).join(`
`)}var es,B0=v(()=>{js(),R0(),es=new Map});function I0(e,t,i,r,n){let{domElement:s,styleElement:a,svgRoot:o}=n;s.innerHTML=`${e}
`,s.setAttribute("style",`transform: scale(${i});transform-origin: top left; display: inline-block`),a.textContent=r;let{width:l,height:h}=n.image;return o.setAttribute("width",l.toString()),o.setAttribute("height",h.toString()),new XMLSerializer().serializeToString(o)}var G0=v(()=>{"use strict"});function O0(e,t){let i=$i.getOptimalCanvasAndContext(e.width,e.height,t),{context:r}=i;return r.clearRect(0,0,e.width,e.height),r.drawImage(e,0,0),$i.returnCanvasAndContext(i),i.canvas}var U0=v(()=>{pa()});function F0(e,t,i){return new Promise(async r=>{i&&await new Promise(n=>setTimeout(n,100)),e.onload=()=>{r()},e.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,e.crossOrigin="anonymous"})}var D0=v(()=>{"use strict"});function L0(e,t,i,r){r=r||Mp||(Mp=new mh);let{domElement:n,styleElement:s,svgRoot:a}=r;n.innerHTML=`${e}
`,n.setAttribute("style","transform-origin: top left; display: inline-block"),i&&(s.textContent=i),document.body.appendChild(a);let o=n.getBoundingClientRect();a.remove();let l=Ri.measureFont(t.fontStyle).descent,h=t.padding*2;return{width:o.width-h,height:o.height+l-h}}var Mp,N0=v(()=>{Sa(),Tp()}),Da,H0=v(()=>{te(),Ln(),sr(),b0(),I(),Ht(),Lf(),Tp(),E0(),C0(),B0(),G0(),U0(),D0(),N0(),Da=class{constructor(e){this._activeTextures={},this._renderer=e,this._createCanvas=e.type===Ei.WEBGPU}getTexture(e){return this._buildTexturePromise(e.text,e.resolution,e.style)}getManagedTexture(e,t,i,r){if(this._activeTextures[r])return this._increaseReferenceCount(r),this._activeTextures[r].promise;let n=this._buildTexturePromise(e,t,i).then(s=>(this._activeTextures[r].texture=s,s));return this._activeTextures[r]={texture:null,promise:n,usageCount:1},n}async _buildTexturePromise(e,t,i){let r=Le.get(mh),n=A0(e,i),s=await k0(n,i,Ap.defaultTextStyle),a=L0(e,i,s,r),o=Math.ceil(Math.ceil(Math.max(1,a.width)+i.padding*2)*t),l=Math.ceil(Math.ceil(Math.max(1,a.height)+i.padding*2)*t),h=r.image,u=2;h.width=(o|0)+u,h.height=(l|0)+u;let d=I0(e,i,t,s,r);await F0(h,d,x0()&&n.length>0);let p=h;this._createCanvas&&(p=O0(h,t));let f=Ff(p,h.width-u,h.height-u,t);return this._createCanvas&&this._renderer.texture.initSource(f.source),Le.return(r),f}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}decreaseReferenceCount(e){let t=this._activeTextures[e];t&&(t.usageCount--,t.usageCount===0&&(t.texture?this._cleanUp(t):t.promise.then(i=>{t.texture=i,this._cleanUp(t)}).catch(()=>{F("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[e]=null))}_cleanUp(e){gi.returnTexture(e.texture),e.texture.source.resource=null,e.texture.source.uploadMethodId="unknown"}getReferenceCount(e){return this._activeTextures[e].usageCount}destroy(){this._activeTextures=null}},Da.extension={type:[G.WebGLSystem,G.WebGPUSystem,G.CanvasSystem],name:"htmlText"},Da.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}}),Pp=v(()=>{te(),y0(),H0(),pe.add(Da),pe.add(fh)}),yh,La,xh=v(()=>{un(),zr(),Zs(),wt(),yh=class dv extends Un{constructor(...t){let i=t[0]??{};i instanceof Float32Array&&(Xe(Ve,"use new MeshGeometry({ positions, uvs, indices }) instead"),i={positions:i,uvs:t[1],indices:t[2]}),i={...dv.defaultOptions,...i};let r=i.positions||new Float32Array([0,0,1,0,1,1,0,1]),n=i.uvs||new Float32Array([0,0,1,0,1,1,0,1]),s=i.indices||new Uint32Array([0,1,2,0,2,3]),a=i.shrinkBuffersToFit,o=new wi({data:r,label:"attribute-mesh-positions",shrinkToFit:a,usage:tt.VERTEX|tt.COPY_DST}),l=new wi({data:n,label:"attribute-mesh-uvs",shrinkToFit:a,usage:tt.VERTEX|tt.COPY_DST}),h=new wi({data:s,label:"index-mesh-buffer",shrinkToFit:a,usage:tt.INDEX|tt.COPY_DST});super({attributes:{aPosition:{buffer:o,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:l,format:"float32x2",stride:2*4,offset:0}},indexBuffer:h,topology:i.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}},yh.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1},La=yh}),vn,Rp,Na,ts=v(()=>{"use strict";vn={name:"local-uniform-bit",vertex:{header:`
struct LocalUniforms {
uTransformMatrix:mat3x3,
uColor:vec4,
uRound:f32,
}
@group(1) @binding(0) var localUniforms : LocalUniforms;
`,main:`
vColor *= localUniforms.uColor;
modelMatrix *= localUniforms.uTransformMatrix;
`,end:`
if(localUniforms.uRound == 1)
{
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
}
`}},Rp={...vn,vertex:{...vn.vertex,header:vn.vertex.header.replace("group(1)","group(2)")}},Na={name:"local-uniform-bit",vertex:{header:`
uniform mat3 uTransformMatrix;
uniform vec4 uColor;
uniform float uRound;
`,main:`
vColor *= uColor;
modelMatrix = uTransformMatrix;
`,end:`
if(uRound == 1.)
{
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
}
`}}}),kp,Bp,z0=v(()=>{"use strict";kp={name:"tiling-bit",vertex:{header:`
struct TilingUniforms {
uMapCoord:mat3x3,
uClampFrame:vec4,
uClampOffset:vec2,
uTextureTransform:mat3x3,
uSizeAnchor:vec4
};
@group(2) @binding(0) var tilingUniforms: TilingUniforms;
@group(2) @binding(1) var uTexture: texture_2d;
@group(2) @binding(2) var uSampler: sampler;
`,main:`
uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;
position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;
`},fragment:{header:`
struct TilingUniforms {
uMapCoord:mat3x3,
uClampFrame:vec4,
uClampOffset:vec2,
uTextureTransform:mat3x3,
uSizeAnchor:vec4
};
@group(2) @binding(0) var tilingUniforms: TilingUniforms;
@group(2) @binding(1) var uTexture: texture_2d;
@group(2) @binding(2) var uSampler: sampler;
`,main:`
var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);
coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;
var unclamped = coord;
coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);
var bias = 0.;
if(unclamped.x == coord.x && unclamped.y == coord.y)
{
bias = -32.;
}
outColor = textureSampleBias(uTexture, uSampler, coord, bias);
`}},Bp={name:"tiling-bit",vertex:{header:`
uniform mat3 uTextureTransform;
uniform vec4 uSizeAnchor;
`,main:`
uv = (uTextureTransform * vec3(aUV, 1.0)).xy;
position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;
`},fragment:{header:`
uniform sampler2D uTexture;
uniform mat3 uMapCoord;
uniform vec4 uClampFrame;
uniform vec2 uClampOffset;
`,main:`
vec2 coord = vUV + ceil(uClampOffset - vUV);
coord = (uMapCoord * vec3(coord, 1.0)).xy;
vec2 unclamped = coord;
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
`}}}),bh,wh,Ip,W0=v(()=>{We(),Tr(),ts(),Sr(),Yi(),pi(),pt(),z0(),Ip=class extends ki{constructor(){bh??(bh=qn({name:"tiling-sprite-shader",bits:[vn,kp,mn]})),wh??(wh=Kn({name:"tiling-sprite-shader",bits:[Na,Bp,_n]}));let e=new ti({uMapCoord:{value:new ke,type:"mat3x3"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2"},uTextureTransform:{value:new ke,type:"mat3x3"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4"}});super({glProgram:wh,gpuProgram:bh,resources:{localUniforms:new ti({uTransformMatrix:{value:new ke,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),tilingUniforms:e,uTexture:Re.EMPTY.source,uSampler:Re.EMPTY.source.style}})}updateUniforms(e,t,i,r,n,s){let a=this.resources.tilingUniforms,o=s.width,l=s.height,h=s.textureMatrix,u=a.uniforms.uTextureTransform;u.set(i.a*o/e,i.b*o/t,i.c*l/e,i.d*l/t,i.tx/e,i.ty/t),u.invert(),a.uniforms.uMapCoord=h.mapCoord,a.uniforms.uClampFrame=h.uClampFrame,a.uniforms.uClampOffset=h.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=e,a.uniforms.uSizeAnchor[1]=t,a.uniforms.uSizeAnchor[2]=r,a.uniforms.uSizeAnchor[3]=n,s&&(this.resources.uTexture=s.source,this.resources.uSampler=s.source.style)}}}),Gp,V0=v(()=>{xh(),Gp=class extends La{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])})}}});function j0(e,t){let i=e.anchor.x,r=e.anchor.y;t[0]=-i*e.width,t[1]=-r*e.height,t[2]=(1-i)*e.width,t[3]=-r*e.height,t[4]=(1-i)*e.width,t[5]=(1-r)*e.height,t[6]=-i*e.width,t[7]=(1-r)*e.height}var $0=v(()=>{"use strict"});function X0(e,t,i,r){let n=0,s=e.length/(t||2),a=r.a,o=r.b,l=r.c,h=r.d,u=r.tx,d=r.ty;for(i*=t;n{"use strict"});function q0(e,t){let i=e.texture,r=i.frame.width,n=i.frame.height,s=0,a=0;e._applyAnchorToTexture&&(s=e.anchor.x,a=e.anchor.y),t[0]=t[6]=-s,t[2]=t[4]=1-s,t[1]=t[3]=-a,t[5]=t[7]=1-a;let o=ke.shared;o.copyFrom(e._tileTransform.matrix),o.tx/=e.width,o.ty/=e.height,o.invert(),o.scale(e.width/r,e.height/n),X0(t,2,0,o)}var K0=v(()=>{We(),Y0()}),is,Th,Z0=v(()=>{te(),Cl(),nr(),sr(),ha(),Fl(),xh(),W0(),V0(),$0(),K0(),is=new Gp,Th=class{constructor(e){this._state=ji.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e}validateRenderable(e){let t=this._getTilingSpriteData(e),i=t.canBatch;this._updateCanBatch(e);let r=t.canBatch;if(r&&r===i){let{batchableMesh:n}=t;if(n&&n.texture._source!==e.texture._source)return!n.batcher.checkAndUpdateTexture(n,e.texture)}return i!==r}addRenderable(e,t){let i=this._renderer.renderPipes.batch;this._updateCanBatch(e);let r=this._getTilingSpriteData(e),{geometry:n,canBatch:s}=r;if(s){r.batchableMesh||(r.batchableMesh=new da);let a=r.batchableMesh;e._didTilingSpriteUpdate&&(e._didTilingSpriteUpdate=!1,this._updateBatchableMesh(e),a.geometry=n,a.mesh=e,a.texture=e._texture),a.roundPixels=this._renderer._roundPixels|e._roundPixels,i.addToBatch(a)}else i.break(t),r.shader||(r.shader=new Ip),this.updateRenderable(e),t.add(e)}execute(e){let{shader:t}=this._tilingSpriteDataHash[e.uid];t.groups[0]=this._renderer.globalUniforms.bindGroup;let i=t.resources.localUniforms.uniforms;i.uTransformMatrix=e.groupTransform,i.uRound=this._renderer._roundPixels|e._roundPixels,la(e.groupColorAlpha,i.uColor,0),this._state.blendMode=qs(e.groupBlendMode,e.texture._source),this._renderer.encoder.draw({geometry:is,shader:t,state:this._state})}updateRenderable(e){let t=this._getTilingSpriteData(e),{canBatch:i}=t;if(i){let{batchableMesh:r}=t;e._didTilingSpriteUpdate&&this._updateBatchableMesh(e),r.batcher.updateElement(r)}else if(e._didTilingSpriteUpdate){let{shader:r}=t;r.updateUniforms(e.width,e.height,e._tileTransform.matrix,e.anchor.x,e.anchor.y,e.texture)}e._didTilingSpriteUpdate=!1}destroyRenderable(e){let t=this._getTilingSpriteData(e);t.batchableMesh=null,t.shader?.destroy(),this._tilingSpriteDataHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(e){return this._tilingSpriteDataHash[e.uid]||this._initTilingSpriteData(e)}_initTilingSpriteData(e){let t=new La({indices:is.indices,positions:is.positions.slice(),uvs:is.uvs.slice()});return this._tilingSpriteDataHash[e.uid]={canBatch:!0,renderable:e,geometry:t},e.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[e.uid]}_updateBatchableMesh(e){let t=this._getTilingSpriteData(e),{geometry:i}=t,r=e.texture.source.style;r.addressMode!=="repeat"&&(r.addressMode="repeat",r.update()),q0(e,i.uvs),j0(e,i.positions)}destroy(){for(let e in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[e].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(e){let t=this._getTilingSpriteData(e),i=e.texture,r=!0;return this._renderer.type===Ei.WEBGL&&(r=this._renderer.context.supports.nonPowOf2wrapping),t.canBatch=i.textureMatrix.isSimple&&(r||i.source.isPowerOfTwo),t.canBatch}},Th.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"tilingSprite"}}),Op=v(()=>{te(),Z0(),pe.add(Th)}),Sh,Up,J0=v(()=>{wt(),xh(),Sh=class fv extends La{constructor(...t){super({});let i=t[0]??{};typeof i=="number"&&(Xe(Ve,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),i={width:i,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(i)}build(t){t={...fv.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let i=this.verticesX*this.verticesY,r=[],n=[],s=[],a=this.verticesX-1,o=this.verticesY-1,l=this.width/a,h=this.height/o;for(let d=0;d{J0(),Eh=class pv extends Up{constructor(t={}){t={...pv.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this.updateUvs(),this.updatePositions()}updatePositions(){let t=this.positions,i=this._leftWidth+this._rightWidth,r=this.width>i?1:this.width/i,n=this._topHeight+this._bottomHeight,s=this.height>n?1:this.height/n,a=Math.min(r,s);t[9]=t[11]=t[13]=t[15]=this._topHeight*a,t[17]=t[19]=t[21]=t[23]=this.height-this._bottomHeight*a,t[25]=t[27]=t[29]=t[31]=this.height,t[2]=t[10]=t[18]=t[26]=this._leftWidth*a,t[4]=t[12]=t[20]=t[28]=this.width-this._rightWidth*a,t[6]=t[14]=t[22]=t[30]=this.width,this.getBuffer("aPosition").update()}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let i=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=i*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-i*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update()}},Eh.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100},Fp=Eh}),Ah,eb=v(()=>{te(),Ht(),Fl(),Q0(),Ah=class{constructor(e){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e}addRenderable(e,t){let i=this._getGpuSprite(e);e._didSpriteUpdate&&this._updateBatchableSprite(e,i),this._renderer.renderPipes.batch.addToBatch(i)}updateRenderable(e){let t=this._gpuSpriteHash[e.uid];e._didSpriteUpdate&&this._updateBatchableSprite(e,t),t.batcher.updateElement(t)}validateRenderable(e){let t=e._texture,i=this._getGpuSprite(e);return i.texture._source!==t._source?!i.batcher.checkAndUpdateTexture(i,t):!1}destroyRenderable(e){let t=this._gpuSpriteHash[e.uid];Le.return(t.geometry),Le.return(t),this._gpuSpriteHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(e,t){e._didSpriteUpdate=!1,t.geometry.update(e),t.texture=e._texture}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let t=Le.get(da);return t.geometry=Le.get(Fp),t.mesh=e,t.texture=e._texture,t.roundPixels=this._renderer._roundPixels|e._roundPixels,e._didSpriteUpdate=!0,this._gpuSpriteHash[e.uid]=t,e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuSpriteHash)this._gpuSpriteHash[e].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}},Ah.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"nineSliceSprite"}}),Dp=v(()=>{te(),eb(),pe.add(Ah)}),Ch,tb=v(()=>{te(),Ch=class{constructor(e){this._renderer=e}push(e,t,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:t,filterEffect:e})}pop(e,t,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(e){e.action==="pushFilter"?this._renderer.filter.push(e):e.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}},Ch.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"filter"}});function ib(e,t){return t.clear(),Lp(e,t),t.isValid||t.set(0,0,0,0),e.renderGroup?t.applyMatrix(e.renderGroup.localTransform):t.applyMatrix(e.parentRenderGroup.worldTransform),t}function Lp(e,t){if(e.localDisplayStatus!==7||!e.measurable)return;let i=!!e.effects.length,r=t;if((e.renderGroup||i)&&(r=w.get().clear()),e.boundsArea)t.addRect(e.boundsArea,e.worldTransform);else{if(e.renderPipeId){let s=e.bounds;r.addFrame(s.minX,s.minY,s.maxX,s.maxY,e.groupTransform)}let n=e.children;for(let s=0;s{We(),S(),Np=new ke});function nb(e,t){t.clear();let i=t.matrix;for(let r=0;r{"use strict"}),Hp,Mh,ab=v(()=>{te(),We(),At(),Nr(),Zs(),pi(),pt(),Ln(),sr(),m(),rb(),sb(),I(),Hp=new Un({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Mh=class{constructor(e){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new ti({uInputSize:{value:new Float32Array(4),type:"vec4"},uInputPixel:{value:new Float32Array(4),type:"vec4"},uInputClamp:{value:new Float32Array(4),type:"vec4"},uOutputFrame:{value:new Float32Array(4),type:"vec4"},uGlobalFrame:{value:new Float32Array(4),type:"vec4"},uOutputTexture:{value:new Float32Array(4),type:"vec4"}}),this._globalFilterBindGroup=new Vi({}),this.renderer=e}get activeBackTexture(){return this._activeFilterData?.backTexture}push(e){let t=this.renderer,i=e.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let r=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){r.skip=!0;return}let n=r.bounds;e.renderables?nb(e.renderables,n):e.filterEffect.filterArea?(n.clear(),n.addRect(e.filterEffect.filterArea),n.applyMatrix(e.container.worldTransform)):ib(e.container,n);let s=t.renderTarget.renderTarget.colorTexture.source,a=1/0,o=0,l=!0,h=!1,u=!1;for(let p=0;p0?this._filterStack[this._filterStackIndex-1].bounds:null,o=e.renderTarget.getRenderTarget(t.previousRenderSurface);n=this.getBackTexture(o,r,a)}t.backTexture=n;let s=t.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(n.source,3),e.globalUniforms.pop(),s.length===1)s[0].apply(this,i,t.previousRenderSurface,!1),gi.returnTexture(i);else{let a=t.inputTexture,o=gi.getOptimalTexture(r.width,r.height,a.source._resolution,!1),l=0;for(l=0;l