@drincs/pixi-vn 1.1.2 → 1.2.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.
Files changed (127) hide show
  1. package/dist/canvas/CanvasManager.cjs +1 -1
  2. package/dist/canvas/CanvasManager.js +1 -1
  3. package/dist/canvas/CanvasManagerStatic.cjs +1 -1
  4. package/dist/canvas/CanvasManagerStatic.js +1 -1
  5. package/dist/canvas/components/Container.cjs +1 -1
  6. package/dist/canvas/components/Container.js +1 -1
  7. package/dist/canvas/components/ImageContainer.cjs +1 -1
  8. package/dist/canvas/components/ImageContainer.js +1 -1
  9. package/dist/canvas/components/ImageSprite.cjs +2 -2
  10. package/dist/canvas/components/ImageSprite.js +2 -2
  11. package/dist/canvas/components/Sprite.cjs +1 -1
  12. package/dist/canvas/components/Sprite.js +1 -1
  13. package/dist/canvas/components/Text.cjs +1 -1
  14. package/dist/canvas/components/Text.js +1 -1
  15. package/dist/canvas/components/VideoSprite.cjs +2 -2
  16. package/dist/canvas/components/VideoSprite.js +2 -2
  17. package/dist/canvas/decorators/canvas-element-decorator.cjs +1 -1
  18. package/dist/canvas/decorators/canvas-element-decorator.js +1 -1
  19. package/dist/canvas/decorators/event-decorator.cjs +1 -1
  20. package/dist/canvas/decorators/event-decorator.js +1 -1
  21. package/dist/canvas/functions/canvas-effect.cjs +1 -1
  22. package/dist/canvas/functions/canvas-effect.js +1 -1
  23. package/dist/canvas/functions/canvas-import-utility.cjs +1 -1
  24. package/dist/canvas/functions/canvas-import-utility.js +1 -1
  25. package/dist/canvas/functions/canvas-transition.cjs +1 -1
  26. package/dist/canvas/functions/canvas-transition.js +1 -1
  27. package/dist/canvas/functions/image-container-utility.cjs +1 -1
  28. package/dist/canvas/functions/image-container-utility.js +1 -1
  29. package/dist/canvas/functions/image-utility.cjs +1 -1
  30. package/dist/canvas/functions/image-utility.js +1 -1
  31. package/dist/canvas/functions/video-utility.cjs +1 -1
  32. package/dist/canvas/functions/video-utility.js +1 -1
  33. package/dist/canvas/index.cjs +1 -1
  34. package/dist/canvas/index.js +1 -1
  35. package/dist/canvas/tickers/classes/TickerBase.cjs +1 -1
  36. package/dist/canvas/tickers/classes/TickerBase.js +1 -1
  37. package/dist/canvas/tickers/components/FadeAlphaTicker.cjs +1 -1
  38. package/dist/canvas/tickers/components/FadeAlphaTicker.js +1 -1
  39. package/dist/canvas/tickers/components/MoveTicker.cjs +1 -1
  40. package/dist/canvas/tickers/components/MoveTicker.js +1 -1
  41. package/dist/canvas/tickers/components/RotateTicker.cjs +1 -1
  42. package/dist/canvas/tickers/components/RotateTicker.js +1 -1
  43. package/dist/canvas/tickers/components/ZoomTicker.cjs +1 -1
  44. package/dist/canvas/tickers/components/ZoomTicker.js +1 -1
  45. package/dist/canvas/tickers/decorators/ticker-decorator.cjs +1 -1
  46. package/dist/canvas/tickers/decorators/ticker-decorator.js +1 -1
  47. package/dist/canvas/tickers/functions/ticker-texture-utility.cjs +1 -1
  48. package/dist/canvas/tickers/functions/ticker-texture-utility.js +1 -1
  49. package/dist/canvas/tickers/index.cjs +1 -1
  50. package/dist/canvas/tickers/index.js +1 -1
  51. package/dist/character/classes/CharacterBaseModel.cjs +17 -17
  52. package/dist/character/classes/CharacterBaseModel.js +17 -17
  53. package/dist/character/classes/CharacterStoredClass.cjs +16 -16
  54. package/dist/character/classes/CharacterStoredClass.js +16 -16
  55. package/dist/character/decorators/character-decorator.cjs +1 -1
  56. package/dist/character/decorators/character-decorator.js +1 -1
  57. package/dist/character/index.cjs +16 -16
  58. package/dist/character/index.js +16 -16
  59. package/dist/classes/CachedMap.cjs +1 -1
  60. package/dist/classes/CachedMap.d.cts +1 -1
  61. package/dist/classes/CachedMap.d.ts +1 -1
  62. package/dist/classes/CachedMap.js +1 -1
  63. package/dist/classes/index.cjs +1 -1
  64. package/dist/classes/index.js +1 -1
  65. package/dist/constants.cjs +1 -1
  66. package/dist/constants.d.cts +5 -1
  67. package/dist/constants.d.ts +5 -1
  68. package/dist/constants.js +1 -1
  69. package/dist/history/HistoryManager.cjs +2 -2
  70. package/dist/history/HistoryManager.d.cts +24 -13
  71. package/dist/history/HistoryManager.d.ts +24 -13
  72. package/dist/history/HistoryManager.js +2 -2
  73. package/dist/history/HistoryManagerStatic.cjs +1 -1
  74. package/dist/history/HistoryManagerStatic.d.cts +9 -8
  75. package/dist/history/HistoryManagerStatic.d.ts +9 -8
  76. package/dist/history/HistoryManagerStatic.js +1 -1
  77. package/dist/history/index.cjs +2 -2
  78. package/dist/history/index.d.cts +4 -2
  79. package/dist/history/index.d.ts +4 -2
  80. package/dist/history/index.js +2 -2
  81. package/dist/history/interfaces/HistoryManagerInterface.d.cts +54 -11
  82. package/dist/history/interfaces/HistoryManagerInterface.d.ts +54 -11
  83. package/dist/{index-CWhYJ7yq.d.ts → index-CvpVN1rC.d.ts} +3 -3
  84. package/dist/{index-CVn6zVij.d.cts → index-DCnX_VPi.d.cts} +3 -3
  85. package/dist/index.cjs +73 -73
  86. package/dist/index.d.cts +6 -5
  87. package/dist/index.d.ts +6 -5
  88. package/dist/index.js +73 -73
  89. package/dist/narration/NarrationManager.cjs +16 -16
  90. package/dist/narration/NarrationManager.d.cts +1 -1
  91. package/dist/narration/NarrationManager.d.ts +1 -1
  92. package/dist/narration/NarrationManager.js +16 -16
  93. package/dist/narration/NarrationManagerStatic.cjs +1 -1
  94. package/dist/narration/NarrationManagerStatic.js +1 -1
  95. package/dist/narration/classes/ChoiceMenuOption.cjs +1 -1
  96. package/dist/narration/classes/ChoiceMenuOption.js +1 -1
  97. package/dist/narration/decorators/RegisteredLabels.cjs +1 -1
  98. package/dist/narration/decorators/RegisteredLabels.js +1 -1
  99. package/dist/narration/decorators/newLabel.cjs +1 -1
  100. package/dist/narration/decorators/newLabel.js +1 -1
  101. package/dist/narration/index.cjs +17 -17
  102. package/dist/narration/index.d.cts +2 -2
  103. package/dist/narration/index.d.ts +2 -2
  104. package/dist/narration/index.js +17 -17
  105. package/dist/narration/interfaces/HistoryStep.d.cts +5 -5
  106. package/dist/narration/interfaces/HistoryStep.d.ts +5 -5
  107. package/dist/narration/interfaces/{NarrativeHistory.d.cts → NarrationHistory.d.cts} +2 -2
  108. package/dist/narration/interfaces/{NarrativeHistory.d.ts → NarrationHistory.d.ts} +2 -2
  109. package/dist/narration/interfaces/NarrationManagerInterface.d.cts +1 -1
  110. package/dist/narration/interfaces/NarrationManagerInterface.d.ts +1 -1
  111. package/dist/pixi-devtools/additionalPositionsProperties.cjs +1 -1
  112. package/dist/pixi-devtools/additionalPositionsProperties.js +1 -1
  113. package/dist/pixi-vn.d.d.cts +44 -1
  114. package/dist/pixi-vn.d.d.ts +44 -1
  115. package/dist/storage/StorageManager.cjs +1 -1
  116. package/dist/storage/StorageManager.js +1 -1
  117. package/dist/storage/StorageManagerStatic.cjs +1 -1
  118. package/dist/storage/StorageManagerStatic.js +1 -1
  119. package/dist/storage/classes/StoredClassModel.cjs +1 -1
  120. package/dist/storage/classes/StoredClassModel.js +1 -1
  121. package/dist/storage/index.cjs +1 -1
  122. package/dist/storage/index.js +1 -1
  123. package/dist/utils/diff-utility.d.cts +2 -2
  124. package/dist/utils/diff-utility.d.ts +2 -2
  125. package/package.json +3 -3
  126. /package/dist/narration/interfaces/{NarrativeHistory.cjs → NarrationHistory.cjs} +0 -0
  127. /package/dist/narration/interfaces/{NarrativeHistory.js → NarrationHistory.js} +0 -0
@@ -566,4 +566,4 @@ fn mainFragment(
566
566
 
567
567
  outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
568
568
 
569
- `}};});var vh,Th,To,fm=p(()=>{Q();Rs();lm();Us();hi();xe();pt();dm();To=class extends Qt{constructor(){vh??(vh=ar({name:"tiling-sprite-shader",bits:[Pi,cm,lr]})),Th??(Th=hr({name:"tiling-sprite-shader",bits:[hm,um,cr]}));let t=new St({uMapCoord:{value:new M,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new M,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Th,gpuProgram:vh,resources:{localUniforms:new St({uTransformMatrix:{value:new M,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:k.EMPTY.source,uSampler:k.EMPTY.source.style}});}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,h=n.width,l=n.height,c=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(r.a*h/t,r.b*h/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),u.invert(),a.uniforms.uMapCoord=c.mapCoord,a.uniforms.uClampFrame=c.uClampFrame,a.uniforms.uClampOffset=c.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style);}};});var So,pm=p(()=>{vo();So=class extends Pr{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])});}};});function mm(i,t){let e=i.anchor.x,r=i.anchor.y;t[0]=-e*i.width,t[1]=-r*i.height,t[2]=(1-e)*i.width,t[3]=-r*i.height,t[4]=(1-e)*i.width,t[5]=(1-r)*i.height,t[6]=-e*i.width,t[7]=(1-r)*i.height;}var gm=p(()=>{});function xm(i,t,e,r){let s=0,o=i.length/(t),n=r.a,a=r.b,h=r.c,l=r.d,c=r.tx,u=r.ty;for(e*=t;s<o;){let f=i[e],d=i[e+1];i[e]=n*f+h*d+c,i[e+1]=a*f+l*d+u,e+=t,s++;}}var _m=p(()=>{});function ym(i,t){let e=i.texture,r=e.frame.width,s=e.frame.height,o=0,n=0;i.applyAnchorToTexture&&(o=i.anchor.x,n=i.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=M.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),xm(t,2,0,a);}var bm=p(()=>{Q();_m();});var wo,Ci,vm=p(()=>{R();si();Xs();ai();di();js();vo();fm();pm();gm();bm();wo=new So,Ci=class{constructor(t){this._state=Oe.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash");}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return !o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new ye);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e);}else r.break(e),s.shader||(s.shader=new To),this.updateRenderable(t),e.add(t);}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,_e(t.groupColorAlpha,r.uColor,0),this._state.blendMode=oe(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:wo,shader:e,state:this._state});}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s);}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture);}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new Pr({indices:wo.indices,positions:wo.positions.slice(),uvs:wo.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:true,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),ym(t,r.uvs),mm(t,r.positions);}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null;}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=true;return this._renderer.type===Zt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};Ci.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"tilingSprite"};});var Sh=p(()=>{R();vm();G.add(Ci);});var Tm,wm,Pm=p(()=>{st();vo();Tm=class Sm extends Pr{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(I(L,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e);}build(t){t={...Sm.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 e=this.verticesX*this.verticesY,r=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,h=this.width/n,l=this.height/a;for(let u=0;u<e;u++){let f=u%this.verticesX,d=u/this.verticesX|0;r.push(f*h,d*l),s.push(f/n,d/a);}let c=n*a;for(let u=0;u<c;u++){let f=u%n,d=u/n|0,m=d*this.verticesX+f,x=d*this.verticesX+f+1,g=(d+1)*this.verticesX+f,_=(d+1)*this.verticesX+f+1;o.push(m,x,g,x,_,g);}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update();}};Tm.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};wm=Tm;});var Cm,Am,Em=p(()=>{Pm();Cm=class Mm extends wm{constructor(t={}){t={...Mm.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t);}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions();}updatePositions(){let t=this.positions,{width:e,height:r,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:h,_anchorY:l}=this,c=s+o,u=e>c?1:e/c,f=n+a,d=r>f?1:r/f,m=Math.min(u,d),x=h*e,g=l*r;t[0]=t[8]=t[16]=t[24]=-x,t[2]=t[10]=t[18]=t[26]=s*m-x,t[4]=t[12]=t[20]=t[28]=e-o*m-x,t[6]=t[14]=t[22]=t[30]=e-x,t[1]=t[3]=t[5]=t[7]=-g,t[9]=t[11]=t[13]=t[15]=n*m-g,t[17]=t[19]=t[21]=t[23]=r-a*m-g,t[25]=t[27]=t[29]=t[31]=r-g,this.getBuffer("aPosition").update();}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update();}};Cm.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};Am=Cm;});var Mi,Bm=p(()=>{R();Gt();js();Em();Mi=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash");}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e);}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e);}validateRenderable(t){let e=this._getGpuSprite(t);return !e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];W.return(e.geometry),W.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture);}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=W.get(ye);return e.geometry=W.get(Am),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null;}};Mi.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"nineSliceSprite"};});var wh=p(()=>{R();Bm();G.add(Mi);});var Ai,Fm=p(()=>{R();Ai=class{constructor(t){this._renderer=t;}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:false,action:"pushFilter",container:e,filterEffect:t});}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:false});}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop();}destroy(){this._renderer=null;}};Ai.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"filter"};});function Rm(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds));}return t.matrix=e,t}var km=p(()=>{});var v_,Ei,Im=p(()=>{R();Q();zt();ii();ni();xe();pt();je();ai();Wt();km();_t();v_=new qt({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Ei=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new St({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new Dt({}),this.renderer=t;}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){s.skip=true;return}let o=s.bounds;if(t.renderables?Rm(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(true,o),t.container){let m=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;m&&o.applyMatrix(m);}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,h=0,l=true,c=false,u=false,f=true;for(let d=0;d<r.length;d++){let m=r[d];if(a=Math.min(a,m.resolution==="inherit"?n._resolution:m.resolution),h+=m.padding,m.antialias==="off"?l=false:m.antialias==="inherit"&&l&&(l=n.antialias),m.clipToViewport||(f=false),!!!(m.compatibleRenderers&e.type)){u=false;break}if(m.blendRequired&&!(e.backBuffer?.useBackBuffer??true)){O("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=false;break}u=m.enabled||u,c||(c=m.blendRequired);}if(!u){s.skip=true;return}if(f){let d=e.renderTarget.rootViewPort,m=e.renderTarget.renderTarget.resolution;o.fitBounds(0,d.width/m,0,d.height/m);}if(o.scale(a).ceil().scale(1/a).pad(h|0),!o.isPositive){s.skip=true;return}s.skip=false,s.bounds=o,s.blendRequired=c,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=yt.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,true),e.globalUniforms.push({offset:o});}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let r=e.inputTexture,s=e.bounds,o=k.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,h=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(h,s,a);}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,r,e.previousRenderSurface,false),yt.returnTexture(r);else {let a=e.inputTexture,h=yt.getOptimalTexture(s.width,s.height,a.source._resolution,false),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,h,true);let u=a;a=h,h=u;}n[l].apply(this,a,e.previousRenderSurface,false),yt.returnTexture(a),yt.returnTexture(h);}e.blendRequired&&yt.returnTexture(o);}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=yt.getOptimalTexture(e.width,e.height,s,false),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let h=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:h,height:l},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,h=V.shared,c=n.previousRenderSurface===r,u=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,f=this._filterStackIndex-1;for(;f>0&&this._filterStack[f].skip;)--f;f>0&&(u=this._filterStack[f].inputTexture.source._resolution);let d=this._filterGlobalUniforms,m=d.uniforms,x=m.uOutputFrame,g=m.uInputSize,_=m.uInputPixel,y=m.uInputClamp,v=m.uGlobalFrame,b=m.uOutputTexture;if(c){let w=this._filterStackIndex;for(;w>0;){w--;let E=this._filterStack[this._filterStackIndex-1];if(!E.skip){h.x=E.bounds.minX,h.y=E.bounds.minY;break}}x[0]=a.minX-h.x,x[1]=a.minY-h.y;}else x[0]=0,x[1]=0;x[2]=e.frame.width,x[3]=e.frame.height,g[0]=e.source.width,g[1]=e.source.height,g[2]=1/g[0],g[3]=1/g[1],_[0]=e.source.pixelWidth,_[1]=e.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],y[0]=.5*_[2],y[1]=.5*_[3],y[2]=e.frame.width*g[2]-.5*_[2],y[3]=e.frame.height*g[3]-.5*_[3];let P=this.renderer.renderTarget.rootRenderTarget.colorTexture;v[0]=h.x*u,v[1]=h.y*u,v[2]=P.source.width*u,v[3]=P.source.height*u;let T=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof k?(b[0]=r.frame.width,b[1]=r.frame.height):(b[0]=T.width,b[1]=T.height),b[2]=T.isRoot?-1:1,d.update(),o.renderPipes.uniformBatch){let w=o.renderPipes.uniformBatch.getUboResource(d);this._globalFilterBindGroup.setResource(w,0);}else this._globalFilterBindGroup.setResource(d,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:v_,shader:t,state:t._state,topology:"triangle-list"}),o.type===Zt.WEBGL&&o.renderTarget.finishRenderPass();}_getFilterData(){return {skip:false,inputTexture:null,bounds:new et,container:null,filterEffect:null,blendRequired:false,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(M.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}};Ei.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"filter"};});var Ph=p(()=>{R();Fm();Im();G.add(Ei);G.add(Ai);});var T_={};var Gm=p(()=>{gc();wn();wc();Cc();fs();ys();Ga();Da();za();ch();xh();bh();Sh();wh();Ph();});var S_={};var Um=p(()=>{wn();fs();ys();Ga();Da();za();ch();xh();bh();Sh();wh();Ph();});R();var Dm={extension:{type:S.Environment,name:"browser",priority:-1},test:()=>true,load:async()=>{await Promise.resolve().then(()=>(Gm(),T_));}};R();var Lm={extension:{type:S.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(Um(),S_));}};R();R();ys();fs();Vi();st();us();var Po=class extends de{constructor(t,e){let{text:r,resolution:s,style:o,anchor:n,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=true,this._resolution=null,this._autoResolution=true,this._didTextUpdate=true,this._styleClass=e,this.text=r??"",this.style=o,this.resolution=s??null,this.allowChildren=false,this._anchor=new dt({_onUpdate:()=>{this.onViewUpdate();}}),n&&(this.anchor=n),this.roundPixels=l??false,a!==void 0&&(this.width=a),h!==void 0&&(this.height=h);}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t);}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate());}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate();}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate();}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width);}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height);}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height);}containsPoint(t){let e=this.bounds.width,r=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-r*this.anchor.y,t.y>=o&&t.y<=o+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=true),super.onViewUpdate();}_getKey(){return `${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=false){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null;}};function Om(i,t){let e=i[0]??{};return (typeof e=="string"||i[1])&&(I(L,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}uo();vr();var Bi=class extends Po{constructor(...t){let e=Om(t,"Text");super(e,At),this.renderPipeId="text";}updateBounds(){let t=this._bounds,e=this._anchor,r=Ut.measureText(this._text,this._style),{width:s,height:o}=r;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o;}};Rn();Ht();Nn();Ke();Ln();Yr();Et();ds();zi(ba());G.add(Dm,Lm);var te={};fg(te,{DistortionFilter:()=>Co,EqualizerFilter:()=>Lt,Filter:()=>lt,MonoFilter:()=>Mo,ReverbFilter:()=>Ao,StereoFilter:()=>Eo,StreamFilter:()=>Bo,TelephoneFilter:()=>Fo});var zm;function Wm(i){return zm=i,i}function X(){return zm}var lt=class{constructor(t,e){this.init(t,e);}init(t,e){this.destination=t,this.source=e||t;}connect(t){this.source?.connect(t);}disconnect(){this.source?.disconnect();}destroy(){this.disconnect(),this.destination=null,this.source=null;}};var Co=class extends lt{constructor(t=0){let e;if(!X().useLegacy){let{audioContext:r}=X().context;e=r.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,X().useLegacy)return;let e=t*1e3,r=44100,s=new Float32Array(r),o=Math.PI/180,n=0,a;for(;n<r;++n)a=n*2/r-1,s[n]=(3+e)*a*20*o/(Math.PI+e*Math.abs(a));this._distortion.curve=s,this._distortion.oversample="4x";}get amount(){return this._amount}destroy(){this._distortion=null,super.destroy();}};var at=class{static setParamValue(t,e){if(t.setValueAtTime){let r=X().context;t.setValueAtTime(e,r.audioContext.currentTime);}else t.value=e;return e}};var j=class extends lt{constructor(i=0,t=0,e=0,r=0,s=0,o=0,n=0,a=0,h=0,l=0){let c=[],u=[{f:j.F32,type:"lowshelf",gain:i},{f:j.F64,type:"peaking",gain:t},{f:j.F125,type:"peaking",gain:e},{f:j.F250,type:"peaking",gain:r},{f:j.F500,type:"peaking",gain:s},{f:j.F1K,type:"peaking",gain:o},{f:j.F2K,type:"peaking",gain:n},{f:j.F4K,type:"peaking",gain:a},{f:j.F8K,type:"peaking",gain:h},{f:j.F16K,type:"highshelf",gain:l}];X().useLegacy||(c=u.map(f=>{let d=X().context.audioContext.createBiquadFilter();return d.type=f.type,at.setParamValue(d.Q,1),d.frequency.value=f.f,at.setParamValue(d.gain,f.gain),d})),super(c[0],c[c.length-1]),this.bands=c,this.bandsMap={};for(let f=0;f<this.bands.length;f++){let d=this.bands[f];f>0&&this.bands[f-1].connect(d),this.bandsMap[d.frequency.value]=d;}}setGain(i,t=0){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);at.setParamValue(this.bandsMap[i].gain,t);}getGain(i){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);return this.bandsMap[i].gain.value}set f32(i){this.setGain(j.F32,i);}get f32(){return this.getGain(j.F32)}set f64(i){this.setGain(j.F64,i);}get f64(){return this.getGain(j.F64)}set f125(i){this.setGain(j.F125,i);}get f125(){return this.getGain(j.F125)}set f250(i){this.setGain(j.F250,i);}get f250(){return this.getGain(j.F250)}set f500(i){this.setGain(j.F500,i);}get f500(){return this.getGain(j.F500)}set f1k(i){this.setGain(j.F1K,i);}get f1k(){return this.getGain(j.F1K)}set f2k(i){this.setGain(j.F2K,i);}get f2k(){return this.getGain(j.F2K)}set f4k(i){this.setGain(j.F4K,i);}get f4k(){return this.getGain(j.F4K)}set f8k(i){this.setGain(j.F8K,i);}get f8k(){return this.getGain(j.F8K)}set f16k(i){this.setGain(j.F16K,i);}get f16k(){return this.getGain(j.F16K)}reset(){this.bands.forEach(i=>{at.setParamValue(i.gain,0);});}destroy(){this.bands.forEach(i=>{i.disconnect();}),this.bands=null,this.bandsMap=null;}},Lt=j;Lt.F32=32;Lt.F64=64;Lt.F125=125;Lt.F250=250;Lt.F500=500;Lt.F1K=1e3;Lt.F2K=2e3;Lt.F4K=4e3;Lt.F8K=8e3;Lt.F16K=16e3;var Mo=class extends lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:r}=X().context;e=r.createChannelSplitter(),t=r.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var Ao=class extends lt{constructor(t=3,e=2,r=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=r,this._rebuild();}_clamp(t,e,r){return Math.min(r,Math.max(e,t))}get seconds(){return this._seconds}set seconds(t){this._seconds=this._clamp(t,1,50),this._rebuild();}get decay(){return this._decay}set decay(t){this._decay=this._clamp(t,0,100),this._rebuild();}get reverse(){return this._reverse}set reverse(t){this._reverse=t,this._rebuild();}_rebuild(){if(X().useLegacy)return;let{audioContext:t}=X().context,e=t.sampleRate,r=e*this._seconds,s=t.createBuffer(2,r,e),o=s.getChannelData(0),n=s.getChannelData(1),a;for(let l=0;l<r;l++)a=this._reverse?r-l:l,o[l]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay),n[l]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay);let h=t.createConvolver();h.buffer=s,this.init(h);}};var Eo=class extends lt{constructor(t=0){let e,r,s;if(!X().useLegacy){let{audioContext:o}=X().context;o.createStereoPanner?(e=o.createStereoPanner(),s=e):(r=o.createPanner(),r.panningModel="equalpower",s=r);}super(s),this._stereo=e,this._panner=r,this.pan=t;}set pan(t){this._pan=t,this._stereo?at.setParamValue(this._stereo.pan,t):this._panner&&this._panner.setPosition(t,0,1-Math.abs(t));}get pan(){return this._pan}destroy(){super.destroy(),this._stereo=null,this._panner=null;}};var Bo=class extends lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:r}=X().context;t=r.createMediaStreamDestination(),e=r.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var Fo=class extends lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:r}=X().context,s=r.createBiquadFilter(),o=r.createBiquadFilter(),n=r.createBiquadFilter(),a=r.createBiquadFilter();s.type="lowpass",at.setParamValue(s.frequency,2e3),o.type="lowpass",at.setParamValue(o.frequency,2e3),n.type="highpass",at.setParamValue(n.frequency,500),a.type="highpass",at.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};var Fi=class extends ${constructor(){super(...arguments),this.speed=1,this.muted=false,this.volume=1,this.paused=false;}refresh(){this.emit("refresh");}refreshPaused(){this.emit("refreshPaused");}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters");}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners();}};var P_=0,Ch=class extends ${constructor(i){super(),this.id=P_++,this.init(i);}set(i,t){if(this[i]===void 0)throw new Error(`Property with name ${i} does not exist.`);switch(i){case "speed":this.speed=t;break;case "volume":this.volume=t;break;case "paused":this.paused=t;break;case "loop":this.loop=t;break;case "muted":this.muted=t;break}return this}get progress(){let{currentTime:i}=this._source;return i/this._duration}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(i){this._playing=false,this._duration=i.source.duration;let t=this._source=i.source.cloneNode(false);t.src=i.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),i.context.on("refresh",this.refresh,this),i.context.on("refreshPaused",this.refreshPaused,this),this._media=i;}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause());}stop(){this._internalStop(),this._source&&this.emit("stop");}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(i){console.warn("HTML Audio does not support filters");}refresh(){let i=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=i.volume*(i.muted?0:1),r=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*r,this._source.playbackRate=this._speed*i.speed*t.speed;}refreshPaused(){let i=this._media.context,t=this._media.parent,e=this._paused||t.paused||i.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e));}play(i){let{start:t,end:e,speed:r,loop:s,volume:o,muted:n}=i;e&&console.assert(e>t,"End time is before start time"),this._speed=r,this._volume=o,this._loop=!!s,this._muted=n,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=false),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-Ch.PADDING),this._end=Math.min(this._end+Ch.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),ht.shared.add(this._onUpdate,this));},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start");}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete();}_onComplete(){ht.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){ht.shared.remove(this._onUpdate,this),this.removeAllListeners();let i=this._source;i&&(i.onended=null,i.onplay=null,i.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=false,this._end=null,this._start=0,this._duration=0,this._playing=false,this._pausedReal=false,this._paused=false,this._muted=false,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null);}toString(){return `[HTMLAudioInstance id=${this.id}]`}},Ro=Ch;Ro.PADDING=.1;var Ri=class extends ${init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new Ro(this)}get isPlayable(){return !!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters");}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null);}get source(){return this._source}load(t){let e=this._source,r=this.parent;if(e.readyState===4){r.isLoaded=true;let h=r.autoPlayStart();t&&setTimeout(()=>{t(null,r,h);},0);return}if(!r.url){t(new Error("sound.url or sound.source must be set"));return}e.src=r.url;let s=()=>{a(),r.isLoaded=true;let h=r.autoPlayStart();t&&t(null,r,h);},o=()=>{a(),t&&t(new Error("Sound loading has been aborted"));},n=()=>{a();let h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h);},a=()=>{e.removeEventListener("canplaythrough",s),e.removeEventListener("load",s),e.removeEventListener("abort",o),e.removeEventListener("error",n);};e.addEventListener("canplaythrough",s,false),e.addEventListener("load",s,false),e.addEventListener("abort",o,false),e.addEventListener("error",n,false),e.load();}};var ki=class{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time");}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null;}};var He=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],Mh=["audio/mpeg","audio/ogg"],Ve={};function Hm(i){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),r={},s=/^no$/;He.forEach(o=>{let n=e.canPlayType(`audio/${o}`).replace(s,""),a=t[o]?e.canPlayType(t[o]).replace(s,""):"";r[o]=!!n||!!a;}),Object.assign(Ve,r);}Hm();var M_=0,Ii=class extends ${constructor(t){super(),this.id=M_++,this._media=null,this._paused=false,this._muted=false,this._elapsed=0,this.init(t);}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case "speed":this.speed=e;break;case "volume":this.volume=e;break;case "muted":this.muted=e;break;case "loop":this.loop=e;break;case "paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"));}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(true);}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh();}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh();}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh();}get filters(){return this._filters}set filters(t){this._filters&&(this._filters?.filter(e=>e).forEach(e=>e.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t?.length?t.slice(0):null,this.refresh();}refresh(){if(!this._source)return;let t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;let r=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),o=this._volume*(this._muted?0:1);at.setParamValue(this._gain.gain,o*s*r),at.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters();}applyFilters(){if(this._filters?.length){this._source.disconnect();let t=this._source;this._filters.forEach(e=>{t.connect(e.destination),t=e;}),t.connect(this._gain);}}refreshPaused(){let t=this._media.context,e=this._media.parent,r=this._paused||e.paused||t.paused;r!==this._pausedReal&&(this._pausedReal=r,r?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",r));}play(t){let{start:e,end:r,speed:s,loop:o,volume:n,muted:a,filters:h}=t;r&&console.assert(r>e,"End time is before start time"),this._paused=false;let{source:l,gain:c}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=c,this._speed=s,this._volume=n,this._loop=!!o,this._muted=a,this._filters=h,this.refresh();let u=this._source.buffer.duration;this._duration=u,this._end=r,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=r,this._source.loopStart=e,this._source.start(0,e)):r?this._source.start(0,e,r-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){ht.shared.remove(this._updateListener,this),t&&ht.shared.add(this._updateListener,this);}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused();}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=false,this._elapsed=0,this._duration=0,this._paused=false,this._muted=false,this._pausedReal=false;}toString(){return `[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update();}_update(t=false){if(this._source){let e=this._now(),r=e-this._lastUpdate;if(r>0||t){let s=this._source.playbackRate.value;this._elapsed+=r*s,this._lastUpdate=e;let o=this._duration,n;if(this._source.loopStart){let a=this._source.loopEnd-this._source.loopStart;n=(this._source.loopStart+this._elapsed%a)/o;}else n=this._elapsed%o/o;this._progress=n,this.emit("progress",this._progress,o);}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this);}_internalStop(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null;}}_onComplete(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this);}};var Ne=class{constructor(t,e){this._output=e,this._input=t;}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect();}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(r=>{e===null?this._input.connect(r.destination):e.connect(r.destination),e=r;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var Vm=class extends Ne{constructor(i){let t=i.audioContext,e=t.createBufferSource(),r=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(r),r.connect(i.destination),super(s,r),this.context=i,this.bufferSource=e,this.gain=r,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(Vm.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null;}cloneBufferSource(){let i=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=i.buffer,at.setParamValue(t.playbackRate,i.playbackRate.value),t.loop=i.loop;let e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}},ko=Vm;ko.BUFFER_SIZE=0;var $e=class{init(t){this.parent=t,this._nodes=new ko(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source;}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null,this.source=null;}create(){return new Ii(this)}get context(){return this.parent.context}get isPlayable(){return !!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t;}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t;}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set");}async _loadUrl(t){let e=this.parent.url,r=await rt.get().fetch(e);this._decode(await r.arrayBuffer(),t);}_decode(t,e){let r=(s,o)=>{if(s)e&&e(s);else {this.parent.isLoaded=true,this.buffer=o;let n=this.parent.autoPlayStart();e&&e(null,this.parent,n);}};t instanceof AudioBuffer?r(null,t):this.parent.context.decode(t,r);}};var Cr=class{static from(i){let t={};typeof i=="string"?t.url=i:i instanceof ArrayBuffer||i instanceof AudioBuffer||i instanceof HTMLAudioElement?t.source=i:Array.isArray(i)?t.url=i:t=i,t={autoPlay:false,singleInstance:false,url:null,source:null,preload:false,volume:1,speed:1,complete:null,loaded:null,loop:false,...t},Object.freeze(t);let e=X().useLegacy?new Ri:new $e;return new Cr(e,t)}constructor(i,t){this.media=i,this.options=t,this._instances=[],this._sprites={},this.media.init(this);let e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=false,this._preloadQueue=null,this.isPlaying=false,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded);}preferUrl(i){let[t]=i.map(e=>({url:e,ext:Ct.extname(e).slice(1)})).filter(({ext:e})=>Ve[e]).sort((e,r)=>He.indexOf(e.ext)-He.indexOf(r.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return X().context}pause(){return this.isPlaying=false,this.paused=true,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=false,this}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get filters(){return this.media.filters}set filters(i){this.media.filters=i;}addSprites(i,t){if(typeof i=="object"){let r={};for(let s in i)r[s]=this.addSprites(s,i[s]);return r}console.assert(!this._sprites[i],`Alias ${i} is already taken`);let e=new ki(this,t);return this._sprites[i]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(i){if(i){let t=this._sprites[i];t!==void 0&&(t.destroy(),delete this._sprites[i]);}else for(let t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=false,this._autoPlayOptions=null,this;this.isPlaying=false;for(let i=this._instances.length-1;i>=0;i--)this._instances[i].stop();return this}play(i,t){let e;if(typeof i=="string"?e={sprite:i,loop:this.loop,complete:t}:typeof i=="function"?(e={},e.complete=i):e=i,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:false,loop:false,...e||{}},e.sprite){let s=e.sprite;console.assert(!!this._sprites[s],`Alias ${s} is not available`);let o=this._sprites[s];e.start=o.start+(e.start||0),e.end=o.end,e.speed=o.speed||1,e.loop=o.loop||e.loop,delete e.sprite;}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(s=>{this._preloadQueue.push(()=>{s(this.play(e));});}):(this._preloadQueue=[],this.autoPlay=true,this._autoPlayOptions=e,new Promise((s,o)=>{this._preload((n,a,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,n?o(n):(e.loaded&&e.loaded(n,a,h),s(h));});}));(this.singleInstance||e.singleInstance)&&this._removeInstances();let r=this._createInstance();return this._instances.push(r),this.isPlaying=true,r.once("end",()=>{e.complete&&e.complete(this),this._onComplete(r);}),r.once("stop",()=>{this._onComplete(r);}),r.play(e),r}refresh(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refresh();}refreshPaused(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}_preload(i){this.media.load(i);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let i;return this.autoPlay&&(i=this.play(this._autoPlayOptions)),i}_removeInstances(){for(let i=this._instances.length-1;i>=0;i--)this._poolInstance(this._instances[i]);this._instances.length=0;}_onComplete(i){if(this._instances){let t=this._instances.indexOf(i);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(i);}_createInstance(){if(Cr._pool.length>0){let i=Cr._pool.pop();return i.init(this.media),i}return this.media.create()}_poolInstance(i){i.destroy(),Cr._pool.indexOf(i)<0&&Cr._pool.push(i);}},ve=Cr;ve._pool=[];var Mr=class i extends Ne{constructor(){let t=window,e=new i.AudioContext,r=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(r),r.connect(e.destination),super(s,r),this.autoPause=true,this._ctx=e,this._offlineCtx=new i.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=r,this.analyser=s,this.events=new $,this.volume=1,this.speed=1,this.muted=false,this.paused=false,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,true),document.addEventListener("touchstart",this._unlock,true),document.addEventListener("touchend",this._unlock,true)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur);}onFocus(){if(!this.autoPause)return;let t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused());}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=true,this.refreshPaused()));}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,true),document.removeEventListener("touchend",this._unlock,true),document.removeEventListener("touchstart",this._unlock,true),this._locked=false));}playEmptySound(){let t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume();}static get AudioContext(){let t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){let t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();let t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null;}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t;}get paused(){return this._paused}refresh(){this.events.emit("refresh");}refreshPaused(){this.events.emit("refreshPaused");}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){let r=o=>{e(new Error(o?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,o=>{e(null,o);},r);s&&s.catch(r);}};var Io=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new Mr),this._htmlAudioContext=new Fi,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t);}get supported(){return Mr.AudioContext!==null}add(t,e){if(typeof t=="object"){let o={};for(let n in t){let a=this._getOptions(t[n],e);o[n]=this.add(n,a);}return o}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof ve)return this._sounds[t]=e,e;let r=this._getOptions(e),s=ve.from(r);return this._sounds[t]=s,s}_getOptions(t,e){let r;return typeof t=="string"?r={url:t}:Array.isArray(t)?r={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?r={source:t}:r=t,r={...r,...e||{}},r}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext;}get disableAutoPause(){return !this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t;}remove(t){return this.exists(t,true),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh();}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh();}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=true,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=false,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=true,this._context.refresh(),this}unmuteAll(){return this._context.muted=false,this._context.refresh(),this}removeAll(){for(let t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(let t in this._sounds)this._sounds[t].stop();return this}exists(t,e=false){let r=!!this._sounds[t];return e&&console.assert(r,`No sound matching alias '${t}'.`),r}isPlaying(){for(let t in this._sounds)if(this._sounds[t].isPlaying)return true;return false}find(t){return this.exists(t,true),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){let r=this.find(t);return e!==void 0&&(r.volume=e),r.volume}speed(t,e){let r=this.find(t);return e!==void 0&&(r.speed=e),r.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}};var Nm=i=>{let t=i.src,e=i?.alias?.[0];return (!e||i.src===e)&&(e=Ct.basename(t,Ct.extname(t))),e},$m={extension:S.Asset,detection:{test:async()=>true,add:async i=>[...i,...He.filter(t=>Ve[t])],remove:async i=>i.filter(t=>i.includes(t))},loader:{name:"sound",extension:{type:[S.LoadParser],priority:Qe.High},test(i){let t=Ct.extname(i).slice(1);return !!Ve[t]||Mh.some(e=>i.startsWith(`data:${e}`))},async load(i,t){let e=await new Promise((r,s)=>ve.from({...t.data,url:i,preload:true,loaded(o,n){o?s(o):r(n),t.data?.loaded?.(o,n);}}));return X().add(Nm(t),e),e},async unload(i,t){X().remove(Nm(t));}}};G.add($m);Wm(new Io);({DistortionFilter:te.DistortionFilter,EqualizerFilter:te.EqualizerFilter,MonoFilter:te.MonoFilter,ReverbFilter:te.ReverbFilter,StereoFilter:te.StereoFilter,StreamFilter:te.StreamFilter,TelephoneFilter:te.TelephoneFilter});var Ar="Container";var Ym="Sprite",Xm="Text";var gt;(s=>(s.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),s.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),s.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),s.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(gt||={});var Er=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Km=new Set,Ah=typeof process=="object"&&process?process:{},qm=(i,t,e,r)=>{typeof Ah.emitWarning=="function"?Ah.emitWarning(i,t,e,r):console.error(`[${e}] ${t}: ${i}`);},Go=globalThis.AbortController,jm=globalThis.AbortSignal;if(typeof Go>"u"){jm=class{onabort;_onabort=[];reason;aborted=false;addEventListener(r,s){this._onabort.push(s);}},Go=class{constructor(){t();}signal=new jm;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=true;for(let s of this.signal._onabort)s(r);this.signal.onabort?.(r);}}};let i=Ah.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{i&&(i=false,qm("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var B_=i=>!Km.has(i),Te=i=>i&&i===Math.floor(i)&&i>0&&isFinite(i),Zm=i=>Te(i)?i<=Math.pow(2,8)?Uint8Array:i<=Math.pow(2,16)?Uint16Array:i<=Math.pow(2,32)?Uint32Array:i<=Number.MAX_SAFE_INTEGER?Br:null:null,Br=class extends Array{constructor(t){super(t),this.fill(0);}},Eh=class i{heap;length;static#h=false;static create(t){let e=Zm(t);if(!e)return [];i.#h=true;let r=new i(t,e);return i.#h=false,r}constructor(t,e){if(!i.#h)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},Do=class i{#h;#u;#m;#M;#g;#F;#R;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#s;#x;#i;#r;#t;#l;#d;#a;#o;#_;#n;#y;#b;#f;#v;#C;#c;#k;static unsafeExposeInternals(t){return {starts:t.#b,ttls:t.#f,sizes:t.#y,keyMap:t.#i,keyList:t.#r,valList:t.#t,next:t.#l,prev:t.#d,get head(){return t.#a},get tail(){return t.#o},free:t.#_,isBackgroundFetch:e=>t.#e(e),backgroundFetch:(e,r,s,o)=>t.#D(e,r,s,o),moveToTail:e=>t.#B(e),indexes:e=>t.#T(e),rindexes:e=>t.#S(e),isStale:e=>t.#p(e)}}get max(){return this.#h}get maxSize(){return this.#u}get calculatedSize(){return this.#x}get size(){return this.#s}get fetchMethod(){return this.#F}get memoMethod(){return this.#R}get dispose(){return this.#m}get onInsert(){return this.#M}get disposeAfter(){return this.#g}constructor(t){let{max:e=0,ttl:r,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:h,dispose:l,onInsert:c,disposeAfter:u,noDisposeOnSet:f,noUpdateTTL:d,maxSize:m=0,maxEntrySize:x=0,sizeCalculation:g,fetchMethod:_,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:P,allowStaleOnFetchAbort:T,ignoreFetchAbort:w}=t;if(e!==0&&!Te(e))throw new TypeError("max option must be a nonnegative integer");let E=e?Zm(e):Array;if(!E)throw new Error("invalid max value: "+e);if(this.#h=e,this.#u=m,this.maxEntrySize=x||this.#u,this.sizeCalculation=g,this.sizeCalculation){if(!this.#u&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#R=y,_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#F=_,this.#C=!!_,this.#i=new Map,this.#r=new Array(e).fill(void 0),this.#t=new Array(e).fill(void 0),this.#l=new E(e),this.#d=new E(e),this.#a=0,this.#o=0,this.#_=Eh.create(e),this.#s=0,this.#x=0,typeof l=="function"&&(this.#m=l),typeof c=="function"&&(this.#M=c),typeof u=="function"?(this.#g=u,this.#n=[]):(this.#g=void 0,this.#n=void 0),this.#v=!!this.#m,this.#k=!!this.#M,this.#c=!!this.#g,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!P,this.allowStaleOnFetchAbort=!!T,this.ignoreFetchAbort=!!w,this.maxEntrySize!==0){if(this.#u!==0&&!Te(this.#u))throw new TypeError("maxSize must be a positive integer if specified");if(!Te(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#V();}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=Te(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!Te(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#U();}if(this.#h===0&&this.ttl===0&&this.#u===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#h&&!this.#u){let B="LRU_CACHE_UNBOUNDED";B_(B)&&(Km.add(B),qm("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",B,i));}}getRemainingTTL(t){return this.#i.has(t)?1/0:0}#U(){let t=new Br(this.#h),e=new Br(this.#h);this.#f=t,this.#b=e,this.#L=(o,n,a=Er.now())=>{if(e[o]=n!==0?a:0,t[o]=n,n!==0&&this.ttlAutopurge){let h=setTimeout(()=>{this.#p(o)&&this.#w(this.#r[o],"expire");},n+1);h.unref&&h.unref();}},this.#A=o=>{e[o]=t[o]!==0?Er.now():0;},this.#P=(o,n)=>{if(t[n]){let a=t[n],h=e[n];if(!a||!h)return;o.ttl=a,o.start=h,o.now=r||s();let l=o.now-h;o.remainingTTL=a-l;}};let r=0,s=()=>{let o=Er.now();if(this.ttlResolution>0){r=o;let n=setTimeout(()=>r=0,this.ttlResolution);n.unref&&n.unref();}return o};this.getRemainingTTL=o=>{let n=this.#i.get(o);if(n===void 0)return 0;let a=t[n],h=e[n];if(!a||!h)return 1/0;let l=(r||s())-h;return a-l},this.#p=o=>{let n=e[o],a=t[o];return !!a&&!!n&&(r||s())-n>a};}#A=()=>{};#P=()=>{};#L=()=>{};#p=()=>false;#V(){let t=new Br(this.#h);this.#x=0,this.#y=t,this.#E=e=>{this.#x-=t[e],t[e]=0;},this.#O=(e,r,s,o)=>{if(this.#e(r))return 0;if(!Te(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(r,e),!Te(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#I=(e,r,s)=>{if(t[e]=r,this.#u){let o=this.#u-t[e];for(;this.#x>o;)this.#G(true);}this.#x+=t[e],s&&(s.entrySize=r,s.totalCalculatedSize=this.#x);};}#E=t=>{};#I=(t,e,r)=>{};#O=(t,e,r,s)=>{if(r||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#T({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#o;!(!this.#z(e)||((t||!this.#p(e))&&(yield e),e===this.#a));)e=this.#d[e];}*#S({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#a;!(!this.#z(e)||((t||!this.#p(e))&&(yield e),e===this.#o));)e=this.#l[e];}#z(t){return t!==void 0&&this.#i.get(this.#r[t])===t}*entries(){for(let t of this.#T())this.#t[t]!==void 0&&this.#r[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#r[t],this.#t[t]]);}*rentries(){for(let t of this.#S())this.#t[t]!==void 0&&this.#r[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#r[t],this.#t[t]]);}*keys(){for(let t of this.#T()){let e=this.#r[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*rkeys(){for(let t of this.#S()){let e=this.#r[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*values(){for(let t of this.#T())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}*rvalues(){for(let t of this.#S())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let r of this.#T()){let s=this.#t[r],o=this.#e(s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,this.#r[r],this))return this.get(this.#r[r],e)}}forEach(t,e=this){for(let r of this.#T()){let s=this.#t[r],o=this.#e(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,this.#r[r],this);}}rforEach(t,e=this){for(let r of this.#S()){let s=this.#t[r],o=this.#e(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,this.#r[r],this);}}purgeStale(){let t=false;for(let e of this.#S({allowStale:true}))this.#p(e)&&(this.#w(this.#r[e],"expire"),t=true);return t}info(t){let e=this.#i.get(t);if(e===void 0)return;let r=this.#t[e],s=this.#e(r)?r.__staleWhileFetching:r;if(s===void 0)return;let o={value:s};if(this.#f&&this.#b){let n=this.#f[e],a=this.#b[e];if(n&&a){let h=n-(Er.now()-a);o.ttl=h,o.start=Date.now();}}return this.#y&&(o.size=this.#y[e]),o}dump(){let t=[];for(let e of this.#T({allowStale:true})){let r=this.#r[e],s=this.#t[e],o=this.#e(s)?s.__staleWhileFetching:s;if(o===void 0||r===void 0)continue;let n={value:o};if(this.#f&&this.#b){n.ttl=this.#f[e];let a=Er.now()-this.#b[e];n.start=Math.floor(Date.now()-a);}this.#y&&(n.size=this.#y[e]),t.unshift([r,n]);}return t}load(t){this.clear();for(let[e,r]of t){if(r.start){let s=Date.now()-r.start;r.start=Er.now()-s;}this.set(e,r.value,r);}}set(t,e,r={}){if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:h}=r,{noUpdateTTL:l=this.noUpdateTTL}=r,c=this.#O(t,e,r.size||0,a);if(this.maxEntrySize&&c>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),this.#w(t,"set"),this;let u=this.#s===0?void 0:this.#i.get(t);if(u===void 0)u=this.#s===0?this.#o:this.#_.length!==0?this.#_.pop():this.#s===this.#h?this.#G(false):this.#s,this.#r[u]=t,this.#t[u]=e,this.#i.set(t,u),this.#l[this.#o]=u,this.#d[u]=this.#o,this.#o=u,this.#s++,this.#I(u,c,h),h&&(h.set="add"),l=false,this.#k&&this.#M?.(e,t,"add");else {this.#B(u);let f=this.#t[u];if(e!==f){if(this.#C&&this.#e(f)){f.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=f;d!==void 0&&!n&&(this.#v&&this.#m?.(d,t,"set"),this.#c&&this.#n?.push([d,t,"set"]));}else n||(this.#v&&this.#m?.(f,t,"set"),this.#c&&this.#n?.push([f,t,"set"]));if(this.#E(u),this.#I(u,c,h),this.#t[u]=e,h){h.set="replace";let d=f&&this.#e(f)?f.__staleWhileFetching:f;d!==void 0&&(h.oldValue=d);}}else h&&(h.set="update");this.#k&&this.onInsert?.(e,t,e===f?"update":"replace");}if(s!==0&&!this.#f&&this.#U(),this.#f&&(l||this.#L(u,s,o),h&&this.#P(h,u)),!n&&this.#c&&this.#n){let f=this.#n,d;for(;d=f?.shift();)this.#g?.(...d);}return this}pop(){try{for(;this.#s;){let t=this.#t[this.#a];if(this.#G(!0),this.#e(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#c&&this.#n){let t=this.#n,e;for(;e=t?.shift();)this.#g?.(...e);}}}#G(t){let e=this.#a,r=this.#r[e],s=this.#t[e];return this.#C&&this.#e(s)?s.__abortController.abort(new Error("evicted")):(this.#v||this.#c)&&(this.#v&&this.#m?.(s,r,"evict"),this.#c&&this.#n?.push([s,r,"evict"])),this.#E(e),t&&(this.#r[e]=void 0,this.#t[e]=void 0,this.#_.push(e)),this.#s===1?(this.#a=this.#o=0,this.#_.length=0):this.#a=this.#l[e],this.#i.delete(r),this.#s--,e}has(t,e={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:s}=e,o=this.#i.get(t);if(o!==void 0){let n=this.#t[o];if(this.#e(n)&&n.__staleWhileFetching===void 0)return false;if(this.#p(o))s&&(s.has="stale",this.#P(s,o));else return r&&this.#A(o),s&&(s.has="hit",this.#P(s,o)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:r=this.allowStale}=e,s=this.#i.get(t);if(s===void 0||!r&&this.#p(s))return;let o=this.#t[s];return this.#e(o)?o.__staleWhileFetching:o}#D(t,e,r,s){let o=e===void 0?void 0:this.#t[e];if(this.#e(o))return o;let n=new Go,{signal:a}=r;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let h={signal:n.signal,options:r,context:s},l=(x,g=false)=>{let{aborted:_}=n.signal,y=r.ignoreFetchAbort&&x!==void 0;if(r.status&&(_&&!g?(r.status.fetchAborted=true,r.status.fetchError=n.signal.reason,y&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),_&&!y&&!g)return u(n.signal.reason);let v=d;return this.#t[e]===d&&(x===void 0?v.__staleWhileFetching?this.#t[e]=v.__staleWhileFetching:this.#w(t,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(t,x,h.options))),x},c=x=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=x),u(x)),u=x=>{let{aborted:g}=n.signal,_=g&&r.allowStaleOnFetchAbort,y=_||r.allowStaleOnFetchRejection,v=y||r.noDeleteOnFetchRejection,b=d;if(this.#t[e]===d&&(!v||b.__staleWhileFetching===void 0?this.#w(t,"fetch"):_||(this.#t[e]=b.__staleWhileFetching)),y)return r.status&&b.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),b.__staleWhileFetching;if(b.__returned===b)throw x},f=(x,g)=>{let _=this.#F?.(t,o,h);_&&_ instanceof Promise&&_.then(y=>x(y===void 0?void 0:y),g),n.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(x(void 0),r.allowStaleOnFetchAbort&&(x=y=>l(y,true)));});};r.status&&(r.status.fetchDispatched=true);let d=new Promise(f).then(l,c),m=Object.assign(d,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return e===void 0?(this.set(t,m,{...h.options,status:void 0}),e=this.#i.get(t)):this.#t[e]=m,m}#e(t){if(!this.#C)return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Go}async fetch(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:x,forceRefresh:g=false,status:_,signal:y}=e;if(!this.#C)return _&&(_.fetch="get"),this.get(t,{allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:_});let v={allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:h,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:m,ignoreFetchAbort:d,status:_,signal:y},b=this.#i.get(t);if(b===void 0){_&&(_.fetch="miss");let P=this.#D(t,b,v,x);return P.__returned=P}else {let P=this.#t[b];if(this.#e(P)){let C=r&&P.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",C&&(_.returnedStale=true)),C?P.__staleWhileFetching:P.__returned=P}let T=this.#p(b);if(!g&&!T)return _&&(_.fetch="hit"),this.#B(b),s&&this.#A(b),_&&this.#P(_,b),P;let w=this.#D(t,b,v,x),B=w.__staleWhileFetching!==void 0&&r;return _&&(_.fetch=T?"stale":"refresh",B&&T&&(_.returnedStale=true)),B?w.__staleWhileFetching:w.__returned=w}}async forceFetch(t,e={}){let r=await this.fetch(t,e);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(t,e={}){let r=this.#R;if(!r)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...n}=e,a=this.get(t,n);if(!o&&a!==void 0)return a;let h=r(t,a,{options:n,context:s});return this.set(t,h,n),h}get(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=e,a=this.#i.get(t);if(a!==void 0){let h=this.#t[a],l=this.#e(h);return n&&this.#P(n,a),this.#p(a)?(n&&(n.get="stale"),l?(n&&r&&h.__staleWhileFetching!==void 0&&(n.returnedStale=true),r?h.__staleWhileFetching:void 0):(o||this.#w(t,"expire"),n&&r&&(n.returnedStale=true),r?h:void 0)):(n&&(n.get="hit"),l?h.__staleWhileFetching:(this.#B(a),s&&this.#A(a),h))}else n&&(n.get="miss");}#W(t,e){this.#d[e]=t,this.#l[t]=e;}#B(t){t!==this.#o&&(t===this.#a?this.#a=this.#l[t]:this.#W(this.#d[t],this.#l[t]),this.#W(this.#o,t),this.#o=t);}delete(t){return this.#w(t,"delete")}#w(t,e){let r=false;if(this.#s!==0){let s=this.#i.get(t);if(s!==void 0)if(r=true,this.#s===1)this.#H(e);else {this.#E(s);let o=this.#t[s];if(this.#e(o)?o.__abortController.abort(new Error("deleted")):(this.#v||this.#c)&&(this.#v&&this.#m?.(o,t,e),this.#c&&this.#n?.push([o,t,e])),this.#i.delete(t),this.#r[s]=void 0,this.#t[s]=void 0,s===this.#o)this.#o=this.#d[s];else if(s===this.#a)this.#a=this.#l[s];else {let n=this.#d[s];this.#l[n]=this.#l[s];let a=this.#l[s];this.#d[a]=this.#d[s];}this.#s--,this.#_.push(s);}}if(this.#c&&this.#n?.length){let s=this.#n,o;for(;o=s?.shift();)this.#g?.(...o);}return r}clear(){return this.#H("delete")}#H(t){for(let e of this.#S({allowStale:true})){let r=this.#t[e];if(this.#e(r))r.__abortController.abort(new Error("deleted"));else {let s=this.#r[e];this.#v&&this.#m?.(r,s,t),this.#c&&this.#n?.push([r,s,t]);}}if(this.#i.clear(),this.#t.fill(void 0),this.#r.fill(void 0),this.#f&&this.#b&&(this.#f.fill(0),this.#b.fill(0)),this.#y&&this.#y.fill(0),this.#a=0,this.#o=0,this.#_.length=0,this.#x=0,this.#s=0,this.#c&&this.#n){let e=this.#n,r;for(;r=e?.shift();)this.#g?.(...r);}}};var Se=class{cache;map=new Map;constructor(t){this.cache=new Do({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}get entries(){return this.map.entries}get keys(){return this.map.keys}get values(){return this.map.values}};var Gi=new Se({cacheSize:5});var Qm;(s=>{function i(o,n){n||(n=o.name),Gi.get(n)&&gt.warn(`CanvasElement "${n}" already registered`),o.prototype.pixivnId=n,Gi.set(n,o);}s.add=i;function t(o){try{let n=Gi.get(o);if(!n){gt.error(`CanvasElement "${o}" not found, did you forget to register it with the canvasComponentDecorator?`);return}return new n,n}catch(n){gt.error(`Error while getting CanvasElement "${o}"`,n);return}}s.get=t;function e(){return Array.from(Gi.values())}s.values=e;function r(o){return Gi.has(o)}s.has=r;})(Qm||={});var Uo=Qm;var Fr=new Se({cacheSize:5});var Jm;(o=>{function i(n,a){a||(a=n.name),Fr.get(a)&&gt.info(`Event "${a}" already exists, it will be overwritten`),n.prototype.id=a,Fr.set(a,n);}o.add=i;function t(n){try{let a=Fr.get(n);if(!a){gt.error(`Event "${n}" not found, did you forget to register it with the eventDecorator?`);return}return new a,a}catch(a){gt.error(`Error while getting Event "${n}"`,a);return}}o.get=t;function e(n){try{let a=Fr.get(n);if(!a){gt.error(`Event "${n}" not found, did you forget to register it with the eventDecorator?`);return}return new a}catch(a){gt.error(`Error while getting Event "${n}"`,a);return}}o.getInstance=e;function r(){return Array.from(Fr.values())}o.values=r;function s(n){return Fr.has(n)}o.has=s;})(Jm||={});var tg=Jm;async function eg(i){let t=F_(i.pixivnId);if(t)await t.setMemory(i);else throw new Error("[Pixi\u2019VN] The element "+i.pixivnId+" could not be created");return t}function F_(i){try{let t=Uo.get(i);return t?new t:void 0}catch(t){gt.error(`Error while getting CanvasElement ${i}`,t);return}}function R_(i){return "memory"in i?i.memory:i instanceof Bi?G_(i):i instanceof pe?I_(i):Di(i)}function k_(i){return {width:i.width,height:i.height,isRenderGroup:i.isRenderGroup,blendMode:i.blendMode,tint:i.tint,alpha:i.alpha,angle:i.angle,renderable:i.renderable,rotation:i.rotation,scale:{x:i.scale.x,y:i.scale.y},pivot:{x:i.pivot.x,y:i.pivot.y},position:{x:i.position.x,y:i.position.y},skew:{x:i.skew.x,y:i.skew.y},visible:i.visible,x:i.x,y:i.y,boundsArea:i.boundsArea,cursor:i.cursor,eventMode:i.eventMode,interactive:i.interactive,interactiveChildren:i.interactiveChildren,hitArea:i.hitArea}}function rg(i,t){return {url:i.source.label,alias:t===i.source.label?void 0:t}}function Di(i,t){let e=D_(i,Ar),s=t?.childrenExport||false?i.children.sort((o,n)=>i.getChildIndex(o)-i.getChildIndex(n)).map(o=>R_(o)):[];return {pixivnId:e,elements:s,...k_(i)}}function I_(i){let t=Di(i),e=t.pixivnId??Ym,r=sg(i),s="textureAlias"in i?rg(i.texture,i.textureAlias):rg(i.texture);return {...t,pixivnId:e,textureData:s,anchor:{x:i.anchor.x,y:i.anchor.y},roundPixels:i.roundPixels,onEvents:r}}function G_(i){let t=Di(i),e=t.pixivnId??Xm,r=sg(i);return {...t,pixivnId:e,anchor:{x:i.anchor.x,y:i.anchor.y},text:i.text,resolution:i.resolution,style:U_(i.style),roundPixels:i.roundPixels,onEvents:r}}function D_(i,t){return Object.prototype.hasOwnProperty.call(i,"pixivnId")?i.pixivnId:t}function sg(i){return "onEvents"in i?i.onEvents:{}}function ig(i,t){if(typeof i!="object"||i===null)return i;gt.warn(`Unsupported property type for Text.style.${t}: FillGradient or FillPattern.`,i);}function U_(i){return {align:i.align,breakWords:i.breakWords,dropShadow:i.dropShadow,fill:ig(i.stroke,"fill"),fontFamily:i.fontFamily,fontSize:i.fontSize,fontStyle:i.fontStyle,fontVariant:i.fontVariant,fontWeight:i.fontWeight,leading:i.leading,letterSpacing:i.letterSpacing,lineHeight:i.lineHeight,padding:i.padding,stroke:ig(i.stroke,"stroke"),textBaseline:i.textBaseline,trim:i.trim,whiteSpace:i.whiteSpace,wordWrap:i.wordWrap,wordWrapWidth:i.wordWrapWidth}}var Lo=class extends Pt{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||Ar;}pixivnId=Ar;get memory(){return Di(this,{childrenExport:true})}set memory(t){}async setMemory(t){return this.memory=t,await this.importChildren(t),await L_(this,t)}async importChildren(t){for(let e=0;e<t.elements.length;e++){let r=t.elements[e],s=await eg(r);this.addChild(s);}}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let r=e.prototype.id,s=tg.getInstance(r);return this._onEvents[t]=r,s?super.on(t,()=>{s.fn(t,this);}):gt.error(`Event ${r} not found`),this}on(t,e,r){return super.on(t,e,r)}};Uo.add(Lo,Ar);async function L_(i,t,e){let r=e?.ignoreScale||false,s=e?.end;"isRenderGroup"in t&&t.isRenderGroup!==void 0&&(i.isRenderGroup=t.isRenderGroup),"blendMode"in t&&t.blendMode!==void 0&&(i.blendMode=t.blendMode),"tint"in t&&t.tint!==void 0&&(i.tint=t.tint),"alpha"in t&&t.alpha!==void 0&&(i.alpha=t.alpha),"angle"in t&&t.angle!==void 0&&(i.angle=t.angle),"renderable"in t&&t.renderable!==void 0&&(i.renderable=t.renderable),"rotation"in t&&t.rotation!==void 0&&(i.rotation=t.rotation),!r&&"scale"in t&&t.scale!==void 0&&(typeof t.scale=="number"?i.scale.set(t.scale,t.scale):i.scale.set(t.scale.x,t.scale.y)),"pivot"in t&&t.pivot!==void 0&&(typeof t.pivot=="number"?i.pivot.set(t.pivot,t.pivot):i.pivot.set(t.pivot.x,t.pivot.y)),"position"in t&&t.position!==void 0&&i.position.set(t.position.x,t.position.y),"skew"in t&&t.skew!==void 0&&i.skew.set(t.skew.x,t.skew.y),"visible"in t&&t.visible!==void 0&&(i.visible=t.visible),"x"in t&&t.x!==void 0&&(i.x=t.x),"y"in t&&t.y!==void 0&&(i.y=t.y),"boundsArea"in t&&t.boundsArea!==void 0&&(i.boundsArea=t.boundsArea),"cursor"in t&&t.cursor!==void 0&&(i.cursor=t.cursor),"eventMode"in t&&t.eventMode!==void 0&&(i.eventMode=t.eventMode),"interactive"in t&&t.interactive!==void 0&&(i.interactive=t.interactive),"interactiveChildren"in t&&t.interactiveChildren!==void 0&&(i.interactiveChildren=t.interactiveChildren),"hitArea"in t&&t.hitArea!==void 0&&(i.hitArea=t.hitArea),s&&await s(),r||("width"in t&&t.width!==void 0&&(i.width=t.width),"height"in t&&t.height!==void 0&&(i.height=t.height));}export{Lo as default,L_ as setMemoryContainer};
569
+ `}};});var vh,Th,To,fm=p(()=>{Q();Rs();lm();Us();hi();xe();pt();dm();To=class extends Qt{constructor(){vh??(vh=ar({name:"tiling-sprite-shader",bits:[Pi,cm,lr]})),Th??(Th=hr({name:"tiling-sprite-shader",bits:[hm,um,cr]}));let t=new St({uMapCoord:{value:new M,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new M,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Th,gpuProgram:vh,resources:{localUniforms:new St({uTransformMatrix:{value:new M,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:k.EMPTY.source,uSampler:k.EMPTY.source.style}});}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,h=n.width,l=n.height,c=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(r.a*h/t,r.b*h/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),u.invert(),a.uniforms.uMapCoord=c.mapCoord,a.uniforms.uClampFrame=c.uClampFrame,a.uniforms.uClampOffset=c.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style);}};});var So,pm=p(()=>{vo();So=class extends Pr{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])});}};});function mm(i,t){let e=i.anchor.x,r=i.anchor.y;t[0]=-e*i.width,t[1]=-r*i.height,t[2]=(1-e)*i.width,t[3]=-r*i.height,t[4]=(1-e)*i.width,t[5]=(1-r)*i.height,t[6]=-e*i.width,t[7]=(1-r)*i.height;}var gm=p(()=>{});function xm(i,t,e,r){let s=0,o=i.length/(t),n=r.a,a=r.b,h=r.c,l=r.d,c=r.tx,u=r.ty;for(e*=t;s<o;){let f=i[e],d=i[e+1];i[e]=n*f+h*d+c,i[e+1]=a*f+l*d+u,e+=t,s++;}}var _m=p(()=>{});function ym(i,t){let e=i.texture,r=e.frame.width,s=e.frame.height,o=0,n=0;i.applyAnchorToTexture&&(o=i.anchor.x,n=i.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=M.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),xm(t,2,0,a);}var bm=p(()=>{Q();_m();});var wo,Ci,vm=p(()=>{R();si();Xs();ai();di();js();vo();fm();pm();gm();bm();wo=new So,Ci=class{constructor(t){this._state=Oe.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash");}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return !o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new ye);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e);}else r.break(e),s.shader||(s.shader=new To),this.updateRenderable(t),e.add(t);}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,_e(t.groupColorAlpha,r.uColor,0),this._state.blendMode=oe(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:wo,shader:e,state:this._state});}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s);}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture);}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new Pr({indices:wo.indices,positions:wo.positions.slice(),uvs:wo.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:true,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),ym(t,r.uvs),mm(t,r.positions);}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null;}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=true;return this._renderer.type===Zt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};Ci.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"tilingSprite"};});var Sh=p(()=>{R();vm();G.add(Ci);});var Tm,wm,Pm=p(()=>{st();vo();Tm=class Sm extends Pr{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(I(L,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e);}build(t){t={...Sm.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 e=this.verticesX*this.verticesY,r=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,h=this.width/n,l=this.height/a;for(let u=0;u<e;u++){let f=u%this.verticesX,d=u/this.verticesX|0;r.push(f*h,d*l),s.push(f/n,d/a);}let c=n*a;for(let u=0;u<c;u++){let f=u%n,d=u/n|0,m=d*this.verticesX+f,x=d*this.verticesX+f+1,g=(d+1)*this.verticesX+f,_=(d+1)*this.verticesX+f+1;o.push(m,x,g,x,_,g);}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update();}};Tm.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};wm=Tm;});var Cm,Am,Em=p(()=>{Pm();Cm=class Mm extends wm{constructor(t={}){t={...Mm.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t);}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions();}updatePositions(){let t=this.positions,{width:e,height:r,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:h,_anchorY:l}=this,c=s+o,u=e>c?1:e/c,f=n+a,d=r>f?1:r/f,m=Math.min(u,d),x=h*e,g=l*r;t[0]=t[8]=t[16]=t[24]=-x,t[2]=t[10]=t[18]=t[26]=s*m-x,t[4]=t[12]=t[20]=t[28]=e-o*m-x,t[6]=t[14]=t[22]=t[30]=e-x,t[1]=t[3]=t[5]=t[7]=-g,t[9]=t[11]=t[13]=t[15]=n*m-g,t[17]=t[19]=t[21]=t[23]=r-a*m-g,t[25]=t[27]=t[29]=t[31]=r-g,this.getBuffer("aPosition").update();}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update();}};Cm.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};Am=Cm;});var Mi,Bm=p(()=>{R();Gt();js();Em();Mi=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash");}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e);}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e);}validateRenderable(t){let e=this._getGpuSprite(t);return !e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];W.return(e.geometry),W.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture);}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=W.get(ye);return e.geometry=W.get(Am),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null;}};Mi.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"nineSliceSprite"};});var wh=p(()=>{R();Bm();G.add(Mi);});var Ai,Fm=p(()=>{R();Ai=class{constructor(t){this._renderer=t;}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:false,action:"pushFilter",container:e,filterEffect:t});}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:false});}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop();}destroy(){this._renderer=null;}};Ai.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"filter"};});function Rm(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds));}return t.matrix=e,t}var km=p(()=>{});var v_,Ei,Im=p(()=>{R();Q();zt();ii();ni();xe();pt();je();ai();Wt();km();_t();v_=new qt({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Ei=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new St({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new Dt({}),this.renderer=t;}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){s.skip=true;return}let o=s.bounds;if(t.renderables?Rm(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(true,o),t.container){let m=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;m&&o.applyMatrix(m);}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,h=0,l=true,c=false,u=false,f=true;for(let d=0;d<r.length;d++){let m=r[d];if(a=Math.min(a,m.resolution==="inherit"?n._resolution:m.resolution),h+=m.padding,m.antialias==="off"?l=false:m.antialias==="inherit"&&l&&(l=n.antialias),m.clipToViewport||(f=false),!!!(m.compatibleRenderers&e.type)){u=false;break}if(m.blendRequired&&!(e.backBuffer?.useBackBuffer??true)){O("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=false;break}u=m.enabled||u,c||(c=m.blendRequired);}if(!u){s.skip=true;return}if(f){let d=e.renderTarget.rootViewPort,m=e.renderTarget.renderTarget.resolution;o.fitBounds(0,d.width/m,0,d.height/m);}if(o.scale(a).ceil().scale(1/a).pad(h|0),!o.isPositive){s.skip=true;return}s.skip=false,s.bounds=o,s.blendRequired=c,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=yt.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,true),e.globalUniforms.push({offset:o});}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let r=e.inputTexture,s=e.bounds,o=k.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,h=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(h,s,a);}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,r,e.previousRenderSurface,false),yt.returnTexture(r);else {let a=e.inputTexture,h=yt.getOptimalTexture(s.width,s.height,a.source._resolution,false),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,h,true);let u=a;a=h,h=u;}n[l].apply(this,a,e.previousRenderSurface,false),yt.returnTexture(a),yt.returnTexture(h);}e.blendRequired&&yt.returnTexture(o);}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=yt.getOptimalTexture(e.width,e.height,s,false),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let h=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:h,height:l},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,h=V.shared,c=n.previousRenderSurface===r,u=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,f=this._filterStackIndex-1;for(;f>0&&this._filterStack[f].skip;)--f;f>0&&(u=this._filterStack[f].inputTexture.source._resolution);let d=this._filterGlobalUniforms,m=d.uniforms,x=m.uOutputFrame,g=m.uInputSize,_=m.uInputPixel,y=m.uInputClamp,v=m.uGlobalFrame,b=m.uOutputTexture;if(c){let w=this._filterStackIndex;for(;w>0;){w--;let E=this._filterStack[this._filterStackIndex-1];if(!E.skip){h.x=E.bounds.minX,h.y=E.bounds.minY;break}}x[0]=a.minX-h.x,x[1]=a.minY-h.y;}else x[0]=0,x[1]=0;x[2]=e.frame.width,x[3]=e.frame.height,g[0]=e.source.width,g[1]=e.source.height,g[2]=1/g[0],g[3]=1/g[1],_[0]=e.source.pixelWidth,_[1]=e.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],y[0]=.5*_[2],y[1]=.5*_[3],y[2]=e.frame.width*g[2]-.5*_[2],y[3]=e.frame.height*g[3]-.5*_[3];let P=this.renderer.renderTarget.rootRenderTarget.colorTexture;v[0]=h.x*u,v[1]=h.y*u,v[2]=P.source.width*u,v[3]=P.source.height*u;let T=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof k?(b[0]=r.frame.width,b[1]=r.frame.height):(b[0]=T.width,b[1]=T.height),b[2]=T.isRoot?-1:1,d.update(),o.renderPipes.uniformBatch){let w=o.renderPipes.uniformBatch.getUboResource(d);this._globalFilterBindGroup.setResource(w,0);}else this._globalFilterBindGroup.setResource(d,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:v_,shader:t,state:t._state,topology:"triangle-list"}),o.type===Zt.WEBGL&&o.renderTarget.finishRenderPass();}_getFilterData(){return {skip:false,inputTexture:null,bounds:new et,container:null,filterEffect:null,blendRequired:false,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(M.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}};Ei.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"filter"};});var Ph=p(()=>{R();Fm();Im();G.add(Ei);G.add(Ai);});var T_={};var Gm=p(()=>{gc();wn();wc();Cc();fs();ys();Ga();Da();za();ch();xh();bh();Sh();wh();Ph();});var S_={};var Um=p(()=>{wn();fs();ys();Ga();Da();za();ch();xh();bh();Sh();wh();Ph();});R();var Dm={extension:{type:S.Environment,name:"browser",priority:-1},test:()=>true,load:async()=>{await Promise.resolve().then(()=>(Gm(),T_));}};R();var Lm={extension:{type:S.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(Um(),S_));}};R();R();ys();fs();Vi();st();us();var Po=class extends de{constructor(t,e){let{text:r,resolution:s,style:o,anchor:n,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=true,this._resolution=null,this._autoResolution=true,this._didTextUpdate=true,this._styleClass=e,this.text=r??"",this.style=o,this.resolution=s??null,this.allowChildren=false,this._anchor=new dt({_onUpdate:()=>{this.onViewUpdate();}}),n&&(this.anchor=n),this.roundPixels=l??false,a!==void 0&&(this.width=a),h!==void 0&&(this.height=h);}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t);}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate());}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate();}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate();}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width);}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height);}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height);}containsPoint(t){let e=this.bounds.width,r=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-r*this.anchor.y,t.y>=o&&t.y<=o+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=true),super.onViewUpdate();}_getKey(){return `${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=false){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null;}};function Om(i,t){let e=i[0]??{};return (typeof e=="string"||i[1])&&(I(L,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}uo();vr();var Bi=class extends Po{constructor(...t){let e=Om(t,"Text");super(e,At),this.renderPipeId="text";}updateBounds(){let t=this._bounds,e=this._anchor,r=Ut.measureText(this._text,this._style),{width:s,height:o}=r;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o;}};Rn();Ht();Nn();Ke();Ln();Yr();Et();ds();zi(ba());G.add(Dm,Lm);var te={};fg(te,{DistortionFilter:()=>Co,EqualizerFilter:()=>Lt,Filter:()=>lt,MonoFilter:()=>Mo,ReverbFilter:()=>Ao,StereoFilter:()=>Eo,StreamFilter:()=>Bo,TelephoneFilter:()=>Fo});var zm;function Wm(i){return zm=i,i}function X(){return zm}var lt=class{constructor(t,e){this.init(t,e);}init(t,e){this.destination=t,this.source=e||t;}connect(t){this.source?.connect(t);}disconnect(){this.source?.disconnect();}destroy(){this.disconnect(),this.destination=null,this.source=null;}};var Co=class extends lt{constructor(t=0){let e;if(!X().useLegacy){let{audioContext:r}=X().context;e=r.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,X().useLegacy)return;let e=t*1e3,r=44100,s=new Float32Array(r),o=Math.PI/180,n=0,a;for(;n<r;++n)a=n*2/r-1,s[n]=(3+e)*a*20*o/(Math.PI+e*Math.abs(a));this._distortion.curve=s,this._distortion.oversample="4x";}get amount(){return this._amount}destroy(){this._distortion=null,super.destroy();}};var at=class{static setParamValue(t,e){if(t.setValueAtTime){let r=X().context;t.setValueAtTime(e,r.audioContext.currentTime);}else t.value=e;return e}};var j=class extends lt{constructor(i=0,t=0,e=0,r=0,s=0,o=0,n=0,a=0,h=0,l=0){let c=[],u=[{f:j.F32,type:"lowshelf",gain:i},{f:j.F64,type:"peaking",gain:t},{f:j.F125,type:"peaking",gain:e},{f:j.F250,type:"peaking",gain:r},{f:j.F500,type:"peaking",gain:s},{f:j.F1K,type:"peaking",gain:o},{f:j.F2K,type:"peaking",gain:n},{f:j.F4K,type:"peaking",gain:a},{f:j.F8K,type:"peaking",gain:h},{f:j.F16K,type:"highshelf",gain:l}];X().useLegacy||(c=u.map(f=>{let d=X().context.audioContext.createBiquadFilter();return d.type=f.type,at.setParamValue(d.Q,1),d.frequency.value=f.f,at.setParamValue(d.gain,f.gain),d})),super(c[0],c[c.length-1]),this.bands=c,this.bandsMap={};for(let f=0;f<this.bands.length;f++){let d=this.bands[f];f>0&&this.bands[f-1].connect(d),this.bandsMap[d.frequency.value]=d;}}setGain(i,t=0){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);at.setParamValue(this.bandsMap[i].gain,t);}getGain(i){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);return this.bandsMap[i].gain.value}set f32(i){this.setGain(j.F32,i);}get f32(){return this.getGain(j.F32)}set f64(i){this.setGain(j.F64,i);}get f64(){return this.getGain(j.F64)}set f125(i){this.setGain(j.F125,i);}get f125(){return this.getGain(j.F125)}set f250(i){this.setGain(j.F250,i);}get f250(){return this.getGain(j.F250)}set f500(i){this.setGain(j.F500,i);}get f500(){return this.getGain(j.F500)}set f1k(i){this.setGain(j.F1K,i);}get f1k(){return this.getGain(j.F1K)}set f2k(i){this.setGain(j.F2K,i);}get f2k(){return this.getGain(j.F2K)}set f4k(i){this.setGain(j.F4K,i);}get f4k(){return this.getGain(j.F4K)}set f8k(i){this.setGain(j.F8K,i);}get f8k(){return this.getGain(j.F8K)}set f16k(i){this.setGain(j.F16K,i);}get f16k(){return this.getGain(j.F16K)}reset(){this.bands.forEach(i=>{at.setParamValue(i.gain,0);});}destroy(){this.bands.forEach(i=>{i.disconnect();}),this.bands=null,this.bandsMap=null;}},Lt=j;Lt.F32=32;Lt.F64=64;Lt.F125=125;Lt.F250=250;Lt.F500=500;Lt.F1K=1e3;Lt.F2K=2e3;Lt.F4K=4e3;Lt.F8K=8e3;Lt.F16K=16e3;var Mo=class extends lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:r}=X().context;e=r.createChannelSplitter(),t=r.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var Ao=class extends lt{constructor(t=3,e=2,r=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=r,this._rebuild();}_clamp(t,e,r){return Math.min(r,Math.max(e,t))}get seconds(){return this._seconds}set seconds(t){this._seconds=this._clamp(t,1,50),this._rebuild();}get decay(){return this._decay}set decay(t){this._decay=this._clamp(t,0,100),this._rebuild();}get reverse(){return this._reverse}set reverse(t){this._reverse=t,this._rebuild();}_rebuild(){if(X().useLegacy)return;let{audioContext:t}=X().context,e=t.sampleRate,r=e*this._seconds,s=t.createBuffer(2,r,e),o=s.getChannelData(0),n=s.getChannelData(1),a;for(let l=0;l<r;l++)a=this._reverse?r-l:l,o[l]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay),n[l]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay);let h=t.createConvolver();h.buffer=s,this.init(h);}};var Eo=class extends lt{constructor(t=0){let e,r,s;if(!X().useLegacy){let{audioContext:o}=X().context;o.createStereoPanner?(e=o.createStereoPanner(),s=e):(r=o.createPanner(),r.panningModel="equalpower",s=r);}super(s),this._stereo=e,this._panner=r,this.pan=t;}set pan(t){this._pan=t,this._stereo?at.setParamValue(this._stereo.pan,t):this._panner&&this._panner.setPosition(t,0,1-Math.abs(t));}get pan(){return this._pan}destroy(){super.destroy(),this._stereo=null,this._panner=null;}};var Bo=class extends lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:r}=X().context;t=r.createMediaStreamDestination(),e=r.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var Fo=class extends lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:r}=X().context,s=r.createBiquadFilter(),o=r.createBiquadFilter(),n=r.createBiquadFilter(),a=r.createBiquadFilter();s.type="lowpass",at.setParamValue(s.frequency,2e3),o.type="lowpass",at.setParamValue(o.frequency,2e3),n.type="highpass",at.setParamValue(n.frequency,500),a.type="highpass",at.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};var Fi=class extends ${constructor(){super(...arguments),this.speed=1,this.muted=false,this.volume=1,this.paused=false;}refresh(){this.emit("refresh");}refreshPaused(){this.emit("refreshPaused");}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters");}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners();}};var P_=0,Ch=class extends ${constructor(i){super(),this.id=P_++,this.init(i);}set(i,t){if(this[i]===void 0)throw new Error(`Property with name ${i} does not exist.`);switch(i){case "speed":this.speed=t;break;case "volume":this.volume=t;break;case "paused":this.paused=t;break;case "loop":this.loop=t;break;case "muted":this.muted=t;break}return this}get progress(){let{currentTime:i}=this._source;return i/this._duration}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(i){this._playing=false,this._duration=i.source.duration;let t=this._source=i.source.cloneNode(false);t.src=i.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),i.context.on("refresh",this.refresh,this),i.context.on("refreshPaused",this.refreshPaused,this),this._media=i;}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause());}stop(){this._internalStop(),this._source&&this.emit("stop");}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(i){console.warn("HTML Audio does not support filters");}refresh(){let i=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=i.volume*(i.muted?0:1),r=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*r,this._source.playbackRate=this._speed*i.speed*t.speed;}refreshPaused(){let i=this._media.context,t=this._media.parent,e=this._paused||t.paused||i.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e));}play(i){let{start:t,end:e,speed:r,loop:s,volume:o,muted:n}=i;e&&console.assert(e>t,"End time is before start time"),this._speed=r,this._volume=o,this._loop=!!s,this._muted=n,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=false),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-Ch.PADDING),this._end=Math.min(this._end+Ch.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),ht.shared.add(this._onUpdate,this));},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start");}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete();}_onComplete(){ht.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){ht.shared.remove(this._onUpdate,this),this.removeAllListeners();let i=this._source;i&&(i.onended=null,i.onplay=null,i.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=false,this._end=null,this._start=0,this._duration=0,this._playing=false,this._pausedReal=false,this._paused=false,this._muted=false,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null);}toString(){return `[HTMLAudioInstance id=${this.id}]`}},Ro=Ch;Ro.PADDING=.1;var Ri=class extends ${init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new Ro(this)}get isPlayable(){return !!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters");}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null);}get source(){return this._source}load(t){let e=this._source,r=this.parent;if(e.readyState===4){r.isLoaded=true;let h=r.autoPlayStart();t&&setTimeout(()=>{t(null,r,h);},0);return}if(!r.url){t(new Error("sound.url or sound.source must be set"));return}e.src=r.url;let s=()=>{a(),r.isLoaded=true;let h=r.autoPlayStart();t&&t(null,r,h);},o=()=>{a(),t&&t(new Error("Sound loading has been aborted"));},n=()=>{a();let h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h);},a=()=>{e.removeEventListener("canplaythrough",s),e.removeEventListener("load",s),e.removeEventListener("abort",o),e.removeEventListener("error",n);};e.addEventListener("canplaythrough",s,false),e.addEventListener("load",s,false),e.addEventListener("abort",o,false),e.addEventListener("error",n,false),e.load();}};var ki=class{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time");}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null;}};var He=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],Mh=["audio/mpeg","audio/ogg"],Ve={};function Hm(i){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),r={},s=/^no$/;He.forEach(o=>{let n=e.canPlayType(`audio/${o}`).replace(s,""),a=t[o]?e.canPlayType(t[o]).replace(s,""):"";r[o]=!!n||!!a;}),Object.assign(Ve,r);}Hm();var M_=0,Ii=class extends ${constructor(t){super(),this.id=M_++,this._media=null,this._paused=false,this._muted=false,this._elapsed=0,this.init(t);}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case "speed":this.speed=e;break;case "volume":this.volume=e;break;case "muted":this.muted=e;break;case "loop":this.loop=e;break;case "paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"));}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(true);}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh();}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh();}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh();}get filters(){return this._filters}set filters(t){this._filters&&(this._filters?.filter(e=>e).forEach(e=>e.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t?.length?t.slice(0):null,this.refresh();}refresh(){if(!this._source)return;let t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;let r=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),o=this._volume*(this._muted?0:1);at.setParamValue(this._gain.gain,o*s*r),at.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters();}applyFilters(){if(this._filters?.length){this._source.disconnect();let t=this._source;this._filters.forEach(e=>{t.connect(e.destination),t=e;}),t.connect(this._gain);}}refreshPaused(){let t=this._media.context,e=this._media.parent,r=this._paused||e.paused||t.paused;r!==this._pausedReal&&(this._pausedReal=r,r?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",r));}play(t){let{start:e,end:r,speed:s,loop:o,volume:n,muted:a,filters:h}=t;r&&console.assert(r>e,"End time is before start time"),this._paused=false;let{source:l,gain:c}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=c,this._speed=s,this._volume=n,this._loop=!!o,this._muted=a,this._filters=h,this.refresh();let u=this._source.buffer.duration;this._duration=u,this._end=r,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=r,this._source.loopStart=e,this._source.start(0,e)):r?this._source.start(0,e,r-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){ht.shared.remove(this._updateListener,this),t&&ht.shared.add(this._updateListener,this);}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused();}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=false,this._elapsed=0,this._duration=0,this._paused=false,this._muted=false,this._pausedReal=false;}toString(){return `[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update();}_update(t=false){if(this._source){let e=this._now(),r=e-this._lastUpdate;if(r>0||t){let s=this._source.playbackRate.value;this._elapsed+=r*s,this._lastUpdate=e;let o=this._duration,n;if(this._source.loopStart){let a=this._source.loopEnd-this._source.loopStart;n=(this._source.loopStart+this._elapsed%a)/o;}else n=this._elapsed%o/o;this._progress=n,this.emit("progress",this._progress,o);}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this);}_internalStop(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null;}}_onComplete(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this);}};var Ne=class{constructor(t,e){this._output=e,this._input=t;}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect();}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(r=>{e===null?this._input.connect(r.destination):e.connect(r.destination),e=r;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var Vm=class extends Ne{constructor(i){let t=i.audioContext,e=t.createBufferSource(),r=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(r),r.connect(i.destination),super(s,r),this.context=i,this.bufferSource=e,this.gain=r,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(Vm.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null;}cloneBufferSource(){let i=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=i.buffer,at.setParamValue(t.playbackRate,i.playbackRate.value),t.loop=i.loop;let e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}},ko=Vm;ko.BUFFER_SIZE=0;var $e=class{init(t){this.parent=t,this._nodes=new ko(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source;}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null,this.source=null;}create(){return new Ii(this)}get context(){return this.parent.context}get isPlayable(){return !!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t;}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t;}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set");}async _loadUrl(t){let e=this.parent.url,r=await rt.get().fetch(e);this._decode(await r.arrayBuffer(),t);}_decode(t,e){let r=(s,o)=>{if(s)e&&e(s);else {this.parent.isLoaded=true,this.buffer=o;let n=this.parent.autoPlayStart();e&&e(null,this.parent,n);}};t instanceof AudioBuffer?r(null,t):this.parent.context.decode(t,r);}};var Cr=class{static from(i){let t={};typeof i=="string"?t.url=i:i instanceof ArrayBuffer||i instanceof AudioBuffer||i instanceof HTMLAudioElement?t.source=i:Array.isArray(i)?t.url=i:t=i,t={autoPlay:false,singleInstance:false,url:null,source:null,preload:false,volume:1,speed:1,complete:null,loaded:null,loop:false,...t},Object.freeze(t);let e=X().useLegacy?new Ri:new $e;return new Cr(e,t)}constructor(i,t){this.media=i,this.options=t,this._instances=[],this._sprites={},this.media.init(this);let e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=false,this._preloadQueue=null,this.isPlaying=false,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded);}preferUrl(i){let[t]=i.map(e=>({url:e,ext:Ct.extname(e).slice(1)})).filter(({ext:e})=>Ve[e]).sort((e,r)=>He.indexOf(e.ext)-He.indexOf(r.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return X().context}pause(){return this.isPlaying=false,this.paused=true,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=false,this}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get filters(){return this.media.filters}set filters(i){this.media.filters=i;}addSprites(i,t){if(typeof i=="object"){let r={};for(let s in i)r[s]=this.addSprites(s,i[s]);return r}console.assert(!this._sprites[i],`Alias ${i} is already taken`);let e=new ki(this,t);return this._sprites[i]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(i){if(i){let t=this._sprites[i];t!==void 0&&(t.destroy(),delete this._sprites[i]);}else for(let t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=false,this._autoPlayOptions=null,this;this.isPlaying=false;for(let i=this._instances.length-1;i>=0;i--)this._instances[i].stop();return this}play(i,t){let e;if(typeof i=="string"?e={sprite:i,loop:this.loop,complete:t}:typeof i=="function"?(e={},e.complete=i):e=i,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:false,loop:false,...e||{}},e.sprite){let s=e.sprite;console.assert(!!this._sprites[s],`Alias ${s} is not available`);let o=this._sprites[s];e.start=o.start+(e.start||0),e.end=o.end,e.speed=o.speed||1,e.loop=o.loop||e.loop,delete e.sprite;}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(s=>{this._preloadQueue.push(()=>{s(this.play(e));});}):(this._preloadQueue=[],this.autoPlay=true,this._autoPlayOptions=e,new Promise((s,o)=>{this._preload((n,a,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,n?o(n):(e.loaded&&e.loaded(n,a,h),s(h));});}));(this.singleInstance||e.singleInstance)&&this._removeInstances();let r=this._createInstance();return this._instances.push(r),this.isPlaying=true,r.once("end",()=>{e.complete&&e.complete(this),this._onComplete(r);}),r.once("stop",()=>{this._onComplete(r);}),r.play(e),r}refresh(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refresh();}refreshPaused(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}_preload(i){this.media.load(i);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let i;return this.autoPlay&&(i=this.play(this._autoPlayOptions)),i}_removeInstances(){for(let i=this._instances.length-1;i>=0;i--)this._poolInstance(this._instances[i]);this._instances.length=0;}_onComplete(i){if(this._instances){let t=this._instances.indexOf(i);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(i);}_createInstance(){if(Cr._pool.length>0){let i=Cr._pool.pop();return i.init(this.media),i}return this.media.create()}_poolInstance(i){i.destroy(),Cr._pool.indexOf(i)<0&&Cr._pool.push(i);}},ve=Cr;ve._pool=[];var Mr=class i extends Ne{constructor(){let t=window,e=new i.AudioContext,r=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(r),r.connect(e.destination),super(s,r),this.autoPause=true,this._ctx=e,this._offlineCtx=new i.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=r,this.analyser=s,this.events=new $,this.volume=1,this.speed=1,this.muted=false,this.paused=false,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,true),document.addEventListener("touchstart",this._unlock,true),document.addEventListener("touchend",this._unlock,true)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur);}onFocus(){if(!this.autoPause)return;let t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused());}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=true,this.refreshPaused()));}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,true),document.removeEventListener("touchend",this._unlock,true),document.removeEventListener("touchstart",this._unlock,true),this._locked=false));}playEmptySound(){let t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume();}static get AudioContext(){let t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){let t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();let t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null;}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t;}get paused(){return this._paused}refresh(){this.events.emit("refresh");}refreshPaused(){this.events.emit("refreshPaused");}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){let r=o=>{e(new Error(o?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,o=>{e(null,o);},r);s&&s.catch(r);}};var Io=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new Mr),this._htmlAudioContext=new Fi,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t);}get supported(){return Mr.AudioContext!==null}add(t,e){if(typeof t=="object"){let o={};for(let n in t){let a=this._getOptions(t[n],e);o[n]=this.add(n,a);}return o}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof ve)return this._sounds[t]=e,e;let r=this._getOptions(e),s=ve.from(r);return this._sounds[t]=s,s}_getOptions(t,e){let r;return typeof t=="string"?r={url:t}:Array.isArray(t)?r={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?r={source:t}:r=t,r={...r,...e||{}},r}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext;}get disableAutoPause(){return !this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t;}remove(t){return this.exists(t,true),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh();}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh();}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=true,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=false,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=true,this._context.refresh(),this}unmuteAll(){return this._context.muted=false,this._context.refresh(),this}removeAll(){for(let t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(let t in this._sounds)this._sounds[t].stop();return this}exists(t,e=false){let r=!!this._sounds[t];return e&&console.assert(r,`No sound matching alias '${t}'.`),r}isPlaying(){for(let t in this._sounds)if(this._sounds[t].isPlaying)return true;return false}find(t){return this.exists(t,true),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){let r=this.find(t);return e!==void 0&&(r.volume=e),r.volume}speed(t,e){let r=this.find(t);return e!==void 0&&(r.speed=e),r.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}};var Nm=i=>{let t=i.src,e=i?.alias?.[0];return (!e||i.src===e)&&(e=Ct.basename(t,Ct.extname(t))),e},$m={extension:S.Asset,detection:{test:async()=>true,add:async i=>[...i,...He.filter(t=>Ve[t])],remove:async i=>i.filter(t=>i.includes(t))},loader:{name:"sound",extension:{type:[S.LoadParser],priority:Qe.High},test(i){let t=Ct.extname(i).slice(1);return !!Ve[t]||Mh.some(e=>i.startsWith(`data:${e}`))},async load(i,t){let e=await new Promise((r,s)=>ve.from({...t.data,url:i,preload:true,loaded(o,n){o?s(o):r(n),t.data?.loaded?.(o,n);}}));return X().add(Nm(t),e),e},async unload(i,t){X().remove(Nm(t));}}};G.add($m);Wm(new Io);({DistortionFilter:te.DistortionFilter,EqualizerFilter:te.EqualizerFilter,MonoFilter:te.MonoFilter,ReverbFilter:te.ReverbFilter,StereoFilter:te.StereoFilter,StreamFilter:te.StreamFilter,TelephoneFilter:te.TelephoneFilter});var Ar="Container";var Ym="Sprite",Xm="Text";var gt;(s=>(s.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),s.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),s.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),s.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(gt||={});var Er=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Km=new Set,Ah=typeof process=="object"&&process?process:{},qm=(i,t,e,r)=>{typeof Ah.emitWarning=="function"?Ah.emitWarning(i,t,e,r):console.error(`[${e}] ${t}: ${i}`);},Go=globalThis.AbortController,jm=globalThis.AbortSignal;if(typeof Go>"u"){jm=class{onabort;_onabort=[];reason;aborted=false;addEventListener(r,s){this._onabort.push(s);}},Go=class{constructor(){t();}signal=new jm;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=true;for(let s of this.signal._onabort)s(r);this.signal.onabort?.(r);}}};let i=Ah.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{i&&(i=false,qm("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var B_=i=>!Km.has(i),Te=i=>i&&i===Math.floor(i)&&i>0&&isFinite(i),Zm=i=>Te(i)?i<=Math.pow(2,8)?Uint8Array:i<=Math.pow(2,16)?Uint16Array:i<=Math.pow(2,32)?Uint32Array:i<=Number.MAX_SAFE_INTEGER?Br:null:null,Br=class extends Array{constructor(t){super(t),this.fill(0);}},Eh=class i{heap;length;static#h=false;static create(t){let e=Zm(t);if(!e)return [];i.#h=true;let r=new i(t,e);return i.#h=false,r}constructor(t,e){if(!i.#h)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},Do=class i{#h;#u;#m;#M;#g;#F;#R;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#s;#x;#i;#r;#t;#l;#d;#a;#o;#_;#n;#y;#b;#f;#v;#C;#c;#k;static unsafeExposeInternals(t){return {starts:t.#b,ttls:t.#f,sizes:t.#y,keyMap:t.#i,keyList:t.#r,valList:t.#t,next:t.#l,prev:t.#d,get head(){return t.#a},get tail(){return t.#o},free:t.#_,isBackgroundFetch:e=>t.#e(e),backgroundFetch:(e,r,s,o)=>t.#D(e,r,s,o),moveToTail:e=>t.#B(e),indexes:e=>t.#T(e),rindexes:e=>t.#S(e),isStale:e=>t.#p(e)}}get max(){return this.#h}get maxSize(){return this.#u}get calculatedSize(){return this.#x}get size(){return this.#s}get fetchMethod(){return this.#F}get memoMethod(){return this.#R}get dispose(){return this.#m}get onInsert(){return this.#M}get disposeAfter(){return this.#g}constructor(t){let{max:e=0,ttl:r,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:h,dispose:l,onInsert:c,disposeAfter:u,noDisposeOnSet:f,noUpdateTTL:d,maxSize:m=0,maxEntrySize:x=0,sizeCalculation:g,fetchMethod:_,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:P,allowStaleOnFetchAbort:T,ignoreFetchAbort:w}=t;if(e!==0&&!Te(e))throw new TypeError("max option must be a nonnegative integer");let E=e?Zm(e):Array;if(!E)throw new Error("invalid max value: "+e);if(this.#h=e,this.#u=m,this.maxEntrySize=x||this.#u,this.sizeCalculation=g,this.sizeCalculation){if(!this.#u&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#R=y,_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#F=_,this.#C=!!_,this.#i=new Map,this.#r=new Array(e).fill(void 0),this.#t=new Array(e).fill(void 0),this.#l=new E(e),this.#d=new E(e),this.#a=0,this.#o=0,this.#_=Eh.create(e),this.#s=0,this.#x=0,typeof l=="function"&&(this.#m=l),typeof c=="function"&&(this.#M=c),typeof u=="function"?(this.#g=u,this.#n=[]):(this.#g=void 0,this.#n=void 0),this.#v=!!this.#m,this.#k=!!this.#M,this.#c=!!this.#g,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!P,this.allowStaleOnFetchAbort=!!T,this.ignoreFetchAbort=!!w,this.maxEntrySize!==0){if(this.#u!==0&&!Te(this.#u))throw new TypeError("maxSize must be a positive integer if specified");if(!Te(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#V();}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=Te(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!Te(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#U();}if(this.#h===0&&this.ttl===0&&this.#u===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#h&&!this.#u){let B="LRU_CACHE_UNBOUNDED";B_(B)&&(Km.add(B),qm("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",B,i));}}getRemainingTTL(t){return this.#i.has(t)?1/0:0}#U(){let t=new Br(this.#h),e=new Br(this.#h);this.#f=t,this.#b=e,this.#L=(o,n,a=Er.now())=>{if(e[o]=n!==0?a:0,t[o]=n,n!==0&&this.ttlAutopurge){let h=setTimeout(()=>{this.#p(o)&&this.#w(this.#r[o],"expire");},n+1);h.unref&&h.unref();}},this.#A=o=>{e[o]=t[o]!==0?Er.now():0;},this.#P=(o,n)=>{if(t[n]){let a=t[n],h=e[n];if(!a||!h)return;o.ttl=a,o.start=h,o.now=r||s();let l=o.now-h;o.remainingTTL=a-l;}};let r=0,s=()=>{let o=Er.now();if(this.ttlResolution>0){r=o;let n=setTimeout(()=>r=0,this.ttlResolution);n.unref&&n.unref();}return o};this.getRemainingTTL=o=>{let n=this.#i.get(o);if(n===void 0)return 0;let a=t[n],h=e[n];if(!a||!h)return 1/0;let l=(r||s())-h;return a-l},this.#p=o=>{let n=e[o],a=t[o];return !!a&&!!n&&(r||s())-n>a};}#A=()=>{};#P=()=>{};#L=()=>{};#p=()=>false;#V(){let t=new Br(this.#h);this.#x=0,this.#y=t,this.#E=e=>{this.#x-=t[e],t[e]=0;},this.#O=(e,r,s,o)=>{if(this.#e(r))return 0;if(!Te(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(r,e),!Te(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#I=(e,r,s)=>{if(t[e]=r,this.#u){let o=this.#u-t[e];for(;this.#x>o;)this.#G(true);}this.#x+=t[e],s&&(s.entrySize=r,s.totalCalculatedSize=this.#x);};}#E=t=>{};#I=(t,e,r)=>{};#O=(t,e,r,s)=>{if(r||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#T({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#o;!(!this.#z(e)||((t||!this.#p(e))&&(yield e),e===this.#a));)e=this.#d[e];}*#S({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#a;!(!this.#z(e)||((t||!this.#p(e))&&(yield e),e===this.#o));)e=this.#l[e];}#z(t){return t!==void 0&&this.#i.get(this.#r[t])===t}*entries(){for(let t of this.#T())this.#t[t]!==void 0&&this.#r[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#r[t],this.#t[t]]);}*rentries(){for(let t of this.#S())this.#t[t]!==void 0&&this.#r[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#r[t],this.#t[t]]);}*keys(){for(let t of this.#T()){let e=this.#r[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*rkeys(){for(let t of this.#S()){let e=this.#r[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*values(){for(let t of this.#T())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}*rvalues(){for(let t of this.#S())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let r of this.#T()){let s=this.#t[r],o=this.#e(s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,this.#r[r],this))return this.get(this.#r[r],e)}}forEach(t,e=this){for(let r of this.#T()){let s=this.#t[r],o=this.#e(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,this.#r[r],this);}}rforEach(t,e=this){for(let r of this.#S()){let s=this.#t[r],o=this.#e(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,this.#r[r],this);}}purgeStale(){let t=false;for(let e of this.#S({allowStale:true}))this.#p(e)&&(this.#w(this.#r[e],"expire"),t=true);return t}info(t){let e=this.#i.get(t);if(e===void 0)return;let r=this.#t[e],s=this.#e(r)?r.__staleWhileFetching:r;if(s===void 0)return;let o={value:s};if(this.#f&&this.#b){let n=this.#f[e],a=this.#b[e];if(n&&a){let h=n-(Er.now()-a);o.ttl=h,o.start=Date.now();}}return this.#y&&(o.size=this.#y[e]),o}dump(){let t=[];for(let e of this.#T({allowStale:true})){let r=this.#r[e],s=this.#t[e],o=this.#e(s)?s.__staleWhileFetching:s;if(o===void 0||r===void 0)continue;let n={value:o};if(this.#f&&this.#b){n.ttl=this.#f[e];let a=Er.now()-this.#b[e];n.start=Math.floor(Date.now()-a);}this.#y&&(n.size=this.#y[e]),t.unshift([r,n]);}return t}load(t){this.clear();for(let[e,r]of t){if(r.start){let s=Date.now()-r.start;r.start=Er.now()-s;}this.set(e,r.value,r);}}set(t,e,r={}){if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:h}=r,{noUpdateTTL:l=this.noUpdateTTL}=r,c=this.#O(t,e,r.size||0,a);if(this.maxEntrySize&&c>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),this.#w(t,"set"),this;let u=this.#s===0?void 0:this.#i.get(t);if(u===void 0)u=this.#s===0?this.#o:this.#_.length!==0?this.#_.pop():this.#s===this.#h?this.#G(false):this.#s,this.#r[u]=t,this.#t[u]=e,this.#i.set(t,u),this.#l[this.#o]=u,this.#d[u]=this.#o,this.#o=u,this.#s++,this.#I(u,c,h),h&&(h.set="add"),l=false,this.#k&&this.#M?.(e,t,"add");else {this.#B(u);let f=this.#t[u];if(e!==f){if(this.#C&&this.#e(f)){f.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=f;d!==void 0&&!n&&(this.#v&&this.#m?.(d,t,"set"),this.#c&&this.#n?.push([d,t,"set"]));}else n||(this.#v&&this.#m?.(f,t,"set"),this.#c&&this.#n?.push([f,t,"set"]));if(this.#E(u),this.#I(u,c,h),this.#t[u]=e,h){h.set="replace";let d=f&&this.#e(f)?f.__staleWhileFetching:f;d!==void 0&&(h.oldValue=d);}}else h&&(h.set="update");this.#k&&this.onInsert?.(e,t,e===f?"update":"replace");}if(s!==0&&!this.#f&&this.#U(),this.#f&&(l||this.#L(u,s,o),h&&this.#P(h,u)),!n&&this.#c&&this.#n){let f=this.#n,d;for(;d=f?.shift();)this.#g?.(...d);}return this}pop(){try{for(;this.#s;){let t=this.#t[this.#a];if(this.#G(!0),this.#e(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#c&&this.#n){let t=this.#n,e;for(;e=t?.shift();)this.#g?.(...e);}}}#G(t){let e=this.#a,r=this.#r[e],s=this.#t[e];return this.#C&&this.#e(s)?s.__abortController.abort(new Error("evicted")):(this.#v||this.#c)&&(this.#v&&this.#m?.(s,r,"evict"),this.#c&&this.#n?.push([s,r,"evict"])),this.#E(e),t&&(this.#r[e]=void 0,this.#t[e]=void 0,this.#_.push(e)),this.#s===1?(this.#a=this.#o=0,this.#_.length=0):this.#a=this.#l[e],this.#i.delete(r),this.#s--,e}has(t,e={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:s}=e,o=this.#i.get(t);if(o!==void 0){let n=this.#t[o];if(this.#e(n)&&n.__staleWhileFetching===void 0)return false;if(this.#p(o))s&&(s.has="stale",this.#P(s,o));else return r&&this.#A(o),s&&(s.has="hit",this.#P(s,o)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:r=this.allowStale}=e,s=this.#i.get(t);if(s===void 0||!r&&this.#p(s))return;let o=this.#t[s];return this.#e(o)?o.__staleWhileFetching:o}#D(t,e,r,s){let o=e===void 0?void 0:this.#t[e];if(this.#e(o))return o;let n=new Go,{signal:a}=r;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let h={signal:n.signal,options:r,context:s},l=(x,g=false)=>{let{aborted:_}=n.signal,y=r.ignoreFetchAbort&&x!==void 0;if(r.status&&(_&&!g?(r.status.fetchAborted=true,r.status.fetchError=n.signal.reason,y&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),_&&!y&&!g)return u(n.signal.reason);let v=d;return this.#t[e]===d&&(x===void 0?v.__staleWhileFetching?this.#t[e]=v.__staleWhileFetching:this.#w(t,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(t,x,h.options))),x},c=x=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=x),u(x)),u=x=>{let{aborted:g}=n.signal,_=g&&r.allowStaleOnFetchAbort,y=_||r.allowStaleOnFetchRejection,v=y||r.noDeleteOnFetchRejection,b=d;if(this.#t[e]===d&&(!v||b.__staleWhileFetching===void 0?this.#w(t,"fetch"):_||(this.#t[e]=b.__staleWhileFetching)),y)return r.status&&b.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),b.__staleWhileFetching;if(b.__returned===b)throw x},f=(x,g)=>{let _=this.#F?.(t,o,h);_&&_ instanceof Promise&&_.then(y=>x(y===void 0?void 0:y),g),n.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(x(void 0),r.allowStaleOnFetchAbort&&(x=y=>l(y,true)));});};r.status&&(r.status.fetchDispatched=true);let d=new Promise(f).then(l,c),m=Object.assign(d,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return e===void 0?(this.set(t,m,{...h.options,status:void 0}),e=this.#i.get(t)):this.#t[e]=m,m}#e(t){if(!this.#C)return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Go}async fetch(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:x,forceRefresh:g=false,status:_,signal:y}=e;if(!this.#C)return _&&(_.fetch="get"),this.get(t,{allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:_});let v={allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:h,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:m,ignoreFetchAbort:d,status:_,signal:y},b=this.#i.get(t);if(b===void 0){_&&(_.fetch="miss");let P=this.#D(t,b,v,x);return P.__returned=P}else {let P=this.#t[b];if(this.#e(P)){let C=r&&P.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",C&&(_.returnedStale=true)),C?P.__staleWhileFetching:P.__returned=P}let T=this.#p(b);if(!g&&!T)return _&&(_.fetch="hit"),this.#B(b),s&&this.#A(b),_&&this.#P(_,b),P;let w=this.#D(t,b,v,x),B=w.__staleWhileFetching!==void 0&&r;return _&&(_.fetch=T?"stale":"refresh",B&&T&&(_.returnedStale=true)),B?w.__staleWhileFetching:w.__returned=w}}async forceFetch(t,e={}){let r=await this.fetch(t,e);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(t,e={}){let r=this.#R;if(!r)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...n}=e,a=this.get(t,n);if(!o&&a!==void 0)return a;let h=r(t,a,{options:n,context:s});return this.set(t,h,n),h}get(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=e,a=this.#i.get(t);if(a!==void 0){let h=this.#t[a],l=this.#e(h);return n&&this.#P(n,a),this.#p(a)?(n&&(n.get="stale"),l?(n&&r&&h.__staleWhileFetching!==void 0&&(n.returnedStale=true),r?h.__staleWhileFetching:void 0):(o||this.#w(t,"expire"),n&&r&&(n.returnedStale=true),r?h:void 0)):(n&&(n.get="hit"),l?h.__staleWhileFetching:(this.#B(a),s&&this.#A(a),h))}else n&&(n.get="miss");}#W(t,e){this.#d[e]=t,this.#l[t]=e;}#B(t){t!==this.#o&&(t===this.#a?this.#a=this.#l[t]:this.#W(this.#d[t],this.#l[t]),this.#W(this.#o,t),this.#o=t);}delete(t){return this.#w(t,"delete")}#w(t,e){let r=false;if(this.#s!==0){let s=this.#i.get(t);if(s!==void 0)if(r=true,this.#s===1)this.#H(e);else {this.#E(s);let o=this.#t[s];if(this.#e(o)?o.__abortController.abort(new Error("deleted")):(this.#v||this.#c)&&(this.#v&&this.#m?.(o,t,e),this.#c&&this.#n?.push([o,t,e])),this.#i.delete(t),this.#r[s]=void 0,this.#t[s]=void 0,s===this.#o)this.#o=this.#d[s];else if(s===this.#a)this.#a=this.#l[s];else {let n=this.#d[s];this.#l[n]=this.#l[s];let a=this.#l[s];this.#d[a]=this.#d[s];}this.#s--,this.#_.push(s);}}if(this.#c&&this.#n?.length){let s=this.#n,o;for(;o=s?.shift();)this.#g?.(...o);}return r}clear(){return this.#H("delete")}#H(t){for(let e of this.#S({allowStale:true})){let r=this.#t[e];if(this.#e(r))r.__abortController.abort(new Error("deleted"));else {let s=this.#r[e];this.#v&&this.#m?.(r,s,t),this.#c&&this.#n?.push([r,s,t]);}}if(this.#i.clear(),this.#t.fill(void 0),this.#r.fill(void 0),this.#f&&this.#b&&(this.#f.fill(0),this.#b.fill(0)),this.#y&&this.#y.fill(0),this.#a=0,this.#o=0,this.#_.length=0,this.#x=0,this.#s=0,this.#c&&this.#n){let e=this.#n,r;for(;r=e?.shift();)this.#g?.(...r);}}};var Se=class{cache;map=new Map;constructor(t){this.cache=new Do({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}get entries(){return this.map.entries}keys(){return this.map.keys()}get values(){return this.map.values}};var Gi=new Se({cacheSize:5});var Qm;(s=>{function i(o,n){n||(n=o.name),Gi.get(n)&&gt.warn(`CanvasElement "${n}" already registered`),o.prototype.pixivnId=n,Gi.set(n,o);}s.add=i;function t(o){try{let n=Gi.get(o);if(!n){gt.error(`CanvasElement "${o}" not found, did you forget to register it with the canvasComponentDecorator?`);return}return new n,n}catch(n){gt.error(`Error while getting CanvasElement "${o}"`,n);return}}s.get=t;function e(){return Array.from(Gi.values())}s.values=e;function r(o){return Gi.has(o)}s.has=r;})(Qm||={});var Uo=Qm;var Fr=new Se({cacheSize:5});var Jm;(o=>{function i(n,a){a||(a=n.name),Fr.get(a)&&gt.info(`Event "${a}" already exists, it will be overwritten`),n.prototype.id=a,Fr.set(a,n);}o.add=i;function t(n){try{let a=Fr.get(n);if(!a){gt.error(`Event "${n}" not found, did you forget to register it with the eventDecorator?`);return}return new a,a}catch(a){gt.error(`Error while getting Event "${n}"`,a);return}}o.get=t;function e(n){try{let a=Fr.get(n);if(!a){gt.error(`Event "${n}" not found, did you forget to register it with the eventDecorator?`);return}return new a}catch(a){gt.error(`Error while getting Event "${n}"`,a);return}}o.getInstance=e;function r(){return Array.from(Fr.values())}o.values=r;function s(n){return Fr.has(n)}o.has=s;})(Jm||={});var tg=Jm;async function eg(i){let t=F_(i.pixivnId);if(t)await t.setMemory(i);else throw new Error("[Pixi\u2019VN] The element "+i.pixivnId+" could not be created");return t}function F_(i){try{let t=Uo.get(i);return t?new t:void 0}catch(t){gt.error(`Error while getting CanvasElement ${i}`,t);return}}function R_(i){return "memory"in i?i.memory:i instanceof Bi?G_(i):i instanceof pe?I_(i):Di(i)}function k_(i){return {width:i.width,height:i.height,isRenderGroup:i.isRenderGroup,blendMode:i.blendMode,tint:i.tint,alpha:i.alpha,angle:i.angle,renderable:i.renderable,rotation:i.rotation,scale:{x:i.scale.x,y:i.scale.y},pivot:{x:i.pivot.x,y:i.pivot.y},position:{x:i.position.x,y:i.position.y},skew:{x:i.skew.x,y:i.skew.y},visible:i.visible,x:i.x,y:i.y,boundsArea:i.boundsArea,cursor:i.cursor,eventMode:i.eventMode,interactive:i.interactive,interactiveChildren:i.interactiveChildren,hitArea:i.hitArea}}function rg(i,t){return {url:i.source.label,alias:t===i.source.label?void 0:t}}function Di(i,t){let e=D_(i,Ar),s=t?.childrenExport||false?i.children.sort((o,n)=>i.getChildIndex(o)-i.getChildIndex(n)).map(o=>R_(o)):[];return {pixivnId:e,elements:s,...k_(i)}}function I_(i){let t=Di(i),e=t.pixivnId??Ym,r=sg(i),s="textureAlias"in i?rg(i.texture,i.textureAlias):rg(i.texture);return {...t,pixivnId:e,textureData:s,anchor:{x:i.anchor.x,y:i.anchor.y},roundPixels:i.roundPixels,onEvents:r}}function G_(i){let t=Di(i),e=t.pixivnId??Xm,r=sg(i);return {...t,pixivnId:e,anchor:{x:i.anchor.x,y:i.anchor.y},text:i.text,resolution:i.resolution,style:U_(i.style),roundPixels:i.roundPixels,onEvents:r}}function D_(i,t){return Object.prototype.hasOwnProperty.call(i,"pixivnId")?i.pixivnId:t}function sg(i){return "onEvents"in i?i.onEvents:{}}function ig(i,t){if(typeof i!="object"||i===null)return i;gt.warn(`Unsupported property type for Text.style.${t}: FillGradient or FillPattern.`,i);}function U_(i){return {align:i.align,breakWords:i.breakWords,dropShadow:i.dropShadow,fill:ig(i.stroke,"fill"),fontFamily:i.fontFamily,fontSize:i.fontSize,fontStyle:i.fontStyle,fontVariant:i.fontVariant,fontWeight:i.fontWeight,leading:i.leading,letterSpacing:i.letterSpacing,lineHeight:i.lineHeight,padding:i.padding,stroke:ig(i.stroke,"stroke"),textBaseline:i.textBaseline,trim:i.trim,whiteSpace:i.whiteSpace,wordWrap:i.wordWrap,wordWrapWidth:i.wordWrapWidth}}var Lo=class extends Pt{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||Ar;}pixivnId=Ar;get memory(){return Di(this,{childrenExport:true})}set memory(t){}async setMemory(t){return this.memory=t,await this.importChildren(t),await L_(this,t)}async importChildren(t){for(let e=0;e<t.elements.length;e++){let r=t.elements[e],s=await eg(r);this.addChild(s);}}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let r=e.prototype.id,s=tg.getInstance(r);return this._onEvents[t]=r,s?super.on(t,()=>{s.fn(t,this);}):gt.error(`Event ${r} not found`),this}on(t,e,r){return super.on(t,e,r)}};Uo.add(Lo,Ar);async function L_(i,t,e){let r=e?.ignoreScale||false,s=e?.end;"isRenderGroup"in t&&t.isRenderGroup!==void 0&&(i.isRenderGroup=t.isRenderGroup),"blendMode"in t&&t.blendMode!==void 0&&(i.blendMode=t.blendMode),"tint"in t&&t.tint!==void 0&&(i.tint=t.tint),"alpha"in t&&t.alpha!==void 0&&(i.alpha=t.alpha),"angle"in t&&t.angle!==void 0&&(i.angle=t.angle),"renderable"in t&&t.renderable!==void 0&&(i.renderable=t.renderable),"rotation"in t&&t.rotation!==void 0&&(i.rotation=t.rotation),!r&&"scale"in t&&t.scale!==void 0&&(typeof t.scale=="number"?i.scale.set(t.scale,t.scale):i.scale.set(t.scale.x,t.scale.y)),"pivot"in t&&t.pivot!==void 0&&(typeof t.pivot=="number"?i.pivot.set(t.pivot,t.pivot):i.pivot.set(t.pivot.x,t.pivot.y)),"position"in t&&t.position!==void 0&&i.position.set(t.position.x,t.position.y),"skew"in t&&t.skew!==void 0&&i.skew.set(t.skew.x,t.skew.y),"visible"in t&&t.visible!==void 0&&(i.visible=t.visible),"x"in t&&t.x!==void 0&&(i.x=t.x),"y"in t&&t.y!==void 0&&(i.y=t.y),"boundsArea"in t&&t.boundsArea!==void 0&&(i.boundsArea=t.boundsArea),"cursor"in t&&t.cursor!==void 0&&(i.cursor=t.cursor),"eventMode"in t&&t.eventMode!==void 0&&(i.eventMode=t.eventMode),"interactive"in t&&t.interactive!==void 0&&(i.interactive=t.interactive),"interactiveChildren"in t&&t.interactiveChildren!==void 0&&(i.interactiveChildren=t.interactiveChildren),"hitArea"in t&&t.hitArea!==void 0&&(i.hitArea=t.hitArea),s&&await s(),r||("width"in t&&t.width!==void 0&&(i.width=t.width),"height"in t&&t.height!==void 0&&(i.height=t.height));}export{Lo as default,L_ as setMemoryContainer};