@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
@@ -364,7 +364,7 @@ fn mainFragment(
364
364
  var sample = textureSample(uTexture, uSampler, uv) * color;
365
365
 
366
366
  return sample;
367
- }`;});var Bo,up=m(()=>{Bt();rt();no();lo();Fi();at();Qn();ap();lp();cp();Bo=class extends ne{constructor(){let t=yr.from({vertex:hp,fragment:np}),e=Ae.from({fragment:{source:Sh,entryPoint:"mainFragment"},vertex:{source:Sh,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:I.WHITE.source,uSampler:new Is({}),uniforms:{uTranslationMatrix:{value:new C,type:"mat3x3<f32>"},uColor:{value:new V(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}});}};});var Er,Ph=m(()=>{rt();Ce();Ci();Ao();Di();op();up();Er=class{constructor(t,e){this.state=Ze.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new Ct({uTranslationMatrix:{value:new C,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new Bo,this.state=Ze.for2d();}validateRenderable(t){return false}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t);}getBuffers(t){return this._gpuBufferHash[t.uid]||this._initBuffer(t)}_initBuffer(t){return this._gpuBufferHash[t.uid]=new Eo({size:t.particleChildren.length,properties:t._properties}),t.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[t.uid]}updateRenderable(t){}destroyRenderable(t){this._gpuBufferHash[t.uid].destroy(),this._gpuBufferHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}execute(t){let e=t.particleChildren;if(e.length===0)return;let i=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=false,o.blendMode=me(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(i.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=i.globalUniforms.globalUniformData.resolution,n.uRound=i._roundPixels|t._roundPixels,Ee(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t);}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null);}};});var Oi,dp=m(()=>{A();tp();Ph();Oi=class extends Er{constructor(t){super(t,new Co);}};Oi.extension={type:[T.WebGLPipes],name:"particle"};});var Io,fp=m(()=>{Io=class{execute(t,e){let i=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,true),s.groups[1]=i.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);i.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6});}};});var zi,pp=m(()=>{A();fp();Ph();zi=class extends Er{constructor(t){super(t,new Io);}};zi.extension={type:[T.WebGPUPipes],name:"particle"};});var Ah=m(()=>{A();dp();pp();R.add(Oi);R.add(zi);});var Br,Mh=m(()=>{Br=class{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=true,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null;}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null;}};});function Wi(r,t){let{texture:e,bounds:i}=r;Ys(i,t._anchor,e);let s=t._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s;}var Ch=m(()=>{va();});var Hi,mp=m(()=>{A();Wt();Mh();Ch();Hi=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText");}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate());}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.currentKey!==i}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e);}updateRenderable(t){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),i._batcher.updateElement(i);}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid);}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),H.return(e.batchableSprite),this._gpuText[t]=null;}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=false,Wi(s,t);}_updateGpuText(t){let e=this._getGpuText(t),i=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=i.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),i.texture=e.texture;}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:H.get(Br)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null;}};Hi.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"text"};});var Eh,Qt,Vi=m(()=>{gt();fi();Eh=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=false;}_createCanvasAndContext(t,e){let i=W.get().createCanvas();i.width=t,i.height=e;let s=i.getContext("2d");return {canvas:i,context:s}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=ue(t),e=ue(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:i,height:s}=e,o=(i<<17)+(s<<1);t.context.clearRect(0,0,i,s),this._canvasPool[o].push(t);}clear(){this._canvasPool={};}},Qt=new Eh;});function gp(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return false;return true}function xp(r,t,e,i,s){let o=4*t;for(let n=i,a=i*o+4*e;n<=s;++n,a+=o)if(r[a+3]!==0)return false;return true}function _p(r,t=1){let{width:e,height:i}=r,s=r.getContext("2d",{willReadFrequently:true});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,i).data,a=0,h=0,l=e-1,c=i-1;for(;h<i&&gp(n,e,h);)++h;if(h===i)return X.EMPTY;for(;gp(n,e,c);)--c;for(;xp(n,e,a,h,c);)++a;for(;xp(n,e,l,h,c);)--l;return ++l,++c,new X(a/t,h/t,(l-a)/t,(c-h)/t)}var yp=m(()=>{It();});var bp,ge,Fo=m(()=>{rt();St();bp={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},ge=class{constructor(t,e){this.uid=$("fillPattern"),this.transform=new C,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=bp[e].addressModeU,t.source.style.addressModeV=bp[e].addressModeV);}setTransform(t){let e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null;}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}};});var Tp=En((q1,vp)=>{vp.exports=K_;var Bh={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},j_=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function K_(r){var t=[];return r.replace(j_,function(e,i,s){var o=i.toLowerCase();for(s=Z_(s),o=="m"&&s.length>2&&(t.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==Bh[o])return s.unshift(i),t.push(s);if(s.length<Bh[o])throw new Error("malformed path data");t.push([i].concat(s.splice(0,Bh[o])));}}),t}var q_=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function Z_(r){var t=r.match(q_);return t?t.map(Number):[]}});function Sp(r,t){let e=(0, wp.default)(r),i=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let h=e[a],l=h[0],c=h;switch(l){case "M":o=c[1],n=c[2],t.moveTo(o,n);break;case "m":o+=c[1],n+=c[2],t.moveTo(o,n);break;case "H":o=c[1],t.lineTo(o,n);break;case "h":o+=c[1],t.lineTo(o,n);break;case "V":n=c[1],t.lineTo(o,n);break;case "v":n+=c[1],t.lineTo(o,n);break;case "L":o=c[1],n=c[2],t.lineTo(o,n);break;case "l":o+=c[1],n+=c[2],t.lineTo(o,n);break;case "C":o=c[5],n=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],o,n);break;case "c":t.bezierCurveTo(o+c[1],n+c[2],o+c[3],n+c[4],o+c[5],n+c[6]),o+=c[5],n+=c[6];break;case "S":o=c[3],n=c[4],t.bezierCurveToShort(c[1],c[2],o,n);break;case "s":t.bezierCurveToShort(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case "Q":o=c[3],n=c[4],t.quadraticCurveTo(c[1],c[2],o,n);break;case "q":t.quadraticCurveTo(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case "T":o=c[1],n=c[2],t.quadraticCurveToShort(o,n);break;case "t":o+=c[1],n+=c[2],t.quadraticCurveToShort(o,n);break;case "A":o=c[6],n=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case "a":o+=c[6],n+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case "Z":case "z":t.closePath(),i.length>0&&(s=i.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:G(`Unknown SVG path command: ${l}`);}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s));}return t}var wp,Pp=m(()=>{wp=_s(Tp());ct();});var Ro,Ap=m(()=>{It();Ro=class r{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i;}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return false;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}strokeContains(t,e,i,s=.5){if(this.radius===0)return false;let o=this.x-t,n=this.y-e,a=this.radius,h=(1-s)*i,l=Math.sqrt(o*o+n*n);return l<=a+h&&l>a-(i-h)}getBounds(t){return t||(t=new X),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return `[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}};});var ko,Mp=m(()=>{It();ko=class r{constructor(t=0,e=0,i=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=s;}clone(){return new r(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return false;let i=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(t,e,i,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return false;let a=i*(1-s),h=i-a,l=o-h,c=n-h,u=o+a,f=n+a,d=t-this.x,p=e-this.y,x=d*d/(l*l)+p*p/(c*c),g=d*d/(u*u)+p*p/(f*f);return x>1&&g<=1}getBounds(t){return t||(t=new X),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return `[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}};});function Cp(r,t,e,i,s,o){let n=r-e,a=t-i,h=s-e,l=o-i,c=n*h+a*l,u=h*h+l*l,f=-1;u!==0&&(f=c/u);let d,p;f<0?(d=e,p=i):f>1?(d=s,p=o):(d=e+f*h,p=i+f*l);let x=r-d,g=t-p;return x*x+g*g}var Ep=m(()=>{});var Q_,J_,Ir,Bp=m(()=>{Ep();It();Ir=class r{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;s<o;s++)i.push(e[s].x,e[s].y);e=i;}this.points=e,this.closePath=true;}isClockwise(){let t=0,e=this.points,i=e.length;for(let s=0;s<i;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%i],h=e[(s+3)%i];t+=(a-o)*(h+n);}return t<0}containsPolygon(t){let e=this.getBounds(Q_),i=t.getBounds(J_);if(!e.containsRect(i))return false;let s=t.points;for(let o=0;o<s.length;o+=2){let n=s[o],a=s[o+1];if(!this.contains(n,a))return false}return true}clone(){let t=this.points.slice(),e=new r(t);return e.closePath=this.closePath,e}contains(t,e){let i=false,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],h=this.points[o*2+1],l=this.points[n*2],c=this.points[n*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(i=!i);}return i}strokeContains(t,e,i,s=.5){let o=i*i,n=o*(1-s),a=o-n,{points:h}=this,l=h.length-(this.closePath?0:2);for(let c=0;c<l;c+=2){let u=h[c],f=h[c+1],d=h[(c+2)%h.length],p=h[(c+3)%h.length],x=Cp(t,e,u,f,d,p),g=Math.sign((d-u)*(e-f)-(p-f)*(t-u));if(x<=(g<0?a:n))return true}return false}getBounds(t){t||(t=new X);let e=this.points,i=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,h=e.length;a<h;a+=2){let l=e[a],c=e[a+1];i=l<i?l:i,s=l>s?l:s,o=c<o?c:o,n=c>n?c:n;}return t.x=i,t.width=s-i,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return `[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}};});var Go,Do,Ip=m(()=>{It();Go=(r,t,e,i,s,o,n)=>{let a=r-e,h=t-i,l=Math.sqrt(a*a+h*h);return l>=s-o&&l<=s+n},Do=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o;}getBounds(t){return t||(t=new X),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return false;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return true;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return true}return false}strokeContains(t,e,i,s=.5){let{x:o,y:n,width:a,height:h,radius:l}=this,c=i*(1-s),u=i-c,f=o+l,d=n+l,p=a-l*2,x=h-l*2,g=o+a,_=n+h;return (t>=o-c&&t<=o+u||t>=g-u&&t<=g+c)&&e>=d&&e<=d+x||(e>=n-c&&e<=n+u||e>=_-u&&e<=_+c)&&t>=f&&t<=f+p?true:t<f&&e<d&&Go(t,e,f,d,l,u,c)||t>g-l&&e<d&&Go(t,e,g-l,d,l,u,c)||t>g-l&&e>_-l&&Go(t,e,g-l,_-l,l,u,c)||t<f&&e>_-l&&Go(t,e,f,_-l,l,u,c)}toString(){return `[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}};});function Lo(r,t,e,i,s,o,n,a,h,l){let u=Math.min(.99,Math.max(0,l??Cr.defaultOptions.bezierSmoothness)),f=(ey-u)/1;return f*=f,ry(t,e,i,s,o,n,a,h,r,f),r}function ry(r,t,e,i,s,o,n,a,h,l){Fh(r,t,e,i,s,o,n,a,h,l,0),h.push(n,a);}function Fh(r,t,e,i,s,o,n,a,h,l,c){if(c>ty)return;let u=Math.PI,f=(r+e)/2,d=(t+i)/2,p=(e+s)/2,x=(i+o)/2,g=(s+n)/2,_=(o+a)/2,y=(f+p)/2,v=(d+x)/2,b=(p+g)/2,P=(x+_)/2,w=(y+b)/2,S=(v+P)/2;if(c>0){let B=n-r,F=a-t,M=Math.abs((e-n)*F-(i-a)*B),E=Math.abs((s-n)*F-(o-a)*B),L,Z;if(M>Uo&&E>Uo){if((M+E)*(M+E)<=l*(B*B+F*F)){if(Fr<Ih){h.push(w,S);return}let xt=Math.atan2(o-i,s-e);if(L=Math.abs(xt-Math.atan2(i-t,e-r)),Z=Math.abs(Math.atan2(a-o,n-s)-xt),L>=u&&(L=2*u-L),Z>=u&&(Z=2*u-Z),L+Z<Fr){h.push(w,S);return}if(Qe!==0){if(L>Qe){h.push(e,i);return}if(Z>Qe){h.push(s,o);return}}}}else if(M>Uo){if(M*M<=l*(B*B+F*F)){if(Fr<Ih){h.push(w,S);return}if(L=Math.abs(Math.atan2(o-i,s-e)-Math.atan2(i-t,e-r)),L>=u&&(L=2*u-L),L<Fr){h.push(e,i),h.push(s,o);return}if(Qe!==0&&L>Qe){h.push(e,i);return}}}else if(E>Uo){if(E*E<=l*(B*B+F*F)){if(Fr<Ih){h.push(w,S);return}if(L=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-i,s-e)),L>=u&&(L=2*u-L),L<Fr){h.push(e,i),h.push(s,o);return}if(Qe!==0&&L>Qe){h.push(s,o);return}}}else if(B=w-(r+n)/2,F=S-(t+a)/2,B*B+F*F<=l){h.push(w,S);return}}Fh(r,t,f,d,y,v,w,S,h,l,c+1),Fh(w,S,b,P,g,_,n,a,h,l,c+1);}var ty,Uo,ey,Ih,Fr,Qe,Rh=m(()=>{Po();ty=8,Uo=11920929e-14,ey=1,Ih=.01,Fr=0,Qe=0;});function Rp(r,t,e,i,s,o,n,a){let l=Math.min(.99,Math.max(0,a??Cr.defaultOptions.bezierSmoothness)),c=(oy-l)/1;return c*=c,ay(t,e,i,s,o,n,r,c),r}function ay(r,t,e,i,s,o,n,a){kh(n,r,t,e,i,s,o,a,0),n.push(s,o);}function kh(r,t,e,i,s,o,n,a,h){if(h>iy)return;let l=Math.PI,c=(t+i)/2,u=(e+s)/2,f=(i+o)/2,d=(s+n)/2,p=(c+f)/2,x=(u+d)/2,g=o-t,_=n-e,y=Math.abs((i-o)*_-(s-n)*g);if(y>sy){if(y*y<=a*(g*g+_*_)){if(Fp<ny){r.push(p,x);return}let v=Math.abs(Math.atan2(n-s,o-i)-Math.atan2(s-e,i-t));if(v>=l&&(v=2*l-v),v<Fp){r.push(p,x);return}}}else if(g=p-(t+o)/2,_=x-(e+n)/2,g*g+_*_<=a){r.push(p,x);return}kh(r,t,e,c,u,p,x,a,h+1),kh(r,p,x,f,d,o,n,a,h+1);}var iy,sy,oy,ny,Fp,kp=m(()=>{Po();iy=8,sy=11920929e-14,oy=1,ny=.01,Fp=0;});function Oo(r,t,e,i,s,o,n,a){let h=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(h=2*Math.PI-h),a||(a=Math.max(6,Math.floor(6*Math.pow(i,1/3)*(h/Math.PI)))),a=Math.max(a,3);let l=h/a,c=s;l*=n?-1:1;for(let u=0;u<a+1;u++){let f=Math.cos(c),d=Math.sin(c),p=t+f*i,x=e+d*i;r.push(p,x),c+=l;}}var Gh=m(()=>{});function Gp(r,t,e,i,s,o){let n=r[r.length-2],h=r[r.length-1]-e,l=n-t,c=s-e,u=i-t,f=Math.abs(h*u-l*c);if(f<1e-8||o===0){(r[r.length-2]!==t||r[r.length-1]!==e)&&r.push(t,e);return}let d=h*h+l*l,p=c*c+u*u,x=h*c+l*u,g=o*Math.sqrt(d)/f,_=o*Math.sqrt(p)/f,y=g*x/d,v=_*x/p,b=g*u+_*l,P=g*c+_*h,w=l*(_+y),S=h*(_+y),B=u*(g+v),F=c*(g+v),M=Math.atan2(S-P,w-b),E=Math.atan2(F-P,B-b);Oo(r,b+t,P+e,o,M,E,l*c>u*h);}var Dp=m(()=>{Gh();});function hy(r,t){let e=t===-1.5707963267948966?-0.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,s=Math.cos(r),o=Math.sin(r),n=Math.cos(r+t),a=Math.sin(r+t);return [{x:s-o*i,y:o+s*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function Lp(r,t,e,i,s,o,n,a=0,h=0,l=0){if(o===0||n===0)return;let c=Math.sin(a*Ni/360),u=Math.cos(a*Ni/360),f=u*(t-i)/2+c*(e-s)/2,d=-c*(t-i)/2+u*(e-s)/2;if(f===0&&d===0)return;o=Math.abs(o),n=Math.abs(n);let p=Math.pow(f,2)/Math.pow(o,2)+Math.pow(d,2)/Math.pow(n,2);p>1&&(o*=Math.sqrt(p),n*=Math.sqrt(p)),ly(t,e,i,s,o,n,h,l,c,u,f,d,Dh);let{ang1:x,ang2:g}=Dh,{centerX:_,centerY:y}=Dh,v=Math.abs(g)/(Ni/4);Math.abs(1-v)<1e-7&&(v=1);let b=Math.max(Math.ceil(v),1);g/=b;let P=r[r.length-2],w=r[r.length-1],S={x:0,y:0};for(let B=0;B<b;B++){let F=hy(x,g),{x:M,y:E}=Uh(F[0],o,n,u,c,_,y,S),{x:L,y:Z}=Uh(F[1],o,n,u,c,_,y,S),{x:xt,y:ri}=Uh(F[2],o,n,u,c,_,y,S);Lo(r,P,w,M,E,L,Z,xt,ri),P=xt,w=ri,x+=g;}}var Ni,Dh,Uh,Up,ly,Op=m(()=>{Rh();Ni=Math.PI*2,Dh={centerX:0,centerY:0,ang1:0,ang2:0},Uh=({x:r,y:t},e,i,s,o,n,a,h)=>{r*=e,t*=i;let l=s*r-o*t,c=o*r+s*t;return h.x=l+n,h.y=c+a,h};Up=(r,t,e,i)=>{let s=r*i-t*e<0?-1:1,o=r*e+t*i;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},ly=(r,t,e,i,s,o,n,a,h,l,c,u,f)=>{let d=Math.pow(s,2),p=Math.pow(o,2),x=Math.pow(c,2),g=Math.pow(u,2),_=d*p-d*g-p*x;_<0&&(_=0),_/=d*g+p*x,_=Math.sqrt(_)*(n===a?-1:1);let y=_*s/o*u,v=_*-o/s*c,b=l*y-h*v+(r+e)/2,P=h*y+l*v+(t+i)/2,w=(c-y)/s,S=(u-v)/o,B=(-c-y)/s,F=(-u-v)/o,M=Up(1,0,w,S),E=Up(w,S,B,F);a===0&&E>0&&(E-=Ni),a===1&&E<0&&(E+=Ni),f.centerX=b,f.centerY=P,f.ang1=M,f.ang2=E;};});function zp(r,t,e){let i=(n,a)=>{let h=a.x-n.x,l=a.y-n.y,c=Math.sqrt(h*h+l*l),u=h/c,f=l/c;return {len:c,nx:u,ny:f}},s=(n,a)=>{n===0?r.moveTo(a.x,a.y):r.lineTo(a.x,a.y);},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],h=a.radius??e;if(h<=0){s(n,a),o=a;continue}let l=t[(n+1)%t.length],c=i(a,o),u=i(a,l);if(c.len<1e-4||u.len<1e-4){s(n,a),o=a;continue}let f=Math.asin(c.nx*u.ny-c.ny*u.nx),d=1,p=false;c.nx*u.nx-c.ny*-u.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,d=-1,p=true):f>0&&(d=-1,p=true);let x=f/2,g,_=Math.abs(Math.cos(x)*h/Math.sin(x));_>Math.min(c.len/2,u.len/2)?(_=Math.min(c.len/2,u.len/2),g=Math.abs(_*Math.sin(x)/Math.cos(x))):g=h;let y=a.x+u.nx*_+-u.ny*g*d,v=a.y+u.ny*_+u.nx*g*d,b=Math.atan2(c.ny,c.nx)+Math.PI/2*d,P=Math.atan2(u.ny,u.nx)-Math.PI/2*d;n===0&&r.moveTo(y+Math.cos(b)*g,v+Math.sin(b)*g),r.arc(y,v,g,b,P,p),o=a;}}function Wp(r,t,e,i){let s=(a,h)=>Math.sqrt((a.x-h.x)**2+(a.y-h.y)**2),o=(a,h,l)=>({x:a.x+(h.x-a.x)*l,y:a.y+(h.y-a.y)*l}),n=t.length;for(let a=0;a<n;a++){let h=t[(a+1)%n],l=h.radius??e;if(l<=0){a===0?r.moveTo(h.x,h.y):r.lineTo(h.x,h.y);continue}let c=t[a],u=t[(a+2)%n],f=s(c,h),d;if(f<1e-4)d=h;else {let g=Math.min(f/2,l);d=o(h,c,g/f);}let p=s(u,h),x;if(p<1e-4)x=h;else {let g=Math.min(p/2,l);x=o(h,u,g/p);}a===0?r.moveTo(d.x,d.y):r.lineTo(d.x,d.y),r.quadraticCurveTo(h.x,h.y,x.x,x.y,i);}}var Hp=m(()=>{});var cy,zo,Vp=m(()=>{Ap();Mp();Bp();It();Ip();qt();Rh();kp();Gh();Dp();Op();Hp();cy=new X,zo=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new ot,this._graphicsPath2D=t,this.signed=t.checkForHoles;}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let i=this._currentPoly.points,s=i[i.length-2],o=i[i.length-1];return (s!==t||o!==e)&&i.push(t,e),this}arc(t,e,i,s,o,n){this._ensurePoly(false);let a=this._currentPoly.points;return Oo(a,t,e,i,s,o,n),this}arcTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return Gp(n,t,e,i,s,o),this}arcToSvg(t,e,i,s,o,n,a){let h=this._currentPoly.points;return Lp(h,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,i,s,o),this}bezierCurveTo(t,e,i,s,o,n,a){this._ensurePoly();let h=this._currentPoly;return Lo(this._currentPoly.points,h.lastX,h.lastY,t,e,i,s,o,n,a),this}quadraticCurveTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly;return Rp(this._currentPoly.points,n.lastX,n.lastY,t,e,i,s,o),this}closePath(){return this.endPoly(true),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(true),t.transform(e));let i=this.shapePrimitives,s=i.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data);}if(t.checkForHoles&&i.length-s>1){let o=null;for(let n=s;n<i.length;n++){let a=i[n];if(a.shape.type==="polygon"){let h=a.shape,l=o?.shape;l&&l.containsPolygon(h)?(o.holes||(o.holes=[]),o.holes.push(a),i.copyWithin(n,n+1),i.length--,n--):o=a;}}}return this}finish(t=false){this.endPoly(t);}rect(t,e,i,s,o){return this.drawShape(new X(t,e,i,s),o),this}circle(t,e,i,s){return this.drawShape(new Ro(t,e,i),s),this}poly(t,e,i){let s=new Ir(t);return s.closePath=e,this.drawShape(s,i),this}regularPoly(t,e,i,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,h=Math.PI*2/s,l=[];for(let c=0;c<s;c++){let u=a-c*h;l.push(t+i*Math.cos(u),e+i*Math.sin(u));}return this.poly(l,true,n),this}roundPoly(t,e,i,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,i,s,n);let h=i*Math.sin(Math.PI/s)-.001;o=Math.min(o,h);let l=-1*Math.PI/2+n,c=Math.PI*2/s,u=(s-2)*Math.PI/s/2;for(let f=0;f<s;f++){let d=f*c+l,p=t+i*Math.cos(d),x=e+i*Math.sin(d),g=d+Math.PI+u,_=d-Math.PI-u,y=p+o*Math.cos(g),v=x+o*Math.sin(g),b=p+o*Math.cos(_),P=x+o*Math.sin(_);f===0?this.moveTo(y,v):this.lineTo(y,v),this.quadraticCurveTo(p,x,b,P,a);}return this.closePath()}roundShape(t,e,i=false,s){return t.length<3?this:(i?Wp(this,t,e,s):zp(this,t,e),this.closePath())}filletRect(t,e,i,s,o){if(o===0)return this.rect(t,e,i,s);let n=Math.min(i,s)/2,a=Math.min(n,Math.max(-n,o)),h=t+i,l=e+s,c=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+c,e+c,t+u,e,u).lineTo(h-u,e).arcTo(h-c,e+c,h,e+u,u).lineTo(h,l-u).arcTo(h-c,l-c,t+i-u,l,u).lineTo(t+u,l).arcTo(t+c,l-c,t,l-u,u).closePath()}chamferRect(t,e,i,s,o,n){if(o<=0)return this.rect(t,e,i,s);let a=Math.min(o,Math.min(i,s)/2),h=t+i,l=e+s,c=[t+a,e,h-a,e,h,e+a,h,l-a,h-a,l,t+a,l,t,l-a,t,e+a];for(let u=c.length-1;u>=2;u-=2)c[u]===c[u-2]&&c[u-1]===c[u-3]&&c.splice(u-1,2);return this.poly(c,true,n)}ellipse(t,e,i,s,o){return this.drawShape(new ko(t,e,i,s),o),this}roundRect(t,e,i,s,o,n){return this.drawShape(new Do(t,e,i,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new Ir,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=false){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=true){if(!this._currentPoly&&(this._currentPoly=new Ir,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=i;i=o.a*i+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty;}this._currentPoly.points.push(i,s);}else this._currentPoly.points.push(0,0);}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){let i=t.instructions[e];this[i.action](...i.data);}this.finish();}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let i=0;i<e.length;i++){let s=e[i],o=s.shape.getBounds(cy);s.transform?t.addRect(o,s.transform):t.addRect(o);}return t}};});function $i(r,t){return r?r.prepend(t):t.clone()}var Ie,Lh=m(()=>{Kt();St();ct();Pp();Vp();Ie=class r{constructor(t,e=false){this.instructions=[],this.uid=$("graphicsPath"),this._dirty=true,this.checkForHoles=e,typeof t=="string"?Sp(t,this):this.instructions=t?.slice()??[];}get shapePath(){return this._shapePath||(this._shapePath=new zo(this)),this._dirty&&(this._dirty=false,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=true,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=true,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=true,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=true,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=true,this}bezierCurveToShort(t,e,i,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(N.shared),h=0,l=0;if(!n||n.action!=="bezierCurveTo")h=a.x,l=a.y;else {h=n.data[2],l=n.data[3];let c=a.x,u=a.y;h=c+(c-h),l=u+(u-l);}return this.instructions.push({action:"bezierCurveTo",data:[h,l,t,e,i,s,o]}),this._dirty=true,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=true,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=true,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=true,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=true,this}quadraticCurveToShort(t,e,i){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(N.shared),n=0,a=0;if(!s||s.action!=="quadraticCurveTo")n=o.x,a=o.y;else {n=s.data[0],a=s.data[1];let h=o.x,l=o.y;n=h+(h-n),a=l+(l-a);}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,i]}),this._dirty=true,this}rect(t,e,i,s,o){return this.instructions.push({action:"rect",data:[t,e,i,s,o]}),this._dirty=true,this}circle(t,e,i,s){return this.instructions.push({action:"circle",data:[t,e,i,s]}),this._dirty=true,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=true,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=true,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=true,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=true,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=true,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=true,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=true,this}star(t,e,i,s,o,n,a){o||(o=s/2);let h=-1*Math.PI/2+n,l=i*2,c=Math.PI*2/l,u=[];for(let f=0;f<l;f++){let d=f%2?o:s,p=f*c+h;u.push(t+d*Math.cos(p),e+d*Math.sin(p));}return this.poly(u,true,a),this}clone(t=false){let e=new r;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){let s=this.instructions[i];e.instructions.push({action:s.action,data:s.data.slice()});}return e}clear(){return this.instructions.length=0,this._dirty=true,this}transform(t){if(t.isIdentity())return this;let e=t.a,i=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,h=0,l=0,c=0,u=0,f=0,d=0,p=0,x=0;for(let g=0;g<this.instructions.length;g++){let _=this.instructions[g],y=_.data;switch(_.action){case "moveTo":case "lineTo":h=y[0],l=y[1],y[0]=e*h+s*l+n,y[1]=i*h+o*l+a;break;case "bezierCurveTo":c=y[0],u=y[1],f=y[2],d=y[3],h=y[4],l=y[5],y[0]=e*c+s*u+n,y[1]=i*c+o*u+a,y[2]=e*f+s*d+n,y[3]=i*f+o*d+a,y[4]=e*h+s*l+n,y[5]=i*h+o*l+a;break;case "quadraticCurveTo":c=y[0],u=y[1],h=y[2],l=y[3],y[0]=e*c+s*u+n,y[1]=i*c+o*u+a,y[2]=e*h+s*l+n,y[3]=i*h+o*l+a;break;case "arcToSvg":h=y[5],l=y[6],p=y[0],x=y[1],y[0]=e*p+s*x,y[1]=i*p+o*x,y[5]=e*h+s*l+n,y[6]=i*h+o*l+a;break;case "circle":y[4]=$i(y[3],t);break;case "rect":y[4]=$i(y[4],t);break;case "ellipse":y[8]=$i(y[8],t);break;case "roundRect":y[5]=$i(y[5],t);break;case "addPath":y[0].transform(t);break;case "poly":y[2]=$i(y[2],t);break;default:G("unknown transform action",_.action);break}}return this._dirty=true,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,i=this.instructions[e];if(!i)return t.x=0,t.y=0,t;for(;i.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;i=this.instructions[e];}switch(i.action){case "moveTo":case "lineTo":t.x=i.data[0],t.y=i.data[1];break;case "quadraticCurveTo":t.x=i.data[2],t.y=i.data[3];break;case "bezierCurveTo":t.x=i.data[4],t.y=i.data[5];break;case "arc":case "arcToSvg":t.x=i.data[5],t.y=i.data[6];break;case "addPath":i.data[0].getLastPoint(t);break}return t}};});function st(r,t,e){let i=r.getAttribute(t);return i?Number(i):e}var Oh=m(()=>{});function Np(r,t){let e=r.querySelectorAll("defs");for(let i=0;i<e.length;i++){let s=e[i];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case "lineargradient":t.defs[n.id]=uy(n);break;case "radialgradient":t.defs[n.id]=dy();break;}}}}function uy(r){let t=st(r,"x1",0),e=st(r,"y1",0),i=st(r,"x2",1),s=st(r,"y2",0),o=r.getAttribute("gradientUnits")||"objectBoundingBox",n=new kt(t,e,i,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<r.children.length;a++){let h=r.children[a],l=st(h,"offset",0),c=V.shared.setValue(h.getAttribute("stop-color")).toNumber();n.addColorStop(l,c);}return n}function dy(r){return G("[SVG Parser] Radial gradients are not yet supported"),new kt(0,0,1,0)}var $p=m(()=>{Bt();ct();Mr();Oh();});function zh(r){let t=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var Yp=m(()=>{});function Wh(r,t){let e=r.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:false,useStroke:false};for(let n in Xp){let a=r.getAttribute(n);a&&jp(t,o,n,a.trim());}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let h=n[a].trim(),[l,c]=h.split(":");Xp[l]&&jp(t,o,l,c.trim());}}return {strokeStyle:o.useStroke?i:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function jp(r,t,e,i){switch(e){case "stroke":if(i!=="none"){if(i.startsWith("url(")){let s=zh(i);t.strokeStyle.fill=r.defs[s];}else t.strokeStyle.color=V.shared.setValue(i).toNumber();t.useStroke=true;}break;case "stroke-width":t.strokeStyle.width=Number(i);break;case "fill":if(i!=="none"){if(i.startsWith("url(")){let s=zh(i);t.fillStyle.fill=r.defs[s];}else t.fillStyle.color=V.shared.setValue(i).toNumber();t.useFill=true;}break;case "fill-opacity":t.fillStyle.alpha=Number(i);break;case "stroke-opacity":t.strokeStyle.alpha=Number(i);break;case "opacity":t.fillStyle.alpha=Number(i),t.strokeStyle.alpha=Number(i);break}}var Xp,Kp=m(()=>{Bt();Yp();Xp={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}};});function qp(r,t){if(typeof r=="string"){let n=document.createElement("div");n.innerHTML=r.trim(),r=n.querySelector("svg");}let e={context:t,defs:{},path:new Ie};Np(r,e);let i=r.children,{fillStyle:s,strokeStyle:o}=Wh(r,e);for(let n=0;n<i.length;n++){let a=i[n];a.nodeName.toLowerCase()!=="defs"&&Zp(a,e,s,o);}return t}function Zp(r,t,e,i){let s=r.children,{fillStyle:o,strokeStyle:n}=Wh(r,t);o&&e?e={...e,...o}:o&&(e=o),n&&i?i={...i,...n}:n&&(i=n);let a=!e&&!i;a&&(e={color:0});let h,l,c,u,f,d,p,x,g,_,y,v,b,P,w,S,B;switch(r.nodeName.toLowerCase()){case "path":P=r.getAttribute("d"),r.getAttribute("fill-rule")==="evenodd"&&G("SVG Evenodd fill rule not supported, your svg may render incorrectly"),w=new Ie(P,true),t.context.path(w),e&&t.context.fill(e),i&&t.context.stroke(i);break;case "circle":p=st(r,"cx",0),x=st(r,"cy",0),g=st(r,"r",0),t.context.ellipse(p,x,g,g),e&&t.context.fill(e),i&&t.context.stroke(i);break;case "rect":h=st(r,"x",0),l=st(r,"y",0),S=st(r,"width",0),B=st(r,"height",0),_=st(r,"rx",0),y=st(r,"ry",0),_||y?t.context.roundRect(h,l,S,B,_||y):t.context.rect(h,l,S,B),e&&t.context.fill(e),i&&t.context.stroke(i);break;case "ellipse":p=st(r,"cx",0),x=st(r,"cy",0),_=st(r,"rx",0),y=st(r,"ry",0),t.context.beginPath(),t.context.ellipse(p,x,_,y),e&&t.context.fill(e),i&&t.context.stroke(i);break;case "line":c=st(r,"x1",0),u=st(r,"y1",0),f=st(r,"x2",0),d=st(r,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(f,d),i&&t.context.stroke(i);break;case "polygon":b=r.getAttribute("points"),v=b.match(/\d+/g).map(F=>parseInt(F,10)),t.context.poly(v,true),e&&t.context.fill(e),i&&t.context.stroke(i);break;case "polyline":b=r.getAttribute("points"),v=b.match(/\d+/g).map(F=>parseInt(F,10)),t.context.poly(v,false),i&&t.context.stroke(i);break;case "g":case "svg":break;default:{G(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}a&&(e=null);for(let F=0;F<s.length;F++)Zp(s[F],t,e,i);}var Qp=m(()=>{ct();Lh();$p();Oh();Kp();});function fy(r){return V.isColorLike(r)}function Jp(r){return r instanceof ge}function tm(r){return r instanceof kt}function py(r){return r instanceof I}function my(r,t,e){let i=V.shared.setValue(t??0);return r.color=i.toNumber(),r.alpha=i.alpha===1?e.alpha:i.alpha,r.texture=I.WHITE,{...e,...r}}function gy(r,t,e){return r.texture=t,{...e,...r}}function em(r,t,e){return r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,{...e,...r}}function rm(r,t,e){return t.buildGradient(),r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,r.textureSpace=t.textureSpace,{...e,...r}}function xy(r,t){let e={...t,...r},i=V.shared.setValue(e.color);return e.alpha*=i.alpha,e.color=i.toNumber(),e}function xe(r,t){if(r==null)return null;let e={},i=r;return fy(r)?my(e,r,t):py(r)?gy(e,r,t):Jp(r)?em(e,r,t):tm(r)?rm(e,r,t):i.fill&&Jp(i.fill)?em(i,i.fill,t):i.fill&&tm(i.fill)?rm(i,i.fill,t):xy(i,t)}function Rr(r,t){let{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...h}=t,l=xe(r,h);return l?{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var Hh=m(()=>{Bt();at();Mr();Fo();});var _y,im,Vh,Et,Wo=m(()=>{Dt();Bt();rt();Kt();at();St();ht();qt();Lh();Qp();Hh();_y=new N,im=new C,Vh=class ae extends Y{constructor(){super(...arguments),this.uid=$("graphicsContext"),this.dirty=true,this.batchMode="auto",this.instructions=[],this._activePath=new Ie,this._transform=new C,this._fillStyle={...ae.defaultFillStyle},this._strokeStyle={...ae.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new ot,this._boundsDirty=true;}clone(){let t=new ae;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=true,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=xe(t,ae.defaultFillStyle);}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=Rr(t,ae.defaultStrokeStyle);}setFillStyle(t){return this._fillStyle=xe(t,ae.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=xe(t,ae.defaultStrokeStyle),this}texture(t,e,i,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?V.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Ie,this}fill(t,e){let i,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?i=s.data.path:i=this._activePath.clone(),i?(t!=null&&(e!==void 0&&typeof t=="number"&&(D(O,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=xe(t,ae.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(N.shared);this._activePath.clear(),this._activePath.moveTo(t,e);}stroke(t){let e,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?e=i.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=Rr(t,ae.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let e=this.instructions[this.instructions.length-1-t],i=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(i);else {e.data.hole=i;break}}return this._initNextPathLocation(),this}arc(t,e,i,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,i,s,o,n),this}arcTo(t,e,i,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}arcToSvg(t,e,i,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.arcToSvg(t,e,i,s,o,h.a*n+h.c*a+h.tx,h.b*n+h.d*a+h.ty),this}bezierCurveTo(t,e,i,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.bezierCurveTo(h.a*t+h.c*e+h.tx,h.b*t+h.d*e+h.ty,h.a*i+h.c*s+h.tx,h.b*i+h.d*s+h.ty,h.a*o+h.c*n+h.tx,h.b*o+h.d*n+h.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,i,s){return this._tick++,this._activePath.ellipse(t,e,i,s,this._transform.clone()),this}circle(t,e,i){return this._tick++,this._activePath.circle(t,e,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*t+i.c*e+i.tx,i.b*t+i.d*e+i.ty),this}moveTo(t,e){this._tick++;let i=this._transform,s=this._activePath.instructions,o=i.a*t+i.c*e+i.tx,n=i.b*t+i.d*e+i.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(t,e,i,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}rect(t,e,i,s){return this._tick++,this._activePath.rect(t,e,i,s,this._transform.clone()),this}roundRect(t,e,i,s,o){return this._tick++,this._activePath.roundRect(t,e,i,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,i,s,o,n),this}roundPoly(t,e,i,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,i,s,o,n),this}roundShape(t,e,i,s){return this._tick++,this._activePath.roundShape(t,e,i,s),this}filletRect(t,e,i,s,o){return this._tick++,this._activePath.filletRect(t,e,i,s,o),this}chamferRect(t,e,i,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,i,s,o,n),this}star(t,e,i,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,i,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,qp(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,i,s,o,n){return t instanceof C?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,s,o,n),this)}transform(t,e,i,s,o,n){return t instanceof C?(this._transform.append(t),this):(im.set(t,e,i,s,o,n),this._transform.append(im),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=true,this._boundsDirty=true);}get bounds(){if(!this._boundsDirty)return this._bounds;let t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){let i=this.instructions[e],s=i.action;if(s==="fill"){let o=i.data;t.addBounds(o.path.bounds);}else if(s==="texture"){let o=i.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform);}if(s==="stroke"){let o=i.data,n=o.style.alignment,a=o.style.width*(1-n),h=o.path.bounds;t.addFrame(h.minX-a,h.minY-a,h.maxX+a,h.maxY+a);}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return false;let e=this.instructions,i=false;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let h=n.style,l=a.shapePath.shapePrimitives;for(let c=0;c<l.length;c++){let u=l[c].shape;if(!h||!u)continue;let f=l[c].transform,d=f?f.applyInverse(t,_y):t;if(o.action==="fill")i=u.contains(d.x,d.y);else {let x=h;i=u.strokeContains(d.x,d.y,x.width,x.alignment);}let p=n.hole;if(p){let x=p.shapePath?.shapePrimitives;if(x)for(let g=0;g<x.length;g++)x[g].shape.contains(d.x,d.y)&&(i=false);}if(i)return true}}return i}destroy(t=false){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(i),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(i);}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null;}};Vh.defaultFillStyle={color:16777215,alpha:1,texture:I.WHITE,matrix:null,fill:null,textureSpace:"local"};Vh.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:I.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:false};Et=Vh;});function Ho(r){let t=[],e=0;for(let i=0;i<sm.length;i++){let s=`_${sm[i]}`;t[e++]=r[s];}return e=om(r._fill,t,e),e=yy(r._stroke,t,e),e=by(r.dropShadow,t,e),t.join("-")}function om(r,t,e){return r&&(t[e++]=r.color,t[e++]=r.alpha,t[e++]=r.fill?.styleKey),e}function yy(r,t,e){return r&&(e=om(r,t,e),t[e++]=r.width,t[e++]=r.alignment,t[e++]=r.cap,t[e++]=r.join,t[e++]=r.miterLimit),e}function by(r,t,e){return r&&(t[e++]=r.alpha,t[e++]=r.angle,t[e++]=r.blur,t[e++]=r.distance,t[e++]=V.shared.setValue(r.color).toNumber()),e}var sm,Nh=m(()=>{Bt();sm=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"];});function vy(r){let t=r;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=Gt.defaultDropShadow;r.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance};}if(t.strokeThickness!==void 0){D(O,"strokeThickness is now a part of stroke");let e=t.stroke,i={};if(V.isColorLike(e))i.color=e;else if(e instanceof kt||e instanceof ge)i.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))i=e;else throw new Error("Invalid stroke value.");r.stroke={...i,width:t.strokeThickness};}if(Array.isArray(t.fillGradientStops)){D(O,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;r.fontSize==null?r.fontSize=Gt.defaultTextStyle.fontSize:typeof r.fontSize=="string"?e=parseInt(r.fontSize,10):e=r.fontSize;let i=new kt({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>V.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o);}),r.fill={fill:i};}}var $h,Gt,Gr=m(()=>{Dt();Bt();ht();Mr();Fo();Wo();Hh();Nh();$h=class kr extends Y{constructor(t={}){super(),vy(t);let e={...kr.defaultTextStyle,...t};for(let i in e){let s=i;this[s]=e[i];}this.update();}get align(){return this._align}set align(t){this._align=t,this.update();}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update();}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...kr.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...kr.defaultDropShadow}):null,this.update();}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update();}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update();}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t.toLowerCase(),this.update();}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update();}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update();}get leading(){return this._leading}set leading(t){this._leading=t,this.update();}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update();}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update();}get padding(){return this._padding}set padding(t){this._padding=t,this.update();}get trim(){return this._trim}set trim(t){this._trim=t,this.update();}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update();}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update();}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update();}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update();}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...Et.defaultFillStyle,...t},()=>{this._fill=xe({...this._originalFill},Et.defaultFillStyle);})),this._fill=xe(t===0?"black":t,Et.defaultFillStyle),this.update());}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Et.defaultStrokeStyle,...t},()=>{this._stroke=Rr({...this._originalStroke},Et.defaultStrokeStyle);})),this._stroke=Rr(t,Et.defaultStrokeStyle),this.update());}_generateKey(){return this._styleKey=Ho(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this);}reset(){let t=kr.defaultTextStyle;for(let e in t)this[e]=t[e];}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new kr({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=false){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(i),this._originalFill?.texture&&this._originalFill.texture.destroy(i),this._stroke?.texture&&this._stroke.texture.destroy(i),this._originalStroke?.texture&&this._originalStroke.texture.destroy(i);}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null;}_createProxy(t,e){return new Proxy(t,{set:(i,s,o)=>(i[s]=o,e?.(s,o),this.update(),true)})}_isFillStyle(t){return (t??null)!==null&&!(V.isColorLike(t)||t instanceof kt||t instanceof ge)}};$h.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};$h.defaultTextStyle={align:"left",breakWords:false,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:false,whiteSpace:"pre",wordWrap:false,wordWrapWidth:100};Gt=$h;});function Vo(r,t,e,i){let s=Ty;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;let o=Tt.getOptimalTexture(s.width,s.height,i,false);return o.source.uploadMethodId="image",o.source.resource=r,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/i,o.frame.height=e/i,o.source.emit("update",o.source),o.updateUvs(),o}var Ty,Yh=m(()=>{nr();qt();Ty=new ot;});function Je(r){let t=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize,e=r.fontFamily;Array.isArray(r.fontFamily)||(e=r.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!wy.includes(s)&&(s=`"${s}"`),e[i]=s;}return `${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${t} ${e.join(",")}`}var wy,No=m(()=>{wy=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];});var Xh,Jt,Vt,$o=m(()=>{gt();No();Xh={willReadFrequently:true},Jt=class k{static get experimentalLetterSpacingSupported(){let t=k._experimentalLetterSpacingSupported;if(t!==void 0){let e=W.get().getCanvasRenderingContext2D().prototype;t=k._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e;}return t}constructor(t,e,i,s,o,n,a,h,l){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l;}static measureText(t=" ",e,i=k._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(k._measurementCache[o])return k._measurementCache[o];let n=Je(e),a=k.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let h=k.__context;h.font=n;let c=(s?k._wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),u=new Array(c.length),f=0;for(let y=0;y<c.length;y++){let v=k._measureText(c[y],e.letterSpacing,h);u[y]=v,f=Math.max(f,v);}let d=e._stroke?.width||0,p=f+d;e.dropShadow&&(p+=e.dropShadow.distance);let x=e.lineHeight||a.fontSize,g=Math.max(x,a.fontSize+d)+(c.length-1)*(x+e.leading);return e.dropShadow&&(g+=e.dropShadow.distance),new k(t,e,p,g,c,u,x+e.leading,f,a)}static _measureText(t,e,i){let s=false;k.experimentalLetterSpacingSupported&&(k.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=true):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let o=i.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,l=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,l-=e;else {let c=(k.graphemeSegmenter(t).length-1)*e;n+=c,l+=c;}return Math.max(n,l)}static _wordWrap(t,e,i=k._canvas){let s=i.getContext("2d",Xh),o=0,n="",a="",h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=k._collapseSpaces(c),f=k._collapseNewlines(c),d=!u,p=e.wordWrapWidth+l,x=k._tokenize(t);for(let g=0;g<x.length;g++){let _=x[g];if(k._isNewline(_)){if(!f){a+=k._addLine(n),d=!u,n="",o=0;continue}_=" ";}if(u){let v=k.isBreakingSpace(_),b=k.isBreakingSpace(n[n.length-1]);if(v&&b)continue}let y=k._getFromCache(_,l,h,s);if(y>p)if(n!==""&&(a+=k._addLine(n),n="",o=0),k.canBreakWords(_,e.breakWords)){let v=k.wordWrapSplit(_);for(let b=0;b<v.length;b++){let P=v[b],w=P,S=1;for(;v[b+S];){let F=v[b+S];if(!k.canBreakChars(w,F,_,b,e.breakWords))P+=F;else break;w=F,S++;}b+=S-1;let B=k._getFromCache(P,l,h,s);B+o>p&&(a+=k._addLine(n),d=false,n="",o=0),n+=P,o+=B;}}else {n.length>0&&(a+=k._addLine(n),n="",o=0);let v=g===x.length-1;a+=k._addLine(_,!v),d=false,n="",o=0;}else y+o>p&&(d=false,a+=k._addLine(n),n="",o=0),(n.length>0||!k.isBreakingSpace(_)||d)&&(n+=_,o+=y);}return a+=k._addLine(n,false),a}static _addLine(t,e=true){return t=k._trimRight(t),t=e?`${t}
367
+ }`;});var Bo,up=m(()=>{Bt();rt();no();lo();Fi();at();Qn();ap();lp();cp();Bo=class extends ne{constructor(){let t=yr.from({vertex:hp,fragment:np}),e=Ae.from({fragment:{source:Sh,entryPoint:"mainFragment"},vertex:{source:Sh,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:I.WHITE.source,uSampler:new Is({}),uniforms:{uTranslationMatrix:{value:new C,type:"mat3x3<f32>"},uColor:{value:new V(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}});}};});var Er,Ph=m(()=>{rt();Ce();Ci();Ao();Di();op();up();Er=class{constructor(t,e){this.state=Ze.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new Ct({uTranslationMatrix:{value:new C,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new Bo,this.state=Ze.for2d();}validateRenderable(t){return false}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t);}getBuffers(t){return this._gpuBufferHash[t.uid]||this._initBuffer(t)}_initBuffer(t){return this._gpuBufferHash[t.uid]=new Eo({size:t.particleChildren.length,properties:t._properties}),t.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[t.uid]}updateRenderable(t){}destroyRenderable(t){this._gpuBufferHash[t.uid].destroy(),this._gpuBufferHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}execute(t){let e=t.particleChildren;if(e.length===0)return;let i=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=false,o.blendMode=me(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(i.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=i.globalUniforms.globalUniformData.resolution,n.uRound=i._roundPixels|t._roundPixels,Ee(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t);}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null);}};});var Oi,dp=m(()=>{A();tp();Ph();Oi=class extends Er{constructor(t){super(t,new Co);}};Oi.extension={type:[T.WebGLPipes],name:"particle"};});var Io,fp=m(()=>{Io=class{execute(t,e){let i=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,true),s.groups[1]=i.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);i.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6});}};});var zi,pp=m(()=>{A();fp();Ph();zi=class extends Er{constructor(t){super(t,new Io);}};zi.extension={type:[T.WebGPUPipes],name:"particle"};});var Ah=m(()=>{A();dp();pp();R.add(Oi);R.add(zi);});var Br,Mh=m(()=>{Br=class{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=true,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null;}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null;}};});function Wi(r,t){let{texture:e,bounds:i}=r;Ys(i,t._anchor,e);let s=t._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s;}var Ch=m(()=>{va();});var Hi,mp=m(()=>{A();Wt();Mh();Ch();Hi=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText");}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate());}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.currentKey!==i}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e);}updateRenderable(t){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),i._batcher.updateElement(i);}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid);}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),H.return(e.batchableSprite),this._gpuText[t]=null;}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=false,Wi(s,t);}_updateGpuText(t){let e=this._getGpuText(t),i=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=i.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),i.texture=e.texture;}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:H.get(Br)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null;}};Hi.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"text"};});var Eh,Qt,Vi=m(()=>{gt();fi();Eh=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=false;}_createCanvasAndContext(t,e){let i=W.get().createCanvas();i.width=t,i.height=e;let s=i.getContext("2d");return {canvas:i,context:s}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=ue(t),e=ue(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:i,height:s}=e,o=(i<<17)+(s<<1);t.context.clearRect(0,0,i,s),this._canvasPool[o].push(t);}clear(){this._canvasPool={};}},Qt=new Eh;});function gp(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return false;return true}function xp(r,t,e,i,s){let o=4*t;for(let n=i,a=i*o+4*e;n<=s;++n,a+=o)if(r[a+3]!==0)return false;return true}function _p(r,t=1){let{width:e,height:i}=r,s=r.getContext("2d",{willReadFrequently:true});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,i).data,a=0,h=0,l=e-1,c=i-1;for(;h<i&&gp(n,e,h);)++h;if(h===i)return X.EMPTY;for(;gp(n,e,c);)--c;for(;xp(n,e,a,h,c);)++a;for(;xp(n,e,l,h,c);)--l;return ++l,++c,new X(a/t,h/t,(l-a)/t,(c-h)/t)}var yp=m(()=>{It();});var bp,ge,Fo=m(()=>{rt();St();bp={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},ge=class{constructor(t,e){this.uid=$("fillPattern"),this.transform=new C,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=bp[e].addressModeU,t.source.style.addressModeV=bp[e].addressModeV);}setTransform(t){let e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null;}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}};});var Tp=En((qE,vp)=>{vp.exports=K_;var Bh={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},j_=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function K_(r){var t=[];return r.replace(j_,function(e,i,s){var o=i.toLowerCase();for(s=Z_(s),o=="m"&&s.length>2&&(t.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==Bh[o])return s.unshift(i),t.push(s);if(s.length<Bh[o])throw new Error("malformed path data");t.push([i].concat(s.splice(0,Bh[o])));}}),t}var q_=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function Z_(r){var t=r.match(q_);return t?t.map(Number):[]}});function Sp(r,t){let e=(0, wp.default)(r),i=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let h=e[a],l=h[0],c=h;switch(l){case "M":o=c[1],n=c[2],t.moveTo(o,n);break;case "m":o+=c[1],n+=c[2],t.moveTo(o,n);break;case "H":o=c[1],t.lineTo(o,n);break;case "h":o+=c[1],t.lineTo(o,n);break;case "V":n=c[1],t.lineTo(o,n);break;case "v":n+=c[1],t.lineTo(o,n);break;case "L":o=c[1],n=c[2],t.lineTo(o,n);break;case "l":o+=c[1],n+=c[2],t.lineTo(o,n);break;case "C":o=c[5],n=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],o,n);break;case "c":t.bezierCurveTo(o+c[1],n+c[2],o+c[3],n+c[4],o+c[5],n+c[6]),o+=c[5],n+=c[6];break;case "S":o=c[3],n=c[4],t.bezierCurveToShort(c[1],c[2],o,n);break;case "s":t.bezierCurveToShort(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case "Q":o=c[3],n=c[4],t.quadraticCurveTo(c[1],c[2],o,n);break;case "q":t.quadraticCurveTo(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case "T":o=c[1],n=c[2],t.quadraticCurveToShort(o,n);break;case "t":o+=c[1],n+=c[2],t.quadraticCurveToShort(o,n);break;case "A":o=c[6],n=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case "a":o+=c[6],n+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case "Z":case "z":t.closePath(),i.length>0&&(s=i.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:G(`Unknown SVG path command: ${l}`);}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s));}return t}var wp,Pp=m(()=>{wp=_s(Tp());ct();});var Ro,Ap=m(()=>{It();Ro=class r{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i;}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return false;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}strokeContains(t,e,i,s=.5){if(this.radius===0)return false;let o=this.x-t,n=this.y-e,a=this.radius,h=(1-s)*i,l=Math.sqrt(o*o+n*n);return l<=a+h&&l>a-(i-h)}getBounds(t){return t||(t=new X),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return `[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}};});var ko,Mp=m(()=>{It();ko=class r{constructor(t=0,e=0,i=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=s;}clone(){return new r(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return false;let i=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(t,e,i,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return false;let a=i*(1-s),h=i-a,l=o-h,c=n-h,u=o+a,f=n+a,d=t-this.x,p=e-this.y,x=d*d/(l*l)+p*p/(c*c),g=d*d/(u*u)+p*p/(f*f);return x>1&&g<=1}getBounds(t){return t||(t=new X),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return `[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}};});function Cp(r,t,e,i,s,o){let n=r-e,a=t-i,h=s-e,l=o-i,c=n*h+a*l,u=h*h+l*l,f=-1;u!==0&&(f=c/u);let d,p;f<0?(d=e,p=i):f>1?(d=s,p=o):(d=e+f*h,p=i+f*l);let x=r-d,g=t-p;return x*x+g*g}var Ep=m(()=>{});var Q_,J_,Ir,Bp=m(()=>{Ep();It();Ir=class r{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;s<o;s++)i.push(e[s].x,e[s].y);e=i;}this.points=e,this.closePath=true;}isClockwise(){let t=0,e=this.points,i=e.length;for(let s=0;s<i;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%i],h=e[(s+3)%i];t+=(a-o)*(h+n);}return t<0}containsPolygon(t){let e=this.getBounds(Q_),i=t.getBounds(J_);if(!e.containsRect(i))return false;let s=t.points;for(let o=0;o<s.length;o+=2){let n=s[o],a=s[o+1];if(!this.contains(n,a))return false}return true}clone(){let t=this.points.slice(),e=new r(t);return e.closePath=this.closePath,e}contains(t,e){let i=false,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],h=this.points[o*2+1],l=this.points[n*2],c=this.points[n*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(i=!i);}return i}strokeContains(t,e,i,s=.5){let o=i*i,n=o*(1-s),a=o-n,{points:h}=this,l=h.length-(this.closePath?0:2);for(let c=0;c<l;c+=2){let u=h[c],f=h[c+1],d=h[(c+2)%h.length],p=h[(c+3)%h.length],x=Cp(t,e,u,f,d,p),g=Math.sign((d-u)*(e-f)-(p-f)*(t-u));if(x<=(g<0?a:n))return true}return false}getBounds(t){t||(t=new X);let e=this.points,i=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,h=e.length;a<h;a+=2){let l=e[a],c=e[a+1];i=l<i?l:i,s=l>s?l:s,o=c<o?c:o,n=c>n?c:n;}return t.x=i,t.width=s-i,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return `[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}};});var Go,Do,Ip=m(()=>{It();Go=(r,t,e,i,s,o,n)=>{let a=r-e,h=t-i,l=Math.sqrt(a*a+h*h);return l>=s-o&&l<=s+n},Do=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o;}getBounds(t){return t||(t=new X),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return false;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return true;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return true}return false}strokeContains(t,e,i,s=.5){let{x:o,y:n,width:a,height:h,radius:l}=this,c=i*(1-s),u=i-c,f=o+l,d=n+l,p=a-l*2,x=h-l*2,g=o+a,_=n+h;return (t>=o-c&&t<=o+u||t>=g-u&&t<=g+c)&&e>=d&&e<=d+x||(e>=n-c&&e<=n+u||e>=_-u&&e<=_+c)&&t>=f&&t<=f+p?true:t<f&&e<d&&Go(t,e,f,d,l,u,c)||t>g-l&&e<d&&Go(t,e,g-l,d,l,u,c)||t>g-l&&e>_-l&&Go(t,e,g-l,_-l,l,u,c)||t<f&&e>_-l&&Go(t,e,f,_-l,l,u,c)}toString(){return `[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}};});function Lo(r,t,e,i,s,o,n,a,h,l){let u=Math.min(.99,Math.max(0,l??Cr.defaultOptions.bezierSmoothness)),f=(ey-u)/1;return f*=f,ry(t,e,i,s,o,n,a,h,r,f),r}function ry(r,t,e,i,s,o,n,a,h,l){Fh(r,t,e,i,s,o,n,a,h,l,0),h.push(n,a);}function Fh(r,t,e,i,s,o,n,a,h,l,c){if(c>ty)return;let u=Math.PI,f=(r+e)/2,d=(t+i)/2,p=(e+s)/2,x=(i+o)/2,g=(s+n)/2,_=(o+a)/2,y=(f+p)/2,v=(d+x)/2,b=(p+g)/2,P=(x+_)/2,w=(y+b)/2,S=(v+P)/2;if(c>0){let B=n-r,F=a-t,M=Math.abs((e-n)*F-(i-a)*B),E=Math.abs((s-n)*F-(o-a)*B),L,Z;if(M>Uo&&E>Uo){if((M+E)*(M+E)<=l*(B*B+F*F)){if(Fr<Ih){h.push(w,S);return}let xt=Math.atan2(o-i,s-e);if(L=Math.abs(xt-Math.atan2(i-t,e-r)),Z=Math.abs(Math.atan2(a-o,n-s)-xt),L>=u&&(L=2*u-L),Z>=u&&(Z=2*u-Z),L+Z<Fr){h.push(w,S);return}if(Qe!==0){if(L>Qe){h.push(e,i);return}if(Z>Qe){h.push(s,o);return}}}}else if(M>Uo){if(M*M<=l*(B*B+F*F)){if(Fr<Ih){h.push(w,S);return}if(L=Math.abs(Math.atan2(o-i,s-e)-Math.atan2(i-t,e-r)),L>=u&&(L=2*u-L),L<Fr){h.push(e,i),h.push(s,o);return}if(Qe!==0&&L>Qe){h.push(e,i);return}}}else if(E>Uo){if(E*E<=l*(B*B+F*F)){if(Fr<Ih){h.push(w,S);return}if(L=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-i,s-e)),L>=u&&(L=2*u-L),L<Fr){h.push(e,i),h.push(s,o);return}if(Qe!==0&&L>Qe){h.push(s,o);return}}}else if(B=w-(r+n)/2,F=S-(t+a)/2,B*B+F*F<=l){h.push(w,S);return}}Fh(r,t,f,d,y,v,w,S,h,l,c+1),Fh(w,S,b,P,g,_,n,a,h,l,c+1);}var ty,Uo,ey,Ih,Fr,Qe,Rh=m(()=>{Po();ty=8,Uo=11920929e-14,ey=1,Ih=.01,Fr=0,Qe=0;});function Rp(r,t,e,i,s,o,n,a){let l=Math.min(.99,Math.max(0,a??Cr.defaultOptions.bezierSmoothness)),c=(oy-l)/1;return c*=c,ay(t,e,i,s,o,n,r,c),r}function ay(r,t,e,i,s,o,n,a){kh(n,r,t,e,i,s,o,a,0),n.push(s,o);}function kh(r,t,e,i,s,o,n,a,h){if(h>iy)return;let l=Math.PI,c=(t+i)/2,u=(e+s)/2,f=(i+o)/2,d=(s+n)/2,p=(c+f)/2,x=(u+d)/2,g=o-t,_=n-e,y=Math.abs((i-o)*_-(s-n)*g);if(y>sy){if(y*y<=a*(g*g+_*_)){if(Fp<ny){r.push(p,x);return}let v=Math.abs(Math.atan2(n-s,o-i)-Math.atan2(s-e,i-t));if(v>=l&&(v=2*l-v),v<Fp){r.push(p,x);return}}}else if(g=p-(t+o)/2,_=x-(e+n)/2,g*g+_*_<=a){r.push(p,x);return}kh(r,t,e,c,u,p,x,a,h+1),kh(r,p,x,f,d,o,n,a,h+1);}var iy,sy,oy,ny,Fp,kp=m(()=>{Po();iy=8,sy=11920929e-14,oy=1,ny=.01,Fp=0;});function Oo(r,t,e,i,s,o,n,a){let h=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(h=2*Math.PI-h),a||(a=Math.max(6,Math.floor(6*Math.pow(i,1/3)*(h/Math.PI)))),a=Math.max(a,3);let l=h/a,c=s;l*=n?-1:1;for(let u=0;u<a+1;u++){let f=Math.cos(c),d=Math.sin(c),p=t+f*i,x=e+d*i;r.push(p,x),c+=l;}}var Gh=m(()=>{});function Gp(r,t,e,i,s,o){let n=r[r.length-2],h=r[r.length-1]-e,l=n-t,c=s-e,u=i-t,f=Math.abs(h*u-l*c);if(f<1e-8||o===0){(r[r.length-2]!==t||r[r.length-1]!==e)&&r.push(t,e);return}let d=h*h+l*l,p=c*c+u*u,x=h*c+l*u,g=o*Math.sqrt(d)/f,_=o*Math.sqrt(p)/f,y=g*x/d,v=_*x/p,b=g*u+_*l,P=g*c+_*h,w=l*(_+y),S=h*(_+y),B=u*(g+v),F=c*(g+v),M=Math.atan2(S-P,w-b),E=Math.atan2(F-P,B-b);Oo(r,b+t,P+e,o,M,E,l*c>u*h);}var Dp=m(()=>{Gh();});function hy(r,t){let e=t===-1.5707963267948966?-0.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,s=Math.cos(r),o=Math.sin(r),n=Math.cos(r+t),a=Math.sin(r+t);return [{x:s-o*i,y:o+s*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function Lp(r,t,e,i,s,o,n,a=0,h=0,l=0){if(o===0||n===0)return;let c=Math.sin(a*Ni/360),u=Math.cos(a*Ni/360),f=u*(t-i)/2+c*(e-s)/2,d=-c*(t-i)/2+u*(e-s)/2;if(f===0&&d===0)return;o=Math.abs(o),n=Math.abs(n);let p=Math.pow(f,2)/Math.pow(o,2)+Math.pow(d,2)/Math.pow(n,2);p>1&&(o*=Math.sqrt(p),n*=Math.sqrt(p)),ly(t,e,i,s,o,n,h,l,c,u,f,d,Dh);let{ang1:x,ang2:g}=Dh,{centerX:_,centerY:y}=Dh,v=Math.abs(g)/(Ni/4);Math.abs(1-v)<1e-7&&(v=1);let b=Math.max(Math.ceil(v),1);g/=b;let P=r[r.length-2],w=r[r.length-1],S={x:0,y:0};for(let B=0;B<b;B++){let F=hy(x,g),{x:M,y:E}=Uh(F[0],o,n,u,c,_,y,S),{x:L,y:Z}=Uh(F[1],o,n,u,c,_,y,S),{x:xt,y:ri}=Uh(F[2],o,n,u,c,_,y,S);Lo(r,P,w,M,E,L,Z,xt,ri),P=xt,w=ri,x+=g;}}var Ni,Dh,Uh,Up,ly,Op=m(()=>{Rh();Ni=Math.PI*2,Dh={centerX:0,centerY:0,ang1:0,ang2:0},Uh=({x:r,y:t},e,i,s,o,n,a,h)=>{r*=e,t*=i;let l=s*r-o*t,c=o*r+s*t;return h.x=l+n,h.y=c+a,h};Up=(r,t,e,i)=>{let s=r*i-t*e<0?-1:1,o=r*e+t*i;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},ly=(r,t,e,i,s,o,n,a,h,l,c,u,f)=>{let d=Math.pow(s,2),p=Math.pow(o,2),x=Math.pow(c,2),g=Math.pow(u,2),_=d*p-d*g-p*x;_<0&&(_=0),_/=d*g+p*x,_=Math.sqrt(_)*(n===a?-1:1);let y=_*s/o*u,v=_*-o/s*c,b=l*y-h*v+(r+e)/2,P=h*y+l*v+(t+i)/2,w=(c-y)/s,S=(u-v)/o,B=(-c-y)/s,F=(-u-v)/o,M=Up(1,0,w,S),E=Up(w,S,B,F);a===0&&E>0&&(E-=Ni),a===1&&E<0&&(E+=Ni),f.centerX=b,f.centerY=P,f.ang1=M,f.ang2=E;};});function zp(r,t,e){let i=(n,a)=>{let h=a.x-n.x,l=a.y-n.y,c=Math.sqrt(h*h+l*l),u=h/c,f=l/c;return {len:c,nx:u,ny:f}},s=(n,a)=>{n===0?r.moveTo(a.x,a.y):r.lineTo(a.x,a.y);},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],h=a.radius??e;if(h<=0){s(n,a),o=a;continue}let l=t[(n+1)%t.length],c=i(a,o),u=i(a,l);if(c.len<1e-4||u.len<1e-4){s(n,a),o=a;continue}let f=Math.asin(c.nx*u.ny-c.ny*u.nx),d=1,p=false;c.nx*u.nx-c.ny*-u.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,d=-1,p=true):f>0&&(d=-1,p=true);let x=f/2,g,_=Math.abs(Math.cos(x)*h/Math.sin(x));_>Math.min(c.len/2,u.len/2)?(_=Math.min(c.len/2,u.len/2),g=Math.abs(_*Math.sin(x)/Math.cos(x))):g=h;let y=a.x+u.nx*_+-u.ny*g*d,v=a.y+u.ny*_+u.nx*g*d,b=Math.atan2(c.ny,c.nx)+Math.PI/2*d,P=Math.atan2(u.ny,u.nx)-Math.PI/2*d;n===0&&r.moveTo(y+Math.cos(b)*g,v+Math.sin(b)*g),r.arc(y,v,g,b,P,p),o=a;}}function Wp(r,t,e,i){let s=(a,h)=>Math.sqrt((a.x-h.x)**2+(a.y-h.y)**2),o=(a,h,l)=>({x:a.x+(h.x-a.x)*l,y:a.y+(h.y-a.y)*l}),n=t.length;for(let a=0;a<n;a++){let h=t[(a+1)%n],l=h.radius??e;if(l<=0){a===0?r.moveTo(h.x,h.y):r.lineTo(h.x,h.y);continue}let c=t[a],u=t[(a+2)%n],f=s(c,h),d;if(f<1e-4)d=h;else {let g=Math.min(f/2,l);d=o(h,c,g/f);}let p=s(u,h),x;if(p<1e-4)x=h;else {let g=Math.min(p/2,l);x=o(h,u,g/p);}a===0?r.moveTo(d.x,d.y):r.lineTo(d.x,d.y),r.quadraticCurveTo(h.x,h.y,x.x,x.y,i);}}var Hp=m(()=>{});var cy,zo,Vp=m(()=>{Ap();Mp();Bp();It();Ip();qt();Rh();kp();Gh();Dp();Op();Hp();cy=new X,zo=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new ot,this._graphicsPath2D=t,this.signed=t.checkForHoles;}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let i=this._currentPoly.points,s=i[i.length-2],o=i[i.length-1];return (s!==t||o!==e)&&i.push(t,e),this}arc(t,e,i,s,o,n){this._ensurePoly(false);let a=this._currentPoly.points;return Oo(a,t,e,i,s,o,n),this}arcTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return Gp(n,t,e,i,s,o),this}arcToSvg(t,e,i,s,o,n,a){let h=this._currentPoly.points;return Lp(h,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,i,s,o),this}bezierCurveTo(t,e,i,s,o,n,a){this._ensurePoly();let h=this._currentPoly;return Lo(this._currentPoly.points,h.lastX,h.lastY,t,e,i,s,o,n,a),this}quadraticCurveTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly;return Rp(this._currentPoly.points,n.lastX,n.lastY,t,e,i,s,o),this}closePath(){return this.endPoly(true),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(true),t.transform(e));let i=this.shapePrimitives,s=i.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data);}if(t.checkForHoles&&i.length-s>1){let o=null;for(let n=s;n<i.length;n++){let a=i[n];if(a.shape.type==="polygon"){let h=a.shape,l=o?.shape;l&&l.containsPolygon(h)?(o.holes||(o.holes=[]),o.holes.push(a),i.copyWithin(n,n+1),i.length--,n--):o=a;}}}return this}finish(t=false){this.endPoly(t);}rect(t,e,i,s,o){return this.drawShape(new X(t,e,i,s),o),this}circle(t,e,i,s){return this.drawShape(new Ro(t,e,i),s),this}poly(t,e,i){let s=new Ir(t);return s.closePath=e,this.drawShape(s,i),this}regularPoly(t,e,i,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,h=Math.PI*2/s,l=[];for(let c=0;c<s;c++){let u=a-c*h;l.push(t+i*Math.cos(u),e+i*Math.sin(u));}return this.poly(l,true,n),this}roundPoly(t,e,i,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,i,s,n);let h=i*Math.sin(Math.PI/s)-.001;o=Math.min(o,h);let l=-1*Math.PI/2+n,c=Math.PI*2/s,u=(s-2)*Math.PI/s/2;for(let f=0;f<s;f++){let d=f*c+l,p=t+i*Math.cos(d),x=e+i*Math.sin(d),g=d+Math.PI+u,_=d-Math.PI-u,y=p+o*Math.cos(g),v=x+o*Math.sin(g),b=p+o*Math.cos(_),P=x+o*Math.sin(_);f===0?this.moveTo(y,v):this.lineTo(y,v),this.quadraticCurveTo(p,x,b,P,a);}return this.closePath()}roundShape(t,e,i=false,s){return t.length<3?this:(i?Wp(this,t,e,s):zp(this,t,e),this.closePath())}filletRect(t,e,i,s,o){if(o===0)return this.rect(t,e,i,s);let n=Math.min(i,s)/2,a=Math.min(n,Math.max(-n,o)),h=t+i,l=e+s,c=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+c,e+c,t+u,e,u).lineTo(h-u,e).arcTo(h-c,e+c,h,e+u,u).lineTo(h,l-u).arcTo(h-c,l-c,t+i-u,l,u).lineTo(t+u,l).arcTo(t+c,l-c,t,l-u,u).closePath()}chamferRect(t,e,i,s,o,n){if(o<=0)return this.rect(t,e,i,s);let a=Math.min(o,Math.min(i,s)/2),h=t+i,l=e+s,c=[t+a,e,h-a,e,h,e+a,h,l-a,h-a,l,t+a,l,t,l-a,t,e+a];for(let u=c.length-1;u>=2;u-=2)c[u]===c[u-2]&&c[u-1]===c[u-3]&&c.splice(u-1,2);return this.poly(c,true,n)}ellipse(t,e,i,s,o){return this.drawShape(new ko(t,e,i,s),o),this}roundRect(t,e,i,s,o,n){return this.drawShape(new Do(t,e,i,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new Ir,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=false){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=true){if(!this._currentPoly&&(this._currentPoly=new Ir,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=i;i=o.a*i+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty;}this._currentPoly.points.push(i,s);}else this._currentPoly.points.push(0,0);}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){let i=t.instructions[e];this[i.action](...i.data);}this.finish();}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let i=0;i<e.length;i++){let s=e[i],o=s.shape.getBounds(cy);s.transform?t.addRect(o,s.transform):t.addRect(o);}return t}};});function $i(r,t){return r?r.prepend(t):t.clone()}var Ie,Lh=m(()=>{Kt();St();ct();Pp();Vp();Ie=class r{constructor(t,e=false){this.instructions=[],this.uid=$("graphicsPath"),this._dirty=true,this.checkForHoles=e,typeof t=="string"?Sp(t,this):this.instructions=t?.slice()??[];}get shapePath(){return this._shapePath||(this._shapePath=new zo(this)),this._dirty&&(this._dirty=false,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=true,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=true,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=true,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=true,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=true,this}bezierCurveToShort(t,e,i,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(N.shared),h=0,l=0;if(!n||n.action!=="bezierCurveTo")h=a.x,l=a.y;else {h=n.data[2],l=n.data[3];let c=a.x,u=a.y;h=c+(c-h),l=u+(u-l);}return this.instructions.push({action:"bezierCurveTo",data:[h,l,t,e,i,s,o]}),this._dirty=true,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=true,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=true,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=true,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=true,this}quadraticCurveToShort(t,e,i){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(N.shared),n=0,a=0;if(!s||s.action!=="quadraticCurveTo")n=o.x,a=o.y;else {n=s.data[0],a=s.data[1];let h=o.x,l=o.y;n=h+(h-n),a=l+(l-a);}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,i]}),this._dirty=true,this}rect(t,e,i,s,o){return this.instructions.push({action:"rect",data:[t,e,i,s,o]}),this._dirty=true,this}circle(t,e,i,s){return this.instructions.push({action:"circle",data:[t,e,i,s]}),this._dirty=true,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=true,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=true,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=true,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=true,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=true,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=true,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=true,this}star(t,e,i,s,o,n,a){o||(o=s/2);let h=-1*Math.PI/2+n,l=i*2,c=Math.PI*2/l,u=[];for(let f=0;f<l;f++){let d=f%2?o:s,p=f*c+h;u.push(t+d*Math.cos(p),e+d*Math.sin(p));}return this.poly(u,true,a),this}clone(t=false){let e=new r;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){let s=this.instructions[i];e.instructions.push({action:s.action,data:s.data.slice()});}return e}clear(){return this.instructions.length=0,this._dirty=true,this}transform(t){if(t.isIdentity())return this;let e=t.a,i=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,h=0,l=0,c=0,u=0,f=0,d=0,p=0,x=0;for(let g=0;g<this.instructions.length;g++){let _=this.instructions[g],y=_.data;switch(_.action){case "moveTo":case "lineTo":h=y[0],l=y[1],y[0]=e*h+s*l+n,y[1]=i*h+o*l+a;break;case "bezierCurveTo":c=y[0],u=y[1],f=y[2],d=y[3],h=y[4],l=y[5],y[0]=e*c+s*u+n,y[1]=i*c+o*u+a,y[2]=e*f+s*d+n,y[3]=i*f+o*d+a,y[4]=e*h+s*l+n,y[5]=i*h+o*l+a;break;case "quadraticCurveTo":c=y[0],u=y[1],h=y[2],l=y[3],y[0]=e*c+s*u+n,y[1]=i*c+o*u+a,y[2]=e*h+s*l+n,y[3]=i*h+o*l+a;break;case "arcToSvg":h=y[5],l=y[6],p=y[0],x=y[1],y[0]=e*p+s*x,y[1]=i*p+o*x,y[5]=e*h+s*l+n,y[6]=i*h+o*l+a;break;case "circle":y[4]=$i(y[3],t);break;case "rect":y[4]=$i(y[4],t);break;case "ellipse":y[8]=$i(y[8],t);break;case "roundRect":y[5]=$i(y[5],t);break;case "addPath":y[0].transform(t);break;case "poly":y[2]=$i(y[2],t);break;default:G("unknown transform action",_.action);break}}return this._dirty=true,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,i=this.instructions[e];if(!i)return t.x=0,t.y=0,t;for(;i.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;i=this.instructions[e];}switch(i.action){case "moveTo":case "lineTo":t.x=i.data[0],t.y=i.data[1];break;case "quadraticCurveTo":t.x=i.data[2],t.y=i.data[3];break;case "bezierCurveTo":t.x=i.data[4],t.y=i.data[5];break;case "arc":case "arcToSvg":t.x=i.data[5],t.y=i.data[6];break;case "addPath":i.data[0].getLastPoint(t);break}return t}};});function st(r,t,e){let i=r.getAttribute(t);return i?Number(i):e}var Oh=m(()=>{});function Np(r,t){let e=r.querySelectorAll("defs");for(let i=0;i<e.length;i++){let s=e[i];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case "lineargradient":t.defs[n.id]=uy(n);break;case "radialgradient":t.defs[n.id]=dy();break;}}}}function uy(r){let t=st(r,"x1",0),e=st(r,"y1",0),i=st(r,"x2",1),s=st(r,"y2",0),o=r.getAttribute("gradientUnits")||"objectBoundingBox",n=new kt(t,e,i,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<r.children.length;a++){let h=r.children[a],l=st(h,"offset",0),c=V.shared.setValue(h.getAttribute("stop-color")).toNumber();n.addColorStop(l,c);}return n}function dy(r){return G("[SVG Parser] Radial gradients are not yet supported"),new kt(0,0,1,0)}var $p=m(()=>{Bt();ct();Mr();Oh();});function zh(r){let t=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var Yp=m(()=>{});function Wh(r,t){let e=r.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:false,useStroke:false};for(let n in Xp){let a=r.getAttribute(n);a&&jp(t,o,n,a.trim());}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let h=n[a].trim(),[l,c]=h.split(":");Xp[l]&&jp(t,o,l,c.trim());}}return {strokeStyle:o.useStroke?i:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function jp(r,t,e,i){switch(e){case "stroke":if(i!=="none"){if(i.startsWith("url(")){let s=zh(i);t.strokeStyle.fill=r.defs[s];}else t.strokeStyle.color=V.shared.setValue(i).toNumber();t.useStroke=true;}break;case "stroke-width":t.strokeStyle.width=Number(i);break;case "fill":if(i!=="none"){if(i.startsWith("url(")){let s=zh(i);t.fillStyle.fill=r.defs[s];}else t.fillStyle.color=V.shared.setValue(i).toNumber();t.useFill=true;}break;case "fill-opacity":t.fillStyle.alpha=Number(i);break;case "stroke-opacity":t.strokeStyle.alpha=Number(i);break;case "opacity":t.fillStyle.alpha=Number(i),t.strokeStyle.alpha=Number(i);break}}var Xp,Kp=m(()=>{Bt();Yp();Xp={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}};});function qp(r,t){if(typeof r=="string"){let n=document.createElement("div");n.innerHTML=r.trim(),r=n.querySelector("svg");}let e={context:t,defs:{},path:new Ie};Np(r,e);let i=r.children,{fillStyle:s,strokeStyle:o}=Wh(r,e);for(let n=0;n<i.length;n++){let a=i[n];a.nodeName.toLowerCase()!=="defs"&&Zp(a,e,s,o);}return t}function Zp(r,t,e,i){let s=r.children,{fillStyle:o,strokeStyle:n}=Wh(r,t);o&&e?e={...e,...o}:o&&(e=o),n&&i?i={...i,...n}:n&&(i=n);let a=!e&&!i;a&&(e={color:0});let h,l,c,u,f,d,p,x,g,_,y,v,b,P,w,S,B;switch(r.nodeName.toLowerCase()){case "path":P=r.getAttribute("d"),r.getAttribute("fill-rule")==="evenodd"&&G("SVG Evenodd fill rule not supported, your svg may render incorrectly"),w=new Ie(P,true),t.context.path(w),e&&t.context.fill(e),i&&t.context.stroke(i);break;case "circle":p=st(r,"cx",0),x=st(r,"cy",0),g=st(r,"r",0),t.context.ellipse(p,x,g,g),e&&t.context.fill(e),i&&t.context.stroke(i);break;case "rect":h=st(r,"x",0),l=st(r,"y",0),S=st(r,"width",0),B=st(r,"height",0),_=st(r,"rx",0),y=st(r,"ry",0),_||y?t.context.roundRect(h,l,S,B,_||y):t.context.rect(h,l,S,B),e&&t.context.fill(e),i&&t.context.stroke(i);break;case "ellipse":p=st(r,"cx",0),x=st(r,"cy",0),_=st(r,"rx",0),y=st(r,"ry",0),t.context.beginPath(),t.context.ellipse(p,x,_,y),e&&t.context.fill(e),i&&t.context.stroke(i);break;case "line":c=st(r,"x1",0),u=st(r,"y1",0),f=st(r,"x2",0),d=st(r,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(f,d),i&&t.context.stroke(i);break;case "polygon":b=r.getAttribute("points"),v=b.match(/\d+/g).map(F=>parseInt(F,10)),t.context.poly(v,true),e&&t.context.fill(e),i&&t.context.stroke(i);break;case "polyline":b=r.getAttribute("points"),v=b.match(/\d+/g).map(F=>parseInt(F,10)),t.context.poly(v,false),i&&t.context.stroke(i);break;case "g":case "svg":break;default:{G(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}a&&(e=null);for(let F=0;F<s.length;F++)Zp(s[F],t,e,i);}var Qp=m(()=>{ct();Lh();$p();Oh();Kp();});function fy(r){return V.isColorLike(r)}function Jp(r){return r instanceof ge}function tm(r){return r instanceof kt}function py(r){return r instanceof I}function my(r,t,e){let i=V.shared.setValue(t??0);return r.color=i.toNumber(),r.alpha=i.alpha===1?e.alpha:i.alpha,r.texture=I.WHITE,{...e,...r}}function gy(r,t,e){return r.texture=t,{...e,...r}}function em(r,t,e){return r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,{...e,...r}}function rm(r,t,e){return t.buildGradient(),r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,r.textureSpace=t.textureSpace,{...e,...r}}function xy(r,t){let e={...t,...r},i=V.shared.setValue(e.color);return e.alpha*=i.alpha,e.color=i.toNumber(),e}function xe(r,t){if(r==null)return null;let e={},i=r;return fy(r)?my(e,r,t):py(r)?gy(e,r,t):Jp(r)?em(e,r,t):tm(r)?rm(e,r,t):i.fill&&Jp(i.fill)?em(i,i.fill,t):i.fill&&tm(i.fill)?rm(i,i.fill,t):xy(i,t)}function Rr(r,t){let{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...h}=t,l=xe(r,h);return l?{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var Hh=m(()=>{Bt();at();Mr();Fo();});var _y,im,Vh,Et,Wo=m(()=>{Dt();Bt();rt();Kt();at();St();ht();qt();Lh();Qp();Hh();_y=new N,im=new C,Vh=class ae extends Y{constructor(){super(...arguments),this.uid=$("graphicsContext"),this.dirty=true,this.batchMode="auto",this.instructions=[],this._activePath=new Ie,this._transform=new C,this._fillStyle={...ae.defaultFillStyle},this._strokeStyle={...ae.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new ot,this._boundsDirty=true;}clone(){let t=new ae;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=true,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=xe(t,ae.defaultFillStyle);}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=Rr(t,ae.defaultStrokeStyle);}setFillStyle(t){return this._fillStyle=xe(t,ae.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=xe(t,ae.defaultStrokeStyle),this}texture(t,e,i,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?V.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Ie,this}fill(t,e){let i,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?i=s.data.path:i=this._activePath.clone(),i?(t!=null&&(e!==void 0&&typeof t=="number"&&(D(O,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=xe(t,ae.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(N.shared);this._activePath.clear(),this._activePath.moveTo(t,e);}stroke(t){let e,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?e=i.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=Rr(t,ae.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let e=this.instructions[this.instructions.length-1-t],i=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(i);else {e.data.hole=i;break}}return this._initNextPathLocation(),this}arc(t,e,i,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,i,s,o,n),this}arcTo(t,e,i,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}arcToSvg(t,e,i,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.arcToSvg(t,e,i,s,o,h.a*n+h.c*a+h.tx,h.b*n+h.d*a+h.ty),this}bezierCurveTo(t,e,i,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.bezierCurveTo(h.a*t+h.c*e+h.tx,h.b*t+h.d*e+h.ty,h.a*i+h.c*s+h.tx,h.b*i+h.d*s+h.ty,h.a*o+h.c*n+h.tx,h.b*o+h.d*n+h.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,i,s){return this._tick++,this._activePath.ellipse(t,e,i,s,this._transform.clone()),this}circle(t,e,i){return this._tick++,this._activePath.circle(t,e,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*t+i.c*e+i.tx,i.b*t+i.d*e+i.ty),this}moveTo(t,e){this._tick++;let i=this._transform,s=this._activePath.instructions,o=i.a*t+i.c*e+i.tx,n=i.b*t+i.d*e+i.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(t,e,i,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}rect(t,e,i,s){return this._tick++,this._activePath.rect(t,e,i,s,this._transform.clone()),this}roundRect(t,e,i,s,o){return this._tick++,this._activePath.roundRect(t,e,i,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,i,s,o,n),this}roundPoly(t,e,i,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,i,s,o,n),this}roundShape(t,e,i,s){return this._tick++,this._activePath.roundShape(t,e,i,s),this}filletRect(t,e,i,s,o){return this._tick++,this._activePath.filletRect(t,e,i,s,o),this}chamferRect(t,e,i,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,i,s,o,n),this}star(t,e,i,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,i,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,qp(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,i,s,o,n){return t instanceof C?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,s,o,n),this)}transform(t,e,i,s,o,n){return t instanceof C?(this._transform.append(t),this):(im.set(t,e,i,s,o,n),this._transform.append(im),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=true,this._boundsDirty=true);}get bounds(){if(!this._boundsDirty)return this._bounds;let t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){let i=this.instructions[e],s=i.action;if(s==="fill"){let o=i.data;t.addBounds(o.path.bounds);}else if(s==="texture"){let o=i.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform);}if(s==="stroke"){let o=i.data,n=o.style.alignment,a=o.style.width*(1-n),h=o.path.bounds;t.addFrame(h.minX-a,h.minY-a,h.maxX+a,h.maxY+a);}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return false;let e=this.instructions,i=false;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let h=n.style,l=a.shapePath.shapePrimitives;for(let c=0;c<l.length;c++){let u=l[c].shape;if(!h||!u)continue;let f=l[c].transform,d=f?f.applyInverse(t,_y):t;if(o.action==="fill")i=u.contains(d.x,d.y);else {let x=h;i=u.strokeContains(d.x,d.y,x.width,x.alignment);}let p=n.hole;if(p){let x=p.shapePath?.shapePrimitives;if(x)for(let g=0;g<x.length;g++)x[g].shape.contains(d.x,d.y)&&(i=false);}if(i)return true}}return i}destroy(t=false){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(i),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(i);}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null;}};Vh.defaultFillStyle={color:16777215,alpha:1,texture:I.WHITE,matrix:null,fill:null,textureSpace:"local"};Vh.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:I.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:false};Et=Vh;});function Ho(r){let t=[],e=0;for(let i=0;i<sm.length;i++){let s=`_${sm[i]}`;t[e++]=r[s];}return e=om(r._fill,t,e),e=yy(r._stroke,t,e),e=by(r.dropShadow,t,e),t.join("-")}function om(r,t,e){return r&&(t[e++]=r.color,t[e++]=r.alpha,t[e++]=r.fill?.styleKey),e}function yy(r,t,e){return r&&(e=om(r,t,e),t[e++]=r.width,t[e++]=r.alignment,t[e++]=r.cap,t[e++]=r.join,t[e++]=r.miterLimit),e}function by(r,t,e){return r&&(t[e++]=r.alpha,t[e++]=r.angle,t[e++]=r.blur,t[e++]=r.distance,t[e++]=V.shared.setValue(r.color).toNumber()),e}var sm,Nh=m(()=>{Bt();sm=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"];});function vy(r){let t=r;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=Gt.defaultDropShadow;r.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance};}if(t.strokeThickness!==void 0){D(O,"strokeThickness is now a part of stroke");let e=t.stroke,i={};if(V.isColorLike(e))i.color=e;else if(e instanceof kt||e instanceof ge)i.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))i=e;else throw new Error("Invalid stroke value.");r.stroke={...i,width:t.strokeThickness};}if(Array.isArray(t.fillGradientStops)){D(O,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;r.fontSize==null?r.fontSize=Gt.defaultTextStyle.fontSize:typeof r.fontSize=="string"?e=parseInt(r.fontSize,10):e=r.fontSize;let i=new kt({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>V.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o);}),r.fill={fill:i};}}var $h,Gt,Gr=m(()=>{Dt();Bt();ht();Mr();Fo();Wo();Hh();Nh();$h=class kr extends Y{constructor(t={}){super(),vy(t);let e={...kr.defaultTextStyle,...t};for(let i in e){let s=i;this[s]=e[i];}this.update();}get align(){return this._align}set align(t){this._align=t,this.update();}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update();}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...kr.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...kr.defaultDropShadow}):null,this.update();}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update();}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update();}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t.toLowerCase(),this.update();}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update();}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update();}get leading(){return this._leading}set leading(t){this._leading=t,this.update();}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update();}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update();}get padding(){return this._padding}set padding(t){this._padding=t,this.update();}get trim(){return this._trim}set trim(t){this._trim=t,this.update();}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update();}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update();}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update();}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update();}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...Et.defaultFillStyle,...t},()=>{this._fill=xe({...this._originalFill},Et.defaultFillStyle);})),this._fill=xe(t===0?"black":t,Et.defaultFillStyle),this.update());}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Et.defaultStrokeStyle,...t},()=>{this._stroke=Rr({...this._originalStroke},Et.defaultStrokeStyle);})),this._stroke=Rr(t,Et.defaultStrokeStyle),this.update());}_generateKey(){return this._styleKey=Ho(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this);}reset(){let t=kr.defaultTextStyle;for(let e in t)this[e]=t[e];}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new kr({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=false){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(i),this._originalFill?.texture&&this._originalFill.texture.destroy(i),this._stroke?.texture&&this._stroke.texture.destroy(i),this._originalStroke?.texture&&this._originalStroke.texture.destroy(i);}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null;}_createProxy(t,e){return new Proxy(t,{set:(i,s,o)=>(i[s]=o,e?.(s,o),this.update(),true)})}_isFillStyle(t){return (t??null)!==null&&!(V.isColorLike(t)||t instanceof kt||t instanceof ge)}};$h.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};$h.defaultTextStyle={align:"left",breakWords:false,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:false,whiteSpace:"pre",wordWrap:false,wordWrapWidth:100};Gt=$h;});function Vo(r,t,e,i){let s=Ty;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;let o=Tt.getOptimalTexture(s.width,s.height,i,false);return o.source.uploadMethodId="image",o.source.resource=r,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/i,o.frame.height=e/i,o.source.emit("update",o.source),o.updateUvs(),o}var Ty,Yh=m(()=>{nr();qt();Ty=new ot;});function Je(r){let t=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize,e=r.fontFamily;Array.isArray(r.fontFamily)||(e=r.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!wy.includes(s)&&(s=`"${s}"`),e[i]=s;}return `${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${t} ${e.join(",")}`}var wy,No=m(()=>{wy=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];});var Xh,Jt,Vt,$o=m(()=>{gt();No();Xh={willReadFrequently:true},Jt=class k{static get experimentalLetterSpacingSupported(){let t=k._experimentalLetterSpacingSupported;if(t!==void 0){let e=W.get().getCanvasRenderingContext2D().prototype;t=k._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e;}return t}constructor(t,e,i,s,o,n,a,h,l){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l;}static measureText(t=" ",e,i=k._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(k._measurementCache[o])return k._measurementCache[o];let n=Je(e),a=k.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let h=k.__context;h.font=n;let c=(s?k._wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),u=new Array(c.length),f=0;for(let y=0;y<c.length;y++){let v=k._measureText(c[y],e.letterSpacing,h);u[y]=v,f=Math.max(f,v);}let d=e._stroke?.width||0,p=f+d;e.dropShadow&&(p+=e.dropShadow.distance);let x=e.lineHeight||a.fontSize,g=Math.max(x,a.fontSize+d)+(c.length-1)*(x+e.leading);return e.dropShadow&&(g+=e.dropShadow.distance),new k(t,e,p,g,c,u,x+e.leading,f,a)}static _measureText(t,e,i){let s=false;k.experimentalLetterSpacingSupported&&(k.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=true):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let o=i.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,l=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,l-=e;else {let c=(k.graphemeSegmenter(t).length-1)*e;n+=c,l+=c;}return Math.max(n,l)}static _wordWrap(t,e,i=k._canvas){let s=i.getContext("2d",Xh),o=0,n="",a="",h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=k._collapseSpaces(c),f=k._collapseNewlines(c),d=!u,p=e.wordWrapWidth+l,x=k._tokenize(t);for(let g=0;g<x.length;g++){let _=x[g];if(k._isNewline(_)){if(!f){a+=k._addLine(n),d=!u,n="",o=0;continue}_=" ";}if(u){let v=k.isBreakingSpace(_),b=k.isBreakingSpace(n[n.length-1]);if(v&&b)continue}let y=k._getFromCache(_,l,h,s);if(y>p)if(n!==""&&(a+=k._addLine(n),n="",o=0),k.canBreakWords(_,e.breakWords)){let v=k.wordWrapSplit(_);for(let b=0;b<v.length;b++){let P=v[b],w=P,S=1;for(;v[b+S];){let F=v[b+S];if(!k.canBreakChars(w,F,_,b,e.breakWords))P+=F;else break;w=F,S++;}b+=S-1;let B=k._getFromCache(P,l,h,s);B+o>p&&(a+=k._addLine(n),d=false,n="",o=0),n+=P,o+=B;}}else {n.length>0&&(a+=k._addLine(n),n="",o=0);let v=g===x.length-1;a+=k._addLine(_,!v),d=false,n="",o=0;}else y+o>p&&(d=false,a+=k._addLine(n),n="",o=0),(n.length>0||!k.isBreakingSpace(_)||d)&&(n+=_,o+=y);}return a+=k._addLine(n,false),a}static _addLine(t,e=true){return t=k._trimRight(t),t=e?`${t}
368
368
  `:t,t}static _getFromCache(t,e,i,s){let o=i[t];return typeof o!="number"&&(o=k._measureText(t,e,s)+e,i[t]=o),o}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return "";for(let e=t.length-1;e>=0;e--){let i=t[e];if(!k.isBreakingSpace(i))break;t=t.slice(0,-1);}return t}static _isNewline(t){return typeof t!="string"?false:k._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?false:k._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(k.isBreakingSpace(o,n)||k._isNewline(o)){i!==""&&(e.push(i),i=""),e.push(o);continue}i+=o;}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,o){return true}static wordWrapSplit(t){return k.graphemeSegmenter(t)}static measureFont(t){if(k._fonts[t])return k._fonts[t];let e=k._context;e.font=t;let i=e.measureText(k.METRICS_STRING+k.BASELINE_SYMBOL),s={ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,fontSize:i.actualBoundingBoxAscent+i.actualBoundingBoxDescent};return k._fonts[t]=s,s}static clearMetrics(t=""){t?delete k._fonts[t]:k._fonts={};}static get _canvas(){if(!k.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",Xh)?.measureText)return k.__canvas=e,e;t=W.get().createCanvas();}catch{t=W.get().createCanvas();}t.width=t.height=10,k.__canvas=t;}return k.__canvas}static get _context(){return k.__context||(k.__context=k._canvas.getContext("2d",Xh)),k.__context}};Jt.METRICS_STRING="|\xC9q\xC5";Jt.BASELINE_SYMBOL="M";Jt.BASELINE_MULTIPLIER=1.4;Jt.HEIGHT_MULTIPLIER=2;Jt.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})();Jt.experimentalLetterSpacing=false;Jt._fonts={};Jt._newlines=[10,13];Jt._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];Jt._measurementCache={};Vt=Jt;});function Dr(r,t,e,i=0){if(r.texture===I.WHITE&&!r.fill)return V.shared.setValue(r.color).setAlpha(r.alpha??1).toHexa();if(r.fill){if(r.fill instanceof ge){let s=r.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(C.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(r.fill instanceof kt){let s=r.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,h=1;n&&e&&(a=e.width+i,h=e.height+i);let l,c=false;if(o){let{start:u,end:f}=s;l=t.createLinearGradient(u.x*a,u.y*h,f.x*a,f.y*h),c=Math.abs(f.x-u.x)<Math.abs((f.y-u.y)*.1);}else {let{center:u,innerRadius:f,outerCenter:d,outerRadius:p}=s;l=t.createRadialGradient(u.x*a,u.y*h,f*a,d.x*a,d.y*h,p*a);}if(c&&n&&e){let u=e.lineHeight/h;for(let f=0;f<e.lines.length;f++){let d=(f*e.lineHeight+i/2)/h;s.colorStops.forEach(p=>{let x=d+p.offset*u;l.addColorStop(Math.floor(x*nm)/nm,V.shared.setValue(p.color).toHex());});}}else s.colorStops.forEach(u=>{l.addColorStop(u.offset,V.shared.setValue(u.color).toHex());});return l}}else {let s=t.createPattern(r.texture.source.resource,"repeat"),o=r.matrix.copyTo(C.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),s.setTransform(o),s}return G("FillStyle not recognised",r),"red"}var nm,jh=m(()=>{Bt();rt();at();ct();Mr();Fo();nm=1e5;});var Yi,am=m(()=>{Bt();A();fi();Vi();nr();yp();ht();Gr();Yh();$o();No();jh();Yi=class{constructor(t){this._activeTextures={},this._renderer=t;}getTextureSize(t,e,i){let s=Vt.measureText(t||" ",i),o=Math.ceil(Math.ceil(Math.max(1,s.width)+i.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+i.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=ue(o),n=ue(n),{width:o,height:n}}getTexture(t,e,i,s){typeof t=="string"&&(D("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof Gt||(t.style=new Gt(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),Qt.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:i}=t,s=t.resolution??this._renderer.resolution,o=Vt.measureText(e||" ",i),n=Math.ceil(Math.ceil(Math.max(1,o.width)+i.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+i.padding*2)*s),h=Qt.getOptimalCanvasAndContext(n,a),{canvas:l}=h;this.renderTextToCanvas(e,i,s,h);let c=Vo(l,n,a,s);if(i.trim){let u=_p(l,s);c.frame.copyFrom(u),c.updateUvs();}return {texture:c,canvasAndContext:h}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let{texture:i,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:i,usageCount:1},i}_increaseReferenceCount(t){this._activeTextures[t].usageCount++;}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",Tt.returnTexture(t);}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(Qt.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null);}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,i,s){let{canvas:o,context:n}=s,a=Je(e),h=Vt.measureText(t||" ",e),l=h.lines,c=h.lineHeight,u=h.lineWidths,f=h.maxLineWidth,d=h.fontProperties,p=o.height;if(n.resetTransform(),n.scale(i,i),n.textBaseline=e.textBaseline,e._stroke?.width){let y=e._stroke;n.lineWidth=y.width,n.miterLimit=y.miterLimit,n.lineJoin=y.join,n.lineCap=y.cap;}n.font=a;let x,g,_=e.dropShadow?2:1;for(let y=0;y<_;++y){let v=e.dropShadow&&y===0,b=v?Math.ceil(Math.max(1,p)+e.padding*2):0,P=b*i;if(v){n.fillStyle="black",n.strokeStyle="black";let B=e.dropShadow,F=B.color,M=B.alpha;n.shadowColor=V.shared.setValue(F).setAlpha(M).toRgbaString();let E=B.blur*i,L=B.distance*i;n.shadowBlur=E,n.shadowOffsetX=Math.cos(B.angle)*L,n.shadowOffsetY=Math.sin(B.angle)*L+P;}else {if(n.fillStyle=e._fill?Dr(e._fill,n,h):null,e._stroke?.width){let B=e._stroke.width*e._stroke.alignment;n.strokeStyle=Dr(e._stroke,n,h,B);}n.shadowColor="black";}let w=(c-d.fontSize)/2;c-d.fontSize<0&&(w=0);let S=e._stroke?.width??0;for(let B=0;B<l.length;B++)x=S/2,g=S/2+B*c+d.ascent+w,e.align==="right"?x+=f-u[B]:e.align==="center"&&(x+=(f-u[B])/2),e._stroke?.width&&this._drawLetterSpacing(l[B],e,s,x+e.padding,g+e.padding-b,true),e._fill!==void 0&&this._drawLetterSpacing(l[B],e,s,x+e.padding,g+e.padding-b);}}_drawLetterSpacing(t,e,i,s,o,n=false){let{context:a}=i,h=e.letterSpacing,l=false;if(Vt.experimentalLetterSpacingSupported&&(Vt.experimentalLetterSpacing?(a.letterSpacing=`${h}px`,a.textLetterSpacing=`${h}px`,l=true):(a.letterSpacing="0px",a.textLetterSpacing="0px")),h===0||l){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let c=s,u=Vt.graphemeSegmenter(t),f=a.measureText(t).width,d=0;for(let p=0;p<u.length;++p){let x=u[p];n?a.strokeText(x,c,o):a.fillText(x,c,o);let g="";for(let _=p+1;_<u.length;++_)g+=u[_];d=a.measureText(g).width,c+=f-d+h,f=d;}}destroy(){this._activeTextures=null;}};Yi.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"canvasText"};});var Kh=m(()=>{A();mp();am();R.add(Yi);R.add(Hi);});var Yo,hm=m(()=>{ht();Vs();Wo();Yo=class r extends we{constructor(t){t instanceof Et&&(t={context:t});let{context:e,roundPixels:i,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new Et,this._context.on("update",this.onViewUpdate,this),this.allowChildren=false,this.roundPixels=i??false;}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate());}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===true||t?.context===true)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t);}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t;}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t;}clone(t=false){return t?new r(this._context.clone()):(this._ownedContext=null,new r(this._context))}lineStyle(t,e,i){D(O,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return t&&(s.width=t),e&&(s.color=e),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(t,e){D(O,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let i={};return t!==void 0&&(i.color=t),e!==void 0&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){D(O,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return (t.width!==Et.defaultStrokeStyle.width||t.color!==Et.defaultStrokeStyle.color||t.alpha!==Et.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return D(O,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return D(O,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return D(O,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return D(O,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return D(O,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return D(O,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}};});var lm,cm,um=m(()=>{lm={name:"local-uniform-msdf-bit",vertex:{header:`
369
369
  struct LocalUniforms {
370
370
  uColor:vec4<f32>,
@@ -617,4 +617,4 @@ ${u}`)}});return await Promise.all(h),o?s[n[0].src]:s}async unload(t){let i=At(t
617
617
  };
618
618
 
619
619
  })();
620
- `,Yr=null,rs=class{constructor(){Yr||(Yr=URL.createObjectURL(new Blob([Ky],{type:"application/javascript"}))),this.worker=new Worker(Yr);}};rs.revokeObjectURL=function(){Yr&&(URL.revokeObjectURL(Yr),Yr=null);};var Vg=0,ml,gl=class{constructor(){this._initialized=false,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={};}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new $r;e.addEventListener("message",i=>{e.terminate(),$r.revokeObjectURL(),t(i.data);});}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=true);}_getWorker(){ml===void 0&&(ml=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return !t&&this._createdWorkers<ml&&(this._createdWorkers++,t=new rs().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next();})),t}_returnWorker(t){this._workerPool.push(t);}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null;}async _run(t,e){await this._initWorkers();let i=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o});});return this._next(),i}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),i=e.id;this._resolveHash[Vg]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Vg++,id:i});}},xl=new gl;pe();var qy=[".jpeg",".jpg",".png",".webp",".avif"],Zy=["image/jpeg","image/png","image/webp","image/avif"];async function Qy(r,t){let e=await W.get().fetch(r);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${e.status} ${e.statusText}`);let i=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var hn={name:"loadTextures",extension:{type:T.LoadParser,priority:mt.High,name:"loadTextures"},config:{preferWorkers:true,preferCreateImageBitmap:true,crossOrigin:"anonymous"},test(r){return Nt(r,Zy)||$t(r,qy)},async load(r,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await xl.isImageBitmapSupported()?i=await xl.loadImageBitmap(r,t):i=await Qy(r,t):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i);},i.onerror=n);});let s=new Rt({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Hr(r),...t.data});return Vr(s,e,r)},unload(r){r.destroy(true);}};A();Ma();Aa();var Ng=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],Jy=Ng.map(r=>`video/${r.substring(1)}`);function tb(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=rb(t):e!==false&&(r.crossOrigin=typeof e=="string"?e:"anonymous");}function eb(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),t();}function s(n){o(),e(n);}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s);}})}function rb(r,t=globalThis.location){if(r.startsWith("data:"))return "";t||(t=globalThis.location);let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var $g={name:"loadVideo",extension:{type:T.LoadParser,name:"loadVideo"},test(r){let t=Nt(r,Jy),e=$t(r,Ng);return t||e},async load(r,t,e){let i={...fr.defaultOptions,resolution:t.data?.resolution||Hr(r),alphaMode:t.data?.alphaMode||await Ks(),...t.data},s=document.createElement("video"),o={preload:i.autoLoad!==false?"auto":void 0,"webkit-playsinline":i.playsinline!==false?"":void 0,playsinline:i.playsinline!==false?"":void 0,muted:i.muted===true?"":void 0,loop:i.loop===true?"":void 0,autoplay:i.autoPlay!==false?"":void 0};Object.keys(o).forEach(h=>{let l=o[h];l!==void 0&&s.setAttribute(h,l);}),i.muted===true&&(s.muted=true),tb(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let h=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=fr.MIME_TYPES[h]||`video/${h}`;}return n.src=r,a&&(n.type=a),new Promise(h=>{let l=async()=>{let c=new fr({...i,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await eb(s),h(Vr(c,e,r));};s.addEventListener("canplay",l),s.appendChild(n);})},unload(r){r.destroy(true);}};A();cr();A();cr();var ln={extension:{type:T.ResolveParser,name:"resolveTexture"},test:hn.test,parse:r=>({resolution:parseFloat(Ot.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var Yg={extension:{type:T.ResolveParser,priority:-2,name:"resolveJson"},test:r=>Ot.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:ln.parse};cr();vi();Ns();var cn=class{constructor(){this._detections=[],this._initialized=false,this.resolver=new Ot,this.loader=new an,this.cache=j,this._backgroundLoader=new on(this.loader),this._backgroundLoader.active=true,this.reset();}async init(t={}){if(this._initialized){G("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=true,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o);}let e=t.texturePreference?.resolution??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences);}add(t){this.resolver.add(t);}async load(t,e){this._initialized||await this.init();let i=Ye(t),s=At(t).map(a=>{if(typeof a!="string"){let h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return i?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e);}async loadBundle(t,e){this._initialized||await this.init();let i=false;typeof t=="string"&&(i=true,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,h=0,l=()=>{e?.(++a/h);},c=n.map(u=>{let f=s[u];return h+=Object.keys(f).length,this._mapLoadToResolve(f,l).then(d=>{o[u]=d;})});return await Promise.all(c),i?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e));}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i));});}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=false;}get(t){if(typeof t=="string")return j.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=j.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=[...new Set(Object.values(t))];this._backgroundLoader.active=false;let s=await this.loader.load(i,e);this._backgroundLoader.active=true;let o={};return i.forEach(n=>{let a=s[n.src],h=[n.src];n.alias&&h.push(...n.alias),h.forEach(l=>{o[l]=a;}),j.set(h,a);}),o}async unload(t){this._initialized||await this.init();let e=At(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i);}async unloadBundle(t){this._initialized||await this.init(),t=At(t);let e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i);}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(i=>{j.remove(i.src);}),await this.loader.unload(e);}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i];});});}},te=new cn;R.handleByList(T.LoadParser,te.loader.parsers).handleByList(T.ResolveParser,te.resolver.parsers).handleByList(T.CacheParser,te.cache.parsers).handleByList(T.DetectionParser,te.detections);R.add(Ig,kg,Fg,Lg,Gg,Dg,Ug,Og,zg,Wg,Hg,hn,$g,Bg,Eg,ln,Yg);var Xg={loader:T.LoadParser,resolver:T.ResolveParser,cache:T.CacheParser,detection:T.DetectionParser};R.handle(T.Asset,r=>{let t=r.ref;Object.entries(Xg).filter(([e])=>!!t[e]).forEach(([e,i])=>R.add(Object.assign(t[e],{extension:t[e].extension??i})));},r=>{let t=r.ref;Object.keys(Xg).filter(e=>!!t[e]).forEach(e=>R.remove(t[e]));});vs();ht();Vs();var un=class extends we{constructor(t,e){let{text:i,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=i??"",this.style=o,this.resolution=s??null,this.allowChildren=false,this._anchor=new _t({_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,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}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 jg(r,t){let e=r[0]??{};return (typeof e=="string"||r[1])&&(D(O,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}$o();Gr();var is=class extends un{constructor(...t){let e=jg(t,"Text");super(e,Gt),this.renderPipeId="text";}updateBounds(){let t=this._bounds,e=this._anchor,i=Vt.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o;}};pe();gt();at();Ba();ar();Ta();gi();Dt();Se();_s(nh());R.add(Ag,Cg);var he={};bx(he,{DistortionFilter:()=>dn,EqualizerFilter:()=>Yt,Filter:()=>ft,MonoFilter:()=>fn,ReverbFilter:()=>pn,StereoFilter:()=>mn,StreamFilter:()=>gn,TelephoneFilter:()=>xn});var Kg;function qg(r){return Kg=r,r}function K(){return Kg}var ft=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 dn=class extends ft{constructor(t=0){let e;if(!K().useLegacy){let{audioContext:i}=K().context;e=i.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,K().useLegacy)return;let e=t*1e3,i=44100,s=new Float32Array(i),o=Math.PI/180,n=0,a;for(;n<i;++n)a=n*2/i-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 ut=class{static setParamValue(t,e){if(t.setValueAtTime){let i=K().context;t.setValueAtTime(e,i.audioContext.currentTime);}else t.value=e;return e}};var q=class extends ft{constructor(r=0,t=0,e=0,i=0,s=0,o=0,n=0,a=0,h=0,l=0){let c=[],u=[{f:q.F32,type:"lowshelf",gain:r},{f:q.F64,type:"peaking",gain:t},{f:q.F125,type:"peaking",gain:e},{f:q.F250,type:"peaking",gain:i},{f:q.F500,type:"peaking",gain:s},{f:q.F1K,type:"peaking",gain:o},{f:q.F2K,type:"peaking",gain:n},{f:q.F4K,type:"peaking",gain:a},{f:q.F8K,type:"peaking",gain:h},{f:q.F16K,type:"highshelf",gain:l}];K().useLegacy||(c=u.map(f=>{let d=K().context.audioContext.createBiquadFilter();return d.type=f.type,ut.setParamValue(d.Q,1),d.frequency.value=f.f,ut.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(r,t=0){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);ut.setParamValue(this.bandsMap[r].gain,t);}getGain(r){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);return this.bandsMap[r].gain.value}set f32(r){this.setGain(q.F32,r);}get f32(){return this.getGain(q.F32)}set f64(r){this.setGain(q.F64,r);}get f64(){return this.getGain(q.F64)}set f125(r){this.setGain(q.F125,r);}get f125(){return this.getGain(q.F125)}set f250(r){this.setGain(q.F250,r);}get f250(){return this.getGain(q.F250)}set f500(r){this.setGain(q.F500,r);}get f500(){return this.getGain(q.F500)}set f1k(r){this.setGain(q.F1K,r);}get f1k(){return this.getGain(q.F1K)}set f2k(r){this.setGain(q.F2K,r);}get f2k(){return this.getGain(q.F2K)}set f4k(r){this.setGain(q.F4K,r);}get f4k(){return this.getGain(q.F4K)}set f8k(r){this.setGain(q.F8K,r);}get f8k(){return this.getGain(q.F8K)}set f16k(r){this.setGain(q.F16K,r);}get f16k(){return this.getGain(q.F16K)}reset(){this.bands.forEach(r=>{ut.setParamValue(r.gain,0);});}destroy(){this.bands.forEach(r=>{r.disconnect();}),this.bands=null,this.bandsMap=null;}},Yt=q;Yt.F32=32;Yt.F64=64;Yt.F125=125;Yt.F250=250;Yt.F500=500;Yt.F1K=1e3;Yt.F2K=2e3;Yt.F4K=4e3;Yt.F8K=8e3;Yt.F16K=16e3;var fn=class extends ft{constructor(){let t,e;if(!K().useLegacy){let{audioContext:i}=K().context;e=i.createChannelSplitter(),t=i.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var pn=class extends ft{constructor(t=3,e=2,i=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=i,this._rebuild();}_clamp(t,e,i){return Math.min(i,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(K().useLegacy)return;let{audioContext:t}=K().context,e=t.sampleRate,i=e*this._seconds,s=t.createBuffer(2,i,e),o=s.getChannelData(0),n=s.getChannelData(1),a;for(let l=0;l<i;l++)a=this._reverse?i-l:l,o[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay),n[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay);let h=t.createConvolver();h.buffer=s,this.init(h);}};var mn=class extends ft{constructor(t=0){let e,i,s;if(!K().useLegacy){let{audioContext:o}=K().context;o.createStereoPanner?(e=o.createStereoPanner(),s=e):(i=o.createPanner(),i.panningModel="equalpower",s=i);}super(s),this._stereo=e,this._panner=i,this.pan=t;}set pan(t){this._pan=t,this._stereo?ut.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 gn=class extends ft{constructor(){let t,e;if(!K().useLegacy){let{audioContext:i}=K().context;t=i.createMediaStreamDestination(),e=i.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var xn=class extends ft{constructor(){let t,e;if(!K().useLegacy){let{audioContext:i}=K().context,s=i.createBiquadFilter(),o=i.createBiquadFilter(),n=i.createBiquadFilter(),a=i.createBiquadFilter();s.type="lowpass",ut.setParamValue(s.frequency,2e3),o.type="lowpass",ut.setParamValue(o.frequency,2e3),n.type="highpass",ut.setParamValue(n.frequency,500),a.type="highpass",ut.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};var ss=class extends Y{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 sb=0,_l=class extends Y{constructor(r){super(),this.id=sb++,this.init(r);}set(r,t){if(this[r]===void 0)throw new Error(`Property with name ${r} does not exist.`);switch(r){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:r}=this._source;return r/this._duration}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(r){this._playing=false,this._duration=r.source.duration;let t=this._source=r.source.cloneNode(false);t.src=r.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),r.context.on("refresh",this.refresh,this),r.context.on("refreshPaused",this.refreshPaused,this),this._media=r;}_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(r){this._speed=r,this.refresh();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(r){console.warn("HTML Audio does not support filters");}refresh(){let r=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=r.volume*(r.muted?0:1),i=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*i,this._source.playbackRate=this._speed*r.speed*t.speed;}refreshPaused(){let r=this._media.context,t=this._media.parent,e=this._paused||t.paused||r.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(r){let{start:t,end:e,speed:i,loop:s,volume:o,muted:n}=r;e&&console.assert(e>t,"End time is before start time"),this._speed=i,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-_l.PADDING),this._end=Math.min(this._end+_l.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),dt.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(){dt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){dt.shared.remove(this._onUpdate,this),this.removeAllListeners();let r=this._source;r&&(r.onended=null,r.onplay=null,r.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}]`}},_n=_l;_n.PADDING=.1;var os=class extends Y{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new _n(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,i=this.parent;if(e.readyState===4){i.isLoaded=true;let h=i.autoPlayStart();t&&setTimeout(()=>{t(null,i,h);},0);return}if(!i.url){t(new Error("sound.url or sound.source must be set"));return}e.src=i.url;let s=()=>{a(),i.isLoaded=true;let h=i.autoPlayStart();t&&t(null,i,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 ns=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 tr=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],yl=["audio/mpeg","audio/ogg"],er={};function Zg(r){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),i={},s=/^no$/;tr.forEach(o=>{let n=e.canPlayType(`audio/${o}`).replace(s,""),a=t[o]?e.canPlayType(t[o]).replace(s,""):"";i[o]=!!n||!!a;}),Object.assign(er,i);}Zg();var nb=0,as=class extends Y{constructor(t){super(),this.id=nb++,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 i=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),o=this._volume*(this._muted?0:1);ut.setParamValue(this._gain.gain,o*s*i),ut.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,i=this._paused||e.paused||t.paused;i!==this._pausedReal&&(this._pausedReal=i,i?(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",i));}play(t){let{start:e,end:i,speed:s,loop:o,volume:n,muted:a,filters:h}=t;i&&console.assert(i>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=i,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=i,this._source.loopStart=e,this._source.start(0,e)):i?this._source.start(0,e,i-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){dt.shared.remove(this._updateListener,this),t&&dt.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(),i=e-this._lastUpdate;if(i>0||t){let s=this._source.playbackRate.value;this._elapsed+=i*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 rr=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(i=>{e===null?this._input.connect(i.destination):e.connect(i.destination),e=i;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var Qg=class extends rr{constructor(r){let t=r.audioContext,e=t.createBufferSource(),i=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(i),i.connect(r.destination),super(s,i),this.context=r,this.bufferSource=e,this.gain=i,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(Qg.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 r=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=r.buffer,ut.setParamValue(t.playbackRate,r.playbackRate.value),t.loop=r.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}},yn=Qg;yn.BUFFER_SIZE=0;var ir=class{init(t){this.parent=t,this._nodes=new yn(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 as(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,i=await W.get().fetch(e);this._decode(await i.arrayBuffer(),t);}_decode(t,e){let i=(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?i(null,t):this.parent.context.decode(t,i);}};var Xr=class{static from(r){let t={};typeof r=="string"?t.url=r:r instanceof ArrayBuffer||r instanceof AudioBuffer||r instanceof HTMLAudioElement?t.source=r:Array.isArray(r)?t.url=r:t=r,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=K().useLegacy?new os:new ir;return new Xr(e,t)}constructor(r,t){this.media=r,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(r){let[t]=r.map(e=>({url:e,ext:tt.extname(e).slice(1)})).filter(({ext:e})=>er[e]).sort((e,i)=>tr.indexOf(e.ext)-tr.indexOf(i.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return K().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(r){this._paused=r,this.refreshPaused();}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh();}get filters(){return this.media.filters}set filters(r){this.media.filters=r;}addSprites(r,t){if(typeof r=="object"){let i={};for(let s in r)i[s]=this.addSprites(s,r[s]);return i}console.assert(!this._sprites[r],`Alias ${r} is already taken`);let e=new ns(this,t);return this._sprites[r]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(r){if(r){let t=this._sprites[r];t!==void 0&&(t.destroy(),delete this._sprites[r]);}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 r=this._instances.length-1;r>=0;r--)this._instances[r].stop();return this}play(r,t){let e;if(typeof r=="string"?e={sprite:r,loop:this.loop,complete:t}:typeof r=="function"?(e={},e.complete=r):e=r,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 i=this._createInstance();return this._instances.push(i),this.isPlaying=true,i.once("end",()=>{e.complete&&e.complete(this),this._onComplete(i);}),i.once("stop",()=>{this._onComplete(i);}),i.play(e),i}refresh(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refresh();}refreshPaused(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}_preload(r){this.media.load(r);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let r;return this.autoPlay&&(r=this.play(this._autoPlayOptions)),r}_removeInstances(){for(let r=this._instances.length-1;r>=0;r--)this._poolInstance(this._instances[r]);this._instances.length=0;}_onComplete(r){if(this._instances){let t=this._instances.indexOf(r);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(r);}_createInstance(){if(Xr._pool.length>0){let r=Xr._pool.pop();return r.init(this.media),r}return this.media.create()}_poolInstance(r){r.destroy(),Xr._pool.indexOf(r)<0&&Xr._pool.push(r);}},Fe=Xr;Fe._pool=[];var jr=class r extends rr{constructor(){let t=window,e=new r.AudioContext,i=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(i),i.connect(e.destination),super(s,i),this.autoPause=true,this._ctx=e,this._offlineCtx=new r.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=i,this.analyser=s,this.events=new Y,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 i=o=>{e(new Error(o?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,o=>{e(null,o);},i);s&&s.catch(i);}};var bn=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new jr),this._htmlAudioContext=new ss,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 jr.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 Fe)return this._sounds[t]=e,e;let i=this._getOptions(e),s=Fe.from(i);return this._sounds[t]=s,s}_getOptions(t,e){let i;return typeof t=="string"?i={url:t}:Array.isArray(t)?i={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?i={source:t}:i=t,i={...i,...e||{}},i}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 i=!!this._sounds[t];return e&&console.assert(i,`No sound matching alias '${t}'.`),i}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 i=this.find(t);return e!==void 0&&(i.volume=e),i.volume}speed(t,e){let i=this.find(t);return e!==void 0&&(i.speed=e),i.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 Jg=r=>{let t=r.src,e=r?.alias?.[0];return (!e||r.src===e)&&(e=tt.basename(t,tt.extname(t))),e},tx={extension:T.Asset,detection:{test:async()=>true,add:async r=>[...r,...tr.filter(t=>er[t])],remove:async r=>r.filter(t=>r.includes(t))},loader:{name:"sound",extension:{type:[T.LoadParser],priority:mt.High},test(r){let t=tt.extname(r).slice(1);return !!er[t]||yl.some(e=>r.startsWith(`data:${e}`))},async load(r,t){let e=await new Promise((i,s)=>Fe.from({...t.data,url:r,preload:true,loaded(o,n){o?s(o):i(n),t.data?.loaded?.(o,n);}}));return K().add(Jg(t),e),e},async unload(r,t){K().remove(Jg(t));}}};R.add(tx);qg(new bn);({DistortionFilter:he.DistortionFilter,EqualizerFilter:he.EqualizerFilter,MonoFilter:he.MonoFilter,ReverbFilter:he.ReverbFilter,StereoFilter:he.StereoFilter,StreamFilter:he.StreamFilter,TelephoneFilter:he.TelephoneFilter});var Kr="Container";var bl="Image",qr="Sprite",ex="Text",vl="Video";var Zr=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ix=new Set,Tl=typeof process=="object"&&process?process:{},sx=(r,t,e,i)=>{typeof Tl.emitWarning=="function"?Tl.emitWarning(r,t,e,i):console.error(`[${e}] ${t}: ${r}`);},vn=globalThis.AbortController,rx=globalThis.AbortSignal;if(typeof vn>"u"){rx=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},vn=class{constructor(){t();}signal=new rx;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let r=Tl.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{r&&(r=false,sx("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 lb=r=>!ix.has(r),Re=r=>r&&r===Math.floor(r)&&r>0&&isFinite(r),ox=r=>Re(r)?r<=Math.pow(2,8)?Uint8Array:r<=Math.pow(2,16)?Uint16Array:r<=Math.pow(2,32)?Uint32Array:r<=Number.MAX_SAFE_INTEGER?Qr:null:null,Qr=class extends Array{constructor(t){super(t),this.fill(0);}},wl=class r{heap;length;static#h=false;static create(t){let e=ox(t);if(!e)return [];r.#h=true;let i=new r(t,e);return r.#h=false,i}constructor(t,e){if(!r.#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]}},Tn=class r{#h;#u;#m;#M;#g;#I;#F;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;#A;#c;#R;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,i,s,o)=>t.#D(e,i,s,o),moveToTail:e=>t.#B(e),indexes:e=>t.#T(e),rindexes:e=>t.#w(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.#I}get memoMethod(){return this.#F}get dispose(){return this.#m}get onInsert(){return this.#M}get disposeAfter(){return this.#g}constructor(t){let{max:e=0,ttl:i,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:h,dispose:l,onInsert:c,disposeAfter:u,noDisposeOnSet:f,noUpdateTTL:d,maxSize:p=0,maxEntrySize:x=0,sizeCalculation:g,fetchMethod:_,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:P,allowStaleOnFetchAbort:w,ignoreFetchAbort:S}=t;if(e!==0&&!Re(e))throw new TypeError("max option must be a nonnegative integer");let B=e?ox(e):Array;if(!B)throw new Error("invalid max value: "+e);if(this.#h=e,this.#u=p,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.#F=y,_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#I=_,this.#A=!!_,this.#i=new Map,this.#r=new Array(e).fill(void 0),this.#t=new Array(e).fill(void 0),this.#l=new B(e),this.#d=new B(e),this.#a=0,this.#o=0,this.#_=wl.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.#R=!!this.#M,this.#c=!!this.#g,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!P,this.allowStaleOnFetchAbort=!!w,this.ignoreFetchAbort=!!S,this.maxEntrySize!==0){if(this.#u!==0&&!Re(this.#u))throw new TypeError("maxSize must be a positive integer if specified");if(!Re(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=Re(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!Re(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 F="LRU_CACHE_UNBOUNDED";lb(F)&&(ix.add(F),sx("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",F,r));}}getRemainingTTL(t){return this.#i.has(t)?1/0:0}#U(){let t=new Qr(this.#h),e=new Qr(this.#h);this.#f=t,this.#b=e,this.#L=(o,n,a=Zr.now())=>{if(e[o]=n!==0?a:0,t[o]=n,n!==0&&this.ttlAutopurge){let h=setTimeout(()=>{this.#p(o)&&this.#S(this.#r[o],"expire");},n+1);h.unref&&h.unref();}},this.#C=o=>{e[o]=t[o]!==0?Zr.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=i||s();let l=o.now-h;o.remainingTTL=a-l;}};let i=0,s=()=>{let o=Zr.now();if(this.ttlResolution>0){i=o;let n=setTimeout(()=>i=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=(i||s())-h;return a-l},this.#p=o=>{let n=e[o],a=t[o];return !!a&&!!n&&(i||s())-n>a};}#C=()=>{};#P=()=>{};#L=()=>{};#p=()=>false;#V(){let t=new Qr(this.#h);this.#x=0,this.#y=t,this.#E=e=>{this.#x-=t[e],t[e]=0;},this.#O=(e,i,s,o)=>{if(this.#e(i))return 0;if(!Re(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(i,e),!Re(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.#k=(e,i,s)=>{if(t[e]=i,this.#u){let o=this.#u-t[e];for(;this.#x>o;)this.#G(true);}this.#x+=t[e],s&&(s.entrySize=i,s.totalCalculatedSize=this.#x);};}#E=t=>{};#k=(t,e,i)=>{};#O=(t,e,i,s)=>{if(i||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];}*#w({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.#w())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.#w()){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.#w())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 i of this.#T()){let s=this.#t[i],o=this.#e(s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,this.#r[i],this))return this.get(this.#r[i],e)}}forEach(t,e=this){for(let i of this.#T()){let s=this.#t[i],o=this.#e(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,this.#r[i],this);}}rforEach(t,e=this){for(let i of this.#w()){let s=this.#t[i],o=this.#e(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,this.#r[i],this);}}purgeStale(){let t=false;for(let e of this.#w({allowStale:true}))this.#p(e)&&(this.#S(this.#r[e],"expire"),t=true);return t}info(t){let e=this.#i.get(t);if(e===void 0)return;let i=this.#t[e],s=this.#e(i)?i.__staleWhileFetching:i;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-(Zr.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 i=this.#r[e],s=this.#t[e],o=this.#e(s)?s.__staleWhileFetching:s;if(o===void 0||i===void 0)continue;let n={value:o};if(this.#f&&this.#b){n.ttl=this.#f[e];let a=Zr.now()-this.#b[e];n.start=Math.floor(Date.now()-a);}this.#y&&(n.size=this.#y[e]),t.unshift([i,n]);}return t}load(t){this.clear();for(let[e,i]of t){if(i.start){let s=Date.now()-i.start;i.start=Zr.now()-s;}this.set(e,i.value,i);}}set(t,e,i={}){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}=i,{noUpdateTTL:l=this.noUpdateTTL}=i,c=this.#O(t,e,i.size||0,a);if(this.maxEntrySize&&c>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),this.#S(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.#k(u,c,h),h&&(h.set="add"),l=false,this.#R&&this.#M?.(e,t,"add");else {this.#B(u);let f=this.#t[u];if(e!==f){if(this.#A&&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.#k(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.#R&&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,i=this.#r[e],s=this.#t[e];return this.#A&&this.#e(s)?s.__abortController.abort(new Error("evicted")):(this.#v||this.#c)&&(this.#v&&this.#m?.(s,i,"evict"),this.#c&&this.#n?.push([s,i,"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(i),this.#s--,e}has(t,e={}){let{updateAgeOnHas:i=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 i&&this.#C(o),s&&(s.has="hit",this.#P(s,o)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:i=this.allowStale}=e,s=this.#i.get(t);if(s===void 0||!i&&this.#p(s))return;let o=this.#t[s];return this.#e(o)?o.__staleWhileFetching:o}#D(t,e,i,s){let o=e===void 0?void 0:this.#t[e];if(this.#e(o))return o;let n=new vn,{signal:a}=i;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let h={signal:n.signal,options:i,context:s},l=(x,g=false)=>{let{aborted:_}=n.signal,y=i.ignoreFetchAbort&&x!==void 0;if(i.status&&(_&&!g?(i.status.fetchAborted=true,i.status.fetchError=n.signal.reason,y&&(i.status.fetchAbortIgnored=true)):i.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.#S(t,"fetch"):(i.status&&(i.status.fetchUpdated=true),this.set(t,x,h.options))),x},c=x=>(i.status&&(i.status.fetchRejected=true,i.status.fetchError=x),u(x)),u=x=>{let{aborted:g}=n.signal,_=g&&i.allowStaleOnFetchAbort,y=_||i.allowStaleOnFetchRejection,v=y||i.noDeleteOnFetchRejection,b=d;if(this.#t[e]===d&&(!v||b.__staleWhileFetching===void 0?this.#S(t,"fetch"):_||(this.#t[e]=b.__staleWhileFetching)),y)return i.status&&b.__staleWhileFetching!==void 0&&(i.status.returnedStale=true),b.__staleWhileFetching;if(b.__returned===b)throw x},f=(x,g)=>{let _=this.#I?.(t,o,h);_&&_ instanceof Promise&&_.then(y=>x(y===void 0?void 0:y),g),n.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(x(void 0),i.allowStaleOnFetchAbort&&(x=y=>l(y,true)));});};i.status&&(i.status.fetchDispatched=true);let d=new Promise(f).then(l,c),p=Object.assign(d,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return e===void 0?(this.set(t,p,{...h.options,status:void 0}),e=this.#i.get(t)):this.#t[e]=p,p}#e(t){if(!this.#A)return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof vn}async fetch(t,e={}){let{allowStale:i=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:p=this.allowStaleOnFetchAbort,context:x,forceRefresh:g=false,status:_,signal:y}=e;if(!this.#A)return _&&(_.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:_});let v={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:h,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:p,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 M=i&&P.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",M&&(_.returnedStale=true)),M?P.__staleWhileFetching:P.__returned=P}let w=this.#p(b);if(!g&&!w)return _&&(_.fetch="hit"),this.#B(b),s&&this.#C(b),_&&this.#P(_,b),P;let S=this.#D(t,b,v,x),F=S.__staleWhileFetching!==void 0&&i;return _&&(_.fetch=w?"stale":"refresh",F&&w&&(_.returnedStale=true)),F?S.__staleWhileFetching:S.__returned=S}}async forceFetch(t,e={}){let i=await this.fetch(t,e);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,e={}){let i=this.#F;if(!i)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=i(t,a,{options:n,context:s});return this.set(t,h,n),h}get(t,e={}){let{allowStale:i=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&&i&&h.__staleWhileFetching!==void 0&&(n.returnedStale=true),i?h.__staleWhileFetching:void 0):(o||this.#S(t,"expire"),n&&i&&(n.returnedStale=true),i?h:void 0)):(n&&(n.get="hit"),l?h.__staleWhileFetching:(this.#B(a),s&&this.#C(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.#S(t,"delete")}#S(t,e){let i=false;if(this.#s!==0){let s=this.#i.get(t);if(s!==void 0)if(i=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 i}clear(){return this.#H("delete")}#H(t){for(let e of this.#w({allowStale:true})){let i=this.#t[e];if(this.#e(i))i.__abortController.abort(new Error("deleted"));else {let s=this.#r[e];this.#v&&this.#m?.(i,s,t),this.#c&&this.#n?.push([i,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,i;for(;i=e?.shift();)this.#g?.(...i);}}};var ke=class{cache;map=new Map;constructor(t){this.cache=new Tn({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 et;(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)))(et||={});var hs=new ke({cacheSize:5});var nx;(s=>{function r(o,n){n||(n=o.name),hs.get(n)&&et.warn(`CanvasElement "${n}" already registered`),o.prototype.pixivnId=n,hs.set(n,o);}s.add=r;function t(o){try{let n=hs.get(o);if(!n){et.error(`CanvasElement "${o}" not found, did you forget to register it with the canvasComponentDecorator?`);return}return new n,n}catch(n){et.error(`Error while getting CanvasElement "${o}"`,n);return}}s.get=t;function e(){return Array.from(hs.values())}s.values=e;function i(o){return hs.has(o)}s.has=i;})(nx||={});var le=nx;function cb(r){return "memory"in r?r.memory:r instanceof is?db(r):r instanceof Mt?cs(r):ls(r)}function ub(r){return {width:r.width,height:r.height,isRenderGroup:r.isRenderGroup,blendMode:r.blendMode,tint:r.tint,alpha:r.alpha,angle:r.angle,renderable:r.renderable,rotation:r.rotation,scale:{x:r.scale.x,y:r.scale.y},pivot:{x:r.pivot.x,y:r.pivot.y},position:{x:r.position.x,y:r.position.y},skew:{x:r.skew.x,y:r.skew.y},visible:r.visible,x:r.x,y:r.y,boundsArea:r.boundsArea,cursor:r.cursor,eventMode:r.eventMode,interactive:r.interactive,interactiveChildren:r.interactiveChildren,hitArea:r.hitArea}}function ax(r,t){return {url:r.source.label,alias:t===r.source.label?void 0:t}}function ls(r,t){let e=fb(r,Kr),s=t?.childrenExport||false?r.children.sort((o,n)=>r.getChildIndex(o)-r.getChildIndex(n)).map(o=>cb(o)):[];return {pixivnId:e,elements:s,...ub(r)}}function cs(r){let t=ls(r),e=t.pixivnId??qr,i=lx(r),s="textureAlias"in r?ax(r.texture,r.textureAlias):ax(r.texture);return {...t,pixivnId:e,textureData:s,anchor:{x:r.anchor.x,y:r.anchor.y},roundPixels:r.roundPixels,onEvents:i}}function db(r){let t=ls(r),e=t.pixivnId??ex,i=lx(r);return {...t,pixivnId:e,anchor:{x:r.anchor.x,y:r.anchor.y},text:r.text,resolution:r.resolution,style:pb(r.style),roundPixels:r.roundPixels,onEvents:i}}function fb(r,t){return Object.prototype.hasOwnProperty.call(r,"pixivnId")?r.pixivnId:t}function lx(r){return "onEvents"in r?r.onEvents:{}}function hx(r,t){if(typeof r!="object"||r===null)return r;et.warn(`Unsupported property type for Text.style.${t}: FillGradient or FillPattern.`,r);}function pb(r){return {align:r.align,breakWords:r.breakWords,dropShadow:r.dropShadow,fill:hx(r.stroke,"fill"),fontFamily:r.fontFamily,fontSize:r.fontSize,fontStyle:r.fontStyle,fontVariant:r.fontVariant,fontWeight:r.fontWeight,leading:r.leading,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,padding:r.padding,stroke:hx(r.stroke,"stroke"),textBaseline:r.textBaseline,trim:r.trim,whiteSpace:r.whiteSpace,wordWrap:r.wordWrap,wordWrapWidth:r.wordWrapWidth}}var Xt=class r{static init(t){r._getScreen=t.getScreen;}static _getScreen;static get screen(){return r._getScreen()}};function Sl(r,t,e,i,s,o=0){return i=i*(s?-1:1),r==="width"?t*(Xt.screen.width-e)+i+o*e+(s?e:0):t*(Xt.screen.height-e)+i+o*e+(s?e:0)}function us(r,t,e,i,s,o=0){return i=i*(s?-1:1),r==="width"?(t-i-o*e-(s?e:0))/(Xt.screen.width-e):(t-i-o*e-(s?e:0))/(Xt.screen.height-e)}function Pl(r,t){return r==="width"?t*Xt.screen.width:t*Xt.screen.height}function ds(r,t){return r==="width"?t/Xt.screen.width:t/Xt.screen.height}function _e(r,t){if(t=t%360,t<0&&(t+=360),t===0)return {x:r.x,y:r.y};if(t===90)return {x:-r.y,y:r.x};if(t===180)return {x:-r.x,y:-r.y};if(t===270)return {x:r.y,y:-r.x};if(t>0&&t<90){let e=t*Math.PI/180,i=Math.cos(e),s=Math.sin(e);return {x:r.x*i-r.y*s,y:r.x*s+r.y*i}}else if(t>90&&t<180){let e=(t-90)*Math.PI/180,i=Math.cos(e),s=Math.sin(e);return {x:-r.y*s-r.x*i,y:r.y*i-r.x*s}}else if(t>180&&t<270){let e=(t-180)*Math.PI/180,i=Math.cos(e),s=Math.sin(e);return {x:-r.x*i+r.y*s,y:-r.x*s-r.y*i}}else if(t>270&&t<360){let e=(t-270)*Math.PI/180,i=Math.cos(e),s=Math.sin(e);return {x:r.y*s-r.x*i,y:-r.y*i-r.x*s}}return {x:0,y:0}}function wn(r){let t=r.width,e=r.height,i=r.angle%360;return i<0&&(i+=360),i===0||i===180?t:i===90||i===270?e:Math.abs(t*Math.cos(i*Math.PI/180))+Math.abs(e*Math.sin(i*Math.PI/180))}function Sn(r){let t=r.width,e=r.height,i=r.angle%360;return i<0&&(i+=360),i===0||i===180?e:i===90||i===270?t:Math.abs(e*Math.cos(i*Math.PI/180))+Math.abs(t*Math.sin(i*Math.PI/180))}async function fs(r){if(r!=="EMPTY"){if(!r){et.error("Texture not found",r);return}if(te.cache.has(r)){let t=te.get(r);if(t)return t}return te.load(r).then(t=>{if(!t){et.error("Texture not found",r);return}if(!(t instanceof I)){et.error("File not is a file",r);return}return t}).catch(t=>{et.error("Error loading file",t);})}}function Al(r){return r&&(typeof r.align!="number"&&(r.xAlign!=null&&(r.align===void 0?(r.align={x:r.xAlign},delete r.xAlign):(r.align.x=r.xAlign,delete r.xAlign)),r.yAlign!=null&&(r.align===void 0?(r.align={y:r.yAlign},delete r.yAlign):(r.align.y=r.yAlign,delete r.yAlign))),typeof r.percentagePosition!="number"&&(r.xPercentagePosition!=null&&(r.percentagePosition===void 0?(r.percentagePosition={x:r.xPercentagePosition},delete r.xPercentagePosition):(r.percentagePosition.x=r.xPercentagePosition,delete r.xPercentagePosition)),r.yPercentagePosition!=null&&(r.percentagePosition===void 0?(r.percentagePosition={y:r.yPercentagePosition},delete r.yPercentagePosition):(r.percentagePosition.y=r.yPercentagePosition,delete r.yPercentagePosition))),r)}var Jr=new ke({cacheSize:5});var cx;(o=>{function r(n,a){a||(a=n.name),Jr.get(a)&&et.info(`Event "${a}" already exists, it will be overwritten`),n.prototype.id=a,Jr.set(a,n);}o.add=r;function t(n){try{let a=Jr.get(n);if(!a){et.error(`Event "${n}" not found, did you forget to register it with the eventDecorator?`);return}return new a,a}catch(a){et.error(`Error while getting Event "${n}"`,a);return}}o.get=t;function e(n){try{let a=Jr.get(n);if(!a){et.error(`Event "${n}" not found, did you forget to register it with the eventDecorator?`);return}return new a}catch(a){et.error(`Error while getting Event "${n}"`,a);return}}o.getInstance=e;function i(){return Array.from(Jr.values())}o.values=i;function s(n){return Jr.has(n)}o.has=s;})(cx||={});var ps=cx;async function ux(r){let t=mb(r.pixivnId);if(t)await t.setMemory(r);else throw new Error("[Pixi\u2019VN] The element "+r.pixivnId+" could not be created");return t}function mb(r){try{let t=le.get(r);return t?new t:void 0}catch(t){et.error(`Error while getting CanvasElement ${r}`,t);return}}var Pn=class extends Ft{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||Kr;}pixivnId=Kr;get memory(){return ls(this,{childrenExport:true})}set memory(t){}async setMemory(t){return this.memory=t,await this.importChildren(t),await Ml(this,t)}async importChildren(t){for(let e=0;e<t.elements.length;e++){let i=t.elements[e],s=await ux(i);this.addChild(s);}}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=ps.getInstance(i);return this._onEvents[t]=i,s?super.on(t,()=>{s.fn(t,this);}):et.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}};le.add(Pn,Kr);async function Ml(r,t,e){"isRenderGroup"in t&&t.isRenderGroup!==void 0&&(r.isRenderGroup=t.isRenderGroup),"blendMode"in t&&t.blendMode!==void 0&&(r.blendMode=t.blendMode),"tint"in t&&t.tint!==void 0&&(r.tint=t.tint),"alpha"in t&&t.alpha!==void 0&&(r.alpha=t.alpha),"angle"in t&&t.angle!==void 0&&(r.angle=t.angle),"renderable"in t&&t.renderable!==void 0&&(r.renderable=t.renderable),"rotation"in t&&t.rotation!==void 0&&(r.rotation=t.rotation),"scale"in t&&t.scale!==void 0&&(typeof t.scale=="number"?r.scale.set(t.scale,t.scale):r.scale.set(t.scale.x,t.scale.y)),"pivot"in t&&t.pivot!==void 0&&(typeof t.pivot=="number"?r.pivot.set(t.pivot,t.pivot):r.pivot.set(t.pivot.x,t.pivot.y)),"position"in t&&t.position!==void 0&&r.position.set(t.position.x,t.position.y),"skew"in t&&t.skew!==void 0&&r.skew.set(t.skew.x,t.skew.y),"visible"in t&&t.visible!==void 0&&(r.visible=t.visible),"x"in t&&t.x!==void 0&&(r.x=t.x),"y"in t&&t.y!==void 0&&(r.y=t.y),"boundsArea"in t&&t.boundsArea!==void 0&&(r.boundsArea=t.boundsArea),"cursor"in t&&t.cursor!==void 0&&(r.cursor=t.cursor),"eventMode"in t&&t.eventMode!==void 0&&(r.eventMode=t.eventMode),"interactive"in t&&t.interactive!==void 0&&(r.interactive=t.interactive),"interactiveChildren"in t&&t.interactiveChildren!==void 0&&(r.interactiveChildren=t.interactiveChildren),"hitArea"in t&&t.hitArea!==void 0&&(r.hitArea=t.hitArea),("width"in t&&t.width!==void 0&&(r.width=t.width),"height"in t&&t.height!==void 0&&(r.height=t.height));}var ti=class r extends Mt{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||qr;}pixivnId=qr;_textureAlias;get textureAlias(){return this._textureAlias?this._textureAlias:this.texture.source.label}set textureAlias(t){this._textureAlias=t;}get memory(){return cs(this)}set memory(t){}async setMemory(t){return this.memory=t,await Cl(this,t)}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=ps.getInstance(i);return this._onEvents[t]=i,s?(super.on(t,()=>{s.fn(t,this);}),this.interactive||(this.interactive=true,this.eventMode="dynamic")):et.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}static from(t,e){let i=Mt.from(t,e),s=new r;return s.texture=i.texture,s}};le.add(ti,qr);async function Cl(r,t,e){let i=e?.ignoreTexture||false;if(await Ml(r,t),!i){if("textureImage"in t&&t.textureImage&&t.textureImage.image){let o=await fs(t.textureImage.image);o&&(r.texture=o);}if("textureData"in t&&(t.textureData.alias&&(r.textureAlias=t.textureData.alias),t.textureData.url!=="EMPTY")){let o=t.textureData.url;t.textureData.alias&&te.resolver.hasKey(t.textureData.alias)&&(o=t.textureData.alias);let n=await fs(o);n&&(r.texture=n);}}let s=e?.half;if(s&&await s(),"anchor"in t&&t.anchor!==void 0&&(typeof t.anchor=="number"?r.anchor.set(t.anchor,t.anchor):r.anchor.set(t.anchor.x,t.anchor.y)),"roundPixels"in t&&t.roundPixels!==void 0&&(r.roundPixels=t.roundPixels),"onEvents"in t)for(let o in t.onEvents){let n=t.onEvents[o],a=ps.get(n);a&&r.onEvent(o,a);}}var ei=class r extends ti{pixivnId=bl;constructor(t,e){t=Al(t);let i,s;t&&"align"in t&&t?.align!==void 0&&(i=t.align,delete t.align),t&&"percentagePosition"in t&&t?.percentagePosition!==void 0&&(s=t.percentagePosition,delete t.percentagePosition),super(t),e&&(this.textureAlias=e),i&&(this.align=i),s&&(this.percentagePosition=s);}get memory(){return {...cs(this),pixivnId:this.pixivnId,align:this._align,percentagePosition:this._percentagePosition,loadIsStarted:this._loadIsStarted}}set memory(t){}async setMemory(t){this.memory=t,await El(this,t),this.reloadPosition();}static from(t,e){let i=Mt.from(t,e),s=new r;return s.texture=i.texture,s}_loadIsStarted=false;get loadIsStarted(){return this._loadIsStarted}async load(){return this._loadIsStarted=true,fs(this.textureAlias).then(t=>{this._loadIsStarted=false,t&&(this.texture=t);}).catch(t=>{this._loadIsStarted=false,et.error("Error into ImageSprite.load()",t);})}set texture(t){super.texture=t,this.reloadPosition();}get texture(){return super.texture}get haveEmptyTexture(){return this.texture._source.label==="EMPTY"}_align=void 0;set align(t){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),typeof t=="number"?(this._align.x=t,this._align.y=t):(t.x!==void 0&&(this._align.x=t.x),t.y!==void 0&&(this._align.y=t.y)),this.reloadPosition();}get align(){let t=_e(this.pivot,this.angle),e=_e(this.scale,this.angle);return {x:us("width",this.x,wn(this),t.x,e.x<0,this.anchor.x),y:us("height",this.y,Sn(this),t.y,e.y<0,this.anchor.y)}}set xAlign(t){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.x=t,this.reloadPosition();}get xAlign(){let t=_e(this.pivot,this.angle),e=_e(this.scale,this.angle);return us("width",this.x,wn(this),t.x,e.x<0,this.anchor.x)}set yAlign(t){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.y=t,this.reloadPosition();}get yAlign(){let t=_e(this.pivot,this.angle),e=_e(this.scale,this.angle);return us("height",this.y,Sn(this),t.y,e.y<0,this.anchor.y)}_percentagePosition=void 0;set percentagePosition(t){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),typeof t=="number"?(this._percentagePosition.x=t,this._percentagePosition.y=t):(t.x!==void 0&&(this._percentagePosition.x=t.x),t.y!==void 0&&(this._percentagePosition.y=t.y)),this.reloadPosition();}get percentagePosition(){return {x:ds("width",this.x),y:ds("height",this.y)}}get xPercentagePosition(){return ds("width",this.x)}set xPercentagePosition(t){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.x=t,this.reloadPosition();}get yPercentagePosition(){return ds("height",this.y)}set yPercentagePosition(t){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.y=t,this.reloadPosition();}get positionType(){return this._align?"align":this._percentagePosition?"percentage":"pixel"}get positionInfo(){return this._align?{x:this._align.x||0,y:this._align.y||0,type:"align"}:this._percentagePosition?{x:this._percentagePosition.x||0,y:this._percentagePosition.y||0,type:"percentage"}:{x:this.x,y:this.y,type:"pixel"}}set positionInfo(t){t.type==="align"?this.align={x:t.x,y:t.y}:t.type==="percentage"?this.percentagePosition={x:t.x,y:t.y}:this.position.set(t.x,t.y);}reloadPosition(){if(this._align){let t=_e(this.pivot,this.angle),e=_e(this.scale,this.angle);this._align.x!==void 0&&(super.x=Sl("width",this._align.x,wn(this),t.x,e.x<0,this.anchor.x)),this._align.y!==void 0&&(super.y=Sl("height",this._align.y,Sn(this),t.y,e.y<0,this.anchor.y));}else this._percentagePosition&&(this._percentagePosition.x!==void 0&&(super.x=Pl("width",this._percentagePosition.x)),this._percentagePosition.y!==void 0&&(super.y=Pl("height",this._percentagePosition.y)));}get position(){return super.position}set position(t){this._align=void 0,this._percentagePosition=void 0,super.position=t;}get x(){return super.x}set x(t){this._align=void 0,this._percentagePosition=void 0,super.x=t;}get y(){return super.y}set y(t){this._align=void 0,this._percentagePosition=void 0,super.y=t;}};le.add(ei,bl);async function El(r,t,e){let i=e?.ignoreTexture||false;return t=Al(t),await Cl(r,t,{half:async()=>{"align"in t&&t.align!==void 0&&(r.align=t.align),"percentagePosition"in t&&t.percentagePosition!==void 0&&(r.percentagePosition=t.percentagePosition),i||"imageLink"in t&&t.imageLink!==void 0&&(r.textureAlias=t.imageLink),"loadIsStarted"in t&&t.loadIsStarted&&await r.load();},ignoreTexture:e?.ignoreTexture})}var An=class r extends ei{constructor(t,e){let i,s,o;t&&"loop"in t&&t?.loop!==void 0&&(i=t.loop,delete t.loop),t&&"paused"in t&&t?.paused!==void 0&&(s=t.paused,delete t.paused),t&&"currentTime"in t&&t?.currentTime!==void 0&&(o=t.currentTime,delete t.currentTime),super(t,e),i&&(this.loop=i),s&&(this.paused=s),o&&(this.currentTime=o);}pixivnId=vl;get memory(){return {...super.memory,pixivnId:this.pixivnId,loop:this.loop,paused:this._paused,currentTime:this.currentTime}}set memory(t){}async setMemory(t){return this.memory=t,await gb(this,t)}static from(t,e){let i=Mt.from(t,e),s=new r;return s.texture=i.texture,s}async load(){await super.load(),this.loop=this._looop,this.currentTime=this._currentTime,this.paused=this._paused;}_looop=false;get loop(){return this.texture?.source?.resource?.loop||false}set loop(t){this._looop=t,this.texture?.source?.resource&&(this.texture.source.resource.loop=t);}_paused=false;get paused(){return this.texture?.source?.resource?.paused||false}set paused(t){t?this.pause():this.play();}pause(){this._paused=true,this.texture?.source?.resource&&this.texture.source.resource.pause();}play(){this._paused=false,this.texture?.source?.resource&&this.texture.source.resource.play();}_currentTime=0;get currentTime(){return this.texture?.source?.resource?.currentTime||0}set currentTime(t){let e=this.duration;e&&t>=e&&(t=0),this._currentTime=t,this.texture?.source?.resource&&(this.texture.source.resource.currentTime=t);}restart(){this.currentTime=0;}get duration(){if(this.texture?.source?.resource)return this.texture.source.resource.duration||0}};le.add(An,vl);async function gb(r,t,e){await El(r,t,{ignoreTexture:e?.ignoreTexture}),"loop"in t&&t.loop!==void 0&&(r.loop=t.loop),"currentTime"in t&&t.currentTime!==void 0&&(r.currentTime=t.currentTime),"paused"in t&&t.paused!==void 0&&(r.paused=t.paused);}exports.default=An;exports.setMemoryVideoSprite=gb;
620
+ `,Yr=null,rs=class{constructor(){Yr||(Yr=URL.createObjectURL(new Blob([Ky],{type:"application/javascript"}))),this.worker=new Worker(Yr);}};rs.revokeObjectURL=function(){Yr&&(URL.revokeObjectURL(Yr),Yr=null);};var Vg=0,ml,gl=class{constructor(){this._initialized=false,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={};}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new $r;e.addEventListener("message",i=>{e.terminate(),$r.revokeObjectURL(),t(i.data);});}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=true);}_getWorker(){ml===void 0&&(ml=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return !t&&this._createdWorkers<ml&&(this._createdWorkers++,t=new rs().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next();})),t}_returnWorker(t){this._workerPool.push(t);}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null;}async _run(t,e){await this._initWorkers();let i=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o});});return this._next(),i}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),i=e.id;this._resolveHash[Vg]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Vg++,id:i});}},xl=new gl;pe();var qy=[".jpeg",".jpg",".png",".webp",".avif"],Zy=["image/jpeg","image/png","image/webp","image/avif"];async function Qy(r,t){let e=await W.get().fetch(r);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${e.status} ${e.statusText}`);let i=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var hn={name:"loadTextures",extension:{type:T.LoadParser,priority:mt.High,name:"loadTextures"},config:{preferWorkers:true,preferCreateImageBitmap:true,crossOrigin:"anonymous"},test(r){return Nt(r,Zy)||$t(r,qy)},async load(r,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await xl.isImageBitmapSupported()?i=await xl.loadImageBitmap(r,t):i=await Qy(r,t):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i);},i.onerror=n);});let s=new Rt({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Hr(r),...t.data});return Vr(s,e,r)},unload(r){r.destroy(true);}};A();Ma();Aa();var Ng=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],Jy=Ng.map(r=>`video/${r.substring(1)}`);function tb(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=rb(t):e!==false&&(r.crossOrigin=typeof e=="string"?e:"anonymous");}function eb(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),t();}function s(n){o(),e(n);}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s);}})}function rb(r,t=globalThis.location){if(r.startsWith("data:"))return "";t||(t=globalThis.location);let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var $g={name:"loadVideo",extension:{type:T.LoadParser,name:"loadVideo"},test(r){let t=Nt(r,Jy),e=$t(r,Ng);return t||e},async load(r,t,e){let i={...fr.defaultOptions,resolution:t.data?.resolution||Hr(r),alphaMode:t.data?.alphaMode||await Ks(),...t.data},s=document.createElement("video"),o={preload:i.autoLoad!==false?"auto":void 0,"webkit-playsinline":i.playsinline!==false?"":void 0,playsinline:i.playsinline!==false?"":void 0,muted:i.muted===true?"":void 0,loop:i.loop===true?"":void 0,autoplay:i.autoPlay!==false?"":void 0};Object.keys(o).forEach(h=>{let l=o[h];l!==void 0&&s.setAttribute(h,l);}),i.muted===true&&(s.muted=true),tb(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let h=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=fr.MIME_TYPES[h]||`video/${h}`;}return n.src=r,a&&(n.type=a),new Promise(h=>{let l=async()=>{let c=new fr({...i,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await eb(s),h(Vr(c,e,r));};s.addEventListener("canplay",l),s.appendChild(n);})},unload(r){r.destroy(true);}};A();cr();A();cr();var ln={extension:{type:T.ResolveParser,name:"resolveTexture"},test:hn.test,parse:r=>({resolution:parseFloat(Ot.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var Yg={extension:{type:T.ResolveParser,priority:-2,name:"resolveJson"},test:r=>Ot.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:ln.parse};cr();vi();Ns();var cn=class{constructor(){this._detections=[],this._initialized=false,this.resolver=new Ot,this.loader=new an,this.cache=j,this._backgroundLoader=new on(this.loader),this._backgroundLoader.active=true,this.reset();}async init(t={}){if(this._initialized){G("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=true,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o);}let e=t.texturePreference?.resolution??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences);}add(t){this.resolver.add(t);}async load(t,e){this._initialized||await this.init();let i=Ye(t),s=At(t).map(a=>{if(typeof a!="string"){let h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return i?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e);}async loadBundle(t,e){this._initialized||await this.init();let i=false;typeof t=="string"&&(i=true,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,h=0,l=()=>{e?.(++a/h);},c=n.map(u=>{let f=s[u];return h+=Object.keys(f).length,this._mapLoadToResolve(f,l).then(d=>{o[u]=d;})});return await Promise.all(c),i?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e));}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i));});}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=false;}get(t){if(typeof t=="string")return j.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=j.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=[...new Set(Object.values(t))];this._backgroundLoader.active=false;let s=await this.loader.load(i,e);this._backgroundLoader.active=true;let o={};return i.forEach(n=>{let a=s[n.src],h=[n.src];n.alias&&h.push(...n.alias),h.forEach(l=>{o[l]=a;}),j.set(h,a);}),o}async unload(t){this._initialized||await this.init();let e=At(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i);}async unloadBundle(t){this._initialized||await this.init(),t=At(t);let e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i);}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(i=>{j.remove(i.src);}),await this.loader.unload(e);}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i];});});}},te=new cn;R.handleByList(T.LoadParser,te.loader.parsers).handleByList(T.ResolveParser,te.resolver.parsers).handleByList(T.CacheParser,te.cache.parsers).handleByList(T.DetectionParser,te.detections);R.add(Ig,kg,Fg,Lg,Gg,Dg,Ug,Og,zg,Wg,Hg,hn,$g,Bg,Eg,ln,Yg);var Xg={loader:T.LoadParser,resolver:T.ResolveParser,cache:T.CacheParser,detection:T.DetectionParser};R.handle(T.Asset,r=>{let t=r.ref;Object.entries(Xg).filter(([e])=>!!t[e]).forEach(([e,i])=>R.add(Object.assign(t[e],{extension:t[e].extension??i})));},r=>{let t=r.ref;Object.keys(Xg).filter(e=>!!t[e]).forEach(e=>R.remove(t[e]));});vs();ht();Vs();var un=class extends we{constructor(t,e){let{text:i,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=i??"",this.style=o,this.resolution=s??null,this.allowChildren=false,this._anchor=new _t({_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,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}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 jg(r,t){let e=r[0]??{};return (typeof e=="string"||r[1])&&(D(O,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}$o();Gr();var is=class extends un{constructor(...t){let e=jg(t,"Text");super(e,Gt),this.renderPipeId="text";}updateBounds(){let t=this._bounds,e=this._anchor,i=Vt.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o;}};pe();gt();at();Ba();ar();Ta();gi();Dt();Se();_s(nh());R.add(Ag,Cg);var he={};bx(he,{DistortionFilter:()=>dn,EqualizerFilter:()=>Yt,Filter:()=>ft,MonoFilter:()=>fn,ReverbFilter:()=>pn,StereoFilter:()=>mn,StreamFilter:()=>gn,TelephoneFilter:()=>xn});var Kg;function qg(r){return Kg=r,r}function K(){return Kg}var ft=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 dn=class extends ft{constructor(t=0){let e;if(!K().useLegacy){let{audioContext:i}=K().context;e=i.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,K().useLegacy)return;let e=t*1e3,i=44100,s=new Float32Array(i),o=Math.PI/180,n=0,a;for(;n<i;++n)a=n*2/i-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 ut=class{static setParamValue(t,e){if(t.setValueAtTime){let i=K().context;t.setValueAtTime(e,i.audioContext.currentTime);}else t.value=e;return e}};var q=class extends ft{constructor(r=0,t=0,e=0,i=0,s=0,o=0,n=0,a=0,h=0,l=0){let c=[],u=[{f:q.F32,type:"lowshelf",gain:r},{f:q.F64,type:"peaking",gain:t},{f:q.F125,type:"peaking",gain:e},{f:q.F250,type:"peaking",gain:i},{f:q.F500,type:"peaking",gain:s},{f:q.F1K,type:"peaking",gain:o},{f:q.F2K,type:"peaking",gain:n},{f:q.F4K,type:"peaking",gain:a},{f:q.F8K,type:"peaking",gain:h},{f:q.F16K,type:"highshelf",gain:l}];K().useLegacy||(c=u.map(f=>{let d=K().context.audioContext.createBiquadFilter();return d.type=f.type,ut.setParamValue(d.Q,1),d.frequency.value=f.f,ut.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(r,t=0){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);ut.setParamValue(this.bandsMap[r].gain,t);}getGain(r){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);return this.bandsMap[r].gain.value}set f32(r){this.setGain(q.F32,r);}get f32(){return this.getGain(q.F32)}set f64(r){this.setGain(q.F64,r);}get f64(){return this.getGain(q.F64)}set f125(r){this.setGain(q.F125,r);}get f125(){return this.getGain(q.F125)}set f250(r){this.setGain(q.F250,r);}get f250(){return this.getGain(q.F250)}set f500(r){this.setGain(q.F500,r);}get f500(){return this.getGain(q.F500)}set f1k(r){this.setGain(q.F1K,r);}get f1k(){return this.getGain(q.F1K)}set f2k(r){this.setGain(q.F2K,r);}get f2k(){return this.getGain(q.F2K)}set f4k(r){this.setGain(q.F4K,r);}get f4k(){return this.getGain(q.F4K)}set f8k(r){this.setGain(q.F8K,r);}get f8k(){return this.getGain(q.F8K)}set f16k(r){this.setGain(q.F16K,r);}get f16k(){return this.getGain(q.F16K)}reset(){this.bands.forEach(r=>{ut.setParamValue(r.gain,0);});}destroy(){this.bands.forEach(r=>{r.disconnect();}),this.bands=null,this.bandsMap=null;}},Yt=q;Yt.F32=32;Yt.F64=64;Yt.F125=125;Yt.F250=250;Yt.F500=500;Yt.F1K=1e3;Yt.F2K=2e3;Yt.F4K=4e3;Yt.F8K=8e3;Yt.F16K=16e3;var fn=class extends ft{constructor(){let t,e;if(!K().useLegacy){let{audioContext:i}=K().context;e=i.createChannelSplitter(),t=i.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var pn=class extends ft{constructor(t=3,e=2,i=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=i,this._rebuild();}_clamp(t,e,i){return Math.min(i,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(K().useLegacy)return;let{audioContext:t}=K().context,e=t.sampleRate,i=e*this._seconds,s=t.createBuffer(2,i,e),o=s.getChannelData(0),n=s.getChannelData(1),a;for(let l=0;l<i;l++)a=this._reverse?i-l:l,o[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay),n[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay);let h=t.createConvolver();h.buffer=s,this.init(h);}};var mn=class extends ft{constructor(t=0){let e,i,s;if(!K().useLegacy){let{audioContext:o}=K().context;o.createStereoPanner?(e=o.createStereoPanner(),s=e):(i=o.createPanner(),i.panningModel="equalpower",s=i);}super(s),this._stereo=e,this._panner=i,this.pan=t;}set pan(t){this._pan=t,this._stereo?ut.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 gn=class extends ft{constructor(){let t,e;if(!K().useLegacy){let{audioContext:i}=K().context;t=i.createMediaStreamDestination(),e=i.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var xn=class extends ft{constructor(){let t,e;if(!K().useLegacy){let{audioContext:i}=K().context,s=i.createBiquadFilter(),o=i.createBiquadFilter(),n=i.createBiquadFilter(),a=i.createBiquadFilter();s.type="lowpass",ut.setParamValue(s.frequency,2e3),o.type="lowpass",ut.setParamValue(o.frequency,2e3),n.type="highpass",ut.setParamValue(n.frequency,500),a.type="highpass",ut.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};var ss=class extends Y{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 sb=0,_l=class extends Y{constructor(r){super(),this.id=sb++,this.init(r);}set(r,t){if(this[r]===void 0)throw new Error(`Property with name ${r} does not exist.`);switch(r){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:r}=this._source;return r/this._duration}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(r){this._playing=false,this._duration=r.source.duration;let t=this._source=r.source.cloneNode(false);t.src=r.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),r.context.on("refresh",this.refresh,this),r.context.on("refreshPaused",this.refreshPaused,this),this._media=r;}_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(r){this._speed=r,this.refresh();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(r){console.warn("HTML Audio does not support filters");}refresh(){let r=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=r.volume*(r.muted?0:1),i=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*i,this._source.playbackRate=this._speed*r.speed*t.speed;}refreshPaused(){let r=this._media.context,t=this._media.parent,e=this._paused||t.paused||r.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(r){let{start:t,end:e,speed:i,loop:s,volume:o,muted:n}=r;e&&console.assert(e>t,"End time is before start time"),this._speed=i,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-_l.PADDING),this._end=Math.min(this._end+_l.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),dt.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(){dt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){dt.shared.remove(this._onUpdate,this),this.removeAllListeners();let r=this._source;r&&(r.onended=null,r.onplay=null,r.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}]`}},_n=_l;_n.PADDING=.1;var os=class extends Y{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new _n(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,i=this.parent;if(e.readyState===4){i.isLoaded=true;let h=i.autoPlayStart();t&&setTimeout(()=>{t(null,i,h);},0);return}if(!i.url){t(new Error("sound.url or sound.source must be set"));return}e.src=i.url;let s=()=>{a(),i.isLoaded=true;let h=i.autoPlayStart();t&&t(null,i,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 ns=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 tr=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],yl=["audio/mpeg","audio/ogg"],er={};function Zg(r){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),i={},s=/^no$/;tr.forEach(o=>{let n=e.canPlayType(`audio/${o}`).replace(s,""),a=t[o]?e.canPlayType(t[o]).replace(s,""):"";i[o]=!!n||!!a;}),Object.assign(er,i);}Zg();var nb=0,as=class extends Y{constructor(t){super(),this.id=nb++,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 i=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),o=this._volume*(this._muted?0:1);ut.setParamValue(this._gain.gain,o*s*i),ut.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,i=this._paused||e.paused||t.paused;i!==this._pausedReal&&(this._pausedReal=i,i?(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",i));}play(t){let{start:e,end:i,speed:s,loop:o,volume:n,muted:a,filters:h}=t;i&&console.assert(i>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=i,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=i,this._source.loopStart=e,this._source.start(0,e)):i?this._source.start(0,e,i-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){dt.shared.remove(this._updateListener,this),t&&dt.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(),i=e-this._lastUpdate;if(i>0||t){let s=this._source.playbackRate.value;this._elapsed+=i*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 rr=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(i=>{e===null?this._input.connect(i.destination):e.connect(i.destination),e=i;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var Qg=class extends rr{constructor(r){let t=r.audioContext,e=t.createBufferSource(),i=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(i),i.connect(r.destination),super(s,i),this.context=r,this.bufferSource=e,this.gain=i,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(Qg.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 r=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=r.buffer,ut.setParamValue(t.playbackRate,r.playbackRate.value),t.loop=r.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}},yn=Qg;yn.BUFFER_SIZE=0;var ir=class{init(t){this.parent=t,this._nodes=new yn(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 as(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,i=await W.get().fetch(e);this._decode(await i.arrayBuffer(),t);}_decode(t,e){let i=(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?i(null,t):this.parent.context.decode(t,i);}};var Xr=class{static from(r){let t={};typeof r=="string"?t.url=r:r instanceof ArrayBuffer||r instanceof AudioBuffer||r instanceof HTMLAudioElement?t.source=r:Array.isArray(r)?t.url=r:t=r,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=K().useLegacy?new os:new ir;return new Xr(e,t)}constructor(r,t){this.media=r,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(r){let[t]=r.map(e=>({url:e,ext:tt.extname(e).slice(1)})).filter(({ext:e})=>er[e]).sort((e,i)=>tr.indexOf(e.ext)-tr.indexOf(i.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return K().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(r){this._paused=r,this.refreshPaused();}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh();}get filters(){return this.media.filters}set filters(r){this.media.filters=r;}addSprites(r,t){if(typeof r=="object"){let i={};for(let s in r)i[s]=this.addSprites(s,r[s]);return i}console.assert(!this._sprites[r],`Alias ${r} is already taken`);let e=new ns(this,t);return this._sprites[r]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(r){if(r){let t=this._sprites[r];t!==void 0&&(t.destroy(),delete this._sprites[r]);}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 r=this._instances.length-1;r>=0;r--)this._instances[r].stop();return this}play(r,t){let e;if(typeof r=="string"?e={sprite:r,loop:this.loop,complete:t}:typeof r=="function"?(e={},e.complete=r):e=r,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 i=this._createInstance();return this._instances.push(i),this.isPlaying=true,i.once("end",()=>{e.complete&&e.complete(this),this._onComplete(i);}),i.once("stop",()=>{this._onComplete(i);}),i.play(e),i}refresh(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refresh();}refreshPaused(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}_preload(r){this.media.load(r);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let r;return this.autoPlay&&(r=this.play(this._autoPlayOptions)),r}_removeInstances(){for(let r=this._instances.length-1;r>=0;r--)this._poolInstance(this._instances[r]);this._instances.length=0;}_onComplete(r){if(this._instances){let t=this._instances.indexOf(r);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(r);}_createInstance(){if(Xr._pool.length>0){let r=Xr._pool.pop();return r.init(this.media),r}return this.media.create()}_poolInstance(r){r.destroy(),Xr._pool.indexOf(r)<0&&Xr._pool.push(r);}},Fe=Xr;Fe._pool=[];var jr=class r extends rr{constructor(){let t=window,e=new r.AudioContext,i=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(i),i.connect(e.destination),super(s,i),this.autoPause=true,this._ctx=e,this._offlineCtx=new r.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=i,this.analyser=s,this.events=new Y,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 i=o=>{e(new Error(o?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,o=>{e(null,o);},i);s&&s.catch(i);}};var bn=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new jr),this._htmlAudioContext=new ss,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 jr.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 Fe)return this._sounds[t]=e,e;let i=this._getOptions(e),s=Fe.from(i);return this._sounds[t]=s,s}_getOptions(t,e){let i;return typeof t=="string"?i={url:t}:Array.isArray(t)?i={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?i={source:t}:i=t,i={...i,...e||{}},i}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 i=!!this._sounds[t];return e&&console.assert(i,`No sound matching alias '${t}'.`),i}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 i=this.find(t);return e!==void 0&&(i.volume=e),i.volume}speed(t,e){let i=this.find(t);return e!==void 0&&(i.speed=e),i.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 Jg=r=>{let t=r.src,e=r?.alias?.[0];return (!e||r.src===e)&&(e=tt.basename(t,tt.extname(t))),e},tx={extension:T.Asset,detection:{test:async()=>true,add:async r=>[...r,...tr.filter(t=>er[t])],remove:async r=>r.filter(t=>r.includes(t))},loader:{name:"sound",extension:{type:[T.LoadParser],priority:mt.High},test(r){let t=tt.extname(r).slice(1);return !!er[t]||yl.some(e=>r.startsWith(`data:${e}`))},async load(r,t){let e=await new Promise((i,s)=>Fe.from({...t.data,url:r,preload:true,loaded(o,n){o?s(o):i(n),t.data?.loaded?.(o,n);}}));return K().add(Jg(t),e),e},async unload(r,t){K().remove(Jg(t));}}};R.add(tx);qg(new bn);({DistortionFilter:he.DistortionFilter,EqualizerFilter:he.EqualizerFilter,MonoFilter:he.MonoFilter,ReverbFilter:he.ReverbFilter,StereoFilter:he.StereoFilter,StreamFilter:he.StreamFilter,TelephoneFilter:he.TelephoneFilter});var Kr="Container";var bl="Image",qr="Sprite",ex="Text",vl="Video";var Zr=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ix=new Set,Tl=typeof process=="object"&&process?process:{},sx=(r,t,e,i)=>{typeof Tl.emitWarning=="function"?Tl.emitWarning(r,t,e,i):console.error(`[${e}] ${t}: ${r}`);},vn=globalThis.AbortController,rx=globalThis.AbortSignal;if(typeof vn>"u"){rx=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},vn=class{constructor(){t();}signal=new rx;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let r=Tl.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{r&&(r=false,sx("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 lb=r=>!ix.has(r),Re=r=>r&&r===Math.floor(r)&&r>0&&isFinite(r),ox=r=>Re(r)?r<=Math.pow(2,8)?Uint8Array:r<=Math.pow(2,16)?Uint16Array:r<=Math.pow(2,32)?Uint32Array:r<=Number.MAX_SAFE_INTEGER?Qr:null:null,Qr=class extends Array{constructor(t){super(t),this.fill(0);}},wl=class r{heap;length;static#h=false;static create(t){let e=ox(t);if(!e)return [];r.#h=true;let i=new r(t,e);return r.#h=false,i}constructor(t,e){if(!r.#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]}},Tn=class r{#h;#u;#m;#M;#g;#I;#F;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;#A;#c;#R;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,i,s,o)=>t.#D(e,i,s,o),moveToTail:e=>t.#B(e),indexes:e=>t.#T(e),rindexes:e=>t.#w(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.#I}get memoMethod(){return this.#F}get dispose(){return this.#m}get onInsert(){return this.#M}get disposeAfter(){return this.#g}constructor(t){let{max:e=0,ttl:i,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:h,dispose:l,onInsert:c,disposeAfter:u,noDisposeOnSet:f,noUpdateTTL:d,maxSize:p=0,maxEntrySize:x=0,sizeCalculation:g,fetchMethod:_,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:P,allowStaleOnFetchAbort:w,ignoreFetchAbort:S}=t;if(e!==0&&!Re(e))throw new TypeError("max option must be a nonnegative integer");let B=e?ox(e):Array;if(!B)throw new Error("invalid max value: "+e);if(this.#h=e,this.#u=p,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.#F=y,_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#I=_,this.#A=!!_,this.#i=new Map,this.#r=new Array(e).fill(void 0),this.#t=new Array(e).fill(void 0),this.#l=new B(e),this.#d=new B(e),this.#a=0,this.#o=0,this.#_=wl.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.#R=!!this.#M,this.#c=!!this.#g,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!P,this.allowStaleOnFetchAbort=!!w,this.ignoreFetchAbort=!!S,this.maxEntrySize!==0){if(this.#u!==0&&!Re(this.#u))throw new TypeError("maxSize must be a positive integer if specified");if(!Re(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=Re(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!Re(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 F="LRU_CACHE_UNBOUNDED";lb(F)&&(ix.add(F),sx("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",F,r));}}getRemainingTTL(t){return this.#i.has(t)?1/0:0}#U(){let t=new Qr(this.#h),e=new Qr(this.#h);this.#f=t,this.#b=e,this.#L=(o,n,a=Zr.now())=>{if(e[o]=n!==0?a:0,t[o]=n,n!==0&&this.ttlAutopurge){let h=setTimeout(()=>{this.#p(o)&&this.#S(this.#r[o],"expire");},n+1);h.unref&&h.unref();}},this.#C=o=>{e[o]=t[o]!==0?Zr.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=i||s();let l=o.now-h;o.remainingTTL=a-l;}};let i=0,s=()=>{let o=Zr.now();if(this.ttlResolution>0){i=o;let n=setTimeout(()=>i=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=(i||s())-h;return a-l},this.#p=o=>{let n=e[o],a=t[o];return !!a&&!!n&&(i||s())-n>a};}#C=()=>{};#P=()=>{};#L=()=>{};#p=()=>false;#V(){let t=new Qr(this.#h);this.#x=0,this.#y=t,this.#E=e=>{this.#x-=t[e],t[e]=0;},this.#O=(e,i,s,o)=>{if(this.#e(i))return 0;if(!Re(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(i,e),!Re(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.#k=(e,i,s)=>{if(t[e]=i,this.#u){let o=this.#u-t[e];for(;this.#x>o;)this.#G(true);}this.#x+=t[e],s&&(s.entrySize=i,s.totalCalculatedSize=this.#x);};}#E=t=>{};#k=(t,e,i)=>{};#O=(t,e,i,s)=>{if(i||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];}*#w({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.#w())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.#w()){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.#w())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 i of this.#T()){let s=this.#t[i],o=this.#e(s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,this.#r[i],this))return this.get(this.#r[i],e)}}forEach(t,e=this){for(let i of this.#T()){let s=this.#t[i],o=this.#e(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,this.#r[i],this);}}rforEach(t,e=this){for(let i of this.#w()){let s=this.#t[i],o=this.#e(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,this.#r[i],this);}}purgeStale(){let t=false;for(let e of this.#w({allowStale:true}))this.#p(e)&&(this.#S(this.#r[e],"expire"),t=true);return t}info(t){let e=this.#i.get(t);if(e===void 0)return;let i=this.#t[e],s=this.#e(i)?i.__staleWhileFetching:i;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-(Zr.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 i=this.#r[e],s=this.#t[e],o=this.#e(s)?s.__staleWhileFetching:s;if(o===void 0||i===void 0)continue;let n={value:o};if(this.#f&&this.#b){n.ttl=this.#f[e];let a=Zr.now()-this.#b[e];n.start=Math.floor(Date.now()-a);}this.#y&&(n.size=this.#y[e]),t.unshift([i,n]);}return t}load(t){this.clear();for(let[e,i]of t){if(i.start){let s=Date.now()-i.start;i.start=Zr.now()-s;}this.set(e,i.value,i);}}set(t,e,i={}){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}=i,{noUpdateTTL:l=this.noUpdateTTL}=i,c=this.#O(t,e,i.size||0,a);if(this.maxEntrySize&&c>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),this.#S(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.#k(u,c,h),h&&(h.set="add"),l=false,this.#R&&this.#M?.(e,t,"add");else {this.#B(u);let f=this.#t[u];if(e!==f){if(this.#A&&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.#k(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.#R&&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,i=this.#r[e],s=this.#t[e];return this.#A&&this.#e(s)?s.__abortController.abort(new Error("evicted")):(this.#v||this.#c)&&(this.#v&&this.#m?.(s,i,"evict"),this.#c&&this.#n?.push([s,i,"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(i),this.#s--,e}has(t,e={}){let{updateAgeOnHas:i=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 i&&this.#C(o),s&&(s.has="hit",this.#P(s,o)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:i=this.allowStale}=e,s=this.#i.get(t);if(s===void 0||!i&&this.#p(s))return;let o=this.#t[s];return this.#e(o)?o.__staleWhileFetching:o}#D(t,e,i,s){let o=e===void 0?void 0:this.#t[e];if(this.#e(o))return o;let n=new vn,{signal:a}=i;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let h={signal:n.signal,options:i,context:s},l=(x,g=false)=>{let{aborted:_}=n.signal,y=i.ignoreFetchAbort&&x!==void 0;if(i.status&&(_&&!g?(i.status.fetchAborted=true,i.status.fetchError=n.signal.reason,y&&(i.status.fetchAbortIgnored=true)):i.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.#S(t,"fetch"):(i.status&&(i.status.fetchUpdated=true),this.set(t,x,h.options))),x},c=x=>(i.status&&(i.status.fetchRejected=true,i.status.fetchError=x),u(x)),u=x=>{let{aborted:g}=n.signal,_=g&&i.allowStaleOnFetchAbort,y=_||i.allowStaleOnFetchRejection,v=y||i.noDeleteOnFetchRejection,b=d;if(this.#t[e]===d&&(!v||b.__staleWhileFetching===void 0?this.#S(t,"fetch"):_||(this.#t[e]=b.__staleWhileFetching)),y)return i.status&&b.__staleWhileFetching!==void 0&&(i.status.returnedStale=true),b.__staleWhileFetching;if(b.__returned===b)throw x},f=(x,g)=>{let _=this.#I?.(t,o,h);_&&_ instanceof Promise&&_.then(y=>x(y===void 0?void 0:y),g),n.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(x(void 0),i.allowStaleOnFetchAbort&&(x=y=>l(y,true)));});};i.status&&(i.status.fetchDispatched=true);let d=new Promise(f).then(l,c),p=Object.assign(d,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return e===void 0?(this.set(t,p,{...h.options,status:void 0}),e=this.#i.get(t)):this.#t[e]=p,p}#e(t){if(!this.#A)return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof vn}async fetch(t,e={}){let{allowStale:i=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:p=this.allowStaleOnFetchAbort,context:x,forceRefresh:g=false,status:_,signal:y}=e;if(!this.#A)return _&&(_.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:_});let v={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:h,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:p,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 M=i&&P.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",M&&(_.returnedStale=true)),M?P.__staleWhileFetching:P.__returned=P}let w=this.#p(b);if(!g&&!w)return _&&(_.fetch="hit"),this.#B(b),s&&this.#C(b),_&&this.#P(_,b),P;let S=this.#D(t,b,v,x),F=S.__staleWhileFetching!==void 0&&i;return _&&(_.fetch=w?"stale":"refresh",F&&w&&(_.returnedStale=true)),F?S.__staleWhileFetching:S.__returned=S}}async forceFetch(t,e={}){let i=await this.fetch(t,e);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,e={}){let i=this.#F;if(!i)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=i(t,a,{options:n,context:s});return this.set(t,h,n),h}get(t,e={}){let{allowStale:i=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&&i&&h.__staleWhileFetching!==void 0&&(n.returnedStale=true),i?h.__staleWhileFetching:void 0):(o||this.#S(t,"expire"),n&&i&&(n.returnedStale=true),i?h:void 0)):(n&&(n.get="hit"),l?h.__staleWhileFetching:(this.#B(a),s&&this.#C(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.#S(t,"delete")}#S(t,e){let i=false;if(this.#s!==0){let s=this.#i.get(t);if(s!==void 0)if(i=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 i}clear(){return this.#H("delete")}#H(t){for(let e of this.#w({allowStale:true})){let i=this.#t[e];if(this.#e(i))i.__abortController.abort(new Error("deleted"));else {let s=this.#r[e];this.#v&&this.#m?.(i,s,t),this.#c&&this.#n?.push([i,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,i;for(;i=e?.shift();)this.#g?.(...i);}}};var ke=class{cache;map=new Map;constructor(t){this.cache=new Tn({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 et;(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)))(et||={});var hs=new ke({cacheSize:5});var nx;(s=>{function r(o,n){n||(n=o.name),hs.get(n)&&et.warn(`CanvasElement "${n}" already registered`),o.prototype.pixivnId=n,hs.set(n,o);}s.add=r;function t(o){try{let n=hs.get(o);if(!n){et.error(`CanvasElement "${o}" not found, did you forget to register it with the canvasComponentDecorator?`);return}return new n,n}catch(n){et.error(`Error while getting CanvasElement "${o}"`,n);return}}s.get=t;function e(){return Array.from(hs.values())}s.values=e;function i(o){return hs.has(o)}s.has=i;})(nx||={});var le=nx;function cb(r){return "memory"in r?r.memory:r instanceof is?db(r):r instanceof Mt?cs(r):ls(r)}function ub(r){return {width:r.width,height:r.height,isRenderGroup:r.isRenderGroup,blendMode:r.blendMode,tint:r.tint,alpha:r.alpha,angle:r.angle,renderable:r.renderable,rotation:r.rotation,scale:{x:r.scale.x,y:r.scale.y},pivot:{x:r.pivot.x,y:r.pivot.y},position:{x:r.position.x,y:r.position.y},skew:{x:r.skew.x,y:r.skew.y},visible:r.visible,x:r.x,y:r.y,boundsArea:r.boundsArea,cursor:r.cursor,eventMode:r.eventMode,interactive:r.interactive,interactiveChildren:r.interactiveChildren,hitArea:r.hitArea}}function ax(r,t){return {url:r.source.label,alias:t===r.source.label?void 0:t}}function ls(r,t){let e=fb(r,Kr),s=t?.childrenExport||false?r.children.sort((o,n)=>r.getChildIndex(o)-r.getChildIndex(n)).map(o=>cb(o)):[];return {pixivnId:e,elements:s,...ub(r)}}function cs(r){let t=ls(r),e=t.pixivnId??qr,i=lx(r),s="textureAlias"in r?ax(r.texture,r.textureAlias):ax(r.texture);return {...t,pixivnId:e,textureData:s,anchor:{x:r.anchor.x,y:r.anchor.y},roundPixels:r.roundPixels,onEvents:i}}function db(r){let t=ls(r),e=t.pixivnId??ex,i=lx(r);return {...t,pixivnId:e,anchor:{x:r.anchor.x,y:r.anchor.y},text:r.text,resolution:r.resolution,style:pb(r.style),roundPixels:r.roundPixels,onEvents:i}}function fb(r,t){return Object.prototype.hasOwnProperty.call(r,"pixivnId")?r.pixivnId:t}function lx(r){return "onEvents"in r?r.onEvents:{}}function hx(r,t){if(typeof r!="object"||r===null)return r;et.warn(`Unsupported property type for Text.style.${t}: FillGradient or FillPattern.`,r);}function pb(r){return {align:r.align,breakWords:r.breakWords,dropShadow:r.dropShadow,fill:hx(r.stroke,"fill"),fontFamily:r.fontFamily,fontSize:r.fontSize,fontStyle:r.fontStyle,fontVariant:r.fontVariant,fontWeight:r.fontWeight,leading:r.leading,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,padding:r.padding,stroke:hx(r.stroke,"stroke"),textBaseline:r.textBaseline,trim:r.trim,whiteSpace:r.whiteSpace,wordWrap:r.wordWrap,wordWrapWidth:r.wordWrapWidth}}var Xt=class r{static init(t){r._getScreen=t.getScreen;}static _getScreen;static get screen(){return r._getScreen()}};function Sl(r,t,e,i,s,o=0){return i=i*(s?-1:1),r==="width"?t*(Xt.screen.width-e)+i+o*e+(s?e:0):t*(Xt.screen.height-e)+i+o*e+(s?e:0)}function us(r,t,e,i,s,o=0){return i=i*(s?-1:1),r==="width"?(t-i-o*e-(s?e:0))/(Xt.screen.width-e):(t-i-o*e-(s?e:0))/(Xt.screen.height-e)}function Pl(r,t){return r==="width"?t*Xt.screen.width:t*Xt.screen.height}function ds(r,t){return r==="width"?t/Xt.screen.width:t/Xt.screen.height}function _e(r,t){if(t=t%360,t<0&&(t+=360),t===0)return {x:r.x,y:r.y};if(t===90)return {x:-r.y,y:r.x};if(t===180)return {x:-r.x,y:-r.y};if(t===270)return {x:r.y,y:-r.x};if(t>0&&t<90){let e=t*Math.PI/180,i=Math.cos(e),s=Math.sin(e);return {x:r.x*i-r.y*s,y:r.x*s+r.y*i}}else if(t>90&&t<180){let e=(t-90)*Math.PI/180,i=Math.cos(e),s=Math.sin(e);return {x:-r.y*s-r.x*i,y:r.y*i-r.x*s}}else if(t>180&&t<270){let e=(t-180)*Math.PI/180,i=Math.cos(e),s=Math.sin(e);return {x:-r.x*i+r.y*s,y:-r.x*s-r.y*i}}else if(t>270&&t<360){let e=(t-270)*Math.PI/180,i=Math.cos(e),s=Math.sin(e);return {x:r.y*s-r.x*i,y:-r.y*i-r.x*s}}return {x:0,y:0}}function wn(r){let t=r.width,e=r.height,i=r.angle%360;return i<0&&(i+=360),i===0||i===180?t:i===90||i===270?e:Math.abs(t*Math.cos(i*Math.PI/180))+Math.abs(e*Math.sin(i*Math.PI/180))}function Sn(r){let t=r.width,e=r.height,i=r.angle%360;return i<0&&(i+=360),i===0||i===180?e:i===90||i===270?t:Math.abs(e*Math.cos(i*Math.PI/180))+Math.abs(t*Math.sin(i*Math.PI/180))}async function fs(r){if(r!=="EMPTY"){if(!r){et.error("Texture not found",r);return}if(te.cache.has(r)){let t=te.get(r);if(t)return t}return te.load(r).then(t=>{if(!t){et.error("Texture not found",r);return}if(!(t instanceof I)){et.error("File not is a file",r);return}return t}).catch(t=>{et.error("Error loading file",t);})}}function Al(r){return r&&(typeof r.align!="number"&&(r.xAlign!=null&&(r.align===void 0?(r.align={x:r.xAlign},delete r.xAlign):(r.align.x=r.xAlign,delete r.xAlign)),r.yAlign!=null&&(r.align===void 0?(r.align={y:r.yAlign},delete r.yAlign):(r.align.y=r.yAlign,delete r.yAlign))),typeof r.percentagePosition!="number"&&(r.xPercentagePosition!=null&&(r.percentagePosition===void 0?(r.percentagePosition={x:r.xPercentagePosition},delete r.xPercentagePosition):(r.percentagePosition.x=r.xPercentagePosition,delete r.xPercentagePosition)),r.yPercentagePosition!=null&&(r.percentagePosition===void 0?(r.percentagePosition={y:r.yPercentagePosition},delete r.yPercentagePosition):(r.percentagePosition.y=r.yPercentagePosition,delete r.yPercentagePosition))),r)}var Jr=new ke({cacheSize:5});var cx;(o=>{function r(n,a){a||(a=n.name),Jr.get(a)&&et.info(`Event "${a}" already exists, it will be overwritten`),n.prototype.id=a,Jr.set(a,n);}o.add=r;function t(n){try{let a=Jr.get(n);if(!a){et.error(`Event "${n}" not found, did you forget to register it with the eventDecorator?`);return}return new a,a}catch(a){et.error(`Error while getting Event "${n}"`,a);return}}o.get=t;function e(n){try{let a=Jr.get(n);if(!a){et.error(`Event "${n}" not found, did you forget to register it with the eventDecorator?`);return}return new a}catch(a){et.error(`Error while getting Event "${n}"`,a);return}}o.getInstance=e;function i(){return Array.from(Jr.values())}o.values=i;function s(n){return Jr.has(n)}o.has=s;})(cx||={});var ps=cx;async function ux(r){let t=mb(r.pixivnId);if(t)await t.setMemory(r);else throw new Error("[Pixi\u2019VN] The element "+r.pixivnId+" could not be created");return t}function mb(r){try{let t=le.get(r);return t?new t:void 0}catch(t){et.error(`Error while getting CanvasElement ${r}`,t);return}}var Pn=class extends Ft{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||Kr;}pixivnId=Kr;get memory(){return ls(this,{childrenExport:true})}set memory(t){}async setMemory(t){return this.memory=t,await this.importChildren(t),await Ml(this,t)}async importChildren(t){for(let e=0;e<t.elements.length;e++){let i=t.elements[e],s=await ux(i);this.addChild(s);}}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=ps.getInstance(i);return this._onEvents[t]=i,s?super.on(t,()=>{s.fn(t,this);}):et.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}};le.add(Pn,Kr);async function Ml(r,t,e){"isRenderGroup"in t&&t.isRenderGroup!==void 0&&(r.isRenderGroup=t.isRenderGroup),"blendMode"in t&&t.blendMode!==void 0&&(r.blendMode=t.blendMode),"tint"in t&&t.tint!==void 0&&(r.tint=t.tint),"alpha"in t&&t.alpha!==void 0&&(r.alpha=t.alpha),"angle"in t&&t.angle!==void 0&&(r.angle=t.angle),"renderable"in t&&t.renderable!==void 0&&(r.renderable=t.renderable),"rotation"in t&&t.rotation!==void 0&&(r.rotation=t.rotation),"scale"in t&&t.scale!==void 0&&(typeof t.scale=="number"?r.scale.set(t.scale,t.scale):r.scale.set(t.scale.x,t.scale.y)),"pivot"in t&&t.pivot!==void 0&&(typeof t.pivot=="number"?r.pivot.set(t.pivot,t.pivot):r.pivot.set(t.pivot.x,t.pivot.y)),"position"in t&&t.position!==void 0&&r.position.set(t.position.x,t.position.y),"skew"in t&&t.skew!==void 0&&r.skew.set(t.skew.x,t.skew.y),"visible"in t&&t.visible!==void 0&&(r.visible=t.visible),"x"in t&&t.x!==void 0&&(r.x=t.x),"y"in t&&t.y!==void 0&&(r.y=t.y),"boundsArea"in t&&t.boundsArea!==void 0&&(r.boundsArea=t.boundsArea),"cursor"in t&&t.cursor!==void 0&&(r.cursor=t.cursor),"eventMode"in t&&t.eventMode!==void 0&&(r.eventMode=t.eventMode),"interactive"in t&&t.interactive!==void 0&&(r.interactive=t.interactive),"interactiveChildren"in t&&t.interactiveChildren!==void 0&&(r.interactiveChildren=t.interactiveChildren),"hitArea"in t&&t.hitArea!==void 0&&(r.hitArea=t.hitArea),("width"in t&&t.width!==void 0&&(r.width=t.width),"height"in t&&t.height!==void 0&&(r.height=t.height));}var ti=class r extends Mt{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||qr;}pixivnId=qr;_textureAlias;get textureAlias(){return this._textureAlias?this._textureAlias:this.texture.source.label}set textureAlias(t){this._textureAlias=t;}get memory(){return cs(this)}set memory(t){}async setMemory(t){return this.memory=t,await Cl(this,t)}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=ps.getInstance(i);return this._onEvents[t]=i,s?(super.on(t,()=>{s.fn(t,this);}),this.interactive||(this.interactive=true,this.eventMode="dynamic")):et.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}static from(t,e){let i=Mt.from(t,e),s=new r;return s.texture=i.texture,s}};le.add(ti,qr);async function Cl(r,t,e){let i=e?.ignoreTexture||false;if(await Ml(r,t),!i){if("textureImage"in t&&t.textureImage&&t.textureImage.image){let o=await fs(t.textureImage.image);o&&(r.texture=o);}if("textureData"in t&&(t.textureData.alias&&(r.textureAlias=t.textureData.alias),t.textureData.url!=="EMPTY")){let o=t.textureData.url;t.textureData.alias&&te.resolver.hasKey(t.textureData.alias)&&(o=t.textureData.alias);let n=await fs(o);n&&(r.texture=n);}}let s=e?.half;if(s&&await s(),"anchor"in t&&t.anchor!==void 0&&(typeof t.anchor=="number"?r.anchor.set(t.anchor,t.anchor):r.anchor.set(t.anchor.x,t.anchor.y)),"roundPixels"in t&&t.roundPixels!==void 0&&(r.roundPixels=t.roundPixels),"onEvents"in t)for(let o in t.onEvents){let n=t.onEvents[o],a=ps.get(n);a&&r.onEvent(o,a);}}var ei=class r extends ti{pixivnId=bl;constructor(t,e){t=Al(t);let i,s;t&&"align"in t&&t?.align!==void 0&&(i=t.align,delete t.align),t&&"percentagePosition"in t&&t?.percentagePosition!==void 0&&(s=t.percentagePosition,delete t.percentagePosition),super(t),e&&(this.textureAlias=e),i&&(this.align=i),s&&(this.percentagePosition=s);}get memory(){return {...cs(this),pixivnId:this.pixivnId,align:this._align,percentagePosition:this._percentagePosition,loadIsStarted:this._loadIsStarted}}set memory(t){}async setMemory(t){this.memory=t,await El(this,t),this.reloadPosition();}static from(t,e){let i=Mt.from(t,e),s=new r;return s.texture=i.texture,s}_loadIsStarted=false;get loadIsStarted(){return this._loadIsStarted}async load(){return this._loadIsStarted=true,fs(this.textureAlias).then(t=>{this._loadIsStarted=false,t&&(this.texture=t);}).catch(t=>{this._loadIsStarted=false,et.error("Error into ImageSprite.load()",t);})}set texture(t){super.texture=t,this.reloadPosition();}get texture(){return super.texture}get haveEmptyTexture(){return this.texture._source.label==="EMPTY"}_align=void 0;set align(t){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),typeof t=="number"?(this._align.x=t,this._align.y=t):(t.x!==void 0&&(this._align.x=t.x),t.y!==void 0&&(this._align.y=t.y)),this.reloadPosition();}get align(){let t=_e(this.pivot,this.angle),e=_e(this.scale,this.angle);return {x:us("width",this.x,wn(this),t.x,e.x<0,this.anchor.x),y:us("height",this.y,Sn(this),t.y,e.y<0,this.anchor.y)}}set xAlign(t){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.x=t,this.reloadPosition();}get xAlign(){let t=_e(this.pivot,this.angle),e=_e(this.scale,this.angle);return us("width",this.x,wn(this),t.x,e.x<0,this.anchor.x)}set yAlign(t){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.y=t,this.reloadPosition();}get yAlign(){let t=_e(this.pivot,this.angle),e=_e(this.scale,this.angle);return us("height",this.y,Sn(this),t.y,e.y<0,this.anchor.y)}_percentagePosition=void 0;set percentagePosition(t){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),typeof t=="number"?(this._percentagePosition.x=t,this._percentagePosition.y=t):(t.x!==void 0&&(this._percentagePosition.x=t.x),t.y!==void 0&&(this._percentagePosition.y=t.y)),this.reloadPosition();}get percentagePosition(){return {x:ds("width",this.x),y:ds("height",this.y)}}get xPercentagePosition(){return ds("width",this.x)}set xPercentagePosition(t){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.x=t,this.reloadPosition();}get yPercentagePosition(){return ds("height",this.y)}set yPercentagePosition(t){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.y=t,this.reloadPosition();}get positionType(){return this._align?"align":this._percentagePosition?"percentage":"pixel"}get positionInfo(){return this._align?{x:this._align.x||0,y:this._align.y||0,type:"align"}:this._percentagePosition?{x:this._percentagePosition.x||0,y:this._percentagePosition.y||0,type:"percentage"}:{x:this.x,y:this.y,type:"pixel"}}set positionInfo(t){t.type==="align"?this.align={x:t.x,y:t.y}:t.type==="percentage"?this.percentagePosition={x:t.x,y:t.y}:this.position.set(t.x,t.y);}reloadPosition(){if(this._align){let t=_e(this.pivot,this.angle),e=_e(this.scale,this.angle);this._align.x!==void 0&&(super.x=Sl("width",this._align.x,wn(this),t.x,e.x<0,this.anchor.x)),this._align.y!==void 0&&(super.y=Sl("height",this._align.y,Sn(this),t.y,e.y<0,this.anchor.y));}else this._percentagePosition&&(this._percentagePosition.x!==void 0&&(super.x=Pl("width",this._percentagePosition.x)),this._percentagePosition.y!==void 0&&(super.y=Pl("height",this._percentagePosition.y)));}get position(){return super.position}set position(t){this._align=void 0,this._percentagePosition=void 0,super.position=t;}get x(){return super.x}set x(t){this._align=void 0,this._percentagePosition=void 0,super.x=t;}get y(){return super.y}set y(t){this._align=void 0,this._percentagePosition=void 0,super.y=t;}};le.add(ei,bl);async function El(r,t,e){let i=e?.ignoreTexture||false;return t=Al(t),await Cl(r,t,{half:async()=>{"align"in t&&t.align!==void 0&&(r.align=t.align),"percentagePosition"in t&&t.percentagePosition!==void 0&&(r.percentagePosition=t.percentagePosition),i||"imageLink"in t&&t.imageLink!==void 0&&(r.textureAlias=t.imageLink),"loadIsStarted"in t&&t.loadIsStarted&&await r.load();},ignoreTexture:e?.ignoreTexture})}var An=class r extends ei{constructor(t,e){let i,s,o;t&&"loop"in t&&t?.loop!==void 0&&(i=t.loop,delete t.loop),t&&"paused"in t&&t?.paused!==void 0&&(s=t.paused,delete t.paused),t&&"currentTime"in t&&t?.currentTime!==void 0&&(o=t.currentTime,delete t.currentTime),super(t,e),i&&(this.loop=i),s&&(this.paused=s),o&&(this.currentTime=o);}pixivnId=vl;get memory(){return {...super.memory,pixivnId:this.pixivnId,loop:this.loop,paused:this._paused,currentTime:this.currentTime}}set memory(t){}async setMemory(t){return this.memory=t,await gb(this,t)}static from(t,e){let i=Mt.from(t,e),s=new r;return s.texture=i.texture,s}async load(){await super.load(),this.loop=this._looop,this.currentTime=this._currentTime,this.paused=this._paused;}_looop=false;get loop(){return this.texture?.source?.resource?.loop||false}set loop(t){this._looop=t,this.texture?.source?.resource&&(this.texture.source.resource.loop=t);}_paused=false;get paused(){return this.texture?.source?.resource?.paused||false}set paused(t){t?this.pause():this.play();}pause(){this._paused=true,this.texture?.source?.resource&&this.texture.source.resource.pause();}play(){this._paused=false,this.texture?.source?.resource&&this.texture.source.resource.play();}_currentTime=0;get currentTime(){return this.texture?.source?.resource?.currentTime||0}set currentTime(t){let e=this.duration;e&&t>=e&&(t=0),this._currentTime=t,this.texture?.source?.resource&&(this.texture.source.resource.currentTime=t);}restart(){this.currentTime=0;}get duration(){if(this.texture?.source?.resource)return this.texture.source.resource.duration||0}};le.add(An,vl);async function gb(r,t,e){await El(r,t,{ignoreTexture:e?.ignoreTexture}),"loop"in t&&t.loop!==void 0&&(r.loop=t.loop),"currentTime"in t&&t.currentTime!==void 0&&(r.currentTime=t.currentTime),"paused"in t&&t.paused!==void 0&&(r.paused=t.paused);}exports.default=An;exports.setMemoryVideoSprite=gb;