pixifact-cli 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/editor/assets/browserAll-DDpbpxbk.js +1 -0
- package/editor/assets/{capture-DkKec9UG.js → capture--KpnplUn.js} +1 -1
- package/editor/assets/{captureCompilerScenePreview-CeYQNPPP.js → captureCompilerScenePreview-CksQqv9T.js} +3 -3
- package/editor/assets/editor-CdMzlphb.js +5 -0
- package/editor/assets/editor-rwswALuA.css +1 -0
- package/editor/assets/{init-BTbgjve4.js → init-Cun-jBBV.js} +1 -1
- package/editor/assets/webworkerAll-CpwJPQ3Y.js +1 -0
- package/editor/capture.html +2 -2
- package/editor/index.html +3 -3
- package/package.json +2 -2
- package/src/editorServer.ts +25 -6
- package/src/editorSession.ts +26 -6
- package/editor/assets/browserAll-D1Wipsos.js +0 -1
- package/editor/assets/editor-B_YR_yGH.css +0 -1
- package/editor/assets/editor-CCOqWQMU.js +0 -5
- package/editor/assets/webworkerAll-Ch415gWo.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browserAll-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browserAll-DDpbpxbk.js","assets/init-Cun-jBBV.js","assets/webworkerAll-CpwJPQ3Y.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=[`x`,`y`,`width`,`height`,`scaleX`,`scaleY`,`rotation`,`pivotX`,`pivotY`,`skewX`,`skewY`],d=[`left`,`right`,`top`,`bottom`,`horizontal`,`vertical`],f=[`alpha`,`visible`,`zIndex`,`eventMode`,`cursor`,`label`],p=[`texture`,`anchorX`,`anchorY`,`tint`],m=[`texture`,`fit`,`anchorX`,`anchorY`,`tint`],h=[`texture`,`leftWidth`,`rightWidth`,`topHeight`,`bottomHeight`,`anchorX`,`anchorY`,`tint`],g=[`texture`,`tilePositionX`,`tilePositionY`,`tileScaleX`,`tileScaleY`,`tileRotation`,`anchorX`,`anchorY`,`tint`],_=[`leftWidth`,`rightWidth`,`topHeight`,`bottomHeight`],v=[`tilePositionX`,`tilePositionY`,`tileScaleX`,`tileScaleY`,`tileRotation`],y=[`text`,`fontSize`,`fontFamily`,`fontWeight`,`fill`],b=[...y,`lineHeight`,`letterSpacing`,`wordWrap`,`alignX`,`alignY`,`overflow`],x=[`shape`,`radius`,`fill`,`fillAlpha`,`strokeColor`,`strokeWidth`,`strokeAlpha`],S=[`fillColor`,`fillAlpha`,`strokeColor`,`strokeAlpha`,`strokeWidth`,`radius`],C=[`gap`,`alignY`,`justify`],w=[`columns`,`gapX`,`gapY`,`alignX`,`alignY`],T=[`gap`,`alignX`,`justify`],E=[`columns`,`gap`,`gapX`,`gapY`,`alignX`,`alignY`,`justify`],D=[`direction`,`scrollX`,`scrollY`],O=[`fontSize`,`fontFamily`,`fontWeight`,`fill`],k=[...p,...m,...h,...g,..._,...v];[...u,...d,...f,...k,...y,...b,...x,...S,...E,...D];var ee=[`Group`,`GridContainer`,`HBoxContainer`,`ScrollContainer`,`VBoxContainer`,`Container`,`Sprite`,`NineSliceSprite`,`TilingSprite`,`Label`,`BitmapLabel`,`Text`,`BitmapText`,`HTMLText`,`Graphics`,`Rect`,`Image`,`NineImage`,`TileImage`],te={x:{key:`x`,type:`number`},y:{key:`y`,type:`number`},width:{key:`width`,type:`number`},height:{key:`height`,type:`number`},scaleX:{key:`scaleX`,type:`number`},scaleY:{key:`scaleY`,type:`number`},rotation:{key:`rotation`,type:`number`},pivotX:{key:`pivotX`,type:`number`},pivotY:{key:`pivotY`,type:`number`},skewX:{key:`skewX`,type:`number`},skewY:{key:`skewY`,type:`number`},left:{key:`left`,type:`number`},right:{key:`right`,type:`number`},top:{key:`top`,type:`number`},bottom:{key:`bottom`,type:`number`},horizontal:{key:`horizontal`,type:`number`},vertical:{key:`vertical`,type:`number`},alpha:{key:`alpha`,type:`number`},visible:{key:`visible`,type:`boolean`},zIndex:{key:`zIndex`,type:`number`},eventMode:{key:`eventMode`,type:`enum`,options:[`none`,`passive`,`auto`,`static`,`dynamic`]},cursor:{key:`cursor`,type:`enum`,options:[`default`,`pointer`,`text`,`grab`,`grabbing`]},label:{key:`label`,type:`string`},texture:{key:`texture`,type:`string`,resource:`image`},fit:{key:`fit`,type:`enum`,options:[`stretch`,`contain`,`cover`,`none`]},anchorX:{key:`anchorX`,type:`number`},anchorY:{key:`anchorY`,type:`number`},tint:{key:`tint`,type:`color`},leftWidth:{key:`leftWidth`,type:`number`},rightWidth:{key:`rightWidth`,type:`number`},topHeight:{key:`topHeight`,type:`number`},bottomHeight:{key:`bottomHeight`,type:`number`},tilePositionX:{key:`tilePositionX`,type:`number`},tilePositionY:{key:`tilePositionY`,type:`number`},tileScaleX:{key:`tileScaleX`,type:`number`},tileScaleY:{key:`tileScaleY`,type:`number`},tileRotation:{key:`tileRotation`,type:`number`},text:{key:`text`,type:`string`},fontSize:{key:`fontSize`,type:`number`},fontFamily:{key:`fontFamily`,type:`string`},fontWeight:{key:`fontWeight`,type:`enum`,options:[400,500,600,700,`bold`]},fill:{key:`fill`,type:`color`},lineHeight:{key:`lineHeight`,type:`number`},letterSpacing:{key:`letterSpacing`,type:`number`},wordWrap:{key:`wordWrap`,type:`boolean`},overflow:{key:`overflow`,type:`enum`,options:[`visible`,`clip`]},fillColor:{key:`fillColor`,type:`color`},shape:{key:`shape`,type:`enum`,options:[`roundRect`,`rect`]},radius:{key:`radius`,type:`number`},fillAlpha:{key:`fillAlpha`,type:`number`},strokeColor:{key:`strokeColor`,type:`color`},strokeWidth:{key:`strokeWidth`,type:`number`},strokeAlpha:{key:`strokeAlpha`,type:`number`},columns:{key:`columns`,type:`number`},gap:{key:`gap`,type:`number`},gapX:{key:`gapX`,type:`number`},gapY:{key:`gapY`,type:`number`},alignX:{key:`alignX`,type:`enum`,options:[`start`,`center`,`end`]},alignY:{key:`alignY`,type:`enum`,options:[`start`,`center`,`end`]},justify:{key:`justify`,type:`enum`,options:[`start`,`center`,`end`,`space-between`]},direction:{key:`direction`,type:`enum`,options:[`vertical`,`horizontal`,`both`]},scrollX:{key:`scrollX`,type:`number`},scrollY:{key:`scrollY`,type:`number`}},A={Group:{type:`Group`,acceptsChildren:!0,defaults:{width:100,height:100},groups:{}},Container:{type:`Container`,acceptsChildren:!0,defaults:{width:100,height:100},groups:{}},Sprite:{type:`Sprite`,acceptsChildren:!1,defaults:{width:96,height:96},groups:{sprite:p}},NineSliceSprite:{type:`NineSliceSprite`,acceptsChildren:!1,defaults:{width:160,height:80,leftWidth:10,rightWidth:10,topHeight:10,bottomHeight:10},groups:{sprite:p,nineSlice:_}},TilingSprite:{type:`TilingSprite`,acceptsChildren:!1,defaults:{width:160,height:96,tileScaleX:1,tileScaleY:1},groups:{sprite:p,tiling:v}},Text:{type:`Text`,acceptsChildren:!1,defaults:{text:`Text`,fontSize:16,fill:1120295},groups:{text:y}},Label:{type:`Label`,acceptsChildren:!1,defaults:{text:`Text`,width:120,height:28,fontFamily:`Arial`,fontSize:16,fontWeight:400,fill:1120295,lineHeight:0,letterSpacing:0,wordWrap:!1,alignX:`start`,alignY:`start`,overflow:`visible`},groups:{text:b}},BitmapLabel:{type:`BitmapLabel`,acceptsChildren:!1,defaults:{text:`Text`,width:120,height:28,fontFamily:`Arial`,fontSize:16,fontWeight:400,fill:1120295,lineHeight:0,letterSpacing:0,wordWrap:!1,alignX:`start`,alignY:`start`,overflow:`visible`},groups:{text:b}},BitmapText:{type:`BitmapText`,acceptsChildren:!1,defaults:{text:`Text`,fontSize:16,fill:1120295},groups:{text:y}},HTMLText:{type:`HTMLText`,acceptsChildren:!1,defaults:{text:`Text`,fontSize:16,fill:1120295},groups:{text:y}},Graphics:{type:`Graphics`,acceptsChildren:!1,defaults:{shape:`roundRect`,width:100,height:60,radius:8,fill:15067115},groups:{graphics:x}},Rect:{type:`Rect`,acceptsChildren:!1,defaults:{width:100,height:60,fillColor:16777215,fillAlpha:1,strokeColor:0,strokeAlpha:1,strokeWidth:0,radius:0},groups:{props:S}},Image:{type:`Image`,acceptsChildren:!1,defaults:{width:96,height:96,fit:`stretch`},groups:{props:m}},NineImage:{type:`NineImage`,acceptsChildren:!1,defaults:{width:160,height:80,leftWidth:10,rightWidth:10,topHeight:10,bottomHeight:10},groups:{props:h}},TileImage:{type:`TileImage`,acceptsChildren:!1,defaults:{width:160,height:96,tileScaleX:1,tileScaleY:1},groups:{props:g}},GridContainer:{type:`GridContainer`,acceptsChildren:!0,defaults:{width:240,height:160,columns:2,gapX:8,gapY:8},groups:{stack:w}},HBoxContainer:{type:`HBoxContainer`,acceptsChildren:!0,defaults:{width:240,height:64,gap:8},groups:{stack:C}},ScrollContainer:{type:`ScrollContainer`,acceptsChildren:!0,defaults:{width:240,height:160,direction:`vertical`,scrollX:0,scrollY:0},groups:{props:D}},VBoxContainer:{type:`VBoxContainer`,acceptsChildren:!0,defaults:{width:160,height:240,gap:8},groups:{stack:T}}};function j(e){return ee.includes(e)}function ne(e){return{...A[e].defaults}}function re(e){return j(e)&&A[e].acceptsChildren}function ie(e){return Object.values(A[e].groups).flat()}function ae(e){return te[e]}function M(e){return!!e&&typeof e==`object`&&e.kind===`binding`}function N(e){return structuredClone(e)}function oe(e,t=``){let n=e.kind===`slotOutlet`?`slot:${e.name}`:e.id??(e.kind===`sceneInstance`?`${e.type}:${e.scene}`:e.type);return t?`${t}:${n}`:(e.kind,n)}function se(e,t,n){return oe(t,e===`__scene__`?String(n):`${e}/${n}`)}function ce(e){return e.trim()||`default`}function le(e,t,n){return e.slots[t]!==void 0||n.sceneInterfaces?.[e.scene]?.slots[t]!==void 0}function ue(e,t,n){return t.kind===`slotOutlet`?e!==`__scene__`&&n:!0}function de(e,t,n,r=`__scene__`,i=!1){for(let[a,o]of e.entries()){let s=se(r,o,a);if(s===t)return{acceptsSlotOutlet:i,index:a,locator:s,node:o,nodes:e,parentLocator:r};if(o.kind===`pixi`){let e=de(o.children,t,n,s,re(o.type));if(e)return e;continue}if(o.kind===`sceneInstance`)for(let[e,r]of Object.entries(o.slots)){let i=de(r,t,n,`${s}/slot:${e}`,!1);if(i)return i}}}function fe(e,t){let n=`${e}/slot:`;if(!t.startsWith(n))return;let r=t.slice(n.length);return r.includes(`/`)?void 0:r}function pe(e,t,n,r=`__scene__`){if(r===`__scene__`&&t===`__scene__`)return{acceptsSlotOutlet:!1,index:e.length,nodes:e,parentLocator:`__scene__`};for(let[i,a]of e.entries()){let e=se(r,a,i);if(a.kind===`pixi`){if(e===t)return re(a.type)?{acceptsSlotOutlet:!0,index:a.children.length,nodes:a.children,parentLocator:e}:void 0;let r=pe(a.children,t,n,e);if(r)return r;continue}if(a.kind===`sceneInstance`){let r=fe(e,t);if(r){if(!le(a,r,n))return;let e=a.slots[r]??[];return a.slots[r]=e,{acceptsSlotOutlet:!1,index:e.length,nodes:e,parentLocator:t}}for(let[r,i]of Object.entries(a.slots)){let a=pe(i,t,n,`${e}/slot:${r}`);if(a)return a}}}}function me(e,t,n=`__scene__`){for(let[r,i]of e.entries()){let e=se(n,i,r);if(i===t)return e;if(i.kind===`pixi`){let n=me(i.children,t,e);if(n)return n;continue}if(i.kind===`sceneInstance`)for(let[n,r]of Object.entries(i.slots)){let i=me(r,t,`${e}/slot:${n}`);if(i)return i}}}function he(e,t){let n=e.name;return e.name=t.value,{ok:!0,command:t,inverse:{op:`setSceneName`,value:n},selection:{type:`scene`}}}function ge(e,t){let n=be(e.props,t.prop);return xe(e.props,t.prop,t.value),{ok:!0,command:t,inverse:{op:`setSceneProp`,prop:t.prop,value:n},selection:{type:`scene`}}}function _e(e,t,n){let r=de(e.children,t.node,n);if(!r||r.node.kind===`slotOutlet`)return{ok:!1,command:t,error:`Node was not found.`};let i=r.node.id,a=t.value?.trim()||void 0;if(a&&a!==i&&ve(e.children,a,r.node))return{ok:!1,command:t,error:`Scene node id "${a}" is already in use.`};r.node.id=a;let o=se(r.parentLocator,r.node,r.index);return{ok:!0,command:t,inverse:{op:`setNodeId`,node:o,value:i},selection:{type:`node`,node:o}}}function ve(e,t,n){for(let r of e)if(r.kind!==`slotOutlet`){if(r!==n&&r.id===t||r.kind===`pixi`&&ve(r.children,t,n))return!0;if(r.kind===`sceneInstance`){for(let e of Object.values(r.slots))if(ve(e,t,n))return!0}}return!1}function ye(e,t,n){let r=de(e.children,t.node,n);if(!r||r.node.kind===`slotOutlet`)return{ok:!1,command:t,error:`Node was not found.`};let i=be(r.node.props,t.prop);return xe(r.node.props,t.prop,t.value),{ok:!0,command:t,inverse:{op:`setNodeProp`,node:t.node,prop:t.prop,value:i},selection:{type:`node`,node:t.node}}}function be(e,t){let[n,r,...i]=t.split(`.`);if(!r||i.length>0)return e[t];let a=e[n];return a&&typeof a==`object`&&!M(a)?a[r]:void 0}function xe(e,t,n){let[r,i,...a]=t.split(`.`);if(!i||a.length>0){n===void 0?delete e[t]:e[t]=n;return}let o=e[r],s=o&&typeof o==`object`&&!M(o)?{...o}:{};n===void 0?delete s[i]:typeof n!=`object`&&(s[i]=n),Object.keys(s).length===0?delete e[r]:e[r]=s}function Se(e,t,n){let r=de(e.children,t.node,n);if(!r||r.node.kind!==`sceneInstance`)return{ok:!1,command:t,error:`Node event target was not found.`};let i=r.node.events[t.event];return t.value===void 0?delete r.node.events[t.event]:r.node.events[t.event]=t.value,{ok:!0,command:t,inverse:{op:`setNodeEvent`,node:t.node,event:t.event,value:i},selection:{type:`node`,node:t.node}}}function Ce(e,t,n){let r=de(e.children,t.node,n);if(!r||r.node.kind!==`slotOutlet`)return{ok:!1,command:t,error:`Slot outlet was not found.`};let i=r.node.name;r.node.name=ce(t.name);let a=se(r.parentLocator,r.node,r.index);return{ok:!0,command:t,inverse:{op:`renameSlotOutlet`,node:a,name:i},selection:{type:`node`,node:a}}}function we(e,t,n){let r=pe(e.children,t.parent,n);if(!r||!ue(t.parent,t.node,r.acceptsSlotOutlet))return{ok:!1,command:t,error:`Parent cannot contain this node.`};let i=N(t.node),a=Math.max(0,Math.min(t.index??r.nodes.length,r.nodes.length));r.nodes.splice(a,0,i);let o=se(t.parent,i,a);return{ok:!0,command:t,inverse:{op:`deleteNode`,node:o},selection:{type:`node`,node:o}}}function Te(e,t,n){let r=de(e.children,t.node,n);if(!r)return{ok:!1,command:t,error:`Node was not found.`};let[i]=r.nodes.splice(r.index,1);return{ok:!0,command:t,inverse:{op:`insertNode`,parent:r.parentLocator,index:r.index,node:N(i)},selection:r.parentLocator===`__scene__`?{type:`scene`}:{type:`node`,node:r.parentLocator}}}function Ee(e,t,n){if(t.parent===t.node||t.parent.startsWith(`${t.node}/`))return{ok:!1,command:t,error:`Cannot move a node into itself.`};let r=de(e.children,t.node,n),i=pe(e.children,t.parent,n);if(!r||!i||!ue(t.parent,r.node,i.acceptsSlotOutlet))return{ok:!1,command:t,error:`Target cannot contain this node.`};let a=r.nodes===i.nodes,[o]=r.nodes.splice(r.index,1),s=t.index;a&&r.index<s&&--s,s=Math.max(0,Math.min(s,i.nodes.length)),i.nodes.splice(s,0,o);let c=me(e.children,o);if(!c)throw Error(`Moved Compiler Scene node is missing from the template.`);return{ok:!0,command:t,inverse:{op:`moveNode`,node:c,parent:r.parentLocator,index:a&&s<r.index?r.index+1:r.index},selection:{type:`node`,node:c}}}function De(e,t,n){let r=[],i;for(let a of t.commands){let o=Oe(e,a,n);if(!o.ok){for(let t=r.length-1;t>=0;t--)Oe(e,r[t],n);return{ok:!1,command:t,error:o.error}}r.push(o.inverse),i=o.selection}return{ok:!0,command:t,inverse:{op:`batch`,commands:[...r].reverse()},selection:i}}function Oe(e,t,n={}){switch(t.op){case`setSceneName`:return he(e,t);case`setSceneProp`:return ge(e,t);case`setNodeId`:return _e(e,t,n);case`setNodeProp`:return ye(e,t,n);case`setNodeEvent`:return Se(e,t,n);case`renameSlotOutlet`:return Ce(e,t,n);case`insertNode`:return we(e,t,n);case`deleteNode`:return Te(e,t,n);case`moveNode`:return Ee(e,t,n);case`batch`:return De(e,t,n)}}var ke=class{undoStack=[];redoStack=[];currentRevision=0;savedRevision=0;get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}get dirty(){return this.currentRevision!==this.savedRevision}execute(e,t,n={},r={}){let i=this.currentRevision,a=Oe(e,t,r);if(!a.ok)return a;this.currentRevision+=1;let o=this.undoStack[this.undoStack.length-1];return n.mergeKey&&o?.mergeKey===n.mergeKey?(o.command=t,o.afterRevision=this.currentRevision,o.label=n.label??o.label):this.undoStack.push({afterRevision:this.currentRevision,beforeRevision:i,command:t,inverse:a.inverse,label:n.label,mergeKey:n.mergeKey}),this.redoStack.length=0,a}undo(e,t={}){let n=this.undoStack.pop();if(!n)return;let r=Oe(e,n.inverse,t);return r.ok?(this.currentRevision=n.beforeRevision,this.redoStack.push(n),r):(this.undoStack.push(n),r)}redo(e,t={}){let n=this.redoStack.pop();if(!n)return;let r=Oe(e,n.command,t);return r.ok?(this.currentRevision=n.afterRevision,this.undoStack.push(n),r):(this.redoStack.push(n),r)}markSaved(){this.savedRevision=this.currentRevision}clear(){this.undoStack.length=0,this.redoStack.length=0,this.currentRevision=0,this.savedRevision=0}},Ae=`pixifact:`,je=new Set([]);function Me(e){return je.has(e)}function Ne(e){if(!Me(e))throw Error(`Unknown built-in Scene "${e}".`);return`${Ae}${e}.scene`}function Pe(e){return e.startsWith(Ae)}function Fe(e){if(!Pe(e)||!e.endsWith(`.scene`))throw Error(`Built-in Scene id "${e}" must use ${Ae}<Name>.scene.`);let t=e.slice(9,-6);if(!Me(t))throw Error(`Unknown built-in Scene "${t}".`);return t}var Ie=[`src`],Le=new Set([`node_modules`,`build`,`dist`,`generated`,`.pixifact`,`coverage`,`test-results`]);function Re(e){return e.replaceAll(`\\`,`/`)}function ze(e,t=``){let n=e.split(`/`).filter(Boolean).at(-1)??``;return t&&n.endsWith(t)?n.slice(0,-t.length):n}function Be(e){let t=Re(e).replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>=0?t.slice(0,n):``}function Ve(e){let t=[];for(let n of Re(e).split(`/`))if(!(!n||n===`.`)){if(n===`..`){t.length&&t[t.length-1]!==`..`?t.pop():t.push(n);continue}t.push(n)}return t.join(`/`)}function He(...e){return Ve(e.filter(Boolean).join(`/`))}function Ue(e){if(Pe(e))return Ne(Fe(e));let t=Re(e).replace(/^\.\/+/,``).replace(/^\/+/,``),n=t.split(`/`).filter(Boolean);if(n.includes(`..`))throw Error(`Scene path "${e}" must stay inside projectRoot.`);if(!t.endsWith(`.scene`))throw Error(`Scene path "${e}" must end with .scene.`);return n.join(`/`)}function We(e){return Le.has(e)}function Ge(e){return Pe(e)?Fe(e):ze(Ue(e),`.scene`)}function Ke(e){return Pe(e)?`${Fe(e)}.ts`:`${Ue(e).slice(0,-6)}.ts`}function qe(e,t){let n=Re(t.trim());if(Pe(n))return Ue(n);if(!n.endsWith(`.scene`))throw Error(`Scene references must use .scene paths.`);return n.startsWith(`./`)||n.startsWith(`../`)?Ue(He(Be(Ue(e)),n)):Ue(n)}var Je=new Set([`Group`,`Container`,`Sprite`,`Text`,`Label`,`BitmapLabel`,`Graphics`,`Rect`,`Image`,`NineImage`,`TileImage`,`BitmapText`,`HTMLText`,`Mesh`,`NineSliceSprite`,`TilingSprite`,`DOMContainer`,`GridContainer`,`HBoxContainer`,`ScrollContainer`,`VBoxContainer`]);function Ye(e){let t=new ot(e).parse();if(t.name!==`Scene`)throw Error(`Expected <Scene> root, received <${t.name}>.`);let n=t.attributes.name;if(!n)throw Error(`Scene template is missing name.`);if(t.attributes.class!==void 0)throw Error(`Scene class is inferred from the paired script @scene class; remove the class attribute.`);if(t.attributes.script!==void 0)throw Error(`Scene script binding is inferred from the colocated TypeScript file.`);let r=t.children.map(Ze);return at(n,r),{version:2,name:n,props:Qe(t,[`name`]),interface:Xe(),children:r}}function Xe(){return{props:{},events:{},slots:{}}}function Ze(e){if(e.name===`slot`)return{kind:`slotOutlet`,name:e.attributes.name||`default`};if(e.attributes.scene!==void 0||Me(e.name)){let t={};for(let n of e.children){let e=n.attributes.slot||`default`;t[e]=t[e]??[],t[e].push(Ze(it(n,`slot`)))}return{kind:`sceneInstance`,type:e.name,scene:e.attributes.scene===void 0?Ne(e.name):e.attributes.scene,props:Qe(e,[`id`,`scene`,`slot`],tt),events:$e(e),slots:t,...e.attributes.id?{id:e.attributes.id}:{}}}if(Je.has(e.name))return{kind:`pixi`,type:e.name,props:Qe(e,[`id`,`slot`]),children:e.children.map(Ze),...e.attributes.id?{id:e.attributes.id}:{}};throw Error(`Unsupported template tag <${e.name}>. Add scene="..." or use a built-in Scene name.`)}function Qe(e,t,n=()=>!1){let r={};for(let[i,a]of Object.entries(e.attributes)){if(t.includes(i)||n(i))continue;let e=nt(i,a),o=i.split(`.`);if(o.length===1){if(r[i]&&typeof r[i]==`object`)throw Error(`Prop "${i}" cannot be both scalar and structured.`);r[i]=e;continue}let[s,c,...l]=o;if(!s||!c||l.length>0)throw Error(`Unsupported structured prop path "${i}".`);if(r[s]!==void 0&&typeof r[s]!=`object`)throw Error(`Prop "${s}" cannot be both scalar and structured.`);if(typeof e==`object`)throw Error(`Structured prop field "${i}" cannot contain an object value.`);let u=r[s]??{};u[c]=e,r[s]=u}return r}function $e(e){let t={};for(let[n,r]of Object.entries(e.attributes)){let e=et(n);e&&(t[e]=r)}return t}function et(e){if(e.startsWith(`@`))return e.slice(1);if(e.startsWith(`on-`)||e.startsWith(`on:`))return e.slice(3)}function tt(e){return et(e)!==void 0}function nt(e,t){return rt(t)||(ae(e)?.type===`string`?t:t===`true`?!0:t===`false`?!1:/^-?\d+(\.\d+)?$/.test(t)?Number(t):/^#[0-9a-fA-F]{6}$/.test(t)?Number.parseInt(t.slice(1),16):t)}function rt(e){let t=/^\{([A-Za-z_$][\w$]*)(?:\.([A-Za-z_$][\w$]*))?\}$/.exec(e);if(!t){if(e.startsWith(`{`)||e.endsWith(`}`))throw Error(`Unsupported Scene binding "${e}". Use {prop} or {variant.field}.`);return}return{kind:`binding`,path:t[2]?[t[1],t[2]]:[t[1]]}}function it(e,t){let n={...e.attributes};return delete n[t],{...e,attributes:n}}function at(e,t){let n=new Set;function r(t){if(t.kind!==`slotOutlet`){if(t.id){if(n.has(t.id))throw Error(`Scene "${e}" has duplicate id "${t.id}".`);n.add(t.id)}if(t.kind===`pixi`){for(let e of t.children)r(e);return}for(let e of Object.values(t.slots))for(let t of e)r(t)}}for(let e of t)r(e)}var ot=class{source;#e=0;constructor(e){this.source=e}parse(){this.#i();let e=this.#t();if(this.#i(),this.#e!==this.source.length)throw Error(`Unexpected content after <${e.name}>.`);return e}#t(){if(this.#o(`<`),this.#c(`/`))throw Error(`Unexpected closing tag.`);let e=this.#n(),t={};for(;;){if(this.#i(),this.#s(`/>`))return{name:e,attributes:t,children:[]};if(this.#s(`>`))break;let n=this.#n();this.#i(),this.#o(`=`),this.#i(),t[n]=this.#r()}let n=[];for(;;){if(this.#i(),this.#s(`</${e}>`))return{name:e,attributes:t,children:n};if(this.#c(`<!--`)){this.#a();continue}if(this.#c(`<`)){n.push(this.#t());continue}throw Error(`Unexpected text inside <${e}>.`)}}#n(){let e=this.#e;for(;this.#e<this.source.length&&/[A-Za-z0-9_:@.-]/.test(this.source[this.#e]);)this.#e+=1;if(e===this.#e)throw Error(`Expected name at offset ${this.#e}.`);return this.source.slice(e,this.#e)}#r(){let e=this.source[this.#e];if(e!==`"`&&e!==`'`)throw Error(`Expected quoted value at offset ${this.#e}.`);this.#e+=1;let t=this.#e;for(;this.#e<this.source.length&&this.source[this.#e]!==e;)this.#e+=1;let n=this.source.slice(t,this.#e);return this.#o(e),st(n)}#i(){for(;this.#e<this.source.length&&/\s/.test(this.source[this.#e]);)this.#e+=1}#a(){let e=this.source.indexOf(`-->`,this.#e+4);if(e===-1)throw Error(`Unterminated comment.`);this.#e=e+3}#o(e){if(!this.#s(e))throw Error(`Expected "${e}" at offset ${this.#e}.`)}#s(e){return this.source.startsWith(e,this.#e)?(this.#e+=e.length,!0):!1}#c(e){return this.source.startsWith(e,this.#e)}};function st(e){return e.replaceAll(`"`,`"`).replaceAll(`'`,`'`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`&`,`&`)}var ct=new Set([`backgroundColor`,`borderColor`,`disabledColor`,`fill`,`fillColor`,`highlightedColor`,`normalColor`,`pressedColor`,`strokeColor`,`textColor`,`tint`]);function lt(e){let t=[`<Scene${pt([[`name`,e.name],...Object.entries(e.props)])}>`];for(let n of e.children)t.push(...ut(n,1));return t.push(`</Scene>`),`${t.join(`
|
|
3
|
-
`)}\n`}function ut(e,t,n=[]){if(e.kind===`slotOutlet`){let r=[...e.name===`default`?[]:[[`name`,e.name]],...n];return[`${vt(t)}<slot${pt(r)} />`]}if(e.kind===`pixi`){let r=[...e.id?[[`id`,e.id]]:[],...n,...Object.entries(e.props)];return ft(e.type,r,e.children,t)}let r=[...e.id?[[`id`,e.id]]:[],...Pe(e.scene)?[]:[[`scene`,e.scene]],...n,...Object.entries(e.props),...Object.entries(e.events).map(([e,t])=>[`@${e}`,t])];return ft(e.type,r,dt(e),t)}function dt(e){return Object.entries(e.slots).flatMap(([e,t])=>t.map(t=>({node:t,slot:e})))}function ft(e,t,n,r){if(n.length===0)return[`${vt(r)}<${e}${pt(t)} />`];let i=[`${vt(r)}<${e}${pt(t)}>`];for(let e of n)if(`slot`in e){let t=e.slot===`default`?[]:[[`slot`,e.slot]];i.push(...ut(e.node,r+1,t))}else i.push(...ut(e,r+1));return i.push(`${vt(r)}</${e}>`),i}function pt(e){return mt(e).map(([e,t])=>` ${e}="${_t(ht(e,t))}"`).join(``)}function mt(e){return e.flatMap(([e,t])=>!t||typeof t!=`object`||gt(t)?[[e,t]]:Object.entries(t).map(([t,n])=>[`${e}.${t}`,n]))}function ht(e,t){return gt(t)?`{${t.path.join(`.`)}}`:typeof t==`number`&&ct.has(e)?`#${t.toString(16).padStart(6,`0`).slice(-6)}`:String(t)}function gt(e){return typeof e==`object`&&e.kind===`binding`}function _t(e){return e.replaceAll(`&`,`&`).replaceAll(`"`,`"`).replaceAll(`<`,`<`).replaceAll(`>`,`>`)}function vt(e){return` `.repeat(e)}new Set(u),new Set(d),new Set(f),new Set(k),new Set(x),new Set(b),new Set(S),new Set(O);var P=(e=>(e.Application=`application`,e.WebGLPipes=`webgl-pipes`,e.WebGLPipesAdaptor=`webgl-pipes-adaptor`,e.WebGLSystem=`webgl-system`,e.WebGPUPipes=`webgpu-pipes`,e.WebGPUPipesAdaptor=`webgpu-pipes-adaptor`,e.WebGPUSystem=`webgpu-system`,e.CanvasSystem=`canvas-system`,e.CanvasPipesAdaptor=`canvas-pipes-adaptor`,e.CanvasPipes=`canvas-pipes`,e.Asset=`asset`,e.LoadParser=`load-parser`,e.ResolveParser=`resolve-parser`,e.CacheParser=`cache-parser`,e.DetectionParser=`detection-parser`,e.MaskEffect=`mask-effect`,e.BlendMode=`blend-mode`,e.TextureSource=`texture-source`,e.Environment=`environment`,e.ShapeBuilder=`shape-builder`,e.Batcher=`batcher`,e))(P||{}),yt=e=>{if(typeof e==`function`||typeof e==`object`&&e.extension){if(!e.extension)throw Error(`Extension class must have an extension object`);e={...typeof e.extension==`object`?e.extension:{type:e.extension},ref:e}}if(typeof e==`object`)e={...e};else throw Error(`Invalid extension type`);return typeof e.type==`string`&&(e.type=[e.type]),e},bt=(e,t)=>yt(e).priority??t,F={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...e){return e.map(yt).forEach(e=>{e.type.forEach(t=>this._removeHandlers[t]?.(e))}),this},add(...e){return e.map(yt).forEach(e=>{e.type.forEach(t=>{let n=this._addHandlers,r=this._queue;n[t]?n[t]?.(e):(r[t]=r[t]||[],r[t]?.push(e))})}),this},handle(e,t,n){let r=this._addHandlers,i=this._removeHandlers;if(r[e]||i[e])throw Error(`Extension type ${e} already has a handler`);r[e]=t,i[e]=n;let a=this._queue;return a[e]&&(a[e]?.forEach(e=>t(e)),delete a[e]),this},handleByMap(e,t){return this.handle(e,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(e,t,n=-1){return this.handle(e,e=>{t.findIndex(t=>t.name===e.name)>=0||(t.push({name:e.name,value:e.ref}),t.sort((e,t)=>bt(t.value,n)-bt(e.value,n)))},e=>{let n=t.findIndex(t=>t.name===e.name);n!==-1&&t.splice(n,1)})},handleByList(e,t,n=-1){return this.handle(e,e=>{t.includes(e.ref)||(t.push(e.ref),t.sort((e,t)=>bt(t,n)-bt(e,n)))},e=>{let n=t.indexOf(e.ref);n!==-1&&t.splice(n,1)})},mixin(e,...t){for(let n of t)Object.defineProperties(e.prototype,Object.getOwnPropertyDescriptors(n))}},xt=`modulepreload`,St=function(e){return`/`+e},Ct={},wt=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=St(t,n),t in Ct)return;Ct[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:xt,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Tt={extension:{type:P.Environment,name:`browser`,priority:-1},test:()=>!0,load:async()=>{await wt(()=>import(`./browserAll-D1Wipsos.js`),__vite__mapDeps([0,1]))}},Et={extension:{type:P.Environment,name:`webworker`,priority:0},test:()=>typeof self<`u`&&self.WorkerGlobalScope!==void 0,load:async()=>{await wt(()=>import(`./webworkerAll-Ch415gWo.js`),__vite__mapDeps([2,1]))}},I=class e{constructor(e,t,n){this._x=t||0,this._y=n||0,this._observer=e}clone(t){return new e(t??this._observer,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this._observer._onUpdate(this)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._observer._onUpdate(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._observer._onUpdate(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._observer._onUpdate(this))}},Dt=l(o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)}))(),1).default,Ot=Math.PI*2,kt=180/Math.PI,At=Math.PI/180,L=class e{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new e(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,t=e){return this.x=e,this.y=t,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return jt.x=0,jt.y=0,jt}},jt=new L,R=class e{constructor(e=1,t=0,n=0,r=1,i=0,a=0){this.array=null,this.a=e,this.b=t,this.c=n,this.d=r,this.tx=i,this.ty=a}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,t,n,r,i,a){return this.a=e,this.b=t,this.c=n,this.d=r,this.tx=i,this.ty=a,this}toArray(e,t){this.array||=new Float32Array(9);let n=t||this.array;return e?(n[0]=this.a,n[1]=this.b,n[2]=0,n[3]=this.c,n[4]=this.d,n[5]=0,n[6]=this.tx,n[7]=this.ty,n[8]=1):(n[0]=this.a,n[1]=this.c,n[2]=this.tx,n[3]=this.b,n[4]=this.d,n[5]=this.ty,n[6]=0,n[7]=0,n[8]=1),n}apply(e,t){t||=new L;let n=e.x,r=e.y;return t.x=this.a*n+this.c*r+this.tx,t.y=this.b*n+this.d*r+this.ty,t}applyInverse(e,t){t||=new L;let n=this.a,r=this.b,i=this.c,a=this.d,o=this.tx,s=this.ty,c=1/(n*a+i*-r),l=e.x,u=e.y;return t.x=a*c*l+-i*c*u+(s*i-o*a)*c,t.y=n*c*u+-r*c*l+(-s*n+o*r)*c,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){let t=Math.cos(e),n=Math.sin(e),r=this.a,i=this.c,a=this.tx;return this.a=r*t-this.b*n,this.b=r*n+this.b*t,this.c=i*t-this.d*n,this.d=i*n+this.d*t,this.tx=a*t-this.ty*n,this.ty=a*n+this.ty*t,this}append(e){let t=this.a,n=this.b,r=this.c,i=this.d;return this.a=e.a*t+e.b*r,this.b=e.a*n+e.b*i,this.c=e.c*t+e.d*r,this.d=e.c*n+e.d*i,this.tx=e.tx*t+e.ty*r+this.tx,this.ty=e.tx*n+e.ty*i+this.ty,this}appendFrom(e,t){let n=e.a,r=e.b,i=e.c,a=e.d,o=e.tx,s=e.ty,c=t.a,l=t.b,u=t.c,d=t.d;return this.a=n*c+r*u,this.b=n*l+r*d,this.c=i*c+a*u,this.d=i*l+a*d,this.tx=o*c+s*u+t.tx,this.ty=o*l+s*d+t.ty,this}setTransform(e,t,n,r,i,a,o,s,c){return this.a=Math.cos(o+c)*i,this.b=Math.sin(o+c)*i,this.c=-Math.sin(o-s)*a,this.d=Math.cos(o-s)*a,this.tx=e-(n*this.a+r*this.c),this.ty=t-(n*this.b+r*this.d),this}prepend(e){let t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let t=this.a,n=this.c;this.a=t*e.a+this.b*e.c,this.b=t*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){let t=this.a,n=this.b,r=this.c,i=this.d,a=e.pivot,o=-Math.atan2(-r,i),s=Math.atan2(n,t),c=Math.abs(o+s);return c<1e-5||Math.abs(Ot-c)<1e-5?(e.rotation=s,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=o,e.skew.y=s),e.scale.x=Math.sqrt(t*t+n*n),e.scale.y=Math.sqrt(r*r+i*i),e.position.x=this.tx+(a.x*t+a.y*r),e.position.y=this.ty+(a.x*n+a.y*i),e}invert(){let e=this.a,t=this.b,n=this.c,r=this.d,i=this.tx,a=e*r-t*n;return this.a=r/a,this.b=-t/a,this.c=-n/a,this.d=e/a,this.tx=(n*this.ty-r*i)/a,this.ty=-(e*this.ty-t*i)/a,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new e;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return Nt.identity()}static get shared(){return Mt.identity()}},Mt=new R,Nt=new R,Pt=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Ft=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],It=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Lt=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Rt=[],zt=[],Bt=Math.sign;function Vt(){for(let e=0;e<16;e++){let t=[];Rt.push(t);for(let n=0;n<16;n++){let r=Bt(Pt[e]*Pt[n]+It[e]*Ft[n]),i=Bt(Ft[e]*Pt[n]+Lt[e]*Ft[n]),a=Bt(Pt[e]*It[n]+It[e]*Lt[n]),o=Bt(Ft[e]*It[n]+Lt[e]*Lt[n]);for(let e=0;e<16;e++)if(Pt[e]===r&&Ft[e]===i&&It[e]===a&&Lt[e]===o){t.push(e);break}}}for(let e=0;e<16;e++){let t=new R;t.set(Pt[e],Ft[e],It[e],Lt[e],0,0),zt.push(t)}}Vt();var z={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=>Pt[e],uY:e=>Ft[e],vX:e=>It[e],vY:e=>Lt[e],inv:e=>e&8?e&15:-e&7,add:(e,t)=>Rt[e][t],sub:(e,t)=>Rt[e][z.inv(t)],rotate180:e=>e^4,isVertical:e=>(e&3)==2,byDirection:(e,t)=>Math.abs(e)*2<=Math.abs(t)?t>=0?z.S:z.N:Math.abs(t)*2<=Math.abs(e)?e>0?z.E:z.W:t>0?e>0?z.SE:z.SW:e>0?z.NE:z.NW,matrixAppendRotationInv:(e,t,n=0,r=0,i=0,a=0)=>{let o=zt[z.inv(t)],s=o.a,c=o.b,l=o.c,u=o.d,d=n-Math.min(0,s*i,l*a,s*i+l*a),f=r-Math.min(0,c*i,u*a,c*i+u*a),p=e.a,m=e.b,h=e.c,g=e.d;e.a=s*p+c*h,e.b=s*m+c*g,e.c=l*p+u*h,e.d=l*m+u*g,e.tx=d*p+f*h+e.tx,e.ty=d*m+f*g+e.ty},transformRectCoords:(e,t,n,r)=>{let{x:i,y:a,width:o,height:s}=e,{x:c,y:l,width:u,height:d}=t;return n===z.E?(r.set(i+c,a+l,o,s),r):n===z.S?r.set(u-a-s+c,i+l,s,o):n===z.W?r.set(u-i-o+c,d-a-s+l,o,s):n===z.N?r.set(a+c,d-i-o+l,s,o):r.set(i+c,a+l,o,s)}},Ht=[new L,new L,new L,new L],B=class e{constructor(e=0,t=0,n=0,r=0){this.type=`rectangle`,this.x=Number(e),this.y=Number(t),this.width=Number(n),this.height=Number(r)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new e(0,0,0,0)}clone(){return new e(this.x,this.y,this.width,this.height)}copyFromBounds(e){return this.x=e.minX,this.y=e.minY,this.width=e.maxX-e.minX,this.height=e.maxY-e.minY,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height}strokeContains(e,t,n,r=.5){let{width:i,height:a}=this;if(i<=0||a<=0)return!1;let o=this.x,s=this.y,c=n*(1-r),l=n-c,u=o-c,d=o+i+c,f=s-c,p=s+a+c,m=o+l,h=o+i-l,g=s+l,_=s+a-l;return e>=u&&e<=d&&t>=f&&t<=p&&!(e>m&&e<h&&t>g&&t<_)}intersects(e,t){if(!t){let t=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=t)return!1;let n=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>n}let n=this.left,r=this.right,i=this.top,a=this.bottom;if(r<=n||a<=i)return!1;let o=Ht[0].set(e.left,e.top),s=Ht[1].set(e.left,e.bottom),c=Ht[2].set(e.right,e.top),l=Ht[3].set(e.right,e.bottom);if(c.x<=o.x||s.y<=o.y)return!1;let u=Math.sign(t.a*t.d-t.b*t.c);if(u===0||(t.apply(o,o),t.apply(s,s),t.apply(c,c),t.apply(l,l),Math.max(o.x,s.x,c.x,l.x)<=n||Math.min(o.x,s.x,c.x,l.x)>=r||Math.max(o.y,s.y,c.y,l.y)<=i||Math.min(o.y,s.y,c.y,l.y)>=a))return!1;let d=u*(s.y-o.y),f=u*(o.x-s.x),p=d*n+f*i,m=d*r+f*i,h=d*n+f*a,g=d*r+f*a;if(Math.max(p,m,h,g)<=d*o.x+f*o.y||Math.min(p,m,h,g)>=d*l.x+f*l.y)return!1;let _=u*(o.y-c.y),v=u*(c.x-o.x),y=_*n+v*i,b=_*r+v*i,x=_*n+v*a,S=_*r+v*a;return!(Math.max(y,b,x,S)<=_*o.x+v*o.y||Math.min(y,b,x,S)>=_*l.x+v*l.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){let t=Math.max(this.x,e.x),n=Math.min(this.x+this.width,e.x+e.width),r=Math.max(this.y,e.y),i=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(n-t,0),this.y=r,this.height=Math.max(i-r,0),this}ceil(e=1,t=.001){let n=Math.ceil((this.x+this.width-t)*e)/e,r=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=n-this.x,this.height=r-this.y,this}scale(e,t=e){return this.x*=e,this.y*=t,this.width*=e,this.height*=t,this}enlarge(e){let t=Math.min(this.x,e.x),n=Math.max(this.x+this.width,e.x+e.width),r=Math.min(this.y,e.y),i=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=n-t,this.y=r,this.height=i-r,this}getBounds(t){return t||=new e,t.copyFrom(this),t}containsRect(e){if(this.width<=0||this.height<=0)return!1;let t=e.x,n=e.y,r=e.x+e.width,i=e.y+e.height;return t>=this.x&&t<this.x+this.width&&n>=this.y&&n<this.y+this.height&&r>=this.x&&r<this.x+this.width&&i>=this.y&&i<this.y+this.height}set(e,t,n,r){return this.x=e,this.y=t,this.width=n,this.height=r,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}},Ut={default:-1};function V(e=`default`){return Ut[e]===void 0&&(Ut[e]=-1),++Ut[e]}var Wt=new Set,H=`8.0.0`,Gt=`8.3.4`,Kt={quiet:!1,noColor:!1},U=((e,t,n=3)=>{if(Kt.quiet||Wt.has(t))return;let r=Error().stack,i=`${t}
|
|
3
|
+
`)}\n`}function ut(e,t,n=[]){if(e.kind===`slotOutlet`){let r=[...e.name===`default`?[]:[[`name`,e.name]],...n];return[`${vt(t)}<slot${pt(r)} />`]}if(e.kind===`pixi`){let r=[...e.id?[[`id`,e.id]]:[],...n,...Object.entries(e.props)];return ft(e.type,r,e.children,t)}let r=[...e.id?[[`id`,e.id]]:[],...Pe(e.scene)?[]:[[`scene`,e.scene]],...n,...Object.entries(e.props),...Object.entries(e.events).map(([e,t])=>[`@${e}`,t])];return ft(e.type,r,dt(e),t)}function dt(e){return Object.entries(e.slots).flatMap(([e,t])=>t.map(t=>({node:t,slot:e})))}function ft(e,t,n,r){if(n.length===0)return[`${vt(r)}<${e}${pt(t)} />`];let i=[`${vt(r)}<${e}${pt(t)}>`];for(let e of n)if(`slot`in e){let t=e.slot===`default`?[]:[[`slot`,e.slot]];i.push(...ut(e.node,r+1,t))}else i.push(...ut(e,r+1));return i.push(`${vt(r)}</${e}>`),i}function pt(e){return mt(e).map(([e,t])=>` ${e}="${_t(ht(e,t))}"`).join(``)}function mt(e){return e.flatMap(([e,t])=>!t||typeof t!=`object`||gt(t)?[[e,t]]:Object.entries(t).map(([t,n])=>[`${e}.${t}`,n]))}function ht(e,t){return gt(t)?`{${t.path.join(`.`)}}`:typeof t==`number`&&ct.has(e)?`#${t.toString(16).padStart(6,`0`).slice(-6)}`:String(t)}function gt(e){return typeof e==`object`&&e.kind===`binding`}function _t(e){return e.replaceAll(`&`,`&`).replaceAll(`"`,`"`).replaceAll(`<`,`<`).replaceAll(`>`,`>`)}function vt(e){return` `.repeat(e)}new Set(u),new Set(d),new Set(f),new Set(k),new Set(x),new Set(b),new Set(S),new Set(O);var P=(e=>(e.Application=`application`,e.WebGLPipes=`webgl-pipes`,e.WebGLPipesAdaptor=`webgl-pipes-adaptor`,e.WebGLSystem=`webgl-system`,e.WebGPUPipes=`webgpu-pipes`,e.WebGPUPipesAdaptor=`webgpu-pipes-adaptor`,e.WebGPUSystem=`webgpu-system`,e.CanvasSystem=`canvas-system`,e.CanvasPipesAdaptor=`canvas-pipes-adaptor`,e.CanvasPipes=`canvas-pipes`,e.Asset=`asset`,e.LoadParser=`load-parser`,e.ResolveParser=`resolve-parser`,e.CacheParser=`cache-parser`,e.DetectionParser=`detection-parser`,e.MaskEffect=`mask-effect`,e.BlendMode=`blend-mode`,e.TextureSource=`texture-source`,e.Environment=`environment`,e.ShapeBuilder=`shape-builder`,e.Batcher=`batcher`,e))(P||{}),yt=e=>{if(typeof e==`function`||typeof e==`object`&&e.extension){if(!e.extension)throw Error(`Extension class must have an extension object`);e={...typeof e.extension==`object`?e.extension:{type:e.extension},ref:e}}if(typeof e==`object`)e={...e};else throw Error(`Invalid extension type`);return typeof e.type==`string`&&(e.type=[e.type]),e},bt=(e,t)=>yt(e).priority??t,F={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...e){return e.map(yt).forEach(e=>{e.type.forEach(t=>this._removeHandlers[t]?.(e))}),this},add(...e){return e.map(yt).forEach(e=>{e.type.forEach(t=>{let n=this._addHandlers,r=this._queue;n[t]?n[t]?.(e):(r[t]=r[t]||[],r[t]?.push(e))})}),this},handle(e,t,n){let r=this._addHandlers,i=this._removeHandlers;if(r[e]||i[e])throw Error(`Extension type ${e} already has a handler`);r[e]=t,i[e]=n;let a=this._queue;return a[e]&&(a[e]?.forEach(e=>t(e)),delete a[e]),this},handleByMap(e,t){return this.handle(e,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(e,t,n=-1){return this.handle(e,e=>{t.findIndex(t=>t.name===e.name)>=0||(t.push({name:e.name,value:e.ref}),t.sort((e,t)=>bt(t.value,n)-bt(e.value,n)))},e=>{let n=t.findIndex(t=>t.name===e.name);n!==-1&&t.splice(n,1)})},handleByList(e,t,n=-1){return this.handle(e,e=>{t.includes(e.ref)||(t.push(e.ref),t.sort((e,t)=>bt(t,n)-bt(e,n)))},e=>{let n=t.indexOf(e.ref);n!==-1&&t.splice(n,1)})},mixin(e,...t){for(let n of t)Object.defineProperties(e.prototype,Object.getOwnPropertyDescriptors(n))}},xt=`modulepreload`,St=function(e){return`/`+e},Ct={},wt=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=St(t,n),t in Ct)return;Ct[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:xt,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Tt={extension:{type:P.Environment,name:`browser`,priority:-1},test:()=>!0,load:async()=>{await wt(()=>import(`./browserAll-DDpbpxbk.js`),__vite__mapDeps([0,1]))}},Et={extension:{type:P.Environment,name:`webworker`,priority:0},test:()=>typeof self<`u`&&self.WorkerGlobalScope!==void 0,load:async()=>{await wt(()=>import(`./webworkerAll-CpwJPQ3Y.js`),__vite__mapDeps([2,1]))}},I=class e{constructor(e,t,n){this._x=t||0,this._y=n||0,this._observer=e}clone(t){return new e(t??this._observer,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this._observer._onUpdate(this)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._observer._onUpdate(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._observer._onUpdate(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._observer._onUpdate(this))}},Dt=l(o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)}))(),1).default,Ot=Math.PI*2,kt=180/Math.PI,At=Math.PI/180,L=class e{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new e(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,t=e){return this.x=e,this.y=t,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return jt.x=0,jt.y=0,jt}},jt=new L,R=class e{constructor(e=1,t=0,n=0,r=1,i=0,a=0){this.array=null,this.a=e,this.b=t,this.c=n,this.d=r,this.tx=i,this.ty=a}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,t,n,r,i,a){return this.a=e,this.b=t,this.c=n,this.d=r,this.tx=i,this.ty=a,this}toArray(e,t){this.array||=new Float32Array(9);let n=t||this.array;return e?(n[0]=this.a,n[1]=this.b,n[2]=0,n[3]=this.c,n[4]=this.d,n[5]=0,n[6]=this.tx,n[7]=this.ty,n[8]=1):(n[0]=this.a,n[1]=this.c,n[2]=this.tx,n[3]=this.b,n[4]=this.d,n[5]=this.ty,n[6]=0,n[7]=0,n[8]=1),n}apply(e,t){t||=new L;let n=e.x,r=e.y;return t.x=this.a*n+this.c*r+this.tx,t.y=this.b*n+this.d*r+this.ty,t}applyInverse(e,t){t||=new L;let n=this.a,r=this.b,i=this.c,a=this.d,o=this.tx,s=this.ty,c=1/(n*a+i*-r),l=e.x,u=e.y;return t.x=a*c*l+-i*c*u+(s*i-o*a)*c,t.y=n*c*u+-r*c*l+(-s*n+o*r)*c,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){let t=Math.cos(e),n=Math.sin(e),r=this.a,i=this.c,a=this.tx;return this.a=r*t-this.b*n,this.b=r*n+this.b*t,this.c=i*t-this.d*n,this.d=i*n+this.d*t,this.tx=a*t-this.ty*n,this.ty=a*n+this.ty*t,this}append(e){let t=this.a,n=this.b,r=this.c,i=this.d;return this.a=e.a*t+e.b*r,this.b=e.a*n+e.b*i,this.c=e.c*t+e.d*r,this.d=e.c*n+e.d*i,this.tx=e.tx*t+e.ty*r+this.tx,this.ty=e.tx*n+e.ty*i+this.ty,this}appendFrom(e,t){let n=e.a,r=e.b,i=e.c,a=e.d,o=e.tx,s=e.ty,c=t.a,l=t.b,u=t.c,d=t.d;return this.a=n*c+r*u,this.b=n*l+r*d,this.c=i*c+a*u,this.d=i*l+a*d,this.tx=o*c+s*u+t.tx,this.ty=o*l+s*d+t.ty,this}setTransform(e,t,n,r,i,a,o,s,c){return this.a=Math.cos(o+c)*i,this.b=Math.sin(o+c)*i,this.c=-Math.sin(o-s)*a,this.d=Math.cos(o-s)*a,this.tx=e-(n*this.a+r*this.c),this.ty=t-(n*this.b+r*this.d),this}prepend(e){let t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let t=this.a,n=this.c;this.a=t*e.a+this.b*e.c,this.b=t*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){let t=this.a,n=this.b,r=this.c,i=this.d,a=e.pivot,o=-Math.atan2(-r,i),s=Math.atan2(n,t),c=Math.abs(o+s);return c<1e-5||Math.abs(Ot-c)<1e-5?(e.rotation=s,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=o,e.skew.y=s),e.scale.x=Math.sqrt(t*t+n*n),e.scale.y=Math.sqrt(r*r+i*i),e.position.x=this.tx+(a.x*t+a.y*r),e.position.y=this.ty+(a.x*n+a.y*i),e}invert(){let e=this.a,t=this.b,n=this.c,r=this.d,i=this.tx,a=e*r-t*n;return this.a=r/a,this.b=-t/a,this.c=-n/a,this.d=e/a,this.tx=(n*this.ty-r*i)/a,this.ty=-(e*this.ty-t*i)/a,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new e;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return Nt.identity()}static get shared(){return Mt.identity()}},Mt=new R,Nt=new R,Pt=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Ft=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],It=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Lt=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Rt=[],zt=[],Bt=Math.sign;function Vt(){for(let e=0;e<16;e++){let t=[];Rt.push(t);for(let n=0;n<16;n++){let r=Bt(Pt[e]*Pt[n]+It[e]*Ft[n]),i=Bt(Ft[e]*Pt[n]+Lt[e]*Ft[n]),a=Bt(Pt[e]*It[n]+It[e]*Lt[n]),o=Bt(Ft[e]*It[n]+Lt[e]*Lt[n]);for(let e=0;e<16;e++)if(Pt[e]===r&&Ft[e]===i&&It[e]===a&&Lt[e]===o){t.push(e);break}}}for(let e=0;e<16;e++){let t=new R;t.set(Pt[e],Ft[e],It[e],Lt[e],0,0),zt.push(t)}}Vt();var z={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=>Pt[e],uY:e=>Ft[e],vX:e=>It[e],vY:e=>Lt[e],inv:e=>e&8?e&15:-e&7,add:(e,t)=>Rt[e][t],sub:(e,t)=>Rt[e][z.inv(t)],rotate180:e=>e^4,isVertical:e=>(e&3)==2,byDirection:(e,t)=>Math.abs(e)*2<=Math.abs(t)?t>=0?z.S:z.N:Math.abs(t)*2<=Math.abs(e)?e>0?z.E:z.W:t>0?e>0?z.SE:z.SW:e>0?z.NE:z.NW,matrixAppendRotationInv:(e,t,n=0,r=0,i=0,a=0)=>{let o=zt[z.inv(t)],s=o.a,c=o.b,l=o.c,u=o.d,d=n-Math.min(0,s*i,l*a,s*i+l*a),f=r-Math.min(0,c*i,u*a,c*i+u*a),p=e.a,m=e.b,h=e.c,g=e.d;e.a=s*p+c*h,e.b=s*m+c*g,e.c=l*p+u*h,e.d=l*m+u*g,e.tx=d*p+f*h+e.tx,e.ty=d*m+f*g+e.ty},transformRectCoords:(e,t,n,r)=>{let{x:i,y:a,width:o,height:s}=e,{x:c,y:l,width:u,height:d}=t;return n===z.E?(r.set(i+c,a+l,o,s),r):n===z.S?r.set(u-a-s+c,i+l,s,o):n===z.W?r.set(u-i-o+c,d-a-s+l,o,s):n===z.N?r.set(a+c,d-i-o+l,s,o):r.set(i+c,a+l,o,s)}},Ht=[new L,new L,new L,new L],B=class e{constructor(e=0,t=0,n=0,r=0){this.type=`rectangle`,this.x=Number(e),this.y=Number(t),this.width=Number(n),this.height=Number(r)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new e(0,0,0,0)}clone(){return new e(this.x,this.y,this.width,this.height)}copyFromBounds(e){return this.x=e.minX,this.y=e.minY,this.width=e.maxX-e.minX,this.height=e.maxY-e.minY,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height}strokeContains(e,t,n,r=.5){let{width:i,height:a}=this;if(i<=0||a<=0)return!1;let o=this.x,s=this.y,c=n*(1-r),l=n-c,u=o-c,d=o+i+c,f=s-c,p=s+a+c,m=o+l,h=o+i-l,g=s+l,_=s+a-l;return e>=u&&e<=d&&t>=f&&t<=p&&!(e>m&&e<h&&t>g&&t<_)}intersects(e,t){if(!t){let t=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=t)return!1;let n=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>n}let n=this.left,r=this.right,i=this.top,a=this.bottom;if(r<=n||a<=i)return!1;let o=Ht[0].set(e.left,e.top),s=Ht[1].set(e.left,e.bottom),c=Ht[2].set(e.right,e.top),l=Ht[3].set(e.right,e.bottom);if(c.x<=o.x||s.y<=o.y)return!1;let u=Math.sign(t.a*t.d-t.b*t.c);if(u===0||(t.apply(o,o),t.apply(s,s),t.apply(c,c),t.apply(l,l),Math.max(o.x,s.x,c.x,l.x)<=n||Math.min(o.x,s.x,c.x,l.x)>=r||Math.max(o.y,s.y,c.y,l.y)<=i||Math.min(o.y,s.y,c.y,l.y)>=a))return!1;let d=u*(s.y-o.y),f=u*(o.x-s.x),p=d*n+f*i,m=d*r+f*i,h=d*n+f*a,g=d*r+f*a;if(Math.max(p,m,h,g)<=d*o.x+f*o.y||Math.min(p,m,h,g)>=d*l.x+f*l.y)return!1;let _=u*(o.y-c.y),v=u*(c.x-o.x),y=_*n+v*i,b=_*r+v*i,x=_*n+v*a,S=_*r+v*a;return!(Math.max(y,b,x,S)<=_*o.x+v*o.y||Math.min(y,b,x,S)>=_*l.x+v*l.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){let t=Math.max(this.x,e.x),n=Math.min(this.x+this.width,e.x+e.width),r=Math.max(this.y,e.y),i=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(n-t,0),this.y=r,this.height=Math.max(i-r,0),this}ceil(e=1,t=.001){let n=Math.ceil((this.x+this.width-t)*e)/e,r=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=n-this.x,this.height=r-this.y,this}scale(e,t=e){return this.x*=e,this.y*=t,this.width*=e,this.height*=t,this}enlarge(e){let t=Math.min(this.x,e.x),n=Math.max(this.x+this.width,e.x+e.width),r=Math.min(this.y,e.y),i=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=n-t,this.y=r,this.height=i-r,this}getBounds(t){return t||=new e,t.copyFrom(this),t}containsRect(e){if(this.width<=0||this.height<=0)return!1;let t=e.x,n=e.y,r=e.x+e.width,i=e.y+e.height;return t>=this.x&&t<this.x+this.width&&n>=this.y&&n<this.y+this.height&&r>=this.x&&r<this.x+this.width&&i>=this.y&&i<this.y+this.height}set(e,t,n,r){return this.x=e,this.y=t,this.width=n,this.height=r,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}},Ut={default:-1};function V(e=`default`){return Ut[e]===void 0&&(Ut[e]=-1),++Ut[e]}var Wt=new Set,H=`8.0.0`,Gt=`8.3.4`,Kt={quiet:!1,noColor:!1},U=((e,t,n=3)=>{if(Kt.quiet||Wt.has(t))return;let r=Error().stack,i=`${t}
|
|
4
4
|
Deprecated since v${e}`,a=typeof console.groupCollapsed==`function`&&!Kt.noColor;r===void 0?console.warn(`PixiJS Deprecation Warning: `,i):(r=r.split(`
|
|
5
5
|
`).splice(n).join(`
|
|
6
6
|
`),a?(console.groupCollapsed(`%cPixiJS Deprecation Warning: %c%s`,`color:#614108;background:#fffbe6`,`font-weight:normal;color:#614108;background:#fffbe6`,i),console.warn(r),console.groupEnd()):(console.warn(`PixiJS Deprecation Warning: `,i),console.warn(r))),Wt.add(t)});Object.defineProperties(U,{quiet:{get:()=>Kt.quiet,set:e=>{Kt.quiet=e},enumerable:!0,configurable:!1},noColor:{get:()=>Kt.noColor,set:e=>{Kt.noColor=e},enumerable:!0,configurable:!1}});var qt=()=>{};function Jt(e){return e+=+(e===0),--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e+1}function Yt(e){return!(e&e-1)&&!!e}function Xt(e){let t={};for(let n in e)e[n]!==void 0&&(t[n]=e[n]);return t}var Zt=Object.create(null);function Qt(e){let t=Zt[e];return t===void 0&&(Zt[e]=V(`resource`)),t}var $t=class e extends Dt{constructor(t={}){super(),this._resourceType=`textureSampler`,this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...e.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(e){this.addressModeU=e,this.addressModeV=e,this.addressModeW=e}get addressMode(){return this.addressModeU}set wrapMode(e){U(H,`TextureStyle.wrapMode is now TextureStyle.addressMode`),this.addressMode=e}get wrapMode(){return this.addressMode}set scaleMode(e){this.magFilter=e,this.minFilter=e,this.mipmapFilter=e}get scaleMode(){return this.magFilter}set maxAnisotropy(e){this._maxAnisotropy=Math.min(e,16),this._maxAnisotropy>1&&(this.scaleMode=`linear`)}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this._sharedResourceId=null,this.emit(`change`,this)}_generateResourceId(){let e=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=Qt(e),this._resourceId}destroy(){this.destroyed=!0,this.emit(`destroy`,this),this.emit(`change`,this),this.removeAllListeners()}};$t.defaultOptions={addressMode:`clamp-to-edge`,scaleMode:`linear`};var en=$t,tn=class e extends Dt{constructor(t={}){super(),this.options=t,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=V(`textureSource`),this._resourceType=`textureSource`,this._resourceId=V(`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.viewDimension=`2d`,this.arrayLayerCount=1,this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...e.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.viewDimension=t.viewDimension??t.dimensions,this.arrayLayerCount=t.arrayLayerCount,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new en(Xt(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(e){this.style!==e&&(this._style?.off(`change`,this._onStyleChange,this),this._style=e,this._style?.on(`change`,this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(e){this._style.maxAnisotropy=e}get maxAnisotropy(){return this._style.maxAnisotropy}get addressMode(){return this._style.addressMode}set addressMode(e){this._style.addressMode=e}get repeatMode(){return this._style.addressMode}set repeatMode(e){this._style.addressMode=e}get magFilter(){return this._style.magFilter}set magFilter(e){this._style.magFilter=e}get minFilter(){return this._style.minFilter}set minFilter(e){this._style.minFilter=e}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(e){this._style.mipmapFilter=e}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(e){this._style.lodMinClamp=e}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(e){this._style.lodMaxClamp=e}_onStyleChange(){this.emit(`styleChange`,this)}update(){if(this.resource){let e=this._resolution;if(this.resize(this.resourceWidth/e,this.resourceHeight/e))return}this.emit(`update`,this)}destroy(){this.destroyed=!0,this.unload(),this.emit(`destroy`,this),this._style&&=(this._style.destroy(),null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=V(`resource`),this.emit(`change`,this),this.emit(`unload`,this);for(let e in this._gpuData)this._gpuData[e]?.destroy?.();this._gpuData=Object.create(null)}get resourceWidth(){let{resource:e}=this;return e.naturalWidth||e.videoWidth||e.displayWidth||e.width}get resourceHeight(){let{resource:e}=this;return e.naturalHeight||e.videoHeight||e.displayHeight||e.height}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this.width=this.pixelWidth/e,this.height=this.pixelHeight/e)}resize(e,t,n){n||=this._resolution,e||=this.width,t||=this.height;let r=Math.round(e*n),i=Math.round(t*n);return this.width=r/n,this.height=i/n,this._resolution=n,this.pixelWidth===r&&this.pixelHeight===i?!1:(this._refreshPOT(),this.pixelWidth=r,this.pixelHeight=i,this.emit(`resize`,this),this._resourceId=V(`resource`),this.emit(`change`,this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit(`updateMipmaps`,this)}set wrapMode(e){this._style.wrapMode=e}get wrapMode(){return this._style.wrapMode}set scaleMode(e){this._style.scaleMode=e}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=Yt(this.pixelWidth)&&Yt(this.pixelHeight)}static test(e){throw Error(`Unimplemented`)}};tn.defaultOptions={resolution:1,format:`bgra8unorm`,alphaMode:`premultiply-alpha-on-upload`,dimensions:`2d`,viewDimension:`2d`,arrayLayerCount:1,mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};var nn=tn,rn=class extends nn{constructor(e){let t=e.resource||new Float32Array(e.width*e.height*4),n=e.format;n||=t instanceof Float32Array?`rgba32float`:t instanceof Int32Array||t instanceof Uint32Array?`rgba32uint`:t instanceof Int16Array||t instanceof Uint16Array?`rgba16uint`:(t instanceof Int8Array,`bgra8unorm`),super({...e,resource:t,format:n}),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}};rn.extension=P.TextureSource;var an=new R,on=class{constructor(e,t){this.mapCoord=new R,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._updateID=0,this.clampOffset=0,t===void 0?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 n=this.mapCoord;for(let r=0;r<e.length;r+=2){let i=e[r],a=e[r+1];t[r]=i*n.a+a*n.c+n.tx,t[r+1]=i*n.b+a*n.d+n.ty}return t}update(){let e=this._texture;this._updateID++;let t=e.uvs;this.mapCoord.set(t.x1-t.x0,t.y1-t.y0,t.x3-t.x0,t.y3-t.y0,t.x0,t.y0);let n=e.orig,r=e.trim;r&&(an.set(n.width/r.width,0,0,n.height/r.height,-r.x/r.width,-r.y/r.height),this.mapCoord.append(an));let i=e.source,a=this.uClampFrame,o=this.clampMargin/i._resolution,s=this.clampOffset/i._resolution;return a[0]=(e.frame.x+o+s)/i.width,a[1]=(e.frame.y+o+s)/i.height,a[2]=(e.frame.x+e.frame.width-o+s)/i.width,a[3]=(e.frame.y+e.frame.height-o+s)/i.height,this.uClampOffset[0]=this.clampOffset/i.pixelWidth,this.uClampOffset[1]=this.clampOffset/i.pixelHeight,this.isSimple=e.frame.width===i.width&&e.frame.height===i.height&&e.rotate===0,!0}},W=class extends Dt{constructor({source:e,label:t,frame:n,orig:r,trim:i,defaultAnchor:a,defaultBorders:o,rotate:s,dynamic:c}={}){if(super(),this.uid=V(`texture`),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new B,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=t,this.source=e?.source??new nn,this.noFrame=!n,n)this.frame.copyFrom(n);else{let{width:e,height:t}=this._source;this.frame.width=e,this.frame.height=t}this.orig=r||this.frame,this.trim=i,this.rotate=s??0,this.defaultAnchor=a,this.defaultBorders=o,this.destroyed=!1,this.dynamic=c||!1,this.updateUvs()}set source(e){this._source&&this._source.off(`resize`,this.update,this),this._source=e,e.on(`resize`,this.update,this),this.emit(`update`,this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||=new on(this),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:e,frame:t}=this,{width:n,height:r}=this._source,i=t.x/n,a=t.y/r,o=t.width/n,s=t.height/r,c=this.rotate;if(c){let t=o/2,n=s/2,r=i+t,l=a+n;c=z.add(c,z.NW),e.x0=r+t*z.uX(c),e.y0=l+n*z.uY(c),c=z.add(c,2),e.x1=r+t*z.uX(c),e.y1=l+n*z.uY(c),c=z.add(c,2),e.x2=r+t*z.uX(c),e.y2=l+n*z.uY(c),c=z.add(c,2),e.x3=r+t*z.uX(c),e.y3=l+n*z.uY(c)}else e.x0=i,e.y0=a,e.x1=i+o,e.y1=a,e.x2=i+o,e.y2=a+s,e.x3=i,e.y3=a+s}destroy(e=!1){this._source&&(this._source.off(`resize`,this.update,this),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 U(H,`Texture.baseTexture is now Texture.source`),this._source}};W.EMPTY=new W({label:`EMPTY`,source:new nn({label:`EMPTY`})}),W.EMPTY.destroy=qt,W.WHITE=new W({source:new rn({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:`premultiply-alpha-on-upload`,label:`WHITE`}),label:`WHITE`}),W.WHITE.destroy=qt;function sn(e,t,n){let{width:r,height:i}=n.orig,a=n.trim;if(a){let n=a.width,o=a.height;e.minX=a.x-t._x*r,e.maxX=e.minX+n,e.minY=a.y-t._y*i,e.maxY=e.minY+o}else e.minX=-t._x*r,e.maxX=e.minX+r,e.minY=-t._y*i,e.maxY=e.minY+i}var cn=new R,ln=class e{constructor(e=1/0,t=1/0,n=-1/0,r=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=cn,this.minX=e,this.minY=t,this.maxX=n,this.maxY=r}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||=new B;let e=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(e.x=0,e.y=0,e.width=0,e.height=0):e.copyFromBounds(this),e}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=cn,this}set(e,t,n,r){this.minX=e,this.minY=t,this.maxX=n,this.maxY=r}addFrame(e,t,n,r,i){i||=this.matrix;let a=i.a,o=i.b,s=i.c,c=i.d,l=i.tx,u=i.ty,d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,h=a*e+s*t+l,g=o*e+c*t+u;h<d&&(d=h),g<f&&(f=g),h>p&&(p=h),g>m&&(m=g),h=a*n+s*t+l,g=o*n+c*t+u,h<d&&(d=h),g<f&&(f=g),h>p&&(p=h),g>m&&(m=g),h=a*e+s*r+l,g=o*e+c*r+u,h<d&&(d=h),g<f&&(f=g),h>p&&(p=h),g>m&&(m=g),h=a*n+s*r+l,g=o*n+c*r+u,h<d&&(d=h),g<f&&(f=g),h>p&&(p=h),g>m&&(m=g),this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addRect(e,t){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,t)}addBounds(e,t){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,t)}addBoundsMask(e){this.minX=this.minX>e.minX?this.minX:e.minX,this.minY=this.minY>e.minY?this.minY:e.minY,this.maxX=this.maxX<e.maxX?this.maxX:e.maxX,this.maxY=this.maxY<e.maxY?this.maxY:e.maxY}applyMatrix(e){let t=this.minX,n=this.minY,r=this.maxX,i=this.maxY,{a,b:o,c:s,d:c,tx:l,ty:u}=e,d=a*t+s*n+l,f=o*t+c*n+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=a*r+s*n+l,f=o*r+c*n+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=a*t+s*i+l,f=o*t+c*i+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=a*r+s*i+l,f=o*r+c*i+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(e){return this.minX<e.left&&(this.minX=e.left),this.maxX>e.right&&(this.maxX=e.right),this.minY<e.top&&(this.minY=e.top),this.maxY>e.bottom&&(this.maxY=e.bottom),this}fitBounds(e,t,n,r){return this.minX<e&&(this.minX=e),this.maxX>t&&(this.maxX=t),this.minY<n&&(this.minY=n),this.maxY>r&&(this.maxY=r),this}pad(e,t=e){return this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new e(this.minX,this.minY,this.maxX,this.maxY)}scale(e,t=e){return this.minX*=e,this.minY*=t,this.maxX*=e,this.maxY*=t,this}get x(){return this.minX}set x(e){let t=this.maxX-this.minX;this.minX=e,this.maxX=e+t}get y(){return this.minY}set y(e){let t=this.maxY-this.minY;this.minY=e,this.maxY=e+t}get width(){return this.maxX-this.minX}set width(e){this.maxX=this.minX+e}get height(){return this.maxY-this.minY}set height(e){this.maxY=this.minY+e}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(e,t,n,r){let i=this.minX,a=this.minY,o=this.maxX,s=this.maxY;r||=this.matrix;let c=r.a,l=r.b,u=r.c,d=r.d,f=r.tx,p=r.ty;for(let r=t;r<n;r+=2){let t=e[r],n=e[r+1],m=c*t+u*n+f,h=l*t+d*n+p;i=m<i?m:i,a=h<a?h:a,o=m>o?m:o,s=h>s?h:s}this.minX=i,this.minY=a,this.maxX=o,this.maxY=s}containsPoint(e,t){return this.minX<=e&&this.minY<=t&&this.maxX>=e&&this.maxY>=t}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(e){return this.minX=e.minX,this.minY=e.minY,this.maxX=e.maxX,this.maxY=e.maxY,this}},un={grad:.9,turn:360,rad:360/(2*Math.PI)},dn=function(e){return typeof e==`string`?e.length>0:typeof e==`number`},fn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=10**t),Math.round(n*e)/n+0},pn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},mn=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},hn=function(e){return{r:pn(e.r,0,255),g:pn(e.g,0,255),b:pn(e.b,0,255),a:pn(e.a)}},gn=function(e){return{r:fn(e.r),g:fn(e.g),b:fn(e.b),a:fn(e.a,3)}},_n=/^#([0-9a-f]{3,8})$/i,vn=function(e){var t=e.toString(16);return t.length<2?`0`+t:t},yn=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=Math.max(t,n,r),o=a-Math.min(t,n,r),s=o?a===t?(n-r)/o:a===n?2+(r-t)/o:4+(t-n)/o:0;return{h:60*(s<0?s+6:s),s:a?o/a*100:0,v:a/255*100,a:i}},bn=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var a=Math.floor(t),o=r*(1-n),s=r*(1-(t-a)*n),c=r*(1-(1-t+a)*n),l=a%6;return{r:255*[r,s,o,o,c,r][l],g:255*[c,r,r,s,o,o][l],b:255*[o,o,c,r,r,s][l],a:i}},xn=function(e){return{h:mn(e.h),s:pn(e.s,0,100),l:pn(e.l,0,100),a:pn(e.a)}},Sn=function(e){return{h:fn(e.h),s:fn(e.s),l:fn(e.l),a:fn(e.a,3)}},Cn=function(e){return bn((n=(t=e).s,{h:t.h,s:(n*=((r=t.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:t.a}));var t,n,r},wn=function(e){return{h:(t=yn(e)).h,s:(i=(200-(n=t.s))*(r=t.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,n,r,i},Tn=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,En=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Dn=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,On=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,kn={string:[[function(e){var t=_n.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?fn(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?fn(parseInt(e.substr(6,2),16)/255,2):1}:null:null},`hex`],[function(e){var t=Dn.exec(e)||On.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:hn({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},`rgb`],[function(e){var t=Tn.exec(e)||En.exec(e);if(!t)return null;var n,r;return Cn(xn({h:(n=t[1],r=t[2],r===void 0&&(r=`deg`),Number(n)*(un[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)}))},`hsl`]],object:[[function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=i===void 0?1:i;return dn(t)&&dn(n)&&dn(r)?hn({r:Number(t),g:Number(n),b:Number(r),a:Number(a)}):null},`rgb`],[function(e){var t=e.h,n=e.s,r=e.l,i=e.a,a=i===void 0?1:i;return!dn(t)||!dn(n)||!dn(r)?null:Cn(xn({h:Number(t),s:Number(n),l:Number(r),a:Number(a)}))},`hsl`],[function(e){var t=e.h,n=e.s,r=e.v,i=e.a,a=i===void 0?1:i;return!dn(t)||!dn(n)||!dn(r)?null:bn(function(e){return{h:mn(e.h),s:pn(e.s,0,100),v:pn(e.v,0,100),a:pn(e.a)}}({h:Number(t),s:Number(n),v:Number(r),a:Number(a)}))},`hsv`]]},An=function(e,t){for(var n=0;n<t.length;n++){var r=t[n][0](e);if(r)return[r,t[n][1]]}return[null,void 0]},jn=function(e){return typeof e==`string`?An(e.trim(),kn.string):typeof e==`object`&&e?An(e,kn.object):[null,void 0]},Mn=function(e,t){var n=wn(e);return{h:n.h,s:pn(n.s+100*t,0,100),l:n.l,a:n.a}},Nn=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},Pn=function(e,t){var n=wn(e);return{h:n.h,s:n.s,l:pn(n.l+100*t,0,100),a:n.a}},Fn=function(){function e(e){this.parsed=jn(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return fn(Nn(this.rgba),2)},e.prototype.isDark=function(){return Nn(this.rgba)<.5},e.prototype.isLight=function(){return Nn(this.rgba)>=.5},e.prototype.toHex=function(){return e=gn(this.rgba),t=e.r,n=e.g,r=e.b,a=(i=e.a)<1?vn(fn(255*i)):``,`#`+vn(t)+vn(n)+vn(r)+a;var e,t,n,r,i,a},e.prototype.toRgb=function(){return gn(this.rgba)},e.prototype.toRgbString=function(){return e=gn(this.rgba),t=e.r,n=e.g,r=e.b,(i=e.a)<1?`rgba(`+t+`, `+n+`, `+r+`, `+i+`)`:`rgb(`+t+`, `+n+`, `+r+`)`;var e,t,n,r,i},e.prototype.toHsl=function(){return Sn(wn(this.rgba))},e.prototype.toHslString=function(){return e=Sn(wn(this.rgba)),t=e.h,n=e.s,r=e.l,(i=e.a)<1?`hsla(`+t+`, `+n+`%, `+r+`%, `+i+`)`:`hsl(`+t+`, `+n+`%, `+r+`%)`;var e,t,n,r,i},e.prototype.toHsv=function(){return e=yn(this.rgba),{h:fn(e.h),s:fn(e.s),v:fn(e.v),a:fn(e.a,3)};var e},e.prototype.invert=function(){return In({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return e===void 0&&(e=.1),In(Mn(this.rgba,e))},e.prototype.desaturate=function(e){return e===void 0&&(e=.1),In(Mn(this.rgba,-e))},e.prototype.grayscale=function(){return In(Mn(this.rgba,-1))},e.prototype.lighten=function(e){return e===void 0&&(e=.1),In(Pn(this.rgba,e))},e.prototype.darken=function(e){return e===void 0&&(e=.1),In(Pn(this.rgba,-e))},e.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return typeof e==`number`?In({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):fn(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=wn(this.rgba);return typeof e==`number`?In({h:e,s:t.s,l:t.l,a:t.a}):fn(t.h)},e.prototype.isEqual=function(e){return this.toHex()===In(e).toHex()},e}(),In=function(e){return e instanceof Fn?e:new Fn(e)},Ln=[],Rn=function(e){e.forEach(function(e){Ln.indexOf(e)<0&&(e(Fn,kn),Ln.push(e))})};function zn(e,t){var n={white:`#ffffff`,bisque:`#ffe4c4`,blue:`#0000ff`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,antiquewhite:`#faebd7`,aqua:`#00ffff`,azure:`#f0ffff`,whitesmoke:`#f5f5f5`,papayawhip:`#ffefd5`,plum:`#dda0dd`,blanchedalmond:`#ffebcd`,black:`#000000`,gold:`#ffd700`,goldenrod:`#daa520`,gainsboro:`#dcdcdc`,cornsilk:`#fff8dc`,cornflowerblue:`#6495ed`,burlywood:`#deb887`,aquamarine:`#7fffd4`,beige:`#f5f5dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkkhaki:`#bdb76b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkgrey:`#a9a9a9`,peachpuff:`#ffdab9`,darkmagenta:`#8b008b`,darkred:`#8b0000`,darkorchid:`#9932cc`,darkorange:`#ff8c00`,darkslateblue:`#483d8b`,gray:`#808080`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,wheat:`#f5deb3`,firebrick:`#b22222`,floralwhite:`#fffaf0`,ghostwhite:`#f8f8ff`,darkviolet:`#9400d3`,magenta:`#ff00ff`,green:`#008000`,dodgerblue:`#1e90ff`,grey:`#808080`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,blueviolet:`#8a2be2`,forestgreen:`#228b22`,lawngreen:`#7cfc00`,indianred:`#cd5c5c`,indigo:`#4b0082`,fuchsia:`#ff00ff`,brown:`#a52a2a`,maroon:`#800000`,mediumblue:`#0000cd`,lightcoral:`#f08080`,darkturquoise:`#00ced1`,lightcyan:`#e0ffff`,ivory:`#fffff0`,lightyellow:`#ffffe0`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,linen:`#faf0e6`,mediumaquamarine:`#66cdaa`,lemonchiffon:`#fffacd`,lime:`#00ff00`,khaki:`#f0e68c`,mediumseagreen:`#3cb371`,limegreen:`#32cd32`,mediumspringgreen:`#00fa9a`,lightskyblue:`#87cefa`,lightblue:`#add8e6`,midnightblue:`#191970`,lightpink:`#ffb6c1`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,mintcream:`#f5fffa`,lightslategray:`#778899`,lightslategrey:`#778899`,navajowhite:`#ffdead`,navy:`#000080`,mediumvioletred:`#c71585`,powderblue:`#b0e0e6`,palegoldenrod:`#eee8aa`,oldlace:`#fdf5e6`,paleturquoise:`#afeeee`,mediumturquoise:`#48d1cc`,mediumorchid:`#ba55d3`,rebeccapurple:`#663399`,lightsteelblue:`#b0c4de`,mediumslateblue:`#7b68ee`,thistle:`#d8bfd8`,tan:`#d2b48c`,orchid:`#da70d6`,mediumpurple:`#9370db`,purple:`#800080`,pink:`#ffc0cb`,skyblue:`#87ceeb`,springgreen:`#00ff7f`,palegreen:`#98fb98`,red:`#ff0000`,yellow:`#ffff00`,slateblue:`#6a5acd`,lavenderblush:`#fff0f5`,peru:`#cd853f`,palevioletred:`#db7093`,violet:`#ee82ee`,teal:`#008080`,slategray:`#708090`,slategrey:`#708090`,aliceblue:`#f0f8ff`,darkseagreen:`#8fbc8f`,darkolivegreen:`#556b2f`,greenyellow:`#adff2f`,seagreen:`#2e8b57`,seashell:`#fff5ee`,tomato:`#ff6347`,silver:`#c0c0c0`,sienna:`#a0522d`,lavender:`#e6e6fa`,lightgreen:`#90ee90`,orange:`#ffa500`,orangered:`#ff4500`,steelblue:`#4682b4`,royalblue:`#4169e1`,turquoise:`#40e0d0`,yellowgreen:`#9acd32`,salmon:`#fa8072`,saddlebrown:`#8b4513`,sandybrown:`#f4a460`,rosybrown:`#bc8f8f`,darksalmon:`#e9967a`,lightgoldenrodyellow:`#fafad2`,snow:`#fffafa`,lightgrey:`#d3d3d3`,lightgray:`#d3d3d3`,dimgray:`#696969`,dimgrey:`#696969`,olivedrab:`#6b8e23`,olive:`#808000`},r={};for(var i in n)r[n[i]]=i;var a={};e.prototype.toName=function(t){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return`transparent`;var i,o,s=r[this.toHex()];if(s)return s;if(t?.closest){var c=this.toRgb(),l=1/0,u=`black`;if(!a.length)for(var d in n)a[d]=new e(n[d]).toRgb();for(var f in n){var p=(i=c,o=a[f],(i.r-o.r)**2+(i.g-o.g)**2+(i.b-o.b)**2);p<l&&(l=p,u=f)}return u}},t.string.push([function(t){var r=t.toLowerCase(),i=r===`transparent`?`#0000`:n[r];return i?new e(i).toRgb():null},`name`])}Rn([zn]);var Bn=class e{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(e){return this.value=e,this}set value(t){if(t instanceof e)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else if(t===null)throw Error(`Cannot set Color#value to null`);else (this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value))}get value(){return this._value}_cloneSource(e){return typeof e==`string`||typeof e==`number`||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e==`object`&&e?{...e}:e}_isSourceEqual(e,t){let n=typeof e;if(n!==typeof t)return!1;if(n===`number`||n===`string`||e instanceof Number)return e===t;if(Array.isArray(e)&&Array.isArray(t)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return e.length===t.length?e.every((e,n)=>e===t[n]):!1;if(e!==null&&t!==null){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>e[n]===t[n]):!1}return e===t}toRgba(){let[e,t,n,r]=this._components;return{r:e,g:t,b:n,a:r}}toRgb(){let[e,t,n]=this._components;return{r:e,g:t,b:n}}toRgbaString(){let[e,t,n]=this.toUint8RgbArray();return`rgba(${e},${t},${n},${this.alpha})`}toUint8RgbArray(e){let[t,n,r]=this._components;return this._arrayRgb||=[],e||=this._arrayRgb,e[0]=Math.round(t*255),e[1]=Math.round(n*255),e[2]=Math.round(r*255),e}toArray(e){this._arrayRgba||=[],e||=this._arrayRgba;let[t,n,r,i]=this._components;return e[0]=t,e[1]=n,e[2]=r,e[3]=i,e}toRgbArray(e){this._arrayRgb||=[],e||=this._arrayRgb;let[t,n,r]=this._components;return e[0]=t,e[1]=n,e[2]=r,e}toNumber(){return this._int}toBgrNumber(){let[e,t,n]=this.toUint8RgbArray();return(n<<16)+(t<<8)+e}toLittleEndianNumber(){let e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(t){let[n,r,i,a]=e._temp.setValue(t)._components;return this._components[0]*=n,this._components[1]*=r,this._components[2]*=i,this._components[3]*=a,this._refreshInt(),this._value=null,this}premultiply(e,t=!0){return t&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this._refreshInt(),this._value=null,this}toPremultiplied(e,t=!0){if(e===1)return(255<<24)+this._int;if(e===0)return t?0:this._int;let n=this._int>>16&255,r=this._int>>8&255,i=this._int&255;return t&&(n=n*e+.5|0,r=r*e+.5|0,i=i*e+.5|0),(e*255<<24)+(n<<16)+(r<<8)+i}toHex(){let e=this._int.toString(16);return`#${`000000`.substring(0,6-e.length)+e}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+`00`.substring(0,2-e.length)+e}setAlpha(e){return this._components[3]=this._clamp(e),this._value=null,this}_normalize(t){let n,r,i,a;if((typeof t==`number`||t instanceof Number)&&t>=0&&t<=16777215){let e=t;n=(e>>16&255)/255,r=(e>>8&255)/255,i=(e&255)/255,a=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[n,r,i,a=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[n,r,i,a=255]=t,n/=255,r/=255,i/=255,a/=255;else if(typeof t==`string`||typeof t==`object`){if(typeof t==`string`){let n=e.HEX_PATTERN.exec(t);n&&(t=`#${n[2]}`)}let o=In(t);o.isValid()&&({r:n,g:r,b:i,a}=o.rgba,n/=255,r/=255,i/=255)}if(n!==void 0)this._components[0]=n,this._components[1]=r,this._components[2]=i,this._components[3]=a,this._refreshInt();else throw Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[e,t,n]=this._components;this._int=(e*255<<16)+(t*255<<8)+(n*255|0)}_clamp(e,t=0,n=1){return typeof e==`number`?Math.min(Math.max(e,t),n):(e.forEach((r,i)=>{e[i]=Math.min(Math.max(r,t),n)}),e)}static isColorLike(t){return typeof t==`number`||typeof t==`string`||t instanceof Number||t instanceof e||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}};Bn.shared=new Bn,Bn._temp=new Bn,Bn.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var G=Bn,Vn={cullArea:null,cullable:!1,cullableChildren:!0},Hn=0,Un=500;function K(...e){Hn!==Un&&(Hn++,Hn===Un?console.warn(`PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS.`):console.warn(`PixiJS Warning: `,...e))}var Wn={_registeredResources:new Set,register(e){this._registeredResources.add(e)},unregister(e){this._registeredResources.delete(e)},release(){this._registeredResources.forEach(e=>e.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(e){return this._registeredResources.has(e)},reset(){this._registeredResources.clear()}},Gn=class{constructor(e,t){this._pool=[],this._count=0,this._index=0,this._classType=e,t&&this.prepopulate(t)}prepopulate(e){for(let t=0;t<e;t++)this._pool[this._index++]=new this._classType;this._count+=e}get(e){let t;return this._index>0?t=this._pool[--this._index]:(t=new this._classType,this._count++),t.init?.(e),t}return(e){e.reset?.(),this._pool[this._index++]=e}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){if(this._pool.length>0&&this._pool[0].destroy)for(let e=0;e<this._index;e++)this._pool[e].destroy();this._pool.length=0,this._count=0,this._index=0}},Kn=new class{constructor(){this._poolsByClass=new Map}prepopulate(e,t){this.getPool(e).prepopulate(t)}get(e,t){return this.getPool(e).get(t)}return(e){this.getPool(e.constructor).return(e)}getPool(e){return this._poolsByClass.has(e)||this._poolsByClass.set(e,new Gn(e)),this._poolsByClass.get(e)}stats(){let e={};return this._poolsByClass.forEach(t=>{let n=e[t._classType.name]?t._classType.name+t._classType.ID:t._classType.name;e[n]={free:t.totalFree,used:t.totalUsed,size:t.totalSize}}),e}clear(){this._poolsByClass.forEach(e=>e.clear()),this._poolsByClass.clear()}};Wn.register(Kn);var qn={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(e){typeof e==`boolean`&&e===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(e===!0?{}:e))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(e){U(`v8.6.0`,`cacheAsBitmap is deprecated, use cacheAsTexture instead.`),this.cacheAsTexture(e)}};function Jn(e,t,n){let r=e.length,i;if(t>=r||n===0)return;n=t+n>r?r-t:n;let a=r-n;for(i=t;i<a;++i)e[i]=e[i+n];e.length=a}var Yn={allowChildren:!0,removeChildren(e=0,t){let n=t??this.children.length,r=n-e,i=[];if(r>0&&r<=n){for(let t=n-1;t>=e;t--){let e=this.children[t];e&&(i.push(e),e.parent=null)}Jn(this.children,e,n);let t=this.renderGroup||this.parentRenderGroup;t&&t.removeChildren(i);for(let e=0;e<i.length;++e){let t=i[e];t.parentRenderLayer?.detach(t),this.emit(`childRemoved`,t,this,e),i[e].emit(`removed`,this)}return i.length>0&&this._didViewChangeTick++,i}else if(r===0&&this.children.length===0)return i;throw RangeError(`removeChildren: numeric values are outside the acceptable range.`)},removeChildAt(e){let t=this.getChildAt(e);return this.removeChild(t)},getChildAt(e){if(e<0||e>=this.children.length)throw Error(`getChildAt: Index (${e}) does not exist.`);return this.children[e]},setChildIndex(e,t){if(t<0||t>=this.children.length)throw Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(e),this.addChildAt(e,t)},getChildIndex(e){let t=this.children.indexOf(e);if(t===-1)throw Error(`The supplied Container must be a child of the caller`);return t},addChildAt(e,t){this.allowChildren||U(H,`addChildAt: Only Containers will be allowed to add children in v8.0.0`);let{children:n}=this;if(t<0||t>n.length)throw Error(`${e}addChildAt: The index ${t} supplied is out of bounds ${n.length}`);let r=e.parent===this;if(e.parent){let n=e.parent.children.indexOf(e);if(r){if(n===t)return e;e.parent.children.splice(n,1)}else e.removeFromParent()}t===n.length?n.push(e):n.splice(t,0,e),e.parent=this,e.didChange=!0,e._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(e),this.sortableChildren&&(this.sortDirty=!0),r?e:(this.emit(`childAdded`,e,this,t),e.emit(`added`,this),e)},swapChildren(e,t){if(e===t)return;let n=this.getChildIndex(e),r=this.getChildIndex(t);this.children[n]=t,this.children[r]=e;let i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...e){return e.length===1?this.reparentChildAt(e[0],this.children.length):(e.forEach(e=>this.reparentChildAt(e,this.children.length)),e[0])},reparentChildAt(e,t){if(e.parent===this)return this.setChildIndex(e,t),e;let n=e.worldTransform.clone();e.removeFromParent(),this.addChildAt(e,t);let r=this.worldTransform.clone();return r.invert(),n.prepend(r),e.setFromMatrix(n),e},replaceChild(e,t){e.updateLocalTransform(),this.addChildAt(t,this.getChildIndex(e)),t.setFromMatrix(e.localTransform),t.updateLocalTransform(),this.removeChild(e)}},Xn={collectRenderables(e,t,n){this.parentRenderLayer&&this.parentRenderLayer!==n||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(e,t,n):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,e):this.collectRenderablesWithEffects(e,t,n))},collectRenderablesSimple(e,t,n){let r=this.children,i=r.length;for(let a=0;a<i;a++)r[a].collectRenderables(e,t,n)},collectRenderablesWithEffects(e,t,n){let{renderPipes:r}=t;for(let t=0;t<this.effects.length;t++){let n=this.effects[t];r[n.pipe].push(n,this,e)}this.collectRenderablesSimple(e,t,n);for(let t=this.effects.length-1;t>=0;t--){let n=this.effects[t];r[n.pipe].pop(n,this,e)}}},Zn=class{constructor(){this.pipe=`filter`,this.priority=1}destroy(){for(let e=0;e<this.filters.length;e++)this.filters[e].destroy();this.filters=null,this.filterArea=null}},Qn=new class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(e=>{this.add({test:e.test,maskClass:e})}))}add(e){this._tests.push(e)}getMaskEffect(e){this._initialized||this.init();for(let t=0;t<this._tests.length;t++){let n=this._tests[t];if(n.test(e))return Kn.get(n.maskClass,e)}return e}returnMaskEffect(e){Kn.return(e)}};F.handleByList(P.MaskEffect,Qn._effectClasses);var $n={_maskEffect:null,_maskOptions:{inverse:!1,channel:`red`},_filterEffect:null,effects:[],_markStructureAsChanged(){let e=this.renderGroup||this.parentRenderGroup;e&&(e.structureDidChange=!0)},addEffect(e){this.effects.indexOf(e)===-1&&(this.effects.push(e),this.effects.sort((e,t)=>e.priority-t.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(e){let t=this.effects.indexOf(e);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(e){let t=this._maskEffect;t?.mask!==e&&(t&&(this.removeEffect(t),Qn.returnMaskEffect(t),this._maskEffect=null),e!=null&&(this._maskEffect=Qn.getMaskEffect(e),this.addEffect(this._maskEffect)))},get mask(){return this._maskEffect?.mask},setMask(e){this._maskOptions={...this._maskOptions,...e},e.mask&&(this.mask=e.mask),this._markStructureAsChanged()},set filters(e){!Array.isArray(e)&&e&&(e=[e]);let t=this._filterEffect||=new Zn;e=e;let n=e?.length>0,r=n!==t.filters?.length>0;e=Array.isArray(e)?e.slice(0):e,t.filters=Object.freeze(e),r&&(n?this.addEffect(t):(this.removeEffect(t),t.filters=e??null))},get filters(){return this._filterEffect?.filters},set filterArea(e){this._filterEffect||=new Zn,this._filterEffect.filterArea=e},get filterArea(){return this._filterEffect?.filterArea}},er={label:null,get name(){return U(H,`Container.name property has been removed, use Container.label instead`),this.label},set name(e){U(H,`Container.name property has been removed, use Container.label instead`),this.label=e},getChildByName(e,t=!1){return this.getChildByLabel(e,t)},getChildByLabel(e,t=!1){let n=this.children;for(let t=0;t<n.length;t++){let r=n[t];if(r.label===e||e instanceof RegExp&&e.test(r.label))return r}if(t)for(let t=0;t<n.length;t++){let r=n[t].getChildByLabel(e,!0);if(r)return r}return null},getChildrenByLabel(e,t=!1,n=[]){let r=this.children;for(let t=0;t<r.length;t++){let i=r[t];(i.label===e||e instanceof RegExp&&e.test(i.label))&&n.push(i)}if(t)for(let t=0;t<r.length;t++)r[t].getChildrenByLabel(e,!0,n);return n}},tr=Kn.getPool(R),nr=Kn.getPool(ln),rr=new R,ir={getFastGlobalBounds(e,t){t||=new ln,t.clear(),this._getGlobalBoundsRecursive(!!e,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let n=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(n.worldTransform),t},_getGlobalBoundsRecursive(e,t,n){let r=t;if(e&&this.parentRenderLayer&&this.parentRenderLayer!==n||this.localDisplayStatus!==7||!this.measurable)return;let i=!!this.effects.length;if((this.renderGroup||i)&&(r=nr.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let e=this.bounds;r.addFrame(e.minX,e.minY,e.maxX,e.maxY,this.groupTransform)}let t=this.children;for(let i=0;i<t.length;i++)t[i]._getGlobalBoundsRecursive(e,r,n)}if(i){let e=!1,n=this.renderGroup||this.parentRenderGroup;for(let t=0;t<this.effects.length;t++)this.effects[t].addBounds&&(e||(e=!0,r.applyMatrix(n.worldTransform)),this.effects[t].addBounds(r,!0));e&&r.applyMatrix(n.worldTransform.copyTo(rr).invert()),t.addBounds(r),nr.return(r)}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),nr.return(r))}};function ar(e,t,n){n.clear();let r,i;return e.parent?t?r=e.parent.worldTransform:(i=tr.get().identity(),r=sr(e,i)):r=R.IDENTITY,or(e,n,r,t),i&&tr.return(i),n.isValid||n.set(0,0,0,0),n}function or(e,t,n,r){if(!e.visible||!e.measurable)return;let i;r?i=e.worldTransform:(e.updateLocalTransform(),i=tr.get(),i.appendFrom(e.localTransform,n));let a=t,o=!!e.effects.length;if(o&&(t=nr.get().clear()),e.boundsArea)t.addRect(e.boundsArea,i);else{let n=e.bounds;n&&!n.isEmpty()&&(t.matrix=i,t.addBounds(n));for(let n=0;n<e.children.length;n++)or(e.children[n],t,i,r)}if(o){for(let n=0;n<e.effects.length;n++)e.effects[n].addBounds?.(t);a.addBounds(t,R.IDENTITY),nr.return(t)}r||tr.return(i)}function sr(e,t){let n=e.parent;return n&&(sr(n,t),n.updateLocalTransform(),t.append(n.localTransform)),t}function cr(e,t){if(e===16777215||!t)return t;if(t===16777215||!e)return e;let n=e>>16&255,r=e>>8&255,i=e&255,a=t>>16&255,o=t>>8&255,s=t&255,c=n*a/255|0,l=r*o/255|0,u=i*s/255|0;return(c<<16)+(l<<8)+u}var lr=16777215;function ur(e,t){return e===lr?t:t===lr?e:cr(e,t)}function dr(e){return((e&255)<<16)+(e&65280)+(e>>16&255)}var fr={getGlobalAlpha(e){if(e)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,n=this.parent;for(;n;)t*=n.alpha,n=n.parent;return t},getGlobalTransform(e=new R,t){if(t)return e.copyFrom(this.worldTransform);this.updateLocalTransform();let n=sr(this,tr.get().identity());return e.appendFrom(this.localTransform,n),tr.return(n),e},getGlobalTint(e){if(e)return this.renderGroup?dr(this.renderGroup.worldColor):this.parentRenderGroup?dr(ur(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,n=this.parent;for(;n;)t=ur(t,n.localColor),n=n.parent;return dr(t)}};function pr(e,t,n){return t.clear(),n||=R.IDENTITY,mr(e,t,n,e,!0),t.isValid||t.set(0,0,0,0),t}function mr(e,t,n,r,i){let a;if(i)a=tr.get(),a=n.copyTo(a);else{if(!e.visible||!e.measurable)return;e.updateLocalTransform();let t=e.localTransform;a=tr.get(),a.appendFrom(t,n)}let o=t,s=!!e.effects.length;if(s&&(t=nr.get().clear()),e.boundsArea)t.addRect(e.boundsArea,a);else{e.renderPipeId&&(t.matrix=a,t.addBounds(e.bounds));let n=e.children;for(let e=0;e<n.length;e++)mr(n[e],t,a,r,!1)}if(s){for(let n=0;n<e.effects.length;n++)e.effects[n].addLocalBounds?.(t,r);o.addBounds(t,R.IDENTITY),nr.return(t)}tr.return(a)}function hr(e,t){let n=e.children;for(let e=0;e<n.length;e++){let r=n[e],i=r.uid,a=(r._didViewChangeTick&65535)<<16|r._didContainerChangeTick&65535,o=t.index;(t.data[o]!==i||t.data[o+1]!==a)&&(t.data[t.index]=i,t.data[t.index+1]=a,t.didChange=!0),t.index=o+2,r.children.length&&hr(r,t)}return t.didChange}var gr=new R,_r={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(e,t){let n=Math.sign(this.scale.x)||1;t===0?this.scale.x=n:this.scale.x=e/t*n},_setHeight(e,t){let n=Math.sign(this.scale.y)||1;t===0?this.scale.y=n:this.scale.y=e/t*n},getLocalBounds(){this._localBoundsCacheData||={data:[],index:1,didChange:!1,localBounds:new ln};let e=this._localBoundsCacheData;return e.index=1,e.didChange=!1,e.data[0]!==this._didViewChangeTick&&(e.didChange=!0,e.data[0]=this._didViewChangeTick),hr(this,e),e.didChange&&pr(this,e.localBounds,gr),e.localBounds},getBounds(e,t){return ar(this,e,t||new ln)}},vr={_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}},yr={_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(br))}};function br(e,t){return e._zIndex-t._zIndex}var xr={getGlobalPosition(e=new L,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,n=!1){let r=this.getGlobalTransform(tr.get(),n);return t=r.apply(e,t),tr.return(r),t},toLocal(e,t,n,r){t&&(e=t.toGlobal(e,n,r));let i=this.getGlobalTransform(tr.get(),r);return n=i.applyInverse(e,n),tr.return(i),n}},Sr=class{constructor(){this.uid=V(`instructionSet`),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}destroy(){this.instructions.length=0,this.renderables.length=0,this.renderPipes=null,this.gcTick=0}add(e){this.instructions[this.instructionSize++]=e}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,[`type`,`action`])}},Cr=0,wr=new class{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this.textureStyle=new en(this.textureOptions)}createTexture(e,t,n,r){return new W({source:new nn({...this.textureOptions,width:e,height:t,resolution:1,antialias:n,autoGarbageCollect:!1,autoGenerateMipmaps:r}),label:`texturePool_${Cr++}`})}getOptimalTexture(e,t,n=1,r,i=!1){let a=Math.ceil(e*n-1e-6),o=Math.ceil(t*n-1e-6);a=Jt(a),o=Jt(o);let s=+!!r,c=+!!i,l=(a<<17)+(o<<2)+(c<<1)+s;this._texturePool[l]||(this._texturePool[l]=[]);let u=this._texturePool[l].pop();return u||=this.createTexture(a,o,r,i),u.source._resolution=n,u.source.width=a/n,u.source.height=o/n,u.source.pixelWidth=a,u.source.pixelHeight=o,u.frame.x=0,u.frame.y=0,u.frame.width=e,u.frame.height=t,u.updateUvs(),this._poolKeyHash[u.uid]=l,u}getSameSizeTexture(e,t=!1){let n=e.source;return this.getOptimalTexture(e.width,e.height,n._resolution,t)}returnTexture(e,t=!1){let n=this._poolKeyHash[e.uid];t&&(e.source.style=this.textureStyle),this._texturePool[n].push(e)}clear(e){if(e=e!==!1,e)for(let e in this._texturePool){let t=this._texturePool[e];if(t)for(let e=0;e<t.length;e++)t[e].destroy(!0)}this._texturePool={}}};Wn.register(wr);var Tr=class{constructor(){this.renderPipeId=`renderGroup`,this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new R,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new Sr,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(e){this.root=e,e._onRender&&this.addOnRender(e),e.didChange=!0;let t=e.children;for(let e=0;e<t.length;e++){let n=t[e];n._updateFlags=15,this.addChild(n)}}enableCacheAsTexture(e={}){this.textureOptions=e,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&=(wr.returnTexture(this.texture,!0),null)}updateCacheTexture(){this.textureNeedsUpdate=!0;let e=this._parentCacheAsTextureRenderGroup;e&&!e.textureNeedsUpdate&&e.updateCacheTexture()}reset(){this.renderGroupChildren.length=0;for(let e in this.childrenToUpdate){let t=this.childrenToUpdate[e];t.list.fill(null),t.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(e){e.renderGroupParent&&e.renderGroupParent._removeRenderGroupChild(e),e.renderGroupParent=this,this.renderGroupChildren.push(e)}_removeRenderGroupChild(e){let t=this.renderGroupChildren.indexOf(e);t>-1&&this.renderGroupChildren.splice(t,1),e.renderGroupParent=null}addChild(e){if(this.structureDidChange=!0,e.parentRenderGroup=this,e.updateTick=-1,e.parent===this.root?e.relativeRenderGroupDepth=1:e.relativeRenderGroupDepth=e.parent.relativeRenderGroupDepth+1,e.didChange=!0,this.onChildUpdate(e),e.renderGroup){this.addRenderGroupChild(e.renderGroup);return}e._onRender&&this.addOnRender(e);let t=e.children;for(let e=0;e<t.length;e++)this.addChild(t[e])}removeChild(e){if(this.structureDidChange=!0,e._onRender&&(e.renderGroup||this.removeOnRender(e)),e.parentRenderGroup=null,e.renderGroup){this._removeRenderGroupChild(e.renderGroup);return}let t=e.children;for(let e=0;e<t.length;e++)this.removeChild(t[e])}removeChildren(e){for(let t=0;t<e.length;t++)this.removeChild(e[t])}onChildUpdate(e){let t=this.childrenToUpdate[e.relativeRenderGroupDepth];t||=this.childrenToUpdate[e.relativeRenderGroupDepth]={index:0,list:[]},t.list[t.index++]=e}updateRenderable(e){e.globalDisplayStatus<7||(this.instructionSet.renderPipes[e.renderPipeId].updateRenderable(e),e.didViewUpdate=!1)}onChildViewUpdate(e){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=e}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(e){this._onRenderContainers.push(e)}removeOnRender(e){this._onRenderContainers.splice(this._onRenderContainers.indexOf(e),1)}runOnRender(e){for(let t=0;t<this._onRenderContainers.length;t++)this._onRenderContainers[t]._onRender(e)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(e=[]){let t=this.root.children;for(let n=0;n<t.length;n++)this._getChildren(t[n],e);return e}_getChildren(e,t=[]){if(t.push(e),e.renderGroup)return t;let n=e.children;for(let e=0;e<n.length;e++)this._getChildren(n[e],t);return t}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return this._matrixDirty&1?(this._matrixDirty&=-2,this._inverseWorldTransform||=new R,this._inverseWorldTransform.copyFrom(this.worldTransform).invert()):this._inverseWorldTransform}get textureOffsetInverseTransform(){return this._matrixDirty&2?(this._matrixDirty&=-3,this._textureOffsetInverseTransform||=new R,this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y)):this._textureOffsetInverseTransform}get inverseParentTextureTransform(){if(!(this._matrixDirty&4))return this._inverseParentTextureTransform;this._matrixDirty&=-5;let e=this._parentCacheAsTextureRenderGroup;return e?(this._inverseParentTextureTransform||=new R,this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(e.inverseWorldTransform).translate(-e._textureBounds.x,-e._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}};function Er(e,t,n={}){for(let r in t)!n[r]&&t[r]!==void 0&&(e[r]=t[r])}var Dr=new I(null),Or=new I(null),kr=new I(null,1,1),Ar=new I(null),jr=class e extends Dt{constructor(e={}){super(),this.uid=V(`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.parentRenderLayer=null,this.updateTick=-1,this.localTransform=new R,this.relativeGroupTransform=new R,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new I(this,0,0),this._scale=kr,this._pivot=Or,this._origin=Ar,this._skew=Dr,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=[],Er(this,e,{children:!0,parent:!0,effects:!0}),e.children?.forEach(e=>this.addChild(e)),e.parent?.addChild(this)}static mixin(t){U(`8.8.0`,`Container.mixin is deprecated, please use extensions.mixin instead.`),F.mixin(e,t)}set _didChangeId(e){this._didViewChangeTick=e>>12&4095,this._didContainerChangeTick=e&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...e){if(this.allowChildren||U(H,`addChild: Only Containers will be allowed to add children in v8.0.0`),e.length>1){for(let t=0;t<e.length;t++)this.addChild(e[t]);return e[0]}let t=e[0],n=this.renderGroup||this.parentRenderGroup;return t.parent===this?(this.children.splice(this.children.indexOf(t),1),this.children.push(t),n&&(n.structureDidChange=!0),t):(t.parent&&t.parent.removeChild(t),this.children.push(t),this.sortableChildren&&(this.sortDirty=!0),t.parent=this,t.didChange=!0,t._updateFlags=15,n&&n.addChild(t),this.emit(`childAdded`,t,this,this.children.length-1),t.emit(`added`,this),this._didViewChangeTick++,t._zIndex!==0&&t.depthOfChildModified(),t)}removeChild(...e){if(e.length>1){for(let t=0;t<e.length;t++)this.removeChild(e[t]);return e[0]}let t=e[0],n=this.children.indexOf(t);return n>-1&&(this._didViewChangeTick++,this.children.splice(n,1),this.renderGroup?this.renderGroup.removeChild(t):this.parentRenderGroup&&this.parentRenderGroup.removeChild(t),t.parentRenderLayer&&t.parentRenderLayer.detach(t),t.parent=null,this.emit(`childRemoved`,t,this,n),t.emit(`removed`,this)),t}_onUpdate(e){e&&e===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(e){!!this.renderGroup!==e&&(e?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),this.renderGroup=Kn.get(Tr,this),this.groupTransform=R.IDENTITY,e?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),Kn.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,e?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||=new R,this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(e){this._position.x=e}get y(){return this._position.y}set y(e){this._position.y=e}get position(){return this._position}set position(e){this._position.copyFrom(e)}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._onUpdate(this._skew))}get angle(){return this.rotation*kt}set angle(e){this.rotation=e*At}get pivot(){return this._pivot===Or&&(this._pivot=new I(this,0,0)),this._pivot}set pivot(e){this._pivot===Or&&(this._pivot=new I(this,0,0),this._origin!==Ar&&K(`Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.`)),typeof e==`number`?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===Dr&&(this._skew=new I(this,0,0)),this._skew}set skew(e){this._skew===Dr&&(this._skew=new I(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===kr&&(this._scale=new I(this,1,1)),this._scale}set scale(e){this._scale===kr&&(this._scale=new I(this,0,0)),typeof e==`string`&&(e=parseFloat(e)),typeof e==`number`?this._scale.set(e):this._scale.copyFrom(e)}get origin(){return this._origin===Ar&&(this._origin=new I(this,0,0)),this._origin}set origin(e){this._origin===Ar&&(this._origin=new I(this,0,0),this._pivot!==Or&&K(`Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.`)),typeof e==`number`?this._origin.set(e):this._origin.copyFrom(e)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(e){let t=this.getLocalBounds().width;this._setWidth(e,t)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){let t=this.getLocalBounds().height;this._setHeight(e,t)}getSize(e){e||={};let t=this.getLocalBounds();return e.width=Math.abs(this.scale.x*t.width),e.height=Math.abs(this.scale.y*t.height),e}setSize(e,t){let n=this.getLocalBounds();typeof e==`object`?(t=e.height??e.width,e=e.width):t??=e,e!==void 0&&this._setWidth(e,n.width),t!==void 0&&this._setHeight(t,n.height)}_updateSkew(){let e=this._rotation,t=this._skew;this._cx=Math.cos(e+t._y),this._sx=Math.sin(e+t._y),this._cy=-Math.sin(e-t._x),this._sy=Math.cos(e-t._x)}updateTransform(e){return this.position.set(typeof e.x==`number`?e.x:this.position.x,typeof e.y==`number`?e.y:this.position.y),this.scale.set(typeof e.scaleX==`number`?e.scaleX||1:this.scale.x,typeof e.scaleY==`number`?e.scaleY||1:this.scale.y),this.rotation=typeof e.rotation==`number`?e.rotation:this.rotation,this.skew.set(typeof e.skewX==`number`?e.skewX:this.skew.x,typeof e.skewY==`number`?e.skewY:this.skew.y),this.pivot.set(typeof e.pivotX==`number`?e.pivotX:this.pivot.x,typeof e.pivotY==`number`?e.pivotY:this.pivot.y),this.origin.set(typeof e.originX==`number`?e.originX:this.origin.x,typeof e.originY==`number`?e.originY:this.origin.y),this}setFromMatrix(e){e.decompose(this)}updateLocalTransform(){let e=this._didContainerChangeTick;if(this._didLocalTransformChangeId===e)return;this._didLocalTransformChangeId=e;let t=this.localTransform,n=this._scale,r=this._pivot,i=this._origin,a=this._position,o=n._x,s=n._y,c=r._x,l=r._y,u=-i._x,d=-i._y;t.a=this._cx*o,t.b=this._sx*o,t.c=this._cy*s,t.d=this._sy*s,t.tx=a._x-(c*t.a+l*t.c)+(u*t.a+d*t.c)-u,t.ty=a._y-(c*t.b+l*t.d)+(u*t.b+d*t.d)-d}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=1,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){let t=G.shared.setValue(e??16777215).toBgrNumber();t!==this.localColor&&(this.localColor=t,this._updateFlags|=1,this._onUpdate())}get tint(){return dr(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=2,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){let t=e?2:0;(this.localDisplayStatus&2)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=4,this.localDisplayStatus^=2,this._onUpdate(),this.emit(`visibleChanged`,e))}get culled(){return!(this.localDisplayStatus&4)}set culled(e){let t=e?0:4;(this.localDisplayStatus&4)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=4,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){let t=+!!e;(this.localDisplayStatus&1)!==t&&(this._updateFlags|=4,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(e=!1){if(this.destroyed)return;this.destroyed=!0;let t;if(this.children.length&&(t=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._origin=null,this._skew=null,this.emit(`destroyed`,this),this.removeAllListeners(),(typeof e==`boolean`?e:e?.children)&&t)for(let n=0;n<t.length;++n)t[n].destroy(e);this.renderGroup?.destroy(),this.renderGroup=null}};F.mixin(jr,Yn,ir,xr,vr,_r,$n,er,yr,Vn,qn,fr,Xn);var Mr=class extends jr{constructor(e){super(e),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this._bounds=new ln(0,1,0,0),this._boundsDirty=!0,this.autoGarbageCollect=e.autoGarbageCollect??!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(e){this._roundPixels=+!!e}containsPoint(e){let t=this.bounds,{x:n,y:r}=e;return n>=t.minX&&n<=t.maxX&&r>=t.minY&&r<=t.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this)}unload(){this.emit(`unload`,this);for(let e in this._gpuData)this._gpuData[e]?.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(e){this.unload(),super.destroy(e),this._bounds=null}collectRenderablesSimple(e,t,n){let{renderPipes:r}=t;r.blendMode.pushBlendMode(this,this.groupBlendMode,e);let i=r[this.renderPipeId];i?.addRenderable&&i.addRenderable(this,e),this.didViewUpdate=!1;let a=this.children,o=a.length;for(let r=0;r<o;r++)a[r].collectRenderables(e,t,n);r.blendMode.popBlendMode(e)}},Nr=class e extends Mr{constructor(e=W.EMPTY){e instanceof W&&(e={texture:e});let{texture:t=W.EMPTY,anchor:n,roundPixels:r,width:i,height:a,...o}=e;super({label:`Sprite`,...o}),this.renderPipeId=`sprite`,this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new I({_onUpdate:()=>{this.onViewUpdate()}}),n?this.anchor=n:t.defaultAnchor&&(this.anchor=t.defaultAnchor),this.texture=t,this.allowChildren=!1,this.roundPixels=r??!1,i!==void 0&&(this.width=i),a!==void 0&&(this.height=a)}static from(t,n=!1){return t instanceof W?new e(t):new e(W.from(t,n))}set texture(e){e||=W.EMPTY;let t=this._texture;t!==e&&(t&&t.dynamic&&t.off(`update`,this.onViewUpdate,this),e.dynamic&&e.on(`update`,this.onViewUpdate,this),this._texture=e,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 visualBounds(){return sn(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return U(`8.6.1`,`Sprite.sourceBounds is deprecated, use visualBounds instead.`),this.visualBounds}updateBounds(){let e=this._anchor,t=this._texture,n=this._bounds,{width:r,height:i}=t.orig;n.minX=-e._x*r,n.maxX=n.minX+r,n.minY=-e._y*i,n.maxY=n.minY+i}destroy(e=!1){if(super.destroy(e),typeof e==`boolean`?e:e?.texture){let t=typeof e==`boolean`?e:e?.textureSource;this._texture.destroy(t)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(e){typeof e==`number`?this._anchor.set(e):this._anchor.copyFrom(e)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this._setWidth(e,this._texture.orig.width),this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this._setHeight(e,this._texture.orig.height),this._height=e}getSize(e){return e||={},e.width=Math.abs(this.scale.x)*this._texture.orig.width,e.height=Math.abs(this.scale.y)*this._texture.orig.height,e}setSize(e,t){typeof e==`object`?(t=e.height??e.width,e=e.width):t??=e,e!==void 0&&this._setWidth(e,this._texture.orig.width),t!==void 0&&this._setHeight(t,this._texture.orig.height)}},Pr=new ln;function Fr(e,t,n){let r=Pr;e.measurable=!0,ar(e,n,r),t.addBoundsMask(r),e.measurable=!1}function Ir(e,t,n){let r=nr.get();e.measurable=!0;let i=tr.get().identity();pr(e,r,Lr(e,n,i)),e.measurable=!1,t.addBoundsMask(r),tr.return(i),nr.return(r)}function Lr(e,t,n){return e?(e!==t&&(Lr(e.parent,t,n),e.updateLocalTransform(),n.append(e.localTransform)),n):(K(`Mask bounds, renderable is not inside the root container`),n)}var Rr=class{constructor(e){this.priority=0,this.inverse=!1,this.channel=`red`,this.pipe=`alphaMask`,e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.renderMaskToTexture=!(e instanceof Nr),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask=null)}addBounds(e,t){this.inverse||Fr(this.mask,e,t)}addLocalBounds(e,t){Ir(this.mask,e,t)}containsPoint(e,t){let n=this.mask;return t(n,e)}destroy(){this.reset()}static test(e){return e instanceof Nr}};Rr.extension=P.MaskEffect;var zr=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`}};zr.extension=P.MaskEffect;var Br=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!==null&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(e,t){Fr(this.mask,e,t)}addLocalBounds(e,t){Ir(this.mask,e,t)}containsPoint(e,t){let n=this.mask;return t(n,e)}destroy(){this.reset()}static test(e){return e instanceof jr}};Br.extension=P.MaskEffect;var Vr={createCanvas:(e,t)=>{let n=document.createElement(`canvas`);return n.width=e,n.height=t,n},createImage:()=>new Image,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`)},q={get(){return Vr},set(e){Vr=e}},Hr=class extends nn{constructor(e){e.resource||=q.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,this.resizeCanvas(),this.transparent=!!e.transparent}resizeCanvas(){this.autoDensity&&`style`in this.resource&&(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,n=this._resolution){let r=super.resize(e,t,n);return r&&this.resizeCanvas(),r}static test(e){return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&e instanceof OffscreenCanvas}get context2D(){return this._context2D||=this.resource.getContext(`2d`)}};Hr.extension=P.TextureSource;var Ur=class extends nn{constructor(e){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}};Ur.extension=P.TextureSource;var Wr=(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))(Wr||{}),Gr=class{constructor(e,t=null,n=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=e,this._context=t,this.priority=n,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}},Kr=class e{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 Gr(null,null,1/0),this.deltaMS=1/e.targetFPMS,this.elapsedMS=1/e.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(e,t,n=Wr.NORMAL){return this._addListener(new Gr(e,t,n))}addOnce(e,t,n=Wr.NORMAL){return this._addListener(new Gr(e,t,n,!0))}_addListener(e){let t=this._head.next,n=this._head;if(!t)e.connect(n);else{for(;t;){if(e.priority>t.priority){e.connect(n);break}n=t,t=t.next}e.previous||e.connect(n)}return this._startIfPossible(),this}remove(e,t){let n=this._head.next;for(;n;)n=n.match(e,t)?n.destroy():n.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,t=this._head;for(;t=t.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let n;if(t>this.lastTime){if(n=this.elapsedMS=t-this.lastTime,n>this._maxElapsedMS&&(n=this._maxElapsedMS),n*=this.speed,this._minElapsedMS){let e=t-this._lastFrame|0;if(e<this._minElapsedMS)return;this._lastFrame=t-e%this._minElapsedMS}this.deltaMS=n,this.deltaTime=this.deltaMS*e.targetFPMS;let r=this._head,i=r.next;for(;i;)i=i.emit(this);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let n=Math.min(Math.max(0,t)/1e3,e.targetFPMS);this._maxElapsedMS=1/n,this._minElapsedMS&&t>this.maxFPS&&(this.maxFPS=t)}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){e===0?this._minElapsedMS=0:(e<this.minFPS&&(this.minFPS=e),this._minElapsedMS=1/(e/1e3))}static get shared(){if(!e._shared){let t=e._shared=new e;t.autoStart=!0,t._protected=!0}return e._shared}static get system(){if(!e._system){let t=e._system=new e;t.autoStart=!0,t._protected=!0}return e._system}};Kr.targetFPMS=.06;var qr=Kr,Jr;async function Yr(){return Jr??=(async()=>{let e=q.get().createCanvas(1,1).getContext(`webgl`);if(!e)return`premultiply-alpha-on-upload`;let t=await new Promise(e=>{let t=document.createElement(`video`);t.onloadeddata=()=>e(t),t.onerror=()=>e(null),t.autoplay=!1,t.crossOrigin=`anonymous`,t.preload=`auto`,t.src=`data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=`,t.load()});if(!t)return`premultiply-alpha-on-upload`;let n=e.createTexture();e.bindTexture(e.TEXTURE_2D,n);let r=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,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 i=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,i),e.deleteFramebuffer(r),e.deleteTexture(n),e.getExtension(`WEBGL_lose_context`)?.loseContext(),i[0]<=i[3]?`premultiplied-alpha`:`premultiply-alpha-on-upload`})(),Jr}var Xr=class e extends nn{constructor(t){super(t),this.isReady=!1,this.uploadMethodId=`video`,t={...e.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),this._onLoadedMetadata=this._onLoadedMetadata.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let e=qr.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!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 e=this.resource,t=this.options;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener(`play`,this._onPlayStart),e.addEventListener(`pause`,this._onPlayStop),e.addEventListener(`seeked`,this._onSeeked),this._isSourceReady()?this._mediaReady():(t.preload||e.addEventListener(`canplay`,this._onCanPlay),e.addEventListener(`canplaythrough`,this._onCanPlayThrough),e.addEventListener(`error`,this._onError,!0)),this.isValid||e.addEventListener(`loadedmetadata`,this._onLoadedMetadata),this.alphaMode=await Yr(),this._load=new Promise((n,r)=>{this.isValid?n(this):(this._resolve=n,this._reject=r,t.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${t.preloadTimeoutMs}ms`))})),e.load())}),this._load}_onError(e){this.resource.removeEventListener(`error`,this._onError,!0),this.emit(`error`,e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){let e=this.resource;return!e.paused&&!e.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onLoadedMetadata(){this.isValid&&this._mediaReady()}_onCanPlay(){this.resource.removeEventListener(`canplay`,this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener(`canplaythrough`,this._onCanPlayThrough),this._preloadTimeout&&=(clearTimeout(this._preloadTimeout),void 0),this._mediaReady()}_mediaReady(){let e=this.resource;this.isValid&&(this.isReady=!0,this.resize(e.videoWidth,e.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&this.isValid&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let e=this.resource;e&&(e.removeEventListener(`play`,this._onPlayStart),e.removeEventListener(`pause`,this._onPlayStop),e.removeEventListener(`seeked`,this._onSeeked),e.removeEventListener(`canplay`,this._onCanPlay),e.removeEventListener(`canplaythrough`,this._onCanPlayThrough),e.removeEventListener(`loadedmetadata`,this._onLoadedMetadata),e.removeEventListener(`error`,this._onError,!0),e.pause(),e.src=``,e.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(qr.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||(qr.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(qr.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}};Xr.extension=P.TextureSource,Xr.defaultOptions={...nn.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1},Xr.MIME_TYPES={ogv:`video/ogg`,mov:`video/quicktime`,m4v:`video/mp4`};var Zr=Xr,Qr=(e,t,n=!1)=>(Array.isArray(e)||(e=[e]),t?e.map(e=>typeof e==`string`||n?t(e):e):e),J=new 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||K(`[Assets] Asset id ${e} was not found in the Cache`),t}set(e,t){let n=Qr(e),r;for(let e=0;e<this.parsers.length;e++){let i=this.parsers[e];if(i.test(t)){r=i.getCacheableAssets(n,t);break}}let i=new Map(Object.entries(r||{}));r||n.forEach(e=>{i.set(e,t)});let a=[...i.keys()],o={cacheKeys:a,keys:n};n.forEach(e=>{this._cacheMap.set(e,o)}),a.forEach(e=>{let n=r?r[e]:t;this._cache.has(e)&&this._cache.get(e)!==n&&K(`[Cache] already has key:`,e),this._cache.set(e,i.get(e))})}remove(e){if(!this._cacheMap.has(e)){K(`[Assets] Asset id ${e} was not found in the Cache`);return}let t=this._cacheMap.get(e);t.cacheKeys.forEach(e=>{this._cache.delete(e)}),t.keys.forEach(e=>{this._cacheMap.delete(e)})}get parsers(){return this._parsers}},$r=[];F.handleByList(P.TextureSource,$r);function ei(e={}){let t=e&&e.resource,n=t?e.resource:e,r=t?e:{resource:e};for(let e=0;e<$r.length;e++){let t=$r[e];if(t.test(n))return new t(r)}throw Error(`Could not find a source type for resource: ${r.resource}`)}function ti(e={},t=!1){let n=e&&e.resource,r=n?e.resource:e,i=n?e:{resource:e};if(!t&&J.has(r))return J.get(r);let a=new W({source:ei(i)});return a.on(`destroy`,()=>{J.has(r)&&J.remove(r)}),t||J.set(r,a),a}function ni(e,t=!1){return typeof e==`string`?J.get(e):e instanceof nn?new W({source:e}):ti(e,t)}W.from=ni,nn.from=ei,F.add(Rr,zr,Br,Zr,Ur,Hr,rn);var ri=(e=>(e[e.Low=0]=`Low`,e[e.Normal=1]=`Normal`,e[e.High=2]=`High`,e))(ri||{});function ii(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received ${JSON.stringify(e)}`)}function ai(e){return e.split(`?`)[0].split(`#`)[0]}function oi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function si(e,t,n){return e.replace(new RegExp(oi(t),`g`),n)}function ci(e,t){let n=``,r=0,i=-1,a=0,o=-1;for(let s=0;s<=e.length;++s){if(s<e.length)o=e.charCodeAt(s);else if(o===47)break;else o=47;if(o===47){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){let e=n.lastIndexOf(`/`);if(e!==n.length-1){e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}}else if(n.length===2||n.length===1){n=``,r=0,i=s,a=0;continue}}t&&(n.length>0?n+=`/..`:n=`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===46&&a!==-1?++a:a=-1}return n}var li={toPosix(e){return si(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){ii(e),e=this.toPosix(e);let t=/^file:\/\/\//.exec(e);if(t)return t[0];let n=/^[^/:]+:\/{0,2}/.exec(e);return n?n[0]:``},toAbsolute(e,t,n){if(ii(e),this.isDataUrl(e)||this.isBlobUrl(e))return e;let r=ai(this.toPosix(t??q.get().getBaseUrl())),i=ai(this.toPosix(n??this.rootname(r)));return e=this.toPosix(e),e.startsWith(`/`)?li.join(i,e.slice(1)):this.isAbsolute(e)?e:this.join(r,e)},normalize(e){if(ii(e),e.length===0)return`.`;if(this.isDataUrl(e)||this.isBlobUrl(e))return e;e=this.toPosix(e);let t=``,n=e.startsWith(`/`);this.hasProtocol(e)&&(t=this.rootname(e),e=e.slice(t.length));let r=e.endsWith(`/`);return e=ci(e,!1),e.length>0&&r&&(e+=`/`),n?`/${e}`:t+e},isAbsolute(e){return ii(e),e=this.toPosix(e),this.hasProtocol(e)?!0:e.startsWith(`/`)},join(...e){if(e.length===0)return`.`;let t;for(let n=0;n<e.length;++n){let r=e[n];if(ii(r),r.length>0)if(t===void 0)t=r;else{let i=e[n-1]??``;this.joinExtensions.includes(this.extname(i).toLowerCase())?t+=`/../${r}`:t+=`/${r}`}}return t===void 0?`.`:this.normalize(t)},dirname(e){if(ii(e),e.length===0)return`.`;e=this.toPosix(e);let t=e.charCodeAt(0),n=t===47,r=-1,i=!0,a=this.getProtocol(e),o=e;e=e.slice(a.length);for(let n=e.length-1;n>=1;--n)if(t=e.charCodeAt(n),t===47){if(!i){r=n;break}}else i=!1;return r===-1?n?`/`:this.isUrl(o)?a+e:a:n&&r===1?`//`:a+e.slice(0,r)},rootname(e){ii(e),e=this.toPosix(e);let t=``;if(t=e.startsWith(`/`)?`/`:this.getProtocol(e),this.isUrl(e)){let n=e.indexOf(`/`,t.length);t=n===-1?e:e.slice(0,n),t.endsWith(`/`)||(t+=`/`)}return t},basename(e,t){ii(e),t&&ii(t),e=ai(this.toPosix(e));let n=0,r=-1,i=!0,a;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;let o=t.length-1,s=-1;for(a=e.length-1;a>=0;--a){let c=e.charCodeAt(a);if(c===47){if(!i){n=a+1;break}}else s===-1&&(i=!1,s=a+1),o>=0&&(c===t.charCodeAt(o)?--o===-1&&(r=a):(o=-1,r=s))}return n===r?r=s:r===-1&&(r=e.length),e.slice(n,r)}for(a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!i){n=a+1;break}}else r===-1&&(i=!1,r=a+1);return r===-1?``:e.slice(n,r)},extname(e){ii(e),e=ai(this.toPosix(e));let t=-1,n=0,r=-1,i=!0,a=0;for(let o=e.length-1;o>=0;--o){let s=e.charCodeAt(o);if(s===47){if(!i){n=o+1;break}continue}r===-1&&(i=!1,r=o+1),s===46?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||r===-1||a===0||a===1&&t===r-1&&t===n+1?``:e.slice(t,r)},parse(e){ii(e);let t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;e=ai(this.toPosix(e));let n=e.charCodeAt(0),r=this.isAbsolute(e),i;t.root=this.rootname(e),i=r||this.hasProtocol(e)?1:0;let a=-1,o=0,s=-1,c=!0,l=e.length-1,u=0;for(;l>=i;--l){if(n=e.charCodeAt(l),n===47){if(!c){o=l+1;break}continue}s===-1&&(c=!1,s=l+1),n===46?a===-1?a=l:u!==1&&(u=1):a!==-1&&(u=-1)}return a===-1||s===-1||u===0||u===1&&a===s-1&&a===o+1?s!==-1&&(o===0&&r?t.base=t.name=e.slice(1,s):t.base=t.name=e.slice(o,s)):(o===0&&r?(t.name=e.slice(1,a),t.base=e.slice(1,s)):(t.name=e.slice(o,a),t.base=e.slice(o,s)),t.ext=e.slice(a,s)),t.dir=this.dirname(e),t},sep:`/`,delimiter:`:`,joinExtensions:[`.html`]};function ui(e,t,n,r,i){let a=t[n];for(let o=0;o<a.length;o++){let s=a[o];n<t.length-1?ui(e.replace(r[n],s),t,n+1,r,i):i.push(e.replace(r[n],s))}}function di(e){let t=e.match(/\{(.*?)\}/g),n=[];if(t){let r=[];t.forEach(e=>{let t=e.substring(1,e.length-1).split(`,`);r.push(t)}),ui(e,r,0,t,n)}else n.push(e);return n}var fi=e=>!Array.isArray(e),pi=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 Error(`[Resolver] GenerateBundleAssetId are not working correctly`)}prefer(...e){e.forEach(e=>{this._preferredOrder.push(e),e.priority||=Object.keys(e.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(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join(`&`)}}getAlias(e){let{alias:t,src:n}=e;return Qr(t||n,e=>typeof e==`string`?e:Array.isArray(e)?e.map(e=>e?.src??e):e?.src?e.src:e,!0)}removeAlias(e,t){this._assetMap[e]&&(t&&t!==this._resolverHash[e]||(delete this._resolverHash[e],delete this._assetMap[e]))}addManifest(e){this._manifest&&K(`[Resolver] Manifest already exists, this will be overwritten`),this._manifest=e,e.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(e,t){let n=[],r=t;Array.isArray(t)||(r=Object.entries(t).map(([e,t])=>typeof t==`string`||Array.isArray(t)?{alias:e,src:t}:{alias:e,...t})),r.forEach(t=>{let r=t.src,i=t.alias,a;if(typeof i==`string`){let t=this._createBundleAssetId(e,i);n.push(t),a=[i,t]}else{let t=i.map(t=>this._createBundleAssetId(e,t));n.push(...t),a=[...i,...t]}this.add({...t,alias:a,src:r})}),this._bundles[e]=n}add(e){let t=[];Array.isArray(e)?t.push(...e):t.push(e);let n=e=>{this.hasKey(e)&&K(`[Resolver] already has key: ${e} overwriting`)};Qr(t).forEach(e=>{let{src:t}=e,{data:r,format:i,loadParser:a,parser:o}=e,s=Qr(t).map(e=>typeof e==`string`?di(e):Array.isArray(e)?e:[e]),c=this.getAlias(e);Array.isArray(c)?c.forEach(n):n(c);let l=[],u=e=>({src:e,...this._parsers.find(t=>t.test(e))?.parse(e)});s.forEach(t=>{t.forEach(t=>{let n={};if(typeof t==`object`?(r=t.data??r,i=t.format??i,(t.loadParser||t.parser)&&(a=t.loadParser??a,o=t.parser??o),n={...u(t.src),...t}):n=u(t),!c)throw Error(`[Resolver] alias is undefined for this asset: ${n.src}`);n=this._buildResolvedAsset(n,{aliases:c,data:r,format:i,loadParser:a,parser:o,progressSize:e.progressSize}),l.push(n)})}),c.forEach(e=>{this._assetMap[e]=l})})}resolveBundle(e){let t=fi(e);e=Qr(e);let n={};return e.forEach(e=>{let t=this._bundles[e];if(t){let r=this.resolve(t),i={};for(let t in r){let n=r[t];i[this._extractAssetIdFromBundle(e,t)]=n}n[e]=i}}),t?n[e[0]]:n}resolveUrl(e){let t=this.resolve(e);if(typeof e!=`string`){let e={};for(let n in t)e[n]=t[n].src;return e}return t.src}resolve(e){let t=fi(e);e=Qr(e);let n={};return e.forEach(e=>{if(!this._resolverHash[e])if(this._assetMap[e]){let t=this._assetMap[e],n=this._getPreferredOrder(t);n?.priority.forEach(e=>{n.params[e].forEach(n=>{let r=t.filter(t=>t[e]?t[e]===n:!1);r.length&&(t=r)})}),this._resolverHash[e]=t[0]}else this._resolverHash[e]=this._buildResolvedAsset({alias:[e],src:e},{});n[e]=this._resolverHash[e]}),t?n[e[0]]:n}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;t<e.length;t++){let n=e[t],r=this._preferredOrder.find(e=>e.params.format.includes(n.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(e){return this._defaultSearchParams?`${e}${/\?/.test(e)?`&`:`?`}${this._defaultSearchParams}`:e}_buildResolvedAsset(e,t){let{aliases:n,data:r,loadParser:i,parser:a,format:o,progressSize:s}=t;return(this._basePath||this._rootPath)&&(e.src=li.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=n??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...r||{},...e.data},e.loadParser=i??e.loadParser,e.parser=a??e.parser,e.format=o??e.format??mi(e.src),s!==void 0&&(e.progressSize=s),e}};pi.RETINA_PREFIX=/@([0-9\.]+)x/;function mi(e){return e.split(`.`).pop().split(`?`).shift().split(`#`).shift()}var hi=(e,t)=>{let n=t.split(`?`)[1];return n&&(e+=`?${n}`),e},gi=class e{constructor(e,t){this.linkedSheets=[];let n=e;e?.source instanceof nn&&(n={texture:e,data:t});let{texture:r,data:i,cachePrefix:a=``}=n;this.cachePrefix=a,this._texture=r instanceof W?r:null,this.textureSource=r.source,this.textures={},this.animations={},this.data=i;let o=parseFloat(i.meta.scale);o?(this.resolution=o,r.source.resolution=this.resolution):this.resolution=r.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<=e.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(t,n=!1){let r=t,i=n?1/0:e.BATCH_SIZE;for(;r-t<i&&r<this._frameKeys.length;){let e=this._frameKeys[r],t=this._frames[e],n=t.frame;if(n){let r=null,i=null,a=t.trimmed!==!1&&t.sourceSize?t.sourceSize:t.frame,o=new B(0,0,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution);r=t.rotated?new B(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):new B(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),t.trimmed!==!1&&t.spriteSourceSize&&(i=new B(Math.floor(t.spriteSourceSize.x)/this.resolution,Math.floor(t.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[e]=new W({source:this.textureSource,frame:r,orig:o,trim:i,rotate:t.rotated?2:0,defaultAnchor:t.anchor,defaultBorders:t.borders,label:e.toString()})}r++}}_processAnimations(){let e=this.data.animations||{};for(let t in e){this.animations[t]=[];for(let n=0;n<e[t].length;n++){let r=e[t][n];this.animations[t].push(this.textures[r])}}}_parseComplete(){let e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*e.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*e.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){for(let e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};gi.BATCH_SIZE=1e3;var _i=gi,vi=[`jpg`,`png`,`jpeg`,`avif`,`webp`,`basis`,`etc2`,`bc7`,`bc6h`,`bc5`,`bc4`,`bc3`,`bc2`,`bc1`,`eac`,`astc`];function yi(e,t,n){let r={};if(e.forEach(e=>{r[e]=t}),Object.keys(t.textures).forEach(e=>{r[`${t.cachePrefix}${e}`]=t.textures[e]}),!n){let n=li.dirname(e[0]);t.linkedSheets.forEach((e,i)=>{let a=yi([`${n}/${t.data.meta.related_multi_packs[i]}`],e,!0);Object.assign(r,a)})}return r}var bi={extension:P.Asset,cache:{test:e=>e instanceof _i,getCacheableAssets:(e,t)=>yi(e,t,!1)},resolver:{extension:{type:P.ResolveParser,name:`resolveSpritesheet`},test:e=>{let t=e.split(`?`)[0].split(`.`),n=t.pop(),r=t.pop();return n===`json`&&vi.includes(r)},parse:e=>{let t=e.split(`.`);return{resolution:parseFloat(pi.RETINA_PREFIX.exec(e)?.[1]??`1`),format:t[t.length-2],src:e}}},loader:{name:`spritesheetLoader`,id:`spritesheet`,extension:{type:P.LoadParser,priority:ri.Normal,name:`spritesheetLoader`},async testParse(e,t){return li.extname(t.src).toLowerCase()===`.json`&&!!e.frames},async parse(e,t,n){let{texture:r,imageFilename:i,textureOptions:a,cachePrefix:o}=t?.data??{},s=li.dirname(t.src);s&&s.lastIndexOf(`/`)!==s.length-1&&(s+=`/`);let c;if(r instanceof W)c=r;else{let r=hi(s+(i??e.meta.image),t.src);c=(await n.load([{src:r,data:a}]))[r]}let l=new _i({texture:c.source,data:e,cachePrefix:o});await l.parse();let u=e?.meta?.related_multi_packs;if(Array.isArray(u)){let e=[];for(let r of u){if(typeof r!=`string`)continue;let i=s+r;t.data?.ignoreMultiPack||(i=hi(i,t.src),e.push(n.load({src:i,data:{textureOptions:a,ignoreMultiPack:!0}})))}let r=await Promise.all(e);l.linkedSheets=r,r.forEach(e=>{e.linkedSheets=[l].concat(l.linkedSheets.filter(t=>t!==e))})}return l},async unload(e,t,n){await n.unload(e.textureSource._sourceOrigin),e.destroy(!1)}}};F.add(bi);var xi=class{constructor(e){this._lastTransform=``,this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;let e=this._canvas.getBoundingClientRect(),t=this._canvas.width,n=this._canvas.height,r=e.width/t*this._renderer.resolution,i=e.height/n*this._renderer.resolution,a=`translate(${e.left}px, ${e.top}px) scale(${r}, ${i})`;a!==this._lastTransform&&(this._domElement.style.transform=a,this._lastTransform=a)},this._domElement=e.domElement,this._renderer=e.renderer,!(globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)&&(this._canvas=this._renderer.canvas,this._attachObserver())}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation())}_attachObserver(){`ResizeObserver`in globalThis?(this._observer&&=(this._observer.disconnect(),null),this._observer=new ResizeObserver(e=>{for(let t of e){if(t.target!==this._canvas)continue;let e=this.canvas.width,n=this.canvas.height,r=t.contentRect.width/e*this._renderer.resolution,i=t.contentRect.height/n*this._renderer.resolution;(this._lastScaleX!==r||this._lastScaleY!==i)&&(this.updateTranslation(),this._lastScaleX=r,this._lastScaleY=i)}}),this._observer.observe(this._canvas)):this._tickerAttached||qr.shared.add(this.updateTranslation,this,Wr.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&qr.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform=``,this._lastScaleX=null,this._lastScaleY=null}},Si=class e{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=e.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new L,this.page=new L,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(e,t,n){throw Error(`initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.`)}initUIEvent(e,t,n,r,i){throw 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}},Ci=/iPhone/i,wi=/iPod/i,Ti=/iPad/i,Ei=/\biOS-universal(?:.+)Mac\b/i,Di=/\bAndroid(?:.+)Mobile\b/i,Oi=/Android/i,ki=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Ai=/Silk/i,ji=/Windows Phone/i,Mi=/\bWindows(?:.+)ARM\b/i,Ni=/BlackBerry/i,Pi=/BB10/i,Fi=/Opera Mini/i,Ii=/\b(CriOS|Chrome)(?:.+)Mobile/i,Li=/Mobile(?:.+)Firefox\b/i,Ri=function(e){return e!==void 0&&e.platform===`MacIntel`&&typeof e.maxTouchPoints==`number`&&e.maxTouchPoints>1&&typeof MSStream>`u`};function zi(e){return function(t){return t.test(e)}}function Bi(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 n=t.userAgent,r=n.split(`[FBAN`);r[1]!==void 0&&(n=r[0]),r=n.split(`Twitter`),r[1]!==void 0&&(n=r[0]);var i=zi(n),a={apple:{phone:i(Ci)&&!i(ji),ipod:i(wi),tablet:!i(Ci)&&(i(Ti)||Ri(t))&&!i(ji),universal:i(Ei),device:(i(Ci)||i(wi)||i(Ti)||i(Ei)||Ri(t))&&!i(ji)},amazon:{phone:i(ki),tablet:!i(ki)&&i(Ai),device:i(ki)||i(Ai)},android:{phone:!i(ji)&&i(ki)||!i(ji)&&i(Di),tablet:!i(ji)&&!i(ki)&&!i(Di)&&(i(Ai)||i(Oi)),device:!i(ji)&&(i(ki)||i(Ai)||i(Di)||i(Oi))||i(/\bokhttp\b/i)},windows:{phone:i(ji),tablet:i(Mi),device:i(ji)||i(Mi)},other:{blackberry:i(Ni),blackberry10:i(Pi),opera:i(Fi),firefox:i(Li),chrome:i(Ii),device:i(Ni)||i(Pi)||i(Fi)||i(Li)||i(Ii)},any:!1,phone:!1,tablet:!1};return a.any=a.apple.device||a.android.device||a.windows.device||a.other.device,a.phone=a.apple.phone||a.android.phone||a.windows.phone,a.tablet=a.apple.tablet||a.android.tablet||a.windows.tablet,a}var Vi=(Bi.default??Bi)(globalThis.navigator),Hi=9,Ui=100,Wi=0,Gi=0,Ki=2,qi=1,Ji=-1e3,Yi=-1e3,Xi=2,Zi=class e{constructor(e,t=Vi){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){let e=document.createElement(`button`);e.style.width=`${qi}px`,e.style.height=`${qi}px`,e.style.position=`absolute`,e.style.top=`${Ji}px`,e.style.left=`${Yi}px`,e.style.zIndex=Xi.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),null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement(`div`),this._div.style.position=`absolute`,this._div.style.top=`${Wi}px`,this._div.style.left=`${Gi}px`,this._div.style.pointerEvents=`none`,this._div.style.zIndex=Ki.toString(),this._canvasObserver=new xi({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener(`keydown`,this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener(`mousemove`,this._boundOnMouseMove,!0);let e=this._renderer.view.canvas;if(e.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{let t=new MutationObserver(()=>{e.parentNode&&(t.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener(`mousemove`,this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener(`keydown`,this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let e of this._children)e._accessibleDiv?.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;for(let e in this._pools)this._pools[e].forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),delete this._pools[e];this._div?.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);let t=e.children;if(t)for(let e=0;e<t.length;e++)this._updateAccessibleObjects(t[e])}init(t){let n={accessibilityOptions:{...e.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=n.accessibilityOptions.debug,this._activateOnTab=n.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=n.accessibilityOptions.deactivateOnMouseMove,n.accessibilityOptions.enabledByDefault&&this._activate(),this._renderer.runners.postrender.remove(this)}postrender(){let e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,(!this._renderer.renderingToScreen||!this._renderer.view.canvas)&&!this._isRunningTests))return;let t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let e of this._children)e._renderId===this._renderId&&t.add(this._children.indexOf(e))}for(let e=this._children.length-1;e>=0;e--){let n=this._children[e];t.has(e)||(n._accessibleDiv&&n._accessibleDiv.parentNode&&(n._accessibleDiv.parentNode.removeChild(n._accessibleDiv),this._getPool(n.accessibleType).push(n._accessibleDiv),n._accessibleDiv=null),n._accessibleActive=!1,Jn(this._children,e,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let e=0;e<this._children.length;e++){let t=this._children[e];if(!t._accessibleActive||!t._accessibleDiv)continue;let n=t._accessibleDiv,r=t.hitArea||t.getBounds().rectangle;if(t.hitArea){let e=t.worldTransform;n.style.left=`${e.tx+r.x*e.a}px`,n.style.top=`${e.ty+r.y*e.d}px`,n.style.width=`${r.width*e.a}px`,n.style.height=`${r.height*e.d}px`}else this._capHitArea(r),n.style.left=`${r.x}px`,n.style.top=`${r.y}px`,n.style.width=`${r.width}px`,n.style.height=`${r.height}px`}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);let{width:t,height:n}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>n&&(e.height=n-e.y)}_addChild(e){let t=this._getPool(e.accessibleType).pop();t?(t.innerHTML=``,t.removeAttribute(`title`),t.removeAttribute(`aria-label`),t.tabIndex=0):(e.accessibleType===`button`?t=document.createElement(`button`):(t=document.createElement(e.accessibleType),t.style.cssText=`
|
|
@@ -1123,4 +1123,4 @@ fn mainFragment(
|
|
|
1123
1123
|
fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
|
|
1124
1124
|
return textureSample(img, imgSampler, texCoord);
|
|
1125
1125
|
}
|
|
1126
|
-
`}),t=this.device.createRenderPipeline({layout:`auto`,vertex:{module:this.mipmapShaderModule,entryPoint:`vertexMain`},fragment:{module:this.mipmapShaderModule,entryPoint:`fragmentMain`,targets:[{format:e}]}}),this.pipelines[e]=t),t}generateMipmap(e){let t=this._getMipmapPipeline(e.format);if(e.dimension===`3d`||e.dimension===`1d`)throw Error(`Generating mipmaps for non-2d textures is currently unsupported!`);let n=e,r=e.depthOrArrayLayers||1,i=e.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!i){let t={size:{width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:r},format:e.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:e.mipLevelCount-1};n=this.device.createTexture(t)}let a=this.device.createCommandEncoder({}),o=t.getBindGroupLayout(0);for(let s=0;s<r;++s){let r=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:`2d`,baseArrayLayer:s,arrayLayerCount:1}),c=+!!i;for(let i=1;i<e.mipLevelCount;++i){let e=n.createView({baseMipLevel:c++,mipLevelCount:1,dimension:`2d`,baseArrayLayer:s,arrayLayerCount:1}),i=a.beginRenderPass({colorAttachments:[{view:e,storeOp:`store`,loadOp:`clear`,clearValue:{r:0,g:0,b:0,a:0}}]}),l=this.device.createBindGroup({layout:o,entries:[{binding:0,resource:this.sampler},{binding:1,resource:r}]});i.setPipeline(t),i.setBindGroup(0,l),i.draw(3,1,0,0),i.end(),r=e}}if(!i){let t={width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:r};for(let r=1;r<e.mipLevelCount;++r)a.copyTextureToTexture({texture:n,mipLevel:r-1},{texture:e,mipLevel:r},t),t.width=Math.ceil(t.width/2),t.height=Math.ceil(t.height/2)}return this.device.queue.submit([a.finish()]),i||n.destroy(),e}},hy=class{constructor(e){this.textureView=null,this.gpuTexture=e}destroy(){this.gpuTexture.destroy(),this.textureView=null,this.gpuTexture=null}},gy=class{constructor(e){this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._renderer=e,e.gc.addCollection(this,`_bindGroupHash`,`hash`),this._managedTextures=new ul({renderer:e,type:`resource`,onUnload:this.onSourceUnload.bind(this),name:`gpuTextureSource`});let t={image:fy,buffer:oy,video:py,compressed:ly};this._uploads={...t,cube:dy(t)}}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(e){this._gpu=e}initSource(e){return e._gpuData[this._renderer.uid]?.gpuTexture||this._initSource(e)}_initSource(e){if(e.autoGenerateMipmaps){let t=Math.max(e.pixelWidth,e.pixelHeight);e.mipLevelCount=Math.floor(Math.log2(t))+1}let t=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;e.uploadMethodId!==`compressed`&&(t|=GPUTextureUsage.RENDER_ATTACHMENT,t|=GPUTextureUsage.COPY_SRC);let n=sy[e.format]||{blockBytes:4,blockWidth:1,blockHeight:1},r=Math.ceil(e.pixelWidth/n.blockWidth)*n.blockWidth,i=Math.ceil(e.pixelHeight/n.blockHeight)*n.blockHeight,a={label:e.label,size:{width:r,height:i,depthOrArrayLayers:e.arrayLayerCount},format:e.format,sampleCount:e.sampleCount,mipLevelCount:e.mipLevelCount,dimension:e.dimension,usage:t},o=this._gpu.device.createTexture(a);return e._gpuData[this._renderer.uid]=new hy(o),this._managedTextures.add(e)&&(e.on(`update`,this.onSourceUpdate,this),e.on(`resize`,this.onSourceResize,this),e.on(`updateMipmaps`,this.onUpdateMipmaps,this)),this.onSourceUpdate(e),o}onSourceUpdate(e){let t=this.getGpuSource(e);t&&(this._uploads[e.uploadMethodId]&&this._uploads[e.uploadMethodId].upload(e,t,this._gpu),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e))}onUpdateMipmaps(e){this._mipmapGenerator||=new my(this._gpu.device);let t=this.getGpuSource(e);this._mipmapGenerator.generateMipmap(t)}onSourceUnload(e){e.off(`update`,this.onSourceUpdate,this),e.off(`resize`,this.onSourceResize,this),e.off(`updateMipmaps`,this.onUpdateMipmaps,this)}onSourceResize(e){e._gcLastUsed=this._renderer.gc.now;let t=e._gpuData[this._renderer.uid],n=t?.gpuTexture;n?(n.width!==e.pixelWidth||n.height!==e.pixelHeight)&&(t.destroy(),this._bindGroupHash[e.uid]=null,e._gpuData[this._renderer.uid]=null,this.initSource(e)):this.initSource(e)}_initSampler(e){return this._gpuSamplers[e._resourceId]=this._gpu.device.createSampler(e),this._gpuSamplers[e._resourceId]}getGpuSampler(e){return this._gpuSamplers[e._resourceId]||this._initSampler(e)}getGpuSource(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]?.gpuTexture||this.initSource(e)}getTextureBindGroup(e){return this._bindGroupHash[e.uid]||this._createTextureBindGroup(e)}_createTextureBindGroup(e){let t=e.source;return this._bindGroupHash[e.uid]=new La({0:t,1:t.style,2:new Ia({uTextureMatrix:{type:`mat3x3<f32>`,value:e.textureMatrix.mapCoord}})}),this._bindGroupHash[e.uid]}getTextureView(e){let t=e.source;t._gcLastUsed=this._renderer.gc.now;let n=t._gpuData[this._renderer.uid];return n||=(this.initSource(t),t._gpuData[this._renderer.uid]),n.textureView||=n.gpuTexture.createView({dimension:t.viewDimension}),n.textureView}generateCanvas(e){let t=this._renderer,n=t.gpu.device.createCommandEncoder(),r=q.get().createCanvas();r.width=e.source.pixelWidth,r.height=e.source.pixelHeight;let i=r.getContext(`webgpu`);return i.configure({device:t.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:q.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:`premultiplied`}),n.copyTextureToTexture({texture:t.texture.getGpuSource(e.source),origin:{x:0,y:0}},{texture:i.getCurrentTexture()},{width:r.width,height:r.height}),t.gpu.device.queue.submit([n.finish()]),r}getPixels(e){let t=this.generateCanvas(e),n=Zd.getOptimalCanvasAndContext(t.width,t.height),r=n.context;r.drawImage(t,0,0);let{width:i,height:a}=t,o=r.getImageData(0,0,i,a),s=new Uint8ClampedArray(o.data.buffer);return Zd.returnCanvasAndContext(n),{pixels:s,width:i,height:a}}destroy(){this._managedTextures.destroy();for(let e of Object.keys(this._bindGroupHash)){let t=Number(e);this._bindGroupHash[t]?.destroy()}this._renderer=null,this._gpu=null,this._mipmapGenerator=null,this._gpuSamplers=null,this._bindGroupHash=null}};gy.extension={type:[P.WebGPUSystem],name:`texture`};var _y=class{constructor(){this._maxTextures=0}contextChange(e){let t=new Ia({uTransformMatrix:{value:new R,type:`mat3x3<f32>`},uColor:{value:new Float32Array([1,1,1,1]),type:`vec4<f32>`},uRound:{value:0,type:`f32`}});this._maxTextures=e.limits.maxBatchableTextures;let n=Gc({name:`graphics`,bits:[qc,Qc(this._maxTextures),Bf,nl]});this.shader=new za({gpuProgram:n,resources:{localUniforms:t}})}execute(e,t){let n=t.context,r=n.customShader||this.shader,i=e.renderer,{batcher:a,instructions:o}=i.graphicsContext.getContextRenderData(n),s=i.encoder;s.setGeometry(a.geometry,r.gpuProgram);let c=i.globalUniforms.bindGroup;s.setBindGroup(0,c,r.gpuProgram);let l=i.renderPipes.uniformBatch.getUniformBindGroup(r.resources.localUniforms,!0);s.setBindGroup(2,l,r.gpuProgram);let u=o.instructions,d=null;for(let t=0;t<o.instructionSize;t++){let n=u[t];if(n.topology!==d&&(d=n.topology,s.setPipelineFromGeometryProgramAndState(a.geometry,r.gpuProgram,e.state,n.topology)),r.groups[1]=n.bindGroup,!n.gpuBindGroup){let e=n.textures;n.bindGroup=Ks(e.textures,e.count,this._maxTextures),n.gpuBindGroup=i.bindGroup.getBindGroup(n.bindGroup,r.gpuProgram,1)}s.setBindGroup(1,n.bindGroup,r.gpuProgram),s.renderPassEncoder.drawIndexed(n.size,1,n.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};_y.extension={type:[P.WebGPUPipesAdaptor],name:`graphics`};var vy=class{init(){let e=Gc({name:`mesh`,bits:[zf,oh,nl]});this._shader=new za({gpuProgram:e,resources:{uTexture:W.EMPTY._source,uSampler:W.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:`mat3x3<f32>`,value:new R}}}})}execute(e,t){let n=e.renderer,r=t._shader;if(!r)r=this._shader,r.groups[2]=n.texture.getTextureBindGroup(t.texture);else if(!r.gpuProgram){K(`Mesh shader has no gpuProgram`,t.shader);return}let i=r.gpuProgram;if(i.autoAssignGlobalUniforms&&(r.groups[0]=n.globalUniforms.bindGroup),i.autoAssignLocalUniforms){let t=e.localUniforms;r.groups[1]=n.renderPipes.uniformBatch.getUniformBindGroup(t,!0)}n.encoder.draw({geometry:t._geometry,shader:r,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}};vy.extension={type:[P.WebGPUPipesAdaptor],name:`mesh`};var yy=s({WebGPURenderer:()=>Ey}),by=[...Eg,qv,Bv,zv,Vv,Iv,gy,ny,ry,ay,$v,Rv,Hv,Pv],xy=[...Dg,Yv],Sy=[rh,vy,_y],Cy=[],wy=[],Ty=[];F.handleByNamedList(P.WebGPUSystem,Cy),F.handleByNamedList(P.WebGPUPipes,wy),F.handleByNamedList(P.WebGPUPipesAdaptor,Ty),F.add(...by,...xy,...Sy);var Ey=class extends zo{constructor(){let e={name:`webgpu`,type:Ra.WEBGPU,systems:Cy,renderPipes:wy,renderPipeAdaptors:Ty};super(e)}},Dy=class e extends kf{constructor(...e){super({});let t=e[0]??{};typeof t==`number`&&(U(H,`PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead`),t={width:t,height:e[1],verticesX:e[2],verticesY:e[3]}),this.build(t)}build(t){t={...e.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 n=this.verticesX*this.verticesY,r=[],i=[],a=[],o=this.verticesX-1,s=this.verticesY-1,c=this.width/o,l=this.height/s;for(let e=0;e<n;e++){let t=e%this.verticesX,n=e/this.verticesX|0;r.push(t*c,n*l),i.push(t/o,n/s)}let u=o*s;for(let e=0;e<u;e++){let t=e%o,n=e/o|0,r=n*this.verticesX+t,i=n*this.verticesX+t+1,s=(n+1)*this.verticesX+t,c=(n+1)*this.verticesX+t+1;a.push(r,i,s,i,c,s)}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(i),this.indexBuffer.data=new Uint32Array(a),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};Dy.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};var Oy=Dy,ky=class{constructor(e){this._renderer=e}validateRenderable(e){return!1}addRenderable(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}updateRenderable(e){}execute(e){let t=this._renderer,n=t.canvasContext,r=n.activeContext;r.save();let i=e.groupTransform,a=t._roundPixels|e._roundPixels;n.setContextTransform(i,a===1),n.setBlendMode(e.groupBlendMode);let o=t.globalUniforms.globalUniformData?.worldColor??4294967295,s=e.groupColorAlpha,c=(o>>>24&255)/255,l=(s>>>24&255)/255,u=t.filter?.alphaMultiplier??1,d=c*l*u;if(d<=0){r.restore();return}r.globalAlpha=d;let f=o&16777215,p=dr(cr(s&16777215,f)),m=e.texture,h=Z.getCanvasSource(m);if(!h){r.restore();return}let g=n.smoothProperty,_=m.source.style.scaleMode!==`nearest`;r[g]!==_&&(r[g]=_);let v=p!==16777215||m.rotate!==0,y=v?Z.getTintedCanvas({texture:m},p):h,{leftWidth:b,topHeight:x,rightWidth:S,bottomHeight:C,width:w,height:T}=e,E=b+S,D=x+C,O=Math.min(E>w?w/E:1,D>T?T/D:1,1),k=b*O,ee=S*O,te=x*O,A=C*O,j=Math.max(0,w-k-ee),ne=Math.max(0,T-te-A),re=e.anchor,ie=m.source._resolution??m.source.resolution??1,ae=m.frame.x*ie,M=m.frame.y*ie,N=-re.x*w,oe=-re.y*T,se=b*ie,ce=x*ie,le=S*ie,ue=C*ie,de=m.frame.width*ie,fe=m.frame.height*ie;v&&(ae=0,M=0,de=y.width,fe=y.height),r.drawImage(y,ae,M,se,ce,N,oe,k,te),r.drawImage(y,ae+se,M,de-se-le,ce,N+k,oe,j,te),r.drawImage(y,ae+de-le,M,le,ce,N+w-ee,oe,ee,te),r.drawImage(y,ae,M+ce,se,fe-ce-ue,N,oe+te,k,ne),r.drawImage(y,ae+se,M+ce,de-se-le,fe-ce-ue,N+k,oe+te,j,ne),r.drawImage(y,ae+de-le,M+ce,le,fe-ce-ue,N+w-ee,oe+te,ee,ne),r.drawImage(y,ae,M+fe-ue,se,ue,N,oe+T-A,k,A),r.drawImage(y,ae+se,M+fe-ue,de-se-le,ue,N+k,oe+T-A,j,A),r.drawImage(y,ae+de-le,M+fe-ue,le,ue,N+w-ee,oe+T-A,ee,A),r.restore()}destroy(){this._renderer=null}};ky.extension={type:[P.CanvasPipes],name:`nineSliceSprite`};var Ay=class e extends Oy{constructor(t={}){t={...e.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this._trimX=0,this._trimY=0,this._trimWidth=t.originalWidth??e.defaultOptions.originalWidth,this._trimHeight=t.originalHeight??e.defaultOptions.originalHeight,this.update(t)}update(e){this.width=e.width??this.width,this.height=e.height??this.height,this._originalWidth=e.originalWidth??this._originalWidth,this._originalHeight=e.originalHeight??this._originalHeight,this._leftWidth=e.leftWidth??this._leftWidth,this._rightWidth=e.rightWidth??this._rightWidth,this._topHeight=e.topHeight??this._topHeight,this._bottomHeight=e.bottomHeight??this._bottomHeight,this._anchorX=e.anchor?.x,this._anchorY=e.anchor?.y,e.trim===void 0?(this._trimWidth=this._originalWidth,this._trimHeight=this._originalHeight):(this._trimX=e.trim?.x??0,this._trimY=e.trim?.y??0,this._trimWidth=e.trim?.width??this._originalWidth,this._trimHeight=e.trim?.height??this._originalHeight),this.updateUvs(),this.updatePositions()}updatePositions(){let e=this.positions,{width:t,height:n,_leftWidth:r,_rightWidth:i,_topHeight:a,_bottomHeight:o,_anchorX:s,_anchorY:c}=this,l=r+i,u=t>l?1:t/l,d=a+o,f=n>d?1:n/d,p=Math.min(u,f),m=s*t,h=c*n;e[0]=e[8]=e[16]=e[24]=-m,e[2]=e[10]=e[18]=e[26]=r*p-m,e[4]=e[12]=e[20]=e[28]=t-i*p-m,e[6]=e[14]=e[22]=e[30]=t-m,e[1]=e[3]=e[5]=e[7]=-h,e[9]=e[11]=e[13]=e[15]=a*p-h,e[17]=e[19]=e[21]=e[23]=n-o*p-h,e[25]=e[27]=e[29]=e[31]=n-h,this.getBuffer(`aPosition`).update()}updateUvs(){let e=this.uvs,t=this._originalWidth,n=this._originalHeight,r=this._trimX/t,i=this._trimY/n,a=(this._trimX+this._trimWidth)/t,o=(this._trimY+this._trimHeight)/n;e[0]=e[8]=e[16]=e[24]=r,e[1]=e[3]=e[5]=e[7]=i,e[6]=e[14]=e[22]=e[30]=a,e[25]=e[27]=e[29]=e[31]=o;let s=1/t,c=1/n;e[2]=e[10]=e[18]=e[26]=r+s*this._leftWidth,e[9]=e[11]=e[13]=e[15]=i+c*this._topHeight,e[4]=e[12]=e[20]=e[28]=a-s*this._rightWidth,e[17]=e[19]=e[21]=e[23]=o-c*this._bottomHeight,this.getBuffer(`aUV`).update()}};Ay.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};var jy=Ay,My=class extends Af{constructor(){super(),this.geometry=new jy}destroy(){this.geometry.destroy()}},Ny=class{constructor(e){this._renderer=e,this._managedSprites=new ul({renderer:e,type:`renderable`,name:`nineSliceSprite`})}addRenderable(e,t){let n=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,n),this._renderer.renderPipes.batch.addToBatch(n,t)}updateRenderable(e){let t=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){let t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}_updateBatchableSprite(e,t){t.geometry.update(e),t.setTexture(e._texture)}_getGpuSprite(e){return e._gpuData[this._renderer.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let t=e._gpuData[this._renderer.uid]=new My,n=t;return n.renderable=e,n.transform=e.groupTransform,n.texture=e._texture,n.roundPixels=this._renderer._roundPixels|e._roundPixels,this._managedSprites.add(e),e.didViewUpdate||this._updateBatchableSprite(e,n),t}destroy(){this._managedSprites.destroy(),this._renderer=null}};Ny.extension={type:[P.WebGLPipes,P.WebGPUPipes],name:`nineSliceSprite`},F.add(ky),F.add(Ny);var Py=class e extends Mr{constructor(t){t instanceof W&&(t={texture:t});let{width:n,height:r,anchor:i,leftWidth:a,rightWidth:o,topHeight:s,bottomHeight:c,texture:l,roundPixels:u,...d}=t;super({label:`NineSliceSprite`,...d}),this.renderPipeId=`nineSliceSprite`,this.batched=!0,this._leftWidth=a??l?.defaultBorders?.left??jy.defaultOptions.leftWidth,this._topHeight=s??l?.defaultBorders?.top??jy.defaultOptions.topHeight,this._rightWidth=o??l?.defaultBorders?.right??jy.defaultOptions.rightWidth,this._bottomHeight=c??l?.defaultBorders?.bottom??jy.defaultOptions.bottomHeight,this._width=n??l.width??jy.defaultOptions.width,this._height=r??l.height??jy.defaultOptions.height,this.allowChildren=!1,this.texture=l??e.defaultOptions.texture,this.roundPixels=u??!1,this._anchor=new I({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:this.texture.defaultAnchor&&(this.anchor=this.texture.defaultAnchor)}get anchor(){return this._anchor}set anchor(e){typeof e==`number`?this._anchor.set(e):this._anchor.copyFrom(e)}get width(){return this._width}set width(e){this._width=e,this.onViewUpdate()}get height(){return this._height}set height(e){this._height=e,this.onViewUpdate()}setSize(e,t){typeof e==`object`&&(t=e.height??e.width,e=e.width),this._width=e,this._height=t??e,this.onViewUpdate()}getSize(e){return e||={},e.width=this._width,e.height=this._height,e}get leftWidth(){return this._leftWidth}set leftWidth(e){this._leftWidth=e,this.onViewUpdate()}get topHeight(){return this._topHeight}set topHeight(e){this._topHeight=e,this.onViewUpdate()}get rightWidth(){return this._rightWidth}set rightWidth(e){this._rightWidth=e,this.onViewUpdate()}get bottomHeight(){return this._bottomHeight}set bottomHeight(e){this._bottomHeight=e,this.onViewUpdate()}get texture(){return this._texture}set texture(e){e||=W.EMPTY;let t=this._texture;t!==e&&(t&&t.dynamic&&t.off(`update`,this.onViewUpdate,this),e.dynamic&&e.on(`update`,this.onViewUpdate,this),this._texture=e,this.onViewUpdate())}get originalWidth(){return this._texture.width}get originalHeight(){return this._texture.height}get trim(){return this._texture.trim??null}destroy(e){if(super.destroy(e),typeof e==`boolean`?e:e?.texture){let t=typeof e==`boolean`?e:e?.textureSource;this._texture.destroy(t)}this._texture=null}updateBounds(){let e=this._bounds,t=this._anchor,n=this._width,r=this._height;e.minX=-t._x*n,e.maxX=e.minX+n,e.minY=-t._y*r,e.maxY=e.minY+r}};Py.defaultOptions={texture:W.EMPTY};var Fy=Py,Iy=s({BitmapFont:()=>Ly}),Ly=class extends am{constructor(e,t){super();let{textures:n,data:r}=e;Object.keys(r.pages).forEach(e=>{let t=n[r.pages[parseInt(e,10)].id];this.pages.push({texture:t})}),Object.keys(r.chars).forEach(e=>{let t=r.chars[e],{frame:i,source:a,rotate:o}=n[t.page],s=new W({frame:z.transformRectCoords(t,i,o,new B),orig:new B(0,0,t.width,t.height),source:a,rotate:o});this.chars[e]={id:e.codePointAt(0),xOffset:t.xOffset,yOffset:t.yOffset,xAdvance:t.xAdvance,kerning:t.kerning??{},texture:s}}),this.baseRenderedFontSize=r.fontSize,this.baseMeasurementFontSize=r.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:r.fontSize},this.baseLineOffset=r.baseLineOffset,this.lineHeight=r.lineHeight,this.fontFamily=r.fontFamily,this.distanceField=r.distanceField??{type:`none`,range:0},this.url=t}destroy(){super.destroy();for(let e=0;e<this.pages.length;e++){let{texture:t}=this.pages[e];t.destroy(!0)}this.pages=null}static install(e){mm.install(e)}static uninstall(e){mm.uninstall(e)}};F.add(Tt,Et);var Ry=[`left`,`right`,`top`,`bottom`,`horizontal`,`vertical`],zy=new WeakMap;function By(e){return zy.get(e)??{}}function Vy(e,t){let n={...By(e)};for(let e of Ry){if(!(e in t))continue;let r=t[e];r===void 0?delete n[e]:n[e]=r}Object.keys(n).length===0?zy.delete(e):zy.set(e,n),Uy(e.parent)}function Hy(e){for(let t of e.children)Wy(e,t)}function Uy(e){let t=e;for(;t;){if(typeof t.layout==`function`){t.layout();return}t=t.parent}}function Wy(e,t){let n=zy.get(t);if(!n)return;let r=Ky({start:n.left,end:n.right,center:n.horizontal,parentSize:e.width,childSize:t.width}),i=Ky({start:n.top,end:n.bottom,center:n.vertical,parentSize:e.height,childSize:t.height});(r.position!==void 0||i.position!==void 0)&&t.position.set(r.position??t.x,i.position??t.y),(r.size!==void 0||i.size!==void 0)&&Gy(t,r.size??t.width,i.size??t.height),t.layout?.()}function Gy(e,t,n){let r=e;if(r.setSize){r.setSize(t,n);return}e.width=t,e.height=n}function Ky(e){return e.start!==void 0&&e.end!==void 0?{position:e.start,size:Math.max(0,e.parentSize-e.start-e.end)}:e.start===void 0?e.end===void 0?e.center===void 0?{position:void 0,size:void 0}:{position:(e.parentSize-e.childSize)/2+e.center,size:void 0}:{position:e.parentSize-e.end-e.childSize,size:void 0}:{position:e.start,size:void 0}}var qy=class extends jr{#e=0;#t=0;constructor(e={}){let{width:t,height:n,...r}=e;super(r),this.on(`childAdded`,this.#r,this),this.on(`childRemoved`,this.#r,this),(t!==void 0||n!==void 0)&&this.#n(t??0,n??0)}get width(){return this.#e}set width(e){this.#n(e,this.#t),this.layout()}get height(){return this.#t}set height(e){this.#n(this.#e,e),this.layout()}getSize(e={width:0,height:0}){return e.width=this.#e,e.height=this.#t,e}setSize(e,t){typeof e==`number`?this.#n(e,t??e):this.#n(e.width,e.height??e.width),this.layout()}layout(){this.#i()}setBoxSize(e,t){this.#n(e,t)}#n(e,t){this.#e=e,this.#t=t,this.#a()}#r(){this.layout()}#i(){Hy(this)}#a(){let e=new B(0,0,this.#e,this.#t);this.hitArea=e,this.boundsArea=e}},Jy=class extends qy{constructor(e={}){super(e)}get left(){return this.#e(`left`)}set left(e){this.#t(`left`,e)}get right(){return this.#e(`right`)}set right(e){this.#t(`right`,e)}get top(){return this.#e(`top`)}set top(e){this.#t(`top`,e)}get bottom(){return this.#e(`bottom`)}set bottom(e){this.#t(`bottom`,e)}get horizontal(){return this.#e(`horizontal`)}set horizontal(e){this.#t(`horizontal`,e)}get vertical(){return this.#e(`vertical`)}set vertical(e){this.#t(`vertical`,e)}#e(e){return By(this)[e]}#t(e,t){Vy(this,{[e]:t})}},Yy=class extends Jy{#e;#t=new Df;#n=`Arial`;#r=16;#i=400;#a=1120295;#o=0;#s=0;#c=!1;#l=`start`;#u=`start`;#d=`visible`;constructor(e,t){let{text:n=`Text`,width:r=120,height:i=28,fontFamily:a=`Arial`,fontSize:o=16,fontWeight:s=400,fill:c=1120295,lineHeight:l=0,letterSpacing:u=0,wordWrap:d=!1,alignX:f=`start`,alignY:p=`start`,overflow:m=`visible`,...h}=e;super({...h,width:r,height:i}),this.#n=a,this.#r=o,this.#i=s,this.#a=c,this.#o=l,this.#s=u,this.#c=d,this.#l=f,this.#u=p,this.#d=m,this.#e=t({text:n,style:{fontFamily:a,fontSize:o,fontWeight:String(s),fill:c,lineHeight:l,letterSpacing:u,wordWrap:d,wordWrapWidth:r,align:Xy(f)}}),super.addChild(this.#e,this.#t),this.layout()}get text(){return this.#e.text}set text(e){this.#e.text=e,this.layout()}get fontFamily(){return this.#n}set fontFamily(e){this.#n=e,this.#e.style.fontFamily=e,this.layout()}get fontSize(){return this.#r}set fontSize(e){this.#r=e,this.#e.style.fontSize=e,this.layout()}get fontWeight(){return this.#i}set fontWeight(e){this.#i=e,this.#e.style.fontWeight=String(e),this.layout()}get fill(){return this.#a}set fill(e){this.#a=e,this.#e.style.fill=e,this.layout()}get lineHeight(){return this.#o}set lineHeight(e){this.#o=e,this.#e.style.lineHeight=e,this.layout()}get letterSpacing(){return this.#s}set letterSpacing(e){this.#s=e,this.#e.style.letterSpacing=e,this.layout()}get wordWrap(){return this.#c}set wordWrap(e){this.#c=e,this.#e.style.wordWrap=e,this.layout()}get alignX(){return this.#l}set alignX(e){this.#l=e,this.#e.style.align=Xy(e),this.layout()}get alignY(){return this.#u}set alignY(e){this.#u=e,this.layout()}get overflow(){return this.#d}set overflow(e){this.#d=e,this.layout()}layout(){if(super.layout(),!this.#e)return;this.#e.style.wordWrapWidth=this.width,this.#e.anchor.set(Zy(this.#l),Zy(this.#u)),this.#e.position.set(this.width*Zy(this.#l),this.height*Zy(this.#u)),this.#t.clear().rect(0,0,this.width,this.height).fill(16777215);let e=this.#d===`clip`;this.#t.visible=e,this.#e.mask=e?this.#t:null}};function Xy(e){return e===`center`?`center`:e===`end`?`right`:`left`}function Zy(e){return e===`center`?.5:+(e===`end`)}var Qy=class extends Yy{constructor(e={}){super(e,e=>new im(e))}},$y=class extends Yy{constructor(e={}){super(e,e=>new Dm(e))}},eb=class extends Df{#e=100;#t=60;#n=16777215;#r=1;#i=0;#a=1;#o=0;#s=0;constructor(e={}){let{width:t,height:n,fillColor:r,fillAlpha:i,strokeColor:a,strokeAlpha:o,strokeWidth:s,radius:c,...l}=e;super(l),this.#e=t??this.#e,this.#t=n??this.#t,this.#n=r??this.#n,this.#r=i??this.#r,this.#i=a??this.#i,this.#a=o??this.#a,this.#o=s??this.#o,this.#s=c??this.#s,this.#d(),this.#f()}get width(){return this.#e}set width(e){this.#u(e,this.#t)}get height(){return this.#t}set height(e){this.#u(this.#e,e)}getSize(e={width:0,height:0}){return e.width=this.#e,e.height=this.#t,e}setSize(e,t){typeof e==`number`?this.#u(e,t??e):this.#u(e.width,e.height??e.width)}get fillColor(){return this.#n}set fillColor(e){this.#n=e,this.#f()}get fillAlpha(){return this.#r}set fillAlpha(e){this.#r=e,this.#f()}get strokeColor(){return this.#i}set strokeColor(e){this.#i=e,this.#f()}get strokeAlpha(){return this.#a}set strokeAlpha(e){this.#a=e,this.#f()}get strokeWidth(){return this.#o}set strokeWidth(e){this.#o=e,this.#f()}get radius(){return this.#s}set radius(e){this.#s=e,this.#f()}get left(){return this.#c(`left`)}set left(e){this.#l(`left`,e)}get right(){return this.#c(`right`)}set right(e){this.#l(`right`,e)}get top(){return this.#c(`top`)}set top(e){this.#l(`top`,e)}get bottom(){return this.#c(`bottom`)}set bottom(e){this.#l(`bottom`,e)}get horizontal(){return this.#c(`horizontal`)}set horizontal(e){this.#l(`horizontal`,e)}get vertical(){return this.#c(`vertical`)}set vertical(e){this.#l(`vertical`,e)}#c(e){return By(this)[e]}#l(e,t){Vy(this,{[e]:t})}#u(e,t){this.#e=e,this.#t=t,this.#d(),this.#f()}#d(){let e=new B(0,0,this.#e,this.#t);this.hitArea=e,this.boundsArea=e}#f(){this.clear();let e=Math.max(0,Math.min(this.#s,this.#e/2,this.#t/2)),t=e>0?this.roundRect(0,0,this.#e,this.#t,e):this.rect(0,0,this.#e,this.#t);t.fill({color:this.#n,alpha:this.#r}),this.#o>0&&t.stroke({width:this.#o,color:this.#i,alpha:this.#a,alignment:1})}};function tb(e,t){return By(e)[t]}function nb(e,t,n){Vy(e,{[t]:n})}var rb=new Uint32Array([0,1,2,0,2,3]),ib=new WeakSet,ab=class extends Nf{#e=96;#t=96;#n=`stretch`;#r=new I({_onUpdate:()=>this.#c()});constructor(e={}){let{texture:t,width:n,height:r,fit:i,anchorX:a,anchorY:o,...s}=e;super({...s,texture:t??W.EMPTY,geometry:new kf({positions:new Float32Array(8),uvs:new Float32Array(8),indices:rb})}),ib.add(this),this.texture.on(`update`,this.#c,this),this.#e=n??this.#e,this.#t=r??this.#t,this.#n=i??this.#n,this.#r.set(a??0,o??0),this.#s(),this.#c()}get width(){return this.#e}set width(e){this.#o(e,this.#t)}get height(){return this.#t}set height(e){this.#o(this.#e,e)}getSize(e={width:0,height:0}){return e.width=this.#e,e.height=this.#t,e}setSize(e,t){typeof e==`number`?this.#o(e,t??e):this.#o(e.width,e.height??e.width)}get texture(){return super.texture}set texture(e){if(!ib.has(this)){super.texture=e;return}super.texture?.off(`update`,this.#c,this),super.texture=e,e.on(`update`,this.#c,this),this.#c()}get fit(){return this.#n}set fit(e){this.#n=e,this.#c()}get anchor(){return this.#r}set anchor(e){typeof e==`number`?this.#r.set(e):this.#r.set(e.x,e.y)}get left(){return this.#i(`left`)}set left(e){this.#a(`left`,e)}get right(){return this.#i(`right`)}set right(e){this.#a(`right`,e)}get top(){return this.#i(`top`)}set top(e){this.#a(`top`,e)}get bottom(){return this.#i(`bottom`)}set bottom(e){this.#a(`bottom`,e)}get horizontal(){return this.#i(`horizontal`)}set horizontal(e){this.#a(`horizontal`,e)}get vertical(){return this.#i(`vertical`)}set vertical(e){this.#a(`vertical`,e)}#i(e){return tb(this,e)}#a(e,t){nb(this,e,t)}#o(e,t){this.#e=e,this.#t=t,this.#s(),this.#c()}#s(){let e=this.#p();this.hitArea=e,this.boundsArea=e}#c(){this.#l(),this.#u(),this.geometry.positions=this.geometry.positions,this.geometry.uvs=this.geometry.uvs}#l(){let e=this.geometry.positions,t=this.#d();e[0]=t.x,e[1]=t.y,e[2]=t.x+t.width,e[3]=t.y,e[4]=t.x+t.width,e[5]=t.y+t.height,e[6]=t.x,e[7]=t.y+t.height}#u(){let e=this.geometry.uvs,t=this.#f();e[0]=t.u0,e[1]=t.v0,e[2]=t.u1,e[3]=t.v0,e[4]=t.u1,e[5]=t.v1,e[6]=t.u0,e[7]=t.v1}#d(){let e=this.#p();if(this.#n===`contain`){let t=ob(this.texture.width,this.texture.height,this.#e,this.#t);return cb(t.width,t.height,e.x,e.y,e.width,e.height)}return this.#n===`none`?new B(e.x,e.y,this.texture.width,this.texture.height):e}#f(){return this.#n===`cover`?sb(this.texture.width,this.texture.height,this.#e,this.#t):{u0:0,v0:0,u1:1,v1:1}}#p(){return new B(-this.#r.x*this.#e,-this.#r.y*this.#t,this.#e,this.#t)}};function ob(e,t,n,r){if(e<=0||t<=0||n<=0||r<=0)return{width:0,height:0};let i=Math.min(n/e,r/t);return{width:e*i,height:t*i}}function sb(e,t,n,r){if(e<=0||t<=0||n<=0||r<=0)return{u0:0,v0:0,u1:1,v1:1};let i=e/t,a=n/r;if(i>a){let e=(1-a/i)/2;return{u0:e,v0:0,u1:1-e,v1:1}}let o=(1-i/a)/2;return{u0:0,v0:o,u1:1,v1:1-o}}function cb(e,t,n,r,i,a){return new B(n+(i-e)/2,r+(a-t)/2,e,t)}var lb=class extends Fy{constructor(e={}){let{texture:t,anchorX:n,anchorY:r,...i}=e;super({texture:t??W.EMPTY,...i}),this.anchor.set(n??0,r??0)}get left(){return this.#e(`left`)}set left(e){this.#t(`left`,e)}get right(){return this.#e(`right`)}set right(e){this.#t(`right`,e)}get top(){return this.#e(`top`)}set top(e){this.#t(`top`,e)}get bottom(){return this.#e(`bottom`)}set bottom(e){this.#t(`bottom`,e)}get horizontal(){return this.#e(`horizontal`)}set horizontal(e){this.#t(`horizontal`,e)}get vertical(){return this.#e(`vertical`)}set vertical(e){this.#t(`vertical`,e)}#e(e){return tb(this,e)}#t(e,t){nb(this,e,t)}},ub=class extends tp{constructor(e={}){let{texture:t,tilePositionX:n,tilePositionY:r,tileScaleX:i,tileScaleY:a,tileRotation:o,anchorX:s,anchorY:c,...l}=e;super({texture:t??W.EMPTY,...l}),this.tilePosition.set(n??0,r??0),this.tileScale.set(i??1,a??1),this.tileRotation=o??0,this.anchor.set(s??0,c??0)}get left(){return this.#e(`left`)}set left(e){this.#t(`left`,e)}get right(){return this.#e(`right`)}set right(e){this.#t(`right`,e)}get top(){return this.#e(`top`)}set top(e){this.#t(`top`,e)}get bottom(){return this.#e(`bottom`)}set bottom(e){this.#t(`bottom`,e)}get horizontal(){return this.#e(`horizontal`)}set horizontal(e){this.#t(`horizontal`,e)}get vertical(){return this.#e(`vertical`)}set vertical(e){this.#t(`vertical`,e)}#e(e){return tb(this,e)}#t(e,t){nb(this,e,t)}};function db(e,t){return Number.isFinite(e)?e:t}function fb(e){return e===`center`||e===`end`?e:`start`}function pb(e){return e===`center`||e===`end`||e===`space-between`?e:`start`}function mb(e,t){return e===`center`?t/2:e===`end`?t:0}function hb(e,t){return e===`center`?t/2:e===`end`?t:0}function gb(e){return{width:e.width,height:e.height}}function _b(e,t,n){if(t.length===0)return{width:0,height:0};let r=n*Math.max(0,t.length-1),i=t.map(gb);return e===`horizontal`?{width:i.reduce((e,t)=>e+t.width,0)+r,height:i.reduce((e,t)=>Math.max(e,t.height),0)}:{width:i.reduce((e,t)=>Math.max(e,t.width),0),height:i.reduce((e,t)=>e+t.height,0)+r}}function vb(e){e.layout?.()}var yb=class extends Jy{#e=1;#t=0;#n=0;#r=`start`;#i=`start`;#a=!1;#o=!1;constructor(e={}){super(e),this.#a=e.width!==void 0,this.#o=e.height!==void 0}get width(){return super.width}set width(e){this.#a=!0,super.width=e}get height(){return super.height}set height(e){this.#o=!0,super.height=e}setSize(e,t){this.#a=!0,this.#o=!0,super.setSize(e,t)}get columns(){return this.#e}set columns(e){this.#e=Math.max(1,Math.floor(db(e,1))),this.layout()}get gapX(){return this.#t}set gapX(e){this.#t=Math.max(0,db(e,0)),this.layout()}get gapY(){return this.#n}set gapY(e){this.#n=Math.max(0,db(e,0)),this.layout()}get alignX(){return this.#r}set alignX(e){this.#r=fb(e),this.layout()}get alignY(){return this.#i}set alignY(e){this.#i=fb(e),this.layout()}layout(){let e=this.children,t=bb(e,this.#e,this.#t,this.#n),n=this.#a?this.width:t.width,r=this.#o?this.height:t.height;(n!==this.width||r!==this.height)&&this.setBoxSize(n,r);let i=0;for(let n=0;n<t.rowHeights.length;n++){let r=0;for(let a=0;a<t.columnWidths.length;a++){let o=e[n*this.#e+a];if(o){let e=gb(o);o.position.set(r+mb(this.#r,Math.max(0,t.columnWidths[a]-e.width)),i+mb(this.#i,Math.max(0,t.rowHeights[n]-e.height))),vb(o)}r+=t.columnWidths[a]+this.#t}i+=t.rowHeights[n]+this.#n}}};function bb(e,t,n,r){if(e.length===0)return{width:0,height:0,columnWidths:[],rowHeights:[]};let i=Math.min(t,e.length),a=Math.ceil(e.length/t),o=Array.from({length:i},()=>0),s=Array.from({length:a},()=>0);for(let n=0;n<e.length;n++){let r=e[n],i=n%t,a=Math.floor(n/t);o[i]=Math.max(o[i],r.width),s[a]=Math.max(s[a],r.height)}return{width:o.reduce((e,t)=>e+t,0)+n*Math.max(0,o.length-1),height:s.reduce((e,t)=>e+t,0)+r*Math.max(0,s.length-1),columnWidths:o,rowHeights:s}}var xb=class extends Jy{#e=0;#t=`start`;#n=`start`;#r=!1;#i=!1;constructor(e={}){super(e),this.#r=e.width!==void 0,this.#i=e.height!==void 0}get width(){return super.width}set width(e){this.#r=!0,super.width=e}get height(){return super.height}set height(e){this.#i=!0,super.height=e}setSize(e,t){this.#r=!0,this.#i=!0,super.setSize(e,t)}get gap(){return this.#e}set gap(e){this.#e=Math.max(0,db(e,0)),this.layout()}get alignY(){return this.#t}set alignY(e){this.#t=fb(e),this.layout()}get justify(){return this.#n}set justify(e){this.#n=pb(e),this.layout()}layout(){let e=this.children,t=_b(`horizontal`,e,this.#e),n=this.#r?this.width:t.width,r=this.#i?this.height:t.height;(n!==this.width||r!==this.height)&&this.setBoxSize(n,r);let i=Math.max(0,n-t.width),a=this.#n===`space-between`&&e.length>1?this.#e+i/(e.length-1):this.#e,o=hb(this.#n,i);for(let t of e){let e=gb(t);t.position.set(o,mb(this.#t,Math.max(0,r-e.height))),vb(t),o+=e.width+a}}},Sb=Symbol(`pixifact.runtimeBehavior`),Cb=.5,wb=.92,Tb=.18,Eb=.72,Db=.05,Ob=.05,kb=class extends Jy{contentLayer=new jr;#e=new Df;#t=`vertical`;#n=0;#r=0;#i=0;#a=0;#o=0;#s=0;#c=!1;#l=new Set;#u=!1;#d;constructor(e={}){let{direction:t,scrollX:n,scrollY:r,...i}=e;super(i),this.#t=t??this.#t,this.#n=n??this.#n,this.#r=r??this.#r,this.contentLayer.mask=this.#e,this.contentLayer.on(`childAdded`,this.#f,this),this.contentLayer.on(`childRemoved`,this.#p,this),super.addChild(this.contentLayer),super.addChild(this.#e),this.layout()}[Sb](){this.eventMode=`static`,this.on(`wheel`,this.#v,this),this.on(`pointerdown`,this.#y,this),this.on(`globalpointermove`,this.#b,this),this.on(`pointerup`,this.#x,this),this.on(`pointerupoutside`,this.#x,this),this.on(`pointercancel`,this.#x,this)}get direction(){return this.#t}set direction(e){this.#O(),this.#t=e,this.#C()}get scrollX(){return this.#i}set scrollX(e){this.#O(),this.#n=e,this.#C()}get scrollY(){return this.#a}set scrollY(e){this.#O(),this.#r=e,this.#C()}addChild(...e){let t=this.contentLayer.addChild(...e);return this.layout(),t}addChildAt(e,t){let n=this.contentLayer.addChildAt(e,t);return this.layout(),n}removeChild(...e){let t=e.every(e=>e.parent===this.contentLayer)?this.contentLayer.removeChild(...e):super.removeChild(...e);return this.layout(),t}setChildIndex(e,t){e.parent===this.contentLayer?this.contentLayer.setChildIndex(e,t):super.setChildIndex(e,t),this.layout()}getChildIndex(e){return e.parent===this.contentLayer?this.contentLayer.getChildIndex(e):super.getChildIndex(e)}swapChildren(e,t){e.parent===this.contentLayer&&t.parent===this.contentLayer?this.contentLayer.swapChildren(e,t):super.swapChildren(e,t),this.layout()}layout(){this.#u||this.destroyed||(super.layout(),this.#S(),this.#C())}destroy(e){this.#u=!0,this.#O(),this.#d=void 0,this.off(`wheel`,this.#v,this),this.off(`pointerdown`,this.#y,this),this.off(`globalpointermove`,this.#b,this),this.off(`pointerup`,this.#x,this),this.off(`pointerupoutside`,this.#x,this),this.off(`pointercancel`,this.#x,this),this.contentLayer.off(`childAdded`,this.#f,this),this.contentLayer.off(`childRemoved`,this.#p,this);for(let e of this.#l)e.off(`childAdded`,this.#m,this),e.off(`childRemoved`,this.#h,this);this.#l.clear(),super.destroy(e)}#f(e){this.#g(e),this.layout()}#p(e){this.#_(e),this.layout()}#m(e){this.#g(e),this.layout()}#h(e){this.#_(e),this.layout()}#g(e){if(!this.#l.has(e)){this.#l.add(e),e.on(`childAdded`,this.#m,this),e.on(`childRemoved`,this.#h,this);for(let t of e.children)this.#g(t)}}#_(e){if(this.#l.delete(e)){e.off(`childAdded`,this.#m,this),e.off(`childRemoved`,this.#h,this);for(let t of e.children)this.#_(t)}}#v(e){this.#O();let t=this.#i,n=this.#a;this.#t!==`vertical`&&(this.#n=this.#i+e.deltaX),this.#t!==`horizontal`&&(this.#r=this.#a+e.deltaY),this.#C(),(t!==this.#i||n!==this.#a)&&(e.preventDefault(),e.stopPropagation())}#y(e){this.#O(),this.#o=0,this.#s=0,this.#d={pointerId:e.pointerId,globalX:e.global.x,globalY:e.global.y,scrollX:this.#i,scrollY:this.#a}}#b(e){if(!this.#d||e.pointerId!==this.#d.pointerId)return;let t=e.global.x-this.#d.globalX,n=e.global.y-this.#d.globalY,r=this.#i,i=this.#a;this.#t!==`vertical`&&(this.#d.scrollX-=t,this.#n=this.#d.scrollX),this.#t!==`horizontal`&&(this.#d.scrollY-=n,this.#r=this.#d.scrollY),this.#w(),this.#o=this.#i-r,this.#s=this.#a-i,this.#d.globalX=e.global.x,this.#d.globalY=e.global.y}#x(e){!this.#d||e.pointerId!==this.#d.pointerId||(this.#d=void 0,this.#D())}#S(){this.#e.clear(),this.#e.rect(0,0,this.width,this.height).fill(16777215)}#C(){let e=this.#E();this.#T(Ab(this.#t===`vertical`?0:this.#n,0,e.x),Ab(this.#t===`horizontal`?0:this.#r,0,e.y))}#w(){let e=this.#E();this.#T(this.#t===`vertical`?0:jb(this.#n,0,e.x),this.#t===`horizontal`?0:jb(this.#r,0,e.y))}#T(e,t){this.#i=e,this.#a=t,this.contentLayer.position.set(-this.#i,-this.#a)}#E(){let e=this.#j();return{x:Math.max(0,e.width-this.width),y:Math.max(0,e.height-this.height)}}#D(){this.#c||!this.#A()||(this.#c=!0,qr.shared.add(this.#k,this))}#O(){this.#c&&=(qr.shared.remove(this.#k,this),!1)}#k(e){if(this.#u||this.destroyed||this.#d){this.#O();return}let t=Math.min(e.deltaTime,4),n=this.#E(),r=this.#t===`vertical`?{value:0,velocity:0}:Mb(this.#i,this.#o,0,n.x,t),i=this.#t===`horizontal`?{value:0,velocity:0}:Mb(this.#a,this.#s,0,n.y,t);this.#o=r.velocity,this.#s=i.velocity,this.#T(r.value,i.value),this.#n=this.#i,this.#r=this.#a,this.#A()||this.#O()}#A(){let e=this.#E();return this.#t!==`vertical`&&Nb(this.#i,this.#o,0,e.x)||this.#t!==`horizontal`&&Nb(this.#a,this.#s,0,e.y)}#j(){let e=0,t=0;for(let n of this.contentLayer.children){let r=Fb(n);e=Math.max(e,r.right),t=Math.max(t,r.bottom)}return{width:e,height:t}}};function Ab(e,t,n){return Math.min(n,Math.max(t,e))}function jb(e,t,n){return e<t?t+(e-t)*Cb:e>n?n+(e-n)*Cb:e}function Mb(e,t,n,r,i){let a=t,o=Pb(e,n,r);o===void 0?a*=wb**+i:(a+=(o-e)*Tb*i,a*=Eb**+i);let s=e+a*i,c=Pb(s,n,r);return o!==void 0&&c===void 0?{value:o,velocity:0}:(c!==void 0&&Math.abs(s-c)<=Db&&Math.abs(a)<=Ob&&(s=c,a=0),{value:s,velocity:a})}function Nb(e,t,n,r){return Math.abs(t)>Ob||Pb(e,n,r)!==void 0}function Pb(e,t,n){if(e<t)return t;if(e>n)return n}function Fb(e){e.updateLocalTransform();let t=e.getLocalBounds();if(!t.isValid)return{right:0,bottom:0};let n=e.localTransform,r=n.a*t.minX+n.c*t.minY+n.tx,i=n.b*t.minX+n.d*t.minY+n.ty,a=n.a*t.maxX+n.c*t.minY+n.tx,o=n.b*t.maxX+n.d*t.minY+n.ty,s=n.a*t.maxX+n.c*t.maxY+n.tx,c=n.b*t.maxX+n.d*t.maxY+n.ty,l=n.a*t.minX+n.c*t.maxY+n.tx,u=n.b*t.minX+n.d*t.maxY+n.ty;return{right:Math.max(0,r,a,s,l),bottom:Math.max(0,i,o,c,u)}}var Ib=class extends Jy{#e=0;#t=`start`;#n=`start`;#r=!1;#i=!1;constructor(e={}){super(e),this.#r=e.width!==void 0,this.#i=e.height!==void 0}get width(){return super.width}set width(e){this.#r=!0,super.width=e}get height(){return super.height}set height(e){this.#i=!0,super.height=e}setSize(e,t){this.#r=!0,this.#i=!0,super.setSize(e,t)}get gap(){return this.#e}set gap(e){this.#e=Math.max(0,db(e,0)),this.layout()}get alignX(){return this.#t}set alignX(e){this.#t=fb(e),this.layout()}get justify(){return this.#n}set justify(e){this.#n=pb(e),this.layout()}layout(){let e=this.children,t=_b(`vertical`,e,this.#e),n=this.#r?this.width:t.width,r=this.#i?this.height:t.height;(n!==this.width||r!==this.height)&&this.setBoxSize(n,r);let i=Math.max(0,r-t.height),a=this.#n===`space-between`&&e.length>1?this.#e+i/(e.length-1):this.#e,o=hb(this.#n,i);for(let t of e){let e=gb(t);t.position.set(mb(this.#t,Math.max(0,n-e.width)),o),vb(t),o+=e.height+a}}},Lb=new WeakMap,Rb=new Set([`left`,`right`,`top`,`bottom`,`horizontal`,`vertical`]),zb=new Set([`fontSize`,`fontFamily`,`fontWeight`,`fill`]),Bb=new Set([`fill`,`fillColor`,`strokeColor`,`tint`]);function Vb(e,t,n={}){let r={definitions:Object.fromEntries(t),subscribers:new Map,values:{}};Lb.set(e,r);for(let[t,i]of Object.entries(r.definitions))r.values[t]=Object.hasOwn(n,t)?n[t]:i.default,Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:()=>r.values[t],set:n=>Ub(e,t,n)})}function Hb(e,t,n={}){Vb(e,new Map(Object.entries(t.props).map(([e,t])=>[e,{...`default`in t?{default:t.default}:{},...t.type===`variant`?{variants:t.variants}:{}}])),n)}function Ub(e,t,n){let r=Jb(e);if(!Object.is(r.values[t],n)){r.values[t]=n;for(let e of r.subscribers.get(t)??[])e()}}function Wb(e,t){let n=Jb(e),[r,i]=t.path,a=n.values[r];if(!i)return a;let o=String(a);return n.definitions[r]?.variants?.[o]?.[i]}function Gb(e,t,n,r){let i=Jb(e),a=()=>Kb(n,r,Wb(e,t)),o=i.subscribers.get(t.path[0])??new Set;o.add(a),i.subscribers.set(t.path[0],o),a()}function Kb(e,t,n){if(t===`text`){e.text=String(n??``);return}let r=qb(t,n);if(Rb.has(t)){Vy(e,{[t]:r});return}let i=e;if(zb.has(t)&&`text`in i&&i.style){i.style[t]=r;return}if(t===`scaleX`||t===`scaleY`){let e=i.scale;e[t===`scaleX`?`x`:`y`]=r;return}if(t===`pivotX`||t===`pivotY`){let e=i.pivot;e[t===`pivotX`?`x`:`y`]=r;return}if(t===`skewX`||t===`skewY`){let e=i.skew;e[t===`skewX`?`x`:`y`]=r;return}if(t===`anchorX`||t===`anchorY`){let e=i.anchor;e[t===`anchorX`?`x`:`y`]=r;return}if(t===`tilePositionX`||t===`tilePositionY`){let e=i.tilePosition;e[t===`tilePositionX`?`x`:`y`]=r;return}if(t===`tileScaleX`||t===`tileScaleY`){let e=i.tileScale;e[t===`tileScaleX`?`x`:`y`]=r;return}i[t]=r}function qb(e,t){return Bb.has(e)&&typeof t==`string`&&/^#[0-9a-fA-F]{6}$/.test(t)?Number.parseInt(t.slice(1),16):t}function Jb(e){let t=Lb.get(e);if(!t)throw Error(`Scene props must be initialized before bindings are mounted.`);return t}var Yb=3,Xb=class extends Error{status;constructor(e,t){super(t),this.status=e}};async function Zb(e){if(e.ok)return e;let t=await e.json();throw new Xb(e.status,t.error??`Editor request failed with ${e.status}.`)}async function Qb(){return(await Zb(await fetch(`/api/project`))).json()}async function $b(){return(await Zb(await fetch(`/api/editor-ui-state`))).json()}async function ex(e){return(await Zb(await fetch(`/api/editor-ui-state`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({assetTreeExpandedDirectories:e})}))).json()}async function tx(e){return(await Zb(await fetch(`/api/scene?path=${encodeURIComponent(e)}`))).json()}async function nx(){return(await Zb(await fetch(`/api/scene-bindings`))).json()}async function rx(e,t,n){return(await Zb(await fetch(`/api/scene?path=${encodeURIComponent(e)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({source:t,expectedVersion:n})}))).json()}async function ix(e){return Zb(await fetch(`/api/file?path=${encodeURIComponent(e)}`))}function ax(e,t,n,r){let i=window.location.protocol===`https:`?`wss:`:`ws:`,a=new WebSocket(`${i}//${window.location.host}/api/events`);return new Promise((i,o)=>{let s=!1,c=!1,l=!1,u=e=>({initialState:e,close:()=>a.close(),publishContext(e){!s||a.readyState!==WebSocket.OPEN||a.send(JSON.stringify({type:`editorContextChanged`,protocolVersion:Yb,context:e}))},requestTakeover(){s||a.readyState!==WebSocket.OPEN||a.send(JSON.stringify({type:`editorSessionTakeoverRequested`,protocolVersion:Yb}))}});a.addEventListener(`message`,t=>{let d=JSON.parse(String(t.data));if(d.protocolVersion!==void 0&&d.protocolVersion!==Yb){a.close(),o(Error(`Editor session protocol version does not match. Restart Pixifact Editor.`));return}if(d.type===`editorSessionActive`||d.type===`editorSessionStandby`){let e={status:d.type===`editorSessionActive`?`active`:`standby`,...d.resume?{resume:d.resume}:{},...d.reason?{reason:d.reason}:{},...d.error?{error:d.error}:{}};s=e.status===`active`,c=!0,l?n(e):(l=!0,i(u(e)));return}if(s&&d.type===`projectFileChanged`&&d.path){e(d.path);return}s&&d.type===`editorScreenshotRequested`&&d.requestId&&d.scene&&r(d.scene).then(e=>{!s||a.readyState!==WebSocket.OPEN||a.send(JSON.stringify({type:`editorScreenshotCompleted`,protocolVersion:Yb,requestId:d.requestId,scene:d.scene,...e}))}).catch(e=>{!s||a.readyState!==WebSocket.OPEN||a.send(JSON.stringify({type:`editorScreenshotFailed`,protocolVersion:Yb,requestId:d.requestId,error:e instanceof Error?e.message:String(e)}))})}),a.addEventListener(`error`,()=>{l||(l=!0,o(Error(`Editor 无法连接本地项目服务。`)))}),a.addEventListener(`close`,()=>{l?c&&t():(l=!0,o(Error(`Editor 本地项目服务连接已关闭。`)))})})}function ox(e){return e===`image`?`asset`:e===`file`?`unknown`:e}function sx(e){let t={id:e.name,name:e.name,path:e.name,kind:`folder`,depth:0,children:[]},n=new Map([[t.path,t]]);for(let r of e.files){let e=r.path.split(`/`),i=t,a=t.path;for(let[t,o]of e.entries()){if(a=`${a}/${o}`,t===e.length-1){i.children.push({id:a,name:o,path:a,kind:ox(r.kind),depth:t+1});continue}let s=n.get(a);s||(s={id:a,name:o,path:a,kind:`folder`,depth:t+1,children:[]},n.set(a,s),i.children.push(s)),i=s}}return t}var cx={readScene:tx,writeScene:rx};function lx(e,t){if(e.path===t)return e;for(let n of e.children??[]){let e=lx(n,t);if(e)return e}}function ux(e,t){return t.path===e.path?``:t.path.slice(e.path.length+1)}async function dx(e,t){return(await ix(ux(e,t))).text()}async function fx(e,t){let n=await ix(ux(e,t));return new Uint8Array(await n.arrayBuffer())}async function px(e){return mx(e)}async function mx(e,t){let n=[];for(let r of gx(e,e))n.push(await hx(e,r,t));let r=await nx();return Object.fromEntries(n.map(e=>{let t=r[e.scenePath];if(!t)throw Error(`No @scene decorator found.`);if(t.className!==e.template.name)throw Error(`Scene ${e.file.name} 的 name "${e.template.name}" 必须等于脚本 @scene 类名 "${t.className}"。`);let n={...e.template,interface:t.interface};return[e.scenePath,{scenePath:e.scenePath,file:e.file,scriptFile:e.scriptFile,template:n,descriptor:t,className:t.className,interface:t.interface}]}))}async function hx(e,t,n){let r=Ue(ux(e,t)),i=Ke(r),a=lx(e,`${e.path}/${i}`);if(!a)throw Error(`找不到 Scene 脚本 ${i}。`);return{scenePath:r,file:t,scriptFile:a,template:n?.file.path===t.path?n.template:Ye(await dx(e,t))}}function gx(e,t,n=[]){if(t.kind===`scene`)return _x(ux(e,t))&&n.push(t),n;if(t.kind===`folder`&&We(t.name))return n;for(let r of t.children??[])gx(e,r,n);return n}function _x(e){let t;try{t=Ue(e)}catch{return!1}return Re(t).split(`/`).some(We)?!1:Ie.some(e=>t.startsWith(`${e}/`))}var vx={".gif":`image/gif`,".jpg":`image/jpeg`,".jpeg":`image/jpeg`,".png":`image/png`,".svg":`image/svg+xml`,".webp":`image/webp`},yx={".jpg":`texture`,".jpeg":`texture`,".png":`texture`,".svg":`svg`,".webp":`texture`},bx=new Set([`shape`,`radius`,`fill`,`fillAlpha`,`strokeColor`,`strokeWidth`,`strokeAlpha`]);function xx(e,t){return typeof e==`number`?e:t}function Sx(e,t){let n=e.props.width!==void 0||e.props.height!==void 0;return{width:xx(e.props.width,n?960:t?.width??960),height:xx(e.props.height,n?540:t?.height??540)}}function Cx(e,t){return`${e.path}/${t}`}function wx(e){let t=e.split(`/`).at(-1)??e,n=t.lastIndexOf(`.`);return n>=0?t.slice(n).toLowerCase():``}function Tx(e,t){return e.interfaces[t]??{props:{},events:{},slots:{}}}function Ex(e,t,n){let r=Sx(t,n);e.setSize(r.width,r.height);for(let[n,r]of Object.entries(t.props))n!==`width`&&n!==`height`&&!M(r)&&Kb(e,n,r)}function Dx(e,t){let n=typeof t.props.texture==`string`?e.textures.get(t.props.texture)??W.EMPTY:W.EMPTY,r=M(t.props.text)?``:String(t.props.text??``),i=Object.fromEntries([`fontSize`,`fontFamily`,`fontWeight`,`fill`].flatMap(e=>{let n=t.props[e];return n===void 0||M(n)?[]:[[e,n]]}));switch(t.type){case`Group`:return new qy;case`GridContainer`:return new yb;case`HBoxContainer`:return new xb;case`ScrollContainer`:return new kb;case`VBoxContainer`:return new Ib;case`Rect`:return new eb;case`Image`:return new ab({texture:n});case`NineImage`:return new lb({texture:n});case`TileImage`:return new ub({texture:n});case`Label`:return new Qy;case`BitmapLabel`:return new $y;case`Container`:return new jr;case`Sprite`:return new Nr({texture:n});case`Text`:return new im({text:r,style:i});case`BitmapText`:return new Dm({text:r,style:i});case`HTMLText`:return new Qm({text:r,style:i});case`Graphics`:return new Df;case`NineSliceSprite`:return new Fy({texture:n});case`TilingSprite`:return new tp({texture:n});default:return Ox(t.type)}}function Ox(e){return new jr}function kx(e,t,n){t.id&&(n.label=t.id);for(let[r,i]of Object.entries(t.props)){if(M(i)){Gb(e.bindingRoot,i,n,r);continue}r===`texture`||t.type===`Graphics`&&bx.has(r)||Kb(n,r,i)}t.type===`Graphics`&&n instanceof Df&&Ax(n,t.props)}function Ax(e,t){let n=Number(t.width??0),r=Number(t.height??0),i=Number(t.radius??0);if(e.clear(),t.shape===`rect`)e.rect(0,0,n,r);else if(t.shape===`roundRect`)e.roundRect(0,0,n,r,i);else return;e.fill({color:Number(t.fill??16777215),alpha:Number(t.fillAlpha??1)}),Number(t.strokeWidth??0)>0&&e.stroke({width:Number(t.strokeWidth),color:Number(t.strokeColor??0),alpha:Number(t.strokeAlpha??1)})}function jx(e,t,n){return Object.fromEntries(Object.entries(t.props).flatMap(([t,r])=>n.props[t]?[[t,M(r)?Wb(e.bindingRoot,r):r]]:[]))}function Mx(e,t,n,r){for(let[i,a]of Object.entries(t.props)){if(r.props[i]){M(a)&&Gb(e.bindingRoot,a,n,i);continue}M(a)?Gb(e.bindingRoot,a,n,i):Kb(n,i,a)}}function Nx(e,t,n,r,i=``){for(let[a,o]of r.entries()){if(o.kind===`slotOutlet`){t.slots.set(o.name,n);continue}let r=oe(o,i?`${i}/${a}`:String(a));if(o.kind===`pixi`){let i=Dx(e,o);kx(t,o,i),o.props.zIndex!==void 0&&(n.sortableChildren=!0),n.addChild(i),t.collectNodes&&e.nodes.set(r,i),Nx(e,t,i,o.children,r);continue}Px(e,t,n,o,r)}}function Px(e,t,n,r,i){let a=qe(t.scenePath,r.scene),o=e.templates.get(a);if(!o)throw Error(`找不到 Scene:${a}`);let s=Tx(e,a),c=new qy;Hb(c,s,jx(t,r,s)),Ex(c,o);let l={bindingRoot:c,collectNodes:!1,scenePath:a,slots:new Map};Nx(e,l,c,o.children),Mx(t,r,c,s),r.id&&!s.props.label&&(c.label=r.id),r.props.zIndex!==void 0&&(n.sortableChildren=!0),n.addChild(c),t.collectNodes&&e.nodes.set(i,c);for(let[n,a]of Object.entries(r.slots)){let r=l.slots.get(n);r&&Nx(e,t,r,a,`${i}/slot:${n}`)}Hy(c)}function Fx(e,t){function n(e){for(let r of e)if(r.kind!==`slotOutlet`)if(typeof r.props.texture==`string`&&t.add(r.props.texture),r.kind===`pixi`)n(r.children);else for(let e of Object.values(r.slots))n(e)}n(e.children)}async function Ix(e){let t=new Set;for(let n of e.templates.values())Fx(n,t);await Promise.all([...t].map(async t=>{e.textures.set(t,await Lx(e,t))}))}async function Lx(e,t){let n=lx(e.projectTree,Cx(e.projectTree,t));if(!n)return Md.load(t);let r=await fx(e.projectTree,n),i=URL.createObjectURL(new Blob([r],{type:Rx(t)}));return e.objectUrls.push(i),Md.load({src:i,parser:yx[wx(t)]})}function Rx(e){return vx[wx(e)]??`application/octet-stream`}async function zx(e){let t=await px(e.projectTree),n=Ue(e.scenePath),r=t[n];if(!r)throw Error(`找不到 Scene 绑定:${n}`);let i=new Map(Object.values(t).map(e=>[e.scenePath,e.template]));i.set(n,e.document.template);let a={...Object.fromEntries(Object.values(t).map(e=>[e.scenePath,e.interface])),...e.document.sceneInterfaces},o={interfaces:a,nodes:new Map,objectUrls:[],projectResolution:e.projectResolution,projectTree:e.projectTree,templates:i,textures:new Map};await Ix(o);let s=new qy;Hb(s,a[n]??r.interface),Ex(s,e.document.template,o.projectResolution),Nx(o,{bindingRoot:s,collectNodes:!0,scenePath:n,slots:new Map},s,e.document.template.children),Hy(s);let c=Sx(e.document.template,o.projectResolution);return{root:s,nodes:o.nodes,width:c.width,height:c.height,dispose:()=>{s.destroy({children:!0});for(let e of o.objectUrls)URL.revokeObjectURL(e)}}}function Bx(e){e?.dispose()}function Vx(e,t){let n=t.root.position.clone(),r=t.root.scale.clone(),i;try{t.root.position.set(0,0),t.root.scale.set(1),i=e.renderer.extract.base64({target:t.root,frame:new B(0,0,t.width,t.height),resolution:1,format:`png`,antialias:!0})}finally{t.root.position.copyFrom(n),t.root.scale.copyFrom(r)}return i}export{qe as A,re as B,$i as C,lt as D,F as E,j as F,ie as H,ee as I,f as L,ke as M,oe as N,Ye as O,M as P,ae as R,Qo as S,jr as T,u as U,ne as V,s as W,df as _,sx as a,Kd as b,tx as c,ex as d,By as f,mf as g,Df as h,ax as i,Ge as j,Ke as k,nx as l,Vy as m,zx as n,cx as o,Uy as p,Bx as r,Qb as s,Vx as t,$b as u,of as v,Qi as w,Pd as x,qd as y,d as z};
|
|
1126
|
+
`}),t=this.device.createRenderPipeline({layout:`auto`,vertex:{module:this.mipmapShaderModule,entryPoint:`vertexMain`},fragment:{module:this.mipmapShaderModule,entryPoint:`fragmentMain`,targets:[{format:e}]}}),this.pipelines[e]=t),t}generateMipmap(e){let t=this._getMipmapPipeline(e.format);if(e.dimension===`3d`||e.dimension===`1d`)throw Error(`Generating mipmaps for non-2d textures is currently unsupported!`);let n=e,r=e.depthOrArrayLayers||1,i=e.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!i){let t={size:{width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:r},format:e.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:e.mipLevelCount-1};n=this.device.createTexture(t)}let a=this.device.createCommandEncoder({}),o=t.getBindGroupLayout(0);for(let s=0;s<r;++s){let r=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:`2d`,baseArrayLayer:s,arrayLayerCount:1}),c=+!!i;for(let i=1;i<e.mipLevelCount;++i){let e=n.createView({baseMipLevel:c++,mipLevelCount:1,dimension:`2d`,baseArrayLayer:s,arrayLayerCount:1}),i=a.beginRenderPass({colorAttachments:[{view:e,storeOp:`store`,loadOp:`clear`,clearValue:{r:0,g:0,b:0,a:0}}]}),l=this.device.createBindGroup({layout:o,entries:[{binding:0,resource:this.sampler},{binding:1,resource:r}]});i.setPipeline(t),i.setBindGroup(0,l),i.draw(3,1,0,0),i.end(),r=e}}if(!i){let t={width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:r};for(let r=1;r<e.mipLevelCount;++r)a.copyTextureToTexture({texture:n,mipLevel:r-1},{texture:e,mipLevel:r},t),t.width=Math.ceil(t.width/2),t.height=Math.ceil(t.height/2)}return this.device.queue.submit([a.finish()]),i||n.destroy(),e}},hy=class{constructor(e){this.textureView=null,this.gpuTexture=e}destroy(){this.gpuTexture.destroy(),this.textureView=null,this.gpuTexture=null}},gy=class{constructor(e){this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._renderer=e,e.gc.addCollection(this,`_bindGroupHash`,`hash`),this._managedTextures=new ul({renderer:e,type:`resource`,onUnload:this.onSourceUnload.bind(this),name:`gpuTextureSource`});let t={image:fy,buffer:oy,video:py,compressed:ly};this._uploads={...t,cube:dy(t)}}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(e){this._gpu=e}initSource(e){return e._gpuData[this._renderer.uid]?.gpuTexture||this._initSource(e)}_initSource(e){if(e.autoGenerateMipmaps){let t=Math.max(e.pixelWidth,e.pixelHeight);e.mipLevelCount=Math.floor(Math.log2(t))+1}let t=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;e.uploadMethodId!==`compressed`&&(t|=GPUTextureUsage.RENDER_ATTACHMENT,t|=GPUTextureUsage.COPY_SRC);let n=sy[e.format]||{blockBytes:4,blockWidth:1,blockHeight:1},r=Math.ceil(e.pixelWidth/n.blockWidth)*n.blockWidth,i=Math.ceil(e.pixelHeight/n.blockHeight)*n.blockHeight,a={label:e.label,size:{width:r,height:i,depthOrArrayLayers:e.arrayLayerCount},format:e.format,sampleCount:e.sampleCount,mipLevelCount:e.mipLevelCount,dimension:e.dimension,usage:t},o=this._gpu.device.createTexture(a);return e._gpuData[this._renderer.uid]=new hy(o),this._managedTextures.add(e)&&(e.on(`update`,this.onSourceUpdate,this),e.on(`resize`,this.onSourceResize,this),e.on(`updateMipmaps`,this.onUpdateMipmaps,this)),this.onSourceUpdate(e),o}onSourceUpdate(e){let t=this.getGpuSource(e);t&&(this._uploads[e.uploadMethodId]&&this._uploads[e.uploadMethodId].upload(e,t,this._gpu),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e))}onUpdateMipmaps(e){this._mipmapGenerator||=new my(this._gpu.device);let t=this.getGpuSource(e);this._mipmapGenerator.generateMipmap(t)}onSourceUnload(e){e.off(`update`,this.onSourceUpdate,this),e.off(`resize`,this.onSourceResize,this),e.off(`updateMipmaps`,this.onUpdateMipmaps,this)}onSourceResize(e){e._gcLastUsed=this._renderer.gc.now;let t=e._gpuData[this._renderer.uid],n=t?.gpuTexture;n?(n.width!==e.pixelWidth||n.height!==e.pixelHeight)&&(t.destroy(),this._bindGroupHash[e.uid]=null,e._gpuData[this._renderer.uid]=null,this.initSource(e)):this.initSource(e)}_initSampler(e){return this._gpuSamplers[e._resourceId]=this._gpu.device.createSampler(e),this._gpuSamplers[e._resourceId]}getGpuSampler(e){return this._gpuSamplers[e._resourceId]||this._initSampler(e)}getGpuSource(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]?.gpuTexture||this.initSource(e)}getTextureBindGroup(e){return this._bindGroupHash[e.uid]||this._createTextureBindGroup(e)}_createTextureBindGroup(e){let t=e.source;return this._bindGroupHash[e.uid]=new La({0:t,1:t.style,2:new Ia({uTextureMatrix:{type:`mat3x3<f32>`,value:e.textureMatrix.mapCoord}})}),this._bindGroupHash[e.uid]}getTextureView(e){let t=e.source;t._gcLastUsed=this._renderer.gc.now;let n=t._gpuData[this._renderer.uid];return n||=(this.initSource(t),t._gpuData[this._renderer.uid]),n.textureView||=n.gpuTexture.createView({dimension:t.viewDimension}),n.textureView}generateCanvas(e){let t=this._renderer,n=t.gpu.device.createCommandEncoder(),r=q.get().createCanvas();r.width=e.source.pixelWidth,r.height=e.source.pixelHeight;let i=r.getContext(`webgpu`);return i.configure({device:t.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:q.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:`premultiplied`}),n.copyTextureToTexture({texture:t.texture.getGpuSource(e.source),origin:{x:0,y:0}},{texture:i.getCurrentTexture()},{width:r.width,height:r.height}),t.gpu.device.queue.submit([n.finish()]),r}getPixels(e){let t=this.generateCanvas(e),n=Zd.getOptimalCanvasAndContext(t.width,t.height),r=n.context;r.drawImage(t,0,0);let{width:i,height:a}=t,o=r.getImageData(0,0,i,a),s=new Uint8ClampedArray(o.data.buffer);return Zd.returnCanvasAndContext(n),{pixels:s,width:i,height:a}}destroy(){this._managedTextures.destroy();for(let e of Object.keys(this._bindGroupHash)){let t=Number(e);this._bindGroupHash[t]?.destroy()}this._renderer=null,this._gpu=null,this._mipmapGenerator=null,this._gpuSamplers=null,this._bindGroupHash=null}};gy.extension={type:[P.WebGPUSystem],name:`texture`};var _y=class{constructor(){this._maxTextures=0}contextChange(e){let t=new Ia({uTransformMatrix:{value:new R,type:`mat3x3<f32>`},uColor:{value:new Float32Array([1,1,1,1]),type:`vec4<f32>`},uRound:{value:0,type:`f32`}});this._maxTextures=e.limits.maxBatchableTextures;let n=Gc({name:`graphics`,bits:[qc,Qc(this._maxTextures),Bf,nl]});this.shader=new za({gpuProgram:n,resources:{localUniforms:t}})}execute(e,t){let n=t.context,r=n.customShader||this.shader,i=e.renderer,{batcher:a,instructions:o}=i.graphicsContext.getContextRenderData(n),s=i.encoder;s.setGeometry(a.geometry,r.gpuProgram);let c=i.globalUniforms.bindGroup;s.setBindGroup(0,c,r.gpuProgram);let l=i.renderPipes.uniformBatch.getUniformBindGroup(r.resources.localUniforms,!0);s.setBindGroup(2,l,r.gpuProgram);let u=o.instructions,d=null;for(let t=0;t<o.instructionSize;t++){let n=u[t];if(n.topology!==d&&(d=n.topology,s.setPipelineFromGeometryProgramAndState(a.geometry,r.gpuProgram,e.state,n.topology)),r.groups[1]=n.bindGroup,!n.gpuBindGroup){let e=n.textures;n.bindGroup=Ks(e.textures,e.count,this._maxTextures),n.gpuBindGroup=i.bindGroup.getBindGroup(n.bindGroup,r.gpuProgram,1)}s.setBindGroup(1,n.bindGroup,r.gpuProgram),s.renderPassEncoder.drawIndexed(n.size,1,n.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};_y.extension={type:[P.WebGPUPipesAdaptor],name:`graphics`};var vy=class{init(){let e=Gc({name:`mesh`,bits:[zf,oh,nl]});this._shader=new za({gpuProgram:e,resources:{uTexture:W.EMPTY._source,uSampler:W.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:`mat3x3<f32>`,value:new R}}}})}execute(e,t){let n=e.renderer,r=t._shader;if(!r)r=this._shader,r.groups[2]=n.texture.getTextureBindGroup(t.texture);else if(!r.gpuProgram){K(`Mesh shader has no gpuProgram`,t.shader);return}let i=r.gpuProgram;if(i.autoAssignGlobalUniforms&&(r.groups[0]=n.globalUniforms.bindGroup),i.autoAssignLocalUniforms){let t=e.localUniforms;r.groups[1]=n.renderPipes.uniformBatch.getUniformBindGroup(t,!0)}n.encoder.draw({geometry:t._geometry,shader:r,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}};vy.extension={type:[P.WebGPUPipesAdaptor],name:`mesh`};var yy=s({WebGPURenderer:()=>Ey}),by=[...Eg,qv,Bv,zv,Vv,Iv,gy,ny,ry,ay,$v,Rv,Hv,Pv],xy=[...Dg,Yv],Sy=[rh,vy,_y],Cy=[],wy=[],Ty=[];F.handleByNamedList(P.WebGPUSystem,Cy),F.handleByNamedList(P.WebGPUPipes,wy),F.handleByNamedList(P.WebGPUPipesAdaptor,Ty),F.add(...by,...xy,...Sy);var Ey=class extends zo{constructor(){let e={name:`webgpu`,type:Ra.WEBGPU,systems:Cy,renderPipes:wy,renderPipeAdaptors:Ty};super(e)}},Dy=class e extends kf{constructor(...e){super({});let t=e[0]??{};typeof t==`number`&&(U(H,`PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead`),t={width:t,height:e[1],verticesX:e[2],verticesY:e[3]}),this.build(t)}build(t){t={...e.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 n=this.verticesX*this.verticesY,r=[],i=[],a=[],o=this.verticesX-1,s=this.verticesY-1,c=this.width/o,l=this.height/s;for(let e=0;e<n;e++){let t=e%this.verticesX,n=e/this.verticesX|0;r.push(t*c,n*l),i.push(t/o,n/s)}let u=o*s;for(let e=0;e<u;e++){let t=e%o,n=e/o|0,r=n*this.verticesX+t,i=n*this.verticesX+t+1,s=(n+1)*this.verticesX+t,c=(n+1)*this.verticesX+t+1;a.push(r,i,s,i,c,s)}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(i),this.indexBuffer.data=new Uint32Array(a),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};Dy.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};var Oy=Dy,ky=class{constructor(e){this._renderer=e}validateRenderable(e){return!1}addRenderable(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}updateRenderable(e){}execute(e){let t=this._renderer,n=t.canvasContext,r=n.activeContext;r.save();let i=e.groupTransform,a=t._roundPixels|e._roundPixels;n.setContextTransform(i,a===1),n.setBlendMode(e.groupBlendMode);let o=t.globalUniforms.globalUniformData?.worldColor??4294967295,s=e.groupColorAlpha,c=(o>>>24&255)/255,l=(s>>>24&255)/255,u=t.filter?.alphaMultiplier??1,d=c*l*u;if(d<=0){r.restore();return}r.globalAlpha=d;let f=o&16777215,p=dr(cr(s&16777215,f)),m=e.texture,h=Z.getCanvasSource(m);if(!h){r.restore();return}let g=n.smoothProperty,_=m.source.style.scaleMode!==`nearest`;r[g]!==_&&(r[g]=_);let v=p!==16777215||m.rotate!==0,y=v?Z.getTintedCanvas({texture:m},p):h,{leftWidth:b,topHeight:x,rightWidth:S,bottomHeight:C,width:w,height:T}=e,E=b+S,D=x+C,O=Math.min(E>w?w/E:1,D>T?T/D:1,1),k=b*O,ee=S*O,te=x*O,A=C*O,j=Math.max(0,w-k-ee),ne=Math.max(0,T-te-A),re=e.anchor,ie=m.source._resolution??m.source.resolution??1,ae=m.frame.x*ie,M=m.frame.y*ie,N=-re.x*w,oe=-re.y*T,se=b*ie,ce=x*ie,le=S*ie,ue=C*ie,de=m.frame.width*ie,fe=m.frame.height*ie;v&&(ae=0,M=0,de=y.width,fe=y.height),r.drawImage(y,ae,M,se,ce,N,oe,k,te),r.drawImage(y,ae+se,M,de-se-le,ce,N+k,oe,j,te),r.drawImage(y,ae+de-le,M,le,ce,N+w-ee,oe,ee,te),r.drawImage(y,ae,M+ce,se,fe-ce-ue,N,oe+te,k,ne),r.drawImage(y,ae+se,M+ce,de-se-le,fe-ce-ue,N+k,oe+te,j,ne),r.drawImage(y,ae+de-le,M+ce,le,fe-ce-ue,N+w-ee,oe+te,ee,ne),r.drawImage(y,ae,M+fe-ue,se,ue,N,oe+T-A,k,A),r.drawImage(y,ae+se,M+fe-ue,de-se-le,ue,N+k,oe+T-A,j,A),r.drawImage(y,ae+de-le,M+fe-ue,le,ue,N+w-ee,oe+T-A,ee,A),r.restore()}destroy(){this._renderer=null}};ky.extension={type:[P.CanvasPipes],name:`nineSliceSprite`};var Ay=class e extends Oy{constructor(t={}){t={...e.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this._trimX=0,this._trimY=0,this._trimWidth=t.originalWidth??e.defaultOptions.originalWidth,this._trimHeight=t.originalHeight??e.defaultOptions.originalHeight,this.update(t)}update(e){this.width=e.width??this.width,this.height=e.height??this.height,this._originalWidth=e.originalWidth??this._originalWidth,this._originalHeight=e.originalHeight??this._originalHeight,this._leftWidth=e.leftWidth??this._leftWidth,this._rightWidth=e.rightWidth??this._rightWidth,this._topHeight=e.topHeight??this._topHeight,this._bottomHeight=e.bottomHeight??this._bottomHeight,this._anchorX=e.anchor?.x,this._anchorY=e.anchor?.y,e.trim===void 0?(this._trimWidth=this._originalWidth,this._trimHeight=this._originalHeight):(this._trimX=e.trim?.x??0,this._trimY=e.trim?.y??0,this._trimWidth=e.trim?.width??this._originalWidth,this._trimHeight=e.trim?.height??this._originalHeight),this.updateUvs(),this.updatePositions()}updatePositions(){let e=this.positions,{width:t,height:n,_leftWidth:r,_rightWidth:i,_topHeight:a,_bottomHeight:o,_anchorX:s,_anchorY:c}=this,l=r+i,u=t>l?1:t/l,d=a+o,f=n>d?1:n/d,p=Math.min(u,f),m=s*t,h=c*n;e[0]=e[8]=e[16]=e[24]=-m,e[2]=e[10]=e[18]=e[26]=r*p-m,e[4]=e[12]=e[20]=e[28]=t-i*p-m,e[6]=e[14]=e[22]=e[30]=t-m,e[1]=e[3]=e[5]=e[7]=-h,e[9]=e[11]=e[13]=e[15]=a*p-h,e[17]=e[19]=e[21]=e[23]=n-o*p-h,e[25]=e[27]=e[29]=e[31]=n-h,this.getBuffer(`aPosition`).update()}updateUvs(){let e=this.uvs,t=this._originalWidth,n=this._originalHeight,r=this._trimX/t,i=this._trimY/n,a=(this._trimX+this._trimWidth)/t,o=(this._trimY+this._trimHeight)/n;e[0]=e[8]=e[16]=e[24]=r,e[1]=e[3]=e[5]=e[7]=i,e[6]=e[14]=e[22]=e[30]=a,e[25]=e[27]=e[29]=e[31]=o;let s=1/t,c=1/n;e[2]=e[10]=e[18]=e[26]=r+s*this._leftWidth,e[9]=e[11]=e[13]=e[15]=i+c*this._topHeight,e[4]=e[12]=e[20]=e[28]=a-s*this._rightWidth,e[17]=e[19]=e[21]=e[23]=o-c*this._bottomHeight,this.getBuffer(`aUV`).update()}};Ay.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};var jy=Ay,My=class extends Af{constructor(){super(),this.geometry=new jy}destroy(){this.geometry.destroy()}},Ny=class{constructor(e){this._renderer=e,this._managedSprites=new ul({renderer:e,type:`renderable`,name:`nineSliceSprite`})}addRenderable(e,t){let n=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,n),this._renderer.renderPipes.batch.addToBatch(n,t)}updateRenderable(e){let t=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){let t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}_updateBatchableSprite(e,t){t.geometry.update(e),t.setTexture(e._texture)}_getGpuSprite(e){return e._gpuData[this._renderer.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let t=e._gpuData[this._renderer.uid]=new My,n=t;return n.renderable=e,n.transform=e.groupTransform,n.texture=e._texture,n.roundPixels=this._renderer._roundPixels|e._roundPixels,this._managedSprites.add(e),e.didViewUpdate||this._updateBatchableSprite(e,n),t}destroy(){this._managedSprites.destroy(),this._renderer=null}};Ny.extension={type:[P.WebGLPipes,P.WebGPUPipes],name:`nineSliceSprite`},F.add(ky),F.add(Ny);var Py=class e extends Mr{constructor(t){t instanceof W&&(t={texture:t});let{width:n,height:r,anchor:i,leftWidth:a,rightWidth:o,topHeight:s,bottomHeight:c,texture:l,roundPixels:u,...d}=t;super({label:`NineSliceSprite`,...d}),this.renderPipeId=`nineSliceSprite`,this.batched=!0,this._leftWidth=a??l?.defaultBorders?.left??jy.defaultOptions.leftWidth,this._topHeight=s??l?.defaultBorders?.top??jy.defaultOptions.topHeight,this._rightWidth=o??l?.defaultBorders?.right??jy.defaultOptions.rightWidth,this._bottomHeight=c??l?.defaultBorders?.bottom??jy.defaultOptions.bottomHeight,this._width=n??l.width??jy.defaultOptions.width,this._height=r??l.height??jy.defaultOptions.height,this.allowChildren=!1,this.texture=l??e.defaultOptions.texture,this.roundPixels=u??!1,this._anchor=new I({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:this.texture.defaultAnchor&&(this.anchor=this.texture.defaultAnchor)}get anchor(){return this._anchor}set anchor(e){typeof e==`number`?this._anchor.set(e):this._anchor.copyFrom(e)}get width(){return this._width}set width(e){this._width=e,this.onViewUpdate()}get height(){return this._height}set height(e){this._height=e,this.onViewUpdate()}setSize(e,t){typeof e==`object`&&(t=e.height??e.width,e=e.width),this._width=e,this._height=t??e,this.onViewUpdate()}getSize(e){return e||={},e.width=this._width,e.height=this._height,e}get leftWidth(){return this._leftWidth}set leftWidth(e){this._leftWidth=e,this.onViewUpdate()}get topHeight(){return this._topHeight}set topHeight(e){this._topHeight=e,this.onViewUpdate()}get rightWidth(){return this._rightWidth}set rightWidth(e){this._rightWidth=e,this.onViewUpdate()}get bottomHeight(){return this._bottomHeight}set bottomHeight(e){this._bottomHeight=e,this.onViewUpdate()}get texture(){return this._texture}set texture(e){e||=W.EMPTY;let t=this._texture;t!==e&&(t&&t.dynamic&&t.off(`update`,this.onViewUpdate,this),e.dynamic&&e.on(`update`,this.onViewUpdate,this),this._texture=e,this.onViewUpdate())}get originalWidth(){return this._texture.width}get originalHeight(){return this._texture.height}get trim(){return this._texture.trim??null}destroy(e){if(super.destroy(e),typeof e==`boolean`?e:e?.texture){let t=typeof e==`boolean`?e:e?.textureSource;this._texture.destroy(t)}this._texture=null}updateBounds(){let e=this._bounds,t=this._anchor,n=this._width,r=this._height;e.minX=-t._x*n,e.maxX=e.minX+n,e.minY=-t._y*r,e.maxY=e.minY+r}};Py.defaultOptions={texture:W.EMPTY};var Fy=Py,Iy=s({BitmapFont:()=>Ly}),Ly=class extends am{constructor(e,t){super();let{textures:n,data:r}=e;Object.keys(r.pages).forEach(e=>{let t=n[r.pages[parseInt(e,10)].id];this.pages.push({texture:t})}),Object.keys(r.chars).forEach(e=>{let t=r.chars[e],{frame:i,source:a,rotate:o}=n[t.page],s=new W({frame:z.transformRectCoords(t,i,o,new B),orig:new B(0,0,t.width,t.height),source:a,rotate:o});this.chars[e]={id:e.codePointAt(0),xOffset:t.xOffset,yOffset:t.yOffset,xAdvance:t.xAdvance,kerning:t.kerning??{},texture:s}}),this.baseRenderedFontSize=r.fontSize,this.baseMeasurementFontSize=r.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:r.fontSize},this.baseLineOffset=r.baseLineOffset,this.lineHeight=r.lineHeight,this.fontFamily=r.fontFamily,this.distanceField=r.distanceField??{type:`none`,range:0},this.url=t}destroy(){super.destroy();for(let e=0;e<this.pages.length;e++){let{texture:t}=this.pages[e];t.destroy(!0)}this.pages=null}static install(e){mm.install(e)}static uninstall(e){mm.uninstall(e)}};F.add(Tt,Et);var Ry=[`left`,`right`,`top`,`bottom`,`horizontal`,`vertical`],zy=new WeakMap;function By(e){return zy.get(e)??{}}function Vy(e,t){let n={...By(e)};for(let e of Ry){if(!(e in t))continue;let r=t[e];r===void 0?delete n[e]:n[e]=r}Object.keys(n).length===0?zy.delete(e):zy.set(e,n),Uy(e.parent)}function Hy(e){for(let t of e.children)Wy(e,t)}function Uy(e){let t=e;for(;t;){if(typeof t.layout==`function`){t.layout();return}t=t.parent}}function Wy(e,t){let n=zy.get(t);if(!n)return;let r=Ky({start:n.left,end:n.right,center:n.horizontal,parentSize:e.width,childSize:t.width}),i=Ky({start:n.top,end:n.bottom,center:n.vertical,parentSize:e.height,childSize:t.height});(r.position!==void 0||i.position!==void 0)&&t.position.set(r.position??t.x,i.position??t.y),(r.size!==void 0||i.size!==void 0)&&Gy(t,r.size??t.width,i.size??t.height),t.layout?.()}function Gy(e,t,n){let r=e;if(r.setSize){r.setSize(t,n);return}e.width=t,e.height=n}function Ky(e){return e.start!==void 0&&e.end!==void 0?{position:e.start,size:Math.max(0,e.parentSize-e.start-e.end)}:e.start===void 0?e.end===void 0?e.center===void 0?{position:void 0,size:void 0}:{position:(e.parentSize-e.childSize)/2+e.center,size:void 0}:{position:e.parentSize-e.end-e.childSize,size:void 0}:{position:e.start,size:void 0}}var qy=class extends jr{#e=0;#t=0;constructor(e={}){let{width:t,height:n,...r}=e;super(r),this.on(`childAdded`,this.#r,this),this.on(`childRemoved`,this.#r,this),(t!==void 0||n!==void 0)&&this.#n(t??0,n??0)}get width(){return this.#e}set width(e){this.#n(e,this.#t),this.layout()}get height(){return this.#t}set height(e){this.#n(this.#e,e),this.layout()}getSize(e={width:0,height:0}){return e.width=this.#e,e.height=this.#t,e}setSize(e,t){typeof e==`number`?this.#n(e,t??e):this.#n(e.width,e.height??e.width),this.layout()}layout(){this.#i()}setBoxSize(e,t){this.#n(e,t)}#n(e,t){this.#e=e,this.#t=t,this.#a()}#r(){this.layout()}#i(){Hy(this)}#a(){let e=new B(0,0,this.#e,this.#t);this.hitArea=e,this.boundsArea=e}},Jy=class extends qy{constructor(e={}){super(e)}get left(){return this.#e(`left`)}set left(e){this.#t(`left`,e)}get right(){return this.#e(`right`)}set right(e){this.#t(`right`,e)}get top(){return this.#e(`top`)}set top(e){this.#t(`top`,e)}get bottom(){return this.#e(`bottom`)}set bottom(e){this.#t(`bottom`,e)}get horizontal(){return this.#e(`horizontal`)}set horizontal(e){this.#t(`horizontal`,e)}get vertical(){return this.#e(`vertical`)}set vertical(e){this.#t(`vertical`,e)}#e(e){return By(this)[e]}#t(e,t){Vy(this,{[e]:t})}},Yy=class extends Jy{#e;#t=new Df;#n=`Arial`;#r=16;#i=400;#a=1120295;#o=0;#s=0;#c=!1;#l=`start`;#u=`start`;#d=`visible`;constructor(e,t){let{text:n=`Text`,width:r=120,height:i=28,fontFamily:a=`Arial`,fontSize:o=16,fontWeight:s=400,fill:c=1120295,lineHeight:l=0,letterSpacing:u=0,wordWrap:d=!1,alignX:f=`start`,alignY:p=`start`,overflow:m=`visible`,...h}=e;super({...h,width:r,height:i}),this.#n=a,this.#r=o,this.#i=s,this.#a=c,this.#o=l,this.#s=u,this.#c=d,this.#l=f,this.#u=p,this.#d=m,this.#e=t({text:n,style:{fontFamily:a,fontSize:o,fontWeight:String(s),fill:c,lineHeight:l,letterSpacing:u,wordWrap:d,wordWrapWidth:r,align:Xy(f)}}),super.addChild(this.#e,this.#t),this.layout()}get text(){return this.#e.text}set text(e){this.#e.text=e,this.layout()}get fontFamily(){return this.#n}set fontFamily(e){this.#n=e,this.#e.style.fontFamily=e,this.layout()}get fontSize(){return this.#r}set fontSize(e){this.#r=e,this.#e.style.fontSize=e,this.layout()}get fontWeight(){return this.#i}set fontWeight(e){this.#i=e,this.#e.style.fontWeight=String(e),this.layout()}get fill(){return this.#a}set fill(e){this.#a=e,this.#e.style.fill=e,this.layout()}get lineHeight(){return this.#o}set lineHeight(e){this.#o=e,this.#e.style.lineHeight=e,this.layout()}get letterSpacing(){return this.#s}set letterSpacing(e){this.#s=e,this.#e.style.letterSpacing=e,this.layout()}get wordWrap(){return this.#c}set wordWrap(e){this.#c=e,this.#e.style.wordWrap=e,this.layout()}get alignX(){return this.#l}set alignX(e){this.#l=e,this.#e.style.align=Xy(e),this.layout()}get alignY(){return this.#u}set alignY(e){this.#u=e,this.layout()}get overflow(){return this.#d}set overflow(e){this.#d=e,this.layout()}layout(){if(super.layout(),!this.#e)return;this.#e.style.wordWrapWidth=this.width,this.#e.anchor.set(Zy(this.#l),Zy(this.#u)),this.#e.position.set(this.width*Zy(this.#l),this.height*Zy(this.#u)),this.#t.clear().rect(0,0,this.width,this.height).fill(16777215);let e=this.#d===`clip`;this.#t.visible=e,this.#e.mask=e?this.#t:null}};function Xy(e){return e===`center`?`center`:e===`end`?`right`:`left`}function Zy(e){return e===`center`?.5:+(e===`end`)}var Qy=class extends Yy{constructor(e={}){super(e,e=>new im(e))}},$y=class extends Yy{constructor(e={}){super(e,e=>new Dm(e))}},eb=class extends Df{#e=100;#t=60;#n=16777215;#r=1;#i=0;#a=1;#o=0;#s=0;constructor(e={}){let{width:t,height:n,fillColor:r,fillAlpha:i,strokeColor:a,strokeAlpha:o,strokeWidth:s,radius:c,...l}=e;super(l),this.#e=t??this.#e,this.#t=n??this.#t,this.#n=r??this.#n,this.#r=i??this.#r,this.#i=a??this.#i,this.#a=o??this.#a,this.#o=s??this.#o,this.#s=c??this.#s,this.#d(),this.#f()}get width(){return this.#e}set width(e){this.#u(e,this.#t)}get height(){return this.#t}set height(e){this.#u(this.#e,e)}getSize(e={width:0,height:0}){return e.width=this.#e,e.height=this.#t,e}setSize(e,t){typeof e==`number`?this.#u(e,t??e):this.#u(e.width,e.height??e.width)}get fillColor(){return this.#n}set fillColor(e){this.#n=e,this.#f()}get fillAlpha(){return this.#r}set fillAlpha(e){this.#r=e,this.#f()}get strokeColor(){return this.#i}set strokeColor(e){this.#i=e,this.#f()}get strokeAlpha(){return this.#a}set strokeAlpha(e){this.#a=e,this.#f()}get strokeWidth(){return this.#o}set strokeWidth(e){this.#o=e,this.#f()}get radius(){return this.#s}set radius(e){this.#s=e,this.#f()}get left(){return this.#c(`left`)}set left(e){this.#l(`left`,e)}get right(){return this.#c(`right`)}set right(e){this.#l(`right`,e)}get top(){return this.#c(`top`)}set top(e){this.#l(`top`,e)}get bottom(){return this.#c(`bottom`)}set bottom(e){this.#l(`bottom`,e)}get horizontal(){return this.#c(`horizontal`)}set horizontal(e){this.#l(`horizontal`,e)}get vertical(){return this.#c(`vertical`)}set vertical(e){this.#l(`vertical`,e)}#c(e){return By(this)[e]}#l(e,t){Vy(this,{[e]:t})}#u(e,t){this.#e=e,this.#t=t,this.#d(),this.#f()}#d(){let e=new B(0,0,this.#e,this.#t);this.hitArea=e,this.boundsArea=e}#f(){this.clear();let e=Math.max(0,Math.min(this.#s,this.#e/2,this.#t/2)),t=e>0?this.roundRect(0,0,this.#e,this.#t,e):this.rect(0,0,this.#e,this.#t);t.fill({color:this.#n,alpha:this.#r}),this.#o>0&&t.stroke({width:this.#o,color:this.#i,alpha:this.#a,alignment:1})}};function tb(e,t){return By(e)[t]}function nb(e,t,n){Vy(e,{[t]:n})}var rb=new Uint32Array([0,1,2,0,2,3]),ib=new WeakSet,ab=class extends Nf{#e=96;#t=96;#n=`stretch`;#r=new I({_onUpdate:()=>this.#c()});constructor(e={}){let{texture:t,width:n,height:r,fit:i,anchorX:a,anchorY:o,...s}=e;super({...s,texture:t??W.EMPTY,geometry:new kf({positions:new Float32Array(8),uvs:new Float32Array(8),indices:rb})}),ib.add(this),this.texture.on(`update`,this.#c,this),this.#e=n??this.#e,this.#t=r??this.#t,this.#n=i??this.#n,this.#r.set(a??0,o??0),this.#s(),this.#c()}get width(){return this.#e}set width(e){this.#o(e,this.#t)}get height(){return this.#t}set height(e){this.#o(this.#e,e)}getSize(e={width:0,height:0}){return e.width=this.#e,e.height=this.#t,e}setSize(e,t){typeof e==`number`?this.#o(e,t??e):this.#o(e.width,e.height??e.width)}get texture(){return super.texture}set texture(e){if(!ib.has(this)){super.texture=e;return}super.texture?.off(`update`,this.#c,this),super.texture=e,e.on(`update`,this.#c,this),this.#c()}get fit(){return this.#n}set fit(e){this.#n=e,this.#c()}get anchor(){return this.#r}set anchor(e){typeof e==`number`?this.#r.set(e):this.#r.set(e.x,e.y)}get left(){return this.#i(`left`)}set left(e){this.#a(`left`,e)}get right(){return this.#i(`right`)}set right(e){this.#a(`right`,e)}get top(){return this.#i(`top`)}set top(e){this.#a(`top`,e)}get bottom(){return this.#i(`bottom`)}set bottom(e){this.#a(`bottom`,e)}get horizontal(){return this.#i(`horizontal`)}set horizontal(e){this.#a(`horizontal`,e)}get vertical(){return this.#i(`vertical`)}set vertical(e){this.#a(`vertical`,e)}#i(e){return tb(this,e)}#a(e,t){nb(this,e,t)}#o(e,t){this.#e=e,this.#t=t,this.#s(),this.#c()}#s(){let e=this.#p();this.hitArea=e,this.boundsArea=e}#c(){this.#l(),this.#u(),this.geometry.positions=this.geometry.positions,this.geometry.uvs=this.geometry.uvs}#l(){let e=this.geometry.positions,t=this.#d();e[0]=t.x,e[1]=t.y,e[2]=t.x+t.width,e[3]=t.y,e[4]=t.x+t.width,e[5]=t.y+t.height,e[6]=t.x,e[7]=t.y+t.height}#u(){let e=this.geometry.uvs,t=this.#f();e[0]=t.u0,e[1]=t.v0,e[2]=t.u1,e[3]=t.v0,e[4]=t.u1,e[5]=t.v1,e[6]=t.u0,e[7]=t.v1}#d(){let e=this.#p();if(this.#n===`contain`){let t=ob(this.texture.width,this.texture.height,this.#e,this.#t);return cb(t.width,t.height,e.x,e.y,e.width,e.height)}return this.#n===`none`?new B(e.x,e.y,this.texture.width,this.texture.height):e}#f(){return this.#n===`cover`?sb(this.texture.width,this.texture.height,this.#e,this.#t):{u0:0,v0:0,u1:1,v1:1}}#p(){return new B(-this.#r.x*this.#e,-this.#r.y*this.#t,this.#e,this.#t)}};function ob(e,t,n,r){if(e<=0||t<=0||n<=0||r<=0)return{width:0,height:0};let i=Math.min(n/e,r/t);return{width:e*i,height:t*i}}function sb(e,t,n,r){if(e<=0||t<=0||n<=0||r<=0)return{u0:0,v0:0,u1:1,v1:1};let i=e/t,a=n/r;if(i>a){let e=(1-a/i)/2;return{u0:e,v0:0,u1:1-e,v1:1}}let o=(1-i/a)/2;return{u0:0,v0:o,u1:1,v1:1-o}}function cb(e,t,n,r,i,a){return new B(n+(i-e)/2,r+(a-t)/2,e,t)}var lb=class extends Fy{constructor(e={}){let{texture:t,anchorX:n,anchorY:r,...i}=e;super({texture:t??W.EMPTY,...i}),this.anchor.set(n??0,r??0)}get left(){return this.#e(`left`)}set left(e){this.#t(`left`,e)}get right(){return this.#e(`right`)}set right(e){this.#t(`right`,e)}get top(){return this.#e(`top`)}set top(e){this.#t(`top`,e)}get bottom(){return this.#e(`bottom`)}set bottom(e){this.#t(`bottom`,e)}get horizontal(){return this.#e(`horizontal`)}set horizontal(e){this.#t(`horizontal`,e)}get vertical(){return this.#e(`vertical`)}set vertical(e){this.#t(`vertical`,e)}#e(e){return tb(this,e)}#t(e,t){nb(this,e,t)}},ub=class extends tp{constructor(e={}){let{texture:t,tilePositionX:n,tilePositionY:r,tileScaleX:i,tileScaleY:a,tileRotation:o,anchorX:s,anchorY:c,...l}=e;super({texture:t??W.EMPTY,...l}),this.tilePosition.set(n??0,r??0),this.tileScale.set(i??1,a??1),this.tileRotation=o??0,this.anchor.set(s??0,c??0)}get left(){return this.#e(`left`)}set left(e){this.#t(`left`,e)}get right(){return this.#e(`right`)}set right(e){this.#t(`right`,e)}get top(){return this.#e(`top`)}set top(e){this.#t(`top`,e)}get bottom(){return this.#e(`bottom`)}set bottom(e){this.#t(`bottom`,e)}get horizontal(){return this.#e(`horizontal`)}set horizontal(e){this.#t(`horizontal`,e)}get vertical(){return this.#e(`vertical`)}set vertical(e){this.#t(`vertical`,e)}#e(e){return tb(this,e)}#t(e,t){nb(this,e,t)}};function db(e,t){return Number.isFinite(e)?e:t}function fb(e){return e===`center`||e===`end`?e:`start`}function pb(e){return e===`center`||e===`end`||e===`space-between`?e:`start`}function mb(e,t){return e===`center`?t/2:e===`end`?t:0}function hb(e,t){return e===`center`?t/2:e===`end`?t:0}function gb(e){return{width:e.width,height:e.height}}function _b(e,t,n){if(t.length===0)return{width:0,height:0};let r=n*Math.max(0,t.length-1),i=t.map(gb);return e===`horizontal`?{width:i.reduce((e,t)=>e+t.width,0)+r,height:i.reduce((e,t)=>Math.max(e,t.height),0)}:{width:i.reduce((e,t)=>Math.max(e,t.width),0),height:i.reduce((e,t)=>e+t.height,0)+r}}function vb(e){e.layout?.()}var yb=class extends Jy{#e=1;#t=0;#n=0;#r=`start`;#i=`start`;#a=!1;#o=!1;constructor(e={}){super(e),this.#a=e.width!==void 0,this.#o=e.height!==void 0}get width(){return super.width}set width(e){this.#a=!0,super.width=e}get height(){return super.height}set height(e){this.#o=!0,super.height=e}setSize(e,t){this.#a=!0,this.#o=!0,super.setSize(e,t)}get columns(){return this.#e}set columns(e){this.#e=Math.max(1,Math.floor(db(e,1))),this.layout()}get gapX(){return this.#t}set gapX(e){this.#t=Math.max(0,db(e,0)),this.layout()}get gapY(){return this.#n}set gapY(e){this.#n=Math.max(0,db(e,0)),this.layout()}get alignX(){return this.#r}set alignX(e){this.#r=fb(e),this.layout()}get alignY(){return this.#i}set alignY(e){this.#i=fb(e),this.layout()}layout(){let e=this.children,t=bb(e,this.#e,this.#t,this.#n),n=this.#a?this.width:t.width,r=this.#o?this.height:t.height;(n!==this.width||r!==this.height)&&this.setBoxSize(n,r);let i=0;for(let n=0;n<t.rowHeights.length;n++){let r=0;for(let a=0;a<t.columnWidths.length;a++){let o=e[n*this.#e+a];if(o){let e=gb(o);o.position.set(r+mb(this.#r,Math.max(0,t.columnWidths[a]-e.width)),i+mb(this.#i,Math.max(0,t.rowHeights[n]-e.height))),vb(o)}r+=t.columnWidths[a]+this.#t}i+=t.rowHeights[n]+this.#n}}};function bb(e,t,n,r){if(e.length===0)return{width:0,height:0,columnWidths:[],rowHeights:[]};let i=Math.min(t,e.length),a=Math.ceil(e.length/t),o=Array.from({length:i},()=>0),s=Array.from({length:a},()=>0);for(let n=0;n<e.length;n++){let r=e[n],i=n%t,a=Math.floor(n/t);o[i]=Math.max(o[i],r.width),s[a]=Math.max(s[a],r.height)}return{width:o.reduce((e,t)=>e+t,0)+n*Math.max(0,o.length-1),height:s.reduce((e,t)=>e+t,0)+r*Math.max(0,s.length-1),columnWidths:o,rowHeights:s}}var xb=class extends Jy{#e=0;#t=`start`;#n=`start`;#r=!1;#i=!1;constructor(e={}){super(e),this.#r=e.width!==void 0,this.#i=e.height!==void 0}get width(){return super.width}set width(e){this.#r=!0,super.width=e}get height(){return super.height}set height(e){this.#i=!0,super.height=e}setSize(e,t){this.#r=!0,this.#i=!0,super.setSize(e,t)}get gap(){return this.#e}set gap(e){this.#e=Math.max(0,db(e,0)),this.layout()}get alignY(){return this.#t}set alignY(e){this.#t=fb(e),this.layout()}get justify(){return this.#n}set justify(e){this.#n=pb(e),this.layout()}layout(){let e=this.children,t=_b(`horizontal`,e,this.#e),n=this.#r?this.width:t.width,r=this.#i?this.height:t.height;(n!==this.width||r!==this.height)&&this.setBoxSize(n,r);let i=Math.max(0,n-t.width),a=this.#n===`space-between`&&e.length>1?this.#e+i/(e.length-1):this.#e,o=hb(this.#n,i);for(let t of e){let e=gb(t);t.position.set(o,mb(this.#t,Math.max(0,r-e.height))),vb(t),o+=e.width+a}}},Sb=Symbol(`pixifact.runtimeBehavior`),Cb=.5,wb=.92,Tb=.18,Eb=.72,Db=.05,Ob=.05,kb=class extends Jy{contentLayer=new jr;#e=new Df;#t=`vertical`;#n=0;#r=0;#i=0;#a=0;#o=0;#s=0;#c=!1;#l=new Set;#u=!1;#d;constructor(e={}){let{direction:t,scrollX:n,scrollY:r,...i}=e;super(i),this.#t=t??this.#t,this.#n=n??this.#n,this.#r=r??this.#r,this.contentLayer.mask=this.#e,this.contentLayer.on(`childAdded`,this.#f,this),this.contentLayer.on(`childRemoved`,this.#p,this),super.addChild(this.contentLayer),super.addChild(this.#e),this.layout()}[Sb](){this.eventMode=`static`,this.on(`wheel`,this.#v,this),this.on(`pointerdown`,this.#y,this),this.on(`globalpointermove`,this.#b,this),this.on(`pointerup`,this.#x,this),this.on(`pointerupoutside`,this.#x,this),this.on(`pointercancel`,this.#x,this)}get direction(){return this.#t}set direction(e){this.#O(),this.#t=e,this.#C()}get scrollX(){return this.#i}set scrollX(e){this.#O(),this.#n=e,this.#C()}get scrollY(){return this.#a}set scrollY(e){this.#O(),this.#r=e,this.#C()}addChild(...e){let t=this.contentLayer.addChild(...e);return this.layout(),t}addChildAt(e,t){let n=this.contentLayer.addChildAt(e,t);return this.layout(),n}removeChild(...e){let t=e.every(e=>e.parent===this.contentLayer)?this.contentLayer.removeChild(...e):super.removeChild(...e);return this.layout(),t}setChildIndex(e,t){e.parent===this.contentLayer?this.contentLayer.setChildIndex(e,t):super.setChildIndex(e,t),this.layout()}getChildIndex(e){return e.parent===this.contentLayer?this.contentLayer.getChildIndex(e):super.getChildIndex(e)}swapChildren(e,t){e.parent===this.contentLayer&&t.parent===this.contentLayer?this.contentLayer.swapChildren(e,t):super.swapChildren(e,t),this.layout()}layout(){this.#u||this.destroyed||(super.layout(),this.#S(),this.#C())}destroy(e){this.#u=!0,this.#O(),this.#d=void 0,this.off(`wheel`,this.#v,this),this.off(`pointerdown`,this.#y,this),this.off(`globalpointermove`,this.#b,this),this.off(`pointerup`,this.#x,this),this.off(`pointerupoutside`,this.#x,this),this.off(`pointercancel`,this.#x,this),this.contentLayer.off(`childAdded`,this.#f,this),this.contentLayer.off(`childRemoved`,this.#p,this);for(let e of this.#l)e.off(`childAdded`,this.#m,this),e.off(`childRemoved`,this.#h,this);this.#l.clear(),super.destroy(e)}#f(e){this.#g(e),this.layout()}#p(e){this.#_(e),this.layout()}#m(e){this.#g(e),this.layout()}#h(e){this.#_(e),this.layout()}#g(e){if(!this.#l.has(e)){this.#l.add(e),e.on(`childAdded`,this.#m,this),e.on(`childRemoved`,this.#h,this);for(let t of e.children)this.#g(t)}}#_(e){if(this.#l.delete(e)){e.off(`childAdded`,this.#m,this),e.off(`childRemoved`,this.#h,this);for(let t of e.children)this.#_(t)}}#v(e){this.#O();let t=this.#i,n=this.#a;this.#t!==`vertical`&&(this.#n=this.#i+e.deltaX),this.#t!==`horizontal`&&(this.#r=this.#a+e.deltaY),this.#C(),(t!==this.#i||n!==this.#a)&&(e.preventDefault(),e.stopPropagation())}#y(e){this.#O(),this.#o=0,this.#s=0,this.#d={pointerId:e.pointerId,globalX:e.global.x,globalY:e.global.y,scrollX:this.#i,scrollY:this.#a}}#b(e){if(!this.#d||e.pointerId!==this.#d.pointerId)return;let t=e.global.x-this.#d.globalX,n=e.global.y-this.#d.globalY,r=this.#i,i=this.#a;this.#t!==`vertical`&&(this.#d.scrollX-=t,this.#n=this.#d.scrollX),this.#t!==`horizontal`&&(this.#d.scrollY-=n,this.#r=this.#d.scrollY),this.#w(),this.#o=this.#i-r,this.#s=this.#a-i,this.#d.globalX=e.global.x,this.#d.globalY=e.global.y}#x(e){!this.#d||e.pointerId!==this.#d.pointerId||(this.#d=void 0,this.#D())}#S(){this.#e.clear(),this.#e.rect(0,0,this.width,this.height).fill(16777215)}#C(){let e=this.#E();this.#T(Ab(this.#t===`vertical`?0:this.#n,0,e.x),Ab(this.#t===`horizontal`?0:this.#r,0,e.y))}#w(){let e=this.#E();this.#T(this.#t===`vertical`?0:jb(this.#n,0,e.x),this.#t===`horizontal`?0:jb(this.#r,0,e.y))}#T(e,t){this.#i=e,this.#a=t,this.contentLayer.position.set(-this.#i,-this.#a)}#E(){let e=this.#j();return{x:Math.max(0,e.width-this.width),y:Math.max(0,e.height-this.height)}}#D(){this.#c||!this.#A()||(this.#c=!0,qr.shared.add(this.#k,this))}#O(){this.#c&&=(qr.shared.remove(this.#k,this),!1)}#k(e){if(this.#u||this.destroyed||this.#d){this.#O();return}let t=Math.min(e.deltaTime,4),n=this.#E(),r=this.#t===`vertical`?{value:0,velocity:0}:Mb(this.#i,this.#o,0,n.x,t),i=this.#t===`horizontal`?{value:0,velocity:0}:Mb(this.#a,this.#s,0,n.y,t);this.#o=r.velocity,this.#s=i.velocity,this.#T(r.value,i.value),this.#n=this.#i,this.#r=this.#a,this.#A()||this.#O()}#A(){let e=this.#E();return this.#t!==`vertical`&&Nb(this.#i,this.#o,0,e.x)||this.#t!==`horizontal`&&Nb(this.#a,this.#s,0,e.y)}#j(){let e=0,t=0;for(let n of this.contentLayer.children){let r=Fb(n);e=Math.max(e,r.right),t=Math.max(t,r.bottom)}return{width:e,height:t}}};function Ab(e,t,n){return Math.min(n,Math.max(t,e))}function jb(e,t,n){return e<t?t+(e-t)*Cb:e>n?n+(e-n)*Cb:e}function Mb(e,t,n,r,i){let a=t,o=Pb(e,n,r);o===void 0?a*=wb**+i:(a+=(o-e)*Tb*i,a*=Eb**+i);let s=e+a*i,c=Pb(s,n,r);return o!==void 0&&c===void 0?{value:o,velocity:0}:(c!==void 0&&Math.abs(s-c)<=Db&&Math.abs(a)<=Ob&&(s=c,a=0),{value:s,velocity:a})}function Nb(e,t,n,r){return Math.abs(t)>Ob||Pb(e,n,r)!==void 0}function Pb(e,t,n){if(e<t)return t;if(e>n)return n}function Fb(e){e.updateLocalTransform();let t=e.getLocalBounds();if(!t.isValid)return{right:0,bottom:0};let n=e.localTransform,r=n.a*t.minX+n.c*t.minY+n.tx,i=n.b*t.minX+n.d*t.minY+n.ty,a=n.a*t.maxX+n.c*t.minY+n.tx,o=n.b*t.maxX+n.d*t.minY+n.ty,s=n.a*t.maxX+n.c*t.maxY+n.tx,c=n.b*t.maxX+n.d*t.maxY+n.ty,l=n.a*t.minX+n.c*t.maxY+n.tx,u=n.b*t.minX+n.d*t.maxY+n.ty;return{right:Math.max(0,r,a,s,l),bottom:Math.max(0,i,o,c,u)}}var Ib=class extends Jy{#e=0;#t=`start`;#n=`start`;#r=!1;#i=!1;constructor(e={}){super(e),this.#r=e.width!==void 0,this.#i=e.height!==void 0}get width(){return super.width}set width(e){this.#r=!0,super.width=e}get height(){return super.height}set height(e){this.#i=!0,super.height=e}setSize(e,t){this.#r=!0,this.#i=!0,super.setSize(e,t)}get gap(){return this.#e}set gap(e){this.#e=Math.max(0,db(e,0)),this.layout()}get alignX(){return this.#t}set alignX(e){this.#t=fb(e),this.layout()}get justify(){return this.#n}set justify(e){this.#n=pb(e),this.layout()}layout(){let e=this.children,t=_b(`vertical`,e,this.#e),n=this.#r?this.width:t.width,r=this.#i?this.height:t.height;(n!==this.width||r!==this.height)&&this.setBoxSize(n,r);let i=Math.max(0,r-t.height),a=this.#n===`space-between`&&e.length>1?this.#e+i/(e.length-1):this.#e,o=hb(this.#n,i);for(let t of e){let e=gb(t);t.position.set(mb(this.#t,Math.max(0,n-e.width)),o),vb(t),o+=e.height+a}}},Lb=new WeakMap,Rb=new Set([`left`,`right`,`top`,`bottom`,`horizontal`,`vertical`]),zb=new Set([`fontSize`,`fontFamily`,`fontWeight`,`fill`]),Bb=new Set([`fill`,`fillColor`,`strokeColor`,`tint`]);function Vb(e,t,n={}){let r={definitions:Object.fromEntries(t),subscribers:new Map,values:{}};Lb.set(e,r);for(let[t,i]of Object.entries(r.definitions))r.values[t]=Object.hasOwn(n,t)?n[t]:i.default,Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:()=>r.values[t],set:n=>Ub(e,t,n)})}function Hb(e,t,n={}){Vb(e,new Map(Object.entries(t.props).map(([e,t])=>[e,{...`default`in t?{default:t.default}:{},...t.type===`variant`?{variants:t.variants}:{}}])),n)}function Ub(e,t,n){let r=Jb(e);if(!Object.is(r.values[t],n)){r.values[t]=n;for(let e of r.subscribers.get(t)??[])e()}}function Wb(e,t){let n=Jb(e),[r,i]=t.path,a=n.values[r];if(!i)return a;let o=String(a);return n.definitions[r]?.variants?.[o]?.[i]}function Gb(e,t,n,r){let i=Jb(e),a=()=>Kb(n,r,Wb(e,t)),o=i.subscribers.get(t.path[0])??new Set;o.add(a),i.subscribers.set(t.path[0],o),a()}function Kb(e,t,n){if(t===`text`){e.text=String(n??``);return}let r=qb(t,n);if(Rb.has(t)){Vy(e,{[t]:r});return}let i=e;if(zb.has(t)&&`text`in i&&i.style){i.style[t]=r;return}if(t===`scaleX`||t===`scaleY`){let e=i.scale;e[t===`scaleX`?`x`:`y`]=r;return}if(t===`pivotX`||t===`pivotY`){let e=i.pivot;e[t===`pivotX`?`x`:`y`]=r;return}if(t===`skewX`||t===`skewY`){let e=i.skew;e[t===`skewX`?`x`:`y`]=r;return}if(t===`anchorX`||t===`anchorY`){let e=i.anchor;e[t===`anchorX`?`x`:`y`]=r;return}if(t===`tilePositionX`||t===`tilePositionY`){let e=i.tilePosition;e[t===`tilePositionX`?`x`:`y`]=r;return}if(t===`tileScaleX`||t===`tileScaleY`){let e=i.tileScale;e[t===`tileScaleX`?`x`:`y`]=r;return}i[t]=r}function qb(e,t){return Bb.has(e)&&typeof t==`string`&&/^#[0-9a-fA-F]{6}$/.test(t)?Number.parseInt(t.slice(1),16):t}function Jb(e){let t=Lb.get(e);if(!t)throw Error(`Scene props must be initialized before bindings are mounted.`);return t}var Yb=4,Xb=class extends Error{status;constructor(e,t){super(t),this.status=e}};async function Zb(e){if(e.ok)return e;let t=await e.json();throw new Xb(e.status,t.error??`Editor request failed with ${e.status}.`)}async function Qb(){return(await Zb(await fetch(`/api/project`))).json()}async function $b(){return(await Zb(await fetch(`/api/editor-ui-state`))).json()}async function ex(e){return(await Zb(await fetch(`/api/editor-ui-state`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(e)}))).json()}async function tx(e){return(await Zb(await fetch(`/api/scene?path=${encodeURIComponent(e)}`))).json()}async function nx(){return(await Zb(await fetch(`/api/scene-bindings`))).json()}async function rx(e,t,n){return(await Zb(await fetch(`/api/scene?path=${encodeURIComponent(e)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({source:t,expectedVersion:n})}))).json()}async function ix(e){return Zb(await fetch(`/api/file?path=${encodeURIComponent(e)}`))}function ax(e,t,n,r){let i=window.location.protocol===`https:`?`wss:`:`ws:`,a=new WebSocket(`${i}//${window.location.host}/api/events`);return new Promise((i,o)=>{let s=!1,c=!1,l=!1,u=e=>({initialState:e,close:()=>a.close(),clearContext(){!s||a.readyState!==WebSocket.OPEN||a.send(JSON.stringify({type:`editorContextCleared`,protocolVersion:Yb}))},publishContext(e){!s||a.readyState!==WebSocket.OPEN||a.send(JSON.stringify({type:`editorContextChanged`,protocolVersion:Yb,context:e}))},requestTakeover(){s||a.readyState!==WebSocket.OPEN||a.send(JSON.stringify({type:`editorSessionTakeoverRequested`,protocolVersion:Yb}))}});a.addEventListener(`message`,t=>{let d=JSON.parse(String(t.data));if(d.protocolVersion!==void 0&&d.protocolVersion!==Yb){a.close(),o(Error(`Editor session protocol version does not match. Restart Pixifact Editor.`));return}if(d.type===`editorSessionActive`||d.type===`editorSessionStandby`){let e={status:d.type===`editorSessionActive`?`active`:`standby`,...d.resume?{resume:d.resume}:{},...d.reason?{reason:d.reason}:{},...d.error?{error:d.error}:{}};s=e.status===`active`,c=!0,l?n(e):(l=!0,i(u(e)));return}if(s&&d.type===`projectFileChanged`&&d.path){e(d.path);return}s&&d.type===`editorScreenshotRequested`&&d.requestId&&d.scene&&r(d.scene).then(e=>{!s||a.readyState!==WebSocket.OPEN||a.send(JSON.stringify({type:`editorScreenshotCompleted`,protocolVersion:Yb,requestId:d.requestId,scene:d.scene,...e}))}).catch(e=>{!s||a.readyState!==WebSocket.OPEN||a.send(JSON.stringify({type:`editorScreenshotFailed`,protocolVersion:Yb,requestId:d.requestId,error:e instanceof Error?e.message:String(e)}))})}),a.addEventListener(`error`,()=>{l||(l=!0,o(Error(`Editor 无法连接本地项目服务。`)))}),a.addEventListener(`close`,()=>{l?c&&t():(l=!0,o(Error(`Editor 本地项目服务连接已关闭。`)))})})}function ox(e){return e===`image`?`asset`:e===`file`?`unknown`:e}function sx(e){let t={id:e.name,name:e.name,path:e.name,kind:`folder`,depth:0,children:[]},n=new Map([[t.path,t]]);for(let r of e.files){let e=r.path.split(`/`),i=t,a=t.path;for(let[t,o]of e.entries()){if(a=`${a}/${o}`,t===e.length-1){i.children.push({id:a,name:o,path:a,kind:ox(r.kind),depth:t+1});continue}let s=n.get(a);s||(s={id:a,name:o,path:a,kind:`folder`,depth:t+1,children:[]},n.set(a,s),i.children.push(s)),i=s}}return t}var cx={readScene:tx,writeScene:rx};function lx(e,t){if(e.path===t)return e;for(let n of e.children??[]){let e=lx(n,t);if(e)return e}}function ux(e,t){return t.path===e.path?``:t.path.slice(e.path.length+1)}async function dx(e,t){return(await ix(ux(e,t))).text()}async function fx(e,t){let n=await ix(ux(e,t));return new Uint8Array(await n.arrayBuffer())}async function px(e){return mx(e)}async function mx(e,t){let n=[];for(let r of gx(e,e))n.push(await hx(e,r,t));let r=await nx();return Object.fromEntries(n.map(e=>{let t=r[e.scenePath];if(!t)throw Error(`No @scene decorator found.`);if(t.className!==e.template.name)throw Error(`Scene ${e.file.name} 的 name "${e.template.name}" 必须等于脚本 @scene 类名 "${t.className}"。`);let n={...e.template,interface:t.interface};return[e.scenePath,{scenePath:e.scenePath,file:e.file,scriptFile:e.scriptFile,template:n,descriptor:t,className:t.className,interface:t.interface}]}))}async function hx(e,t,n){let r=Ue(ux(e,t)),i=Ke(r),a=lx(e,`${e.path}/${i}`);if(!a)throw Error(`找不到 Scene 脚本 ${i}。`);return{scenePath:r,file:t,scriptFile:a,template:n?.file.path===t.path?n.template:Ye(await dx(e,t))}}function gx(e,t,n=[]){if(t.kind===`scene`)return _x(ux(e,t))&&n.push(t),n;if(t.kind===`folder`&&We(t.name))return n;for(let r of t.children??[])gx(e,r,n);return n}function _x(e){let t;try{t=Ue(e)}catch{return!1}return Re(t).split(`/`).some(We)?!1:Ie.some(e=>t.startsWith(`${e}/`))}var vx={".gif":`image/gif`,".jpg":`image/jpeg`,".jpeg":`image/jpeg`,".png":`image/png`,".svg":`image/svg+xml`,".webp":`image/webp`},yx={".jpg":`texture`,".jpeg":`texture`,".png":`texture`,".svg":`svg`,".webp":`texture`},bx=new Set([`shape`,`radius`,`fill`,`fillAlpha`,`strokeColor`,`strokeWidth`,`strokeAlpha`]);function xx(e,t){return typeof e==`number`?e:t}function Sx(e,t){let n=e.props.width!==void 0||e.props.height!==void 0;return{width:xx(e.props.width,n?960:t?.width??960),height:xx(e.props.height,n?540:t?.height??540)}}function Cx(e,t){return`${e.path}/${t}`}function wx(e){let t=e.split(`/`).at(-1)??e,n=t.lastIndexOf(`.`);return n>=0?t.slice(n).toLowerCase():``}function Tx(e,t){return e.interfaces[t]??{props:{},events:{},slots:{}}}function Ex(e,t,n){let r=Sx(t,n);e.setSize(r.width,r.height);for(let[n,r]of Object.entries(t.props))n!==`width`&&n!==`height`&&!M(r)&&Kb(e,n,r)}function Dx(e,t){let n=typeof t.props.texture==`string`?e.textures.get(t.props.texture)??W.EMPTY:W.EMPTY,r=M(t.props.text)?``:String(t.props.text??``),i=Object.fromEntries([`fontSize`,`fontFamily`,`fontWeight`,`fill`].flatMap(e=>{let n=t.props[e];return n===void 0||M(n)?[]:[[e,n]]}));switch(t.type){case`Group`:return new qy;case`GridContainer`:return new yb;case`HBoxContainer`:return new xb;case`ScrollContainer`:return new kb;case`VBoxContainer`:return new Ib;case`Rect`:return new eb;case`Image`:return new ab({texture:n});case`NineImage`:return new lb({texture:n});case`TileImage`:return new ub({texture:n});case`Label`:return new Qy;case`BitmapLabel`:return new $y;case`Container`:return new jr;case`Sprite`:return new Nr({texture:n});case`Text`:return new im({text:r,style:i});case`BitmapText`:return new Dm({text:r,style:i});case`HTMLText`:return new Qm({text:r,style:i});case`Graphics`:return new Df;case`NineSliceSprite`:return new Fy({texture:n});case`TilingSprite`:return new tp({texture:n});default:return Ox(t.type)}}function Ox(e){return new jr}function kx(e,t,n){t.id&&(n.label=t.id);for(let[r,i]of Object.entries(t.props)){if(M(i)){Gb(e.bindingRoot,i,n,r);continue}r===`texture`||t.type===`Graphics`&&bx.has(r)||Kb(n,r,i)}t.type===`Graphics`&&n instanceof Df&&Ax(n,t.props)}function Ax(e,t){let n=Number(t.width??0),r=Number(t.height??0),i=Number(t.radius??0);if(e.clear(),t.shape===`rect`)e.rect(0,0,n,r);else if(t.shape===`roundRect`)e.roundRect(0,0,n,r,i);else return;e.fill({color:Number(t.fill??16777215),alpha:Number(t.fillAlpha??1)}),Number(t.strokeWidth??0)>0&&e.stroke({width:Number(t.strokeWidth),color:Number(t.strokeColor??0),alpha:Number(t.strokeAlpha??1)})}function jx(e,t,n){return Object.fromEntries(Object.entries(t.props).flatMap(([t,r])=>n.props[t]?[[t,M(r)?Wb(e.bindingRoot,r):r]]:[]))}function Mx(e,t,n,r){for(let[i,a]of Object.entries(t.props)){if(r.props[i]){M(a)&&Gb(e.bindingRoot,a,n,i);continue}M(a)?Gb(e.bindingRoot,a,n,i):Kb(n,i,a)}}function Nx(e,t,n,r,i=``){for(let[a,o]of r.entries()){if(o.kind===`slotOutlet`){t.slots.set(o.name,n);continue}let r=oe(o,i?`${i}/${a}`:String(a));if(o.kind===`pixi`){let i=Dx(e,o);kx(t,o,i),o.props.zIndex!==void 0&&(n.sortableChildren=!0),n.addChild(i),t.collectNodes&&e.nodes.set(r,i),Nx(e,t,i,o.children,r);continue}Px(e,t,n,o,r)}}function Px(e,t,n,r,i){let a=qe(t.scenePath,r.scene),o=e.templates.get(a);if(!o)throw Error(`找不到 Scene:${a}`);let s=Tx(e,a),c=new qy;Hb(c,s,jx(t,r,s)),Ex(c,o);let l={bindingRoot:c,collectNodes:!1,scenePath:a,slots:new Map};Nx(e,l,c,o.children),Mx(t,r,c,s),r.id&&!s.props.label&&(c.label=r.id),r.props.zIndex!==void 0&&(n.sortableChildren=!0),n.addChild(c),t.collectNodes&&e.nodes.set(i,c);for(let[n,a]of Object.entries(r.slots)){let r=l.slots.get(n);r&&Nx(e,t,r,a,`${i}/slot:${n}`)}Hy(c)}function Fx(e,t){function n(e){for(let r of e)if(r.kind!==`slotOutlet`)if(typeof r.props.texture==`string`&&t.add(r.props.texture),r.kind===`pixi`)n(r.children);else for(let e of Object.values(r.slots))n(e)}n(e.children)}async function Ix(e){let t=new Set;for(let n of e.templates.values())Fx(n,t);await Promise.all([...t].map(async t=>{e.textures.set(t,await Lx(e,t))}))}async function Lx(e,t){let n=lx(e.projectTree,Cx(e.projectTree,t));if(!n)return Md.load(t);let r=await fx(e.projectTree,n),i=URL.createObjectURL(new Blob([r],{type:Rx(t)}));return e.objectUrls.push(i),Md.load({src:i,parser:yx[wx(t)]})}function Rx(e){return vx[wx(e)]??`application/octet-stream`}async function zx(e){let t=await px(e.projectTree),n=Ue(e.scenePath),r=t[n];if(!r)throw Error(`找不到 Scene 绑定:${n}`);let i=new Map(Object.values(t).map(e=>[e.scenePath,e.template]));i.set(n,e.document.template);let a={...Object.fromEntries(Object.values(t).map(e=>[e.scenePath,e.interface])),...e.document.sceneInterfaces},o={interfaces:a,nodes:new Map,objectUrls:[],projectResolution:e.projectResolution,projectTree:e.projectTree,templates:i,textures:new Map};await Ix(o);let s=new qy;Hb(s,a[n]??r.interface),Ex(s,e.document.template,o.projectResolution),Nx(o,{bindingRoot:s,collectNodes:!0,scenePath:n,slots:new Map},s,e.document.template.children),Hy(s);let c=Sx(e.document.template,o.projectResolution);return{root:s,nodes:o.nodes,width:c.width,height:c.height,dispose:()=>{s.destroy({children:!0});for(let e of o.objectUrls)URL.revokeObjectURL(e)}}}function Bx(e){e?.dispose()}function Vx(e,t){let n=t.root.position.clone(),r=t.root.scale.clone(),i;try{t.root.position.set(0,0),t.root.scale.set(1),i=e.renderer.extract.base64({target:t.root,frame:new B(0,0,t.width,t.height),resolution:1,format:`png`,antialias:!0})}finally{t.root.position.copyFrom(n),t.root.scale.copyFrom(r)}return i}export{qe as A,re as B,$i as C,lt as D,F as E,j as F,ie as H,ee as I,f as L,ke as M,oe as N,Ye as O,M as P,ae as R,Qo as S,jr as T,u as U,ne as V,s as W,df as _,sx as a,Kd as b,tx as c,ex as d,By as f,mf as g,Df as h,ax as i,Ge as j,Ke as k,nx as l,Vy as m,zx as n,cx as o,Uy as p,Bx as r,Qb as s,Vx as t,$b as u,of as v,Qi as w,Pd as x,qd as y,d as z};
|