pixi.js 7.2.0 → 7.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pixi.min.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  var Yh=Object.defineProperty,qh=Object.defineProperties;var Kh=Object.getOwnPropertyDescriptors;var Zs=Object.getOwnPropertySymbols;var $n=Object.prototype.hasOwnProperty,jn=Object.prototype.propertyIsEnumerable;var Wn=(e,t,s)=>t in e?Yh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,yt=(e,t)=>{for(var s in t||(t={}))$n.call(t,s)&&Wn(e,s,t[s]);if(Zs)for(var s of Zs(t))jn.call(t,s)&&Wn(e,s,t[s]);return e},as=(e,t)=>qh(e,Kh(t));var tr=(e,t)=>{var s={};for(var i in e)$n.call(e,i)&&t.indexOf(i)<0&&(s[i]=e[i]);if(e!=null&&Zs)for(var i of Zs(e))t.indexOf(i)<0&&jn.call(e,i)&&(s[i]=e[i]);return s};var $h;/*!
2
- * pixi.js - v7.2.0
3
- * Compiled Tue, 14 Mar 2023 19:26:30 UTC
2
+ * pixi.js - v7.2.1
3
+ * Compiled Fri, 17 Mar 2023 16:54:13 UTC
4
4
  *
5
5
  * pixi.js is licensed under the MIT License.
6
6
  * http://www.opensource.org/licenses/mit-license
@@ -489,7 +489,7 @@ void main(void)
489
489
  `)}}return n.push(`
490
490
  renderer.buffer.update(buffer);
491
491
  `),{size:r,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(`
492
- `))}}let Gc=0;const Si={textureCount:0,uboCount:0};class Qr{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=Gc++}systemCheck(){if(!na())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,s){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const i=t.program,r=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(r.program)),s||(Si.textureCount=0,Si.uboCount=0,this.syncUniformGroup(t.uniformGroup,Si)),r}setUniforms(t){const s=this.shader.program,i=s.glPrograms[this.renderer.CONTEXT_UID];s.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,s){const i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,s))}syncUniforms(t,s,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(s.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){const s=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[s]||(this.cache[s]=xc(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[s],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,s){const i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;const r=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,s);t.buffer.update(),r(i.uniformData,t.uniforms,this.renderer,Si,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[s])}createSyncBufferGroup(t,s,i){const{gl:r}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(s.program,i);s.uniformBufferBindings[i]=this.shader.uniformBindCount,r.uniformBlockBinding(s.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const o=this.getSignature(t,this.shader.program.uniformData,"ubo");let a=this._uboCache[o];if(a||(a=this._uboCache[o]=Ea(t,this.shader.program.uniformData)),t.autoManage){const h=new Float32Array(a.size/4);t.buffer.update(h)}return s.uniformGroups[t.id]=a.syncFunc,s.uniformGroups[t.id]}getSignature(t,s,i){const r=t.uniforms,n=[`${i}-`];for(const o in r)n.push(o),s[o]&&n.push(s[o].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const s=this.gl,i=t.program,r=ya(s,i);return i.glPrograms[this.renderer.CONTEXT_UID]=r,r}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}Qr.extension={type:P.RendererSystem,name:"shader"},O.add(Qr);class ws{constructor(t){this.renderer=t}run(t){const{renderer:s}=this;s.runners.init.emit(s.options),t.hello&&console.log(`PixiJS 7.2.0 - ${s.rendererLogId} - https://pixijs.com`),s.resize(s.screen.width,s.screen.height)}destroy(){}}ws.defaultOptions={hello:!1},ws.extension={type:[P.RendererSystem,P.CanvasRendererSystem],name:"startup"},O.add(ws);function Hc(e,t=[]){return t[k.NORMAL]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.ADD]=[e.ONE,e.ONE],t[k.MULTIPLY]=[e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.SCREEN]=[e.ONE,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.OVERLAY]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.DARKEN]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.LIGHTEN]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.COLOR_DODGE]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.COLOR_BURN]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.HARD_LIGHT]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.SOFT_LIGHT]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.DIFFERENCE]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.EXCLUSION]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.HUE]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.SATURATION]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.COLOR]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.LUMINOSITY]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.NONE]=[0,0],t[k.NORMAL_NPM]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.ADD_NPM]=[e.SRC_ALPHA,e.ONE,e.ONE,e.ONE],t[k.SCREEN_NPM]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.SRC_IN]=[e.DST_ALPHA,e.ZERO],t[k.SRC_OUT]=[e.ONE_MINUS_DST_ALPHA,e.ZERO],t[k.SRC_ATOP]=[e.DST_ALPHA,e.ONE_MINUS_SRC_ALPHA],t[k.DST_OVER]=[e.ONE_MINUS_DST_ALPHA,e.ONE],t[k.DST_IN]=[e.ZERO,e.SRC_ALPHA],t[k.DST_OUT]=[e.ZERO,e.ONE_MINUS_SRC_ALPHA],t[k.DST_ATOP]=[e.ONE_MINUS_DST_ALPHA,e.SRC_ALPHA],t[k.XOR]=[e.ONE_MINUS_DST_ALPHA,e.ONE_MINUS_SRC_ALPHA],t[k.SUBTRACT]=[e.ONE,e.ONE,e.ONE,e.ONE,e.FUNC_REVERSE_SUBTRACT,e.FUNC_ADD],t}const Xc=0,Vc=1,zc=2,Wc=3,$c=4,jc=5,tn=class{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=k.NONE,this._blendEq=!1,this.map=[],this.map[Xc]=this.setBlend,this.map[Vc]=this.setOffset,this.map[zc]=this.setCullFace,this.map[Wc]=this.setDepthTest,this.map[$c]=this.setFrontFace,this.map[jc]=this.setDepthMask,this.checks=[],this.defaultState=new ne,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=Hc(e),this.set(this.defaultState),this.reset()}set(e){if(e=e||this.defaultState,this.stateId!==e.data){let t=this.stateId^e.data,s=0;for(;t;)t&1&&this.map[s].call(this,!!(e.data&1<<s)),t=t>>1,s++;this.stateId=e.data}for(let t=0;t<this.checks.length;t++)this.checks[t](this,e)}forceState(e){e=e||this.defaultState;for(let t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(let t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data}setBlend(e){this.updateCheck(tn.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this.updateCheck(tn.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this.gl[e?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(e){this.gl.frontFace(this.gl[e?"CW":"CCW"])}setBlendMode(e){if(e===this.blendMode)return;this.blendMode=e;const t=this.blendModes[e],s=this.gl;t.length===2?s.blendFunc(t[0],t[1]):s.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,s.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,s.blendEquationSeparate(s.FUNC_ADD,s.FUNC_ADD))}setPolygonOffset(e,t){this.gl.polygonOffset(e,t)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(e,t){const s=this.checks.indexOf(e);t&&s===-1?this.checks.push(e):!t&&s!==-1&&this.checks.splice(s,1)}static checkBlendMode(e,t){e.setBlendMode(t.blendMode)}static checkPolygonOffset(e,t){e.setPolygonOffset(1,t.polygonOffset)}destroy(){this.gl=null}};let en=tn;en.extension={type:P.RendererSystem,name:"state"},O.add(en);class wa extends Ge{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){var r;this.addRunners(...t.runners);const s=((r=t.priority)!=null?r:[]).filter(n=>t.systems[n]),i=[...s,...Object.keys(t.systems).filter(n=>!s.includes(n))];for(const n of i)this.addSystem(t.systems[n],n)}addRunners(...t){t.forEach(s=>{this.runners[s]=new It(s)})}addSystem(t,s){const i=new t(this);if(this[s])throw new Error(`Whoops! The name "${s}" is already in use`);this[s]=i,this._systemsHash[s]=i;for(const r in this.runners)this.runners[r].add(i);return this}emitWithCustomOptions(t,s){const i=Object.keys(this._systemsHash);t.items.forEach(r=>{const n=i.find(o=>this._systemsHash[o]===r);r[t.name](s[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const Ai=class{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=Ai.defaultMaxIdle,this.checkCountMax=Ai.defaultCheckCountMax,this.mode=Ai.defaultMode}postrender(){!this.renderer.objectRenderer.renderingToScreen||(this.count++,this.mode!==ti.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const e=this.renderer.texture,t=e.managedTextures;let s=!1;for(let i=0;i<t.length;i++){const r=t[i];!r.framebuffer&&this.count-r.touched>this.maxIdle&&(e.destroyTexture(r,!0),t[i]=null,s=!0)}if(s){let i=0;for(let r=0;r<t.length;r++)t[r]!==null&&(t[i++]=t[r]);t.length=i}}unload(e){const t=this.renderer.texture,s=e._texture;s&&!s.framebuffer&&t.destroyTexture(s);for(let i=e.children.length-1;i>=0;i--)this.unload(e.children[i])}destroy(){this.renderer=null}};let Lt=Ai;Lt.defaultMode=ti.AUTO,Lt.defaultMaxIdle=60*60,Lt.defaultCheckCountMax=60*10,Lt.extension={type:P.RendererSystem,name:"textureGC"},O.add(Lt);class Ci{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=U.UNSIGNED_BYTE,this.internalFormat=C.RGBA,this.samplerType=0}}function Yc(e){let t;return"WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext?t={[U.UNSIGNED_BYTE]:{[C.RGBA]:e.RGBA8,[C.RGB]:e.RGB8,[C.RG]:e.RG8,[C.RED]:e.R8,[C.RGBA_INTEGER]:e.RGBA8UI,[C.RGB_INTEGER]:e.RGB8UI,[C.RG_INTEGER]:e.RG8UI,[C.RED_INTEGER]:e.R8UI,[C.ALPHA]:e.ALPHA,[C.LUMINANCE]:e.LUMINANCE,[C.LUMINANCE_ALPHA]:e.LUMINANCE_ALPHA},[U.BYTE]:{[C.RGBA]:e.RGBA8_SNORM,[C.RGB]:e.RGB8_SNORM,[C.RG]:e.RG8_SNORM,[C.RED]:e.R8_SNORM,[C.RGBA_INTEGER]:e.RGBA8I,[C.RGB_INTEGER]:e.RGB8I,[C.RG_INTEGER]:e.RG8I,[C.RED_INTEGER]:e.R8I},[U.UNSIGNED_SHORT]:{[C.RGBA_INTEGER]:e.RGBA16UI,[C.RGB_INTEGER]:e.RGB16UI,[C.RG_INTEGER]:e.RG16UI,[C.RED_INTEGER]:e.R16UI,[C.DEPTH_COMPONENT]:e.DEPTH_COMPONENT16},[U.SHORT]:{[C.RGBA_INTEGER]:e.RGBA16I,[C.RGB_INTEGER]:e.RGB16I,[C.RG_INTEGER]:e.RG16I,[C.RED_INTEGER]:e.R16I},[U.UNSIGNED_INT]:{[C.RGBA_INTEGER]:e.RGBA32UI,[C.RGB_INTEGER]:e.RGB32UI,[C.RG_INTEGER]:e.RG32UI,[C.RED_INTEGER]:e.R32UI,[C.DEPTH_COMPONENT]:e.DEPTH_COMPONENT24},[U.INT]:{[C.RGBA_INTEGER]:e.RGBA32I,[C.RGB_INTEGER]:e.RGB32I,[C.RG_INTEGER]:e.RG32I,[C.RED_INTEGER]:e.R32I},[U.FLOAT]:{[C.RGBA]:e.RGBA32F,[C.RGB]:e.RGB32F,[C.RG]:e.RG32F,[C.RED]:e.R32F,[C.DEPTH_COMPONENT]:e.DEPTH_COMPONENT32F},[U.HALF_FLOAT]:{[C.RGBA]:e.RGBA16F,[C.RGB]:e.RGB16F,[C.RG]:e.RG16F,[C.RED]:e.R16F},[U.UNSIGNED_SHORT_5_6_5]:{[C.RGB]:e.RGB565},[U.UNSIGNED_SHORT_4_4_4_4]:{[C.RGBA]:e.RGBA4},[U.UNSIGNED_SHORT_5_5_5_1]:{[C.RGBA]:e.RGB5_A1},[U.UNSIGNED_INT_2_10_10_10_REV]:{[C.RGBA]:e.RGB10_A2,[C.RGBA_INTEGER]:e.RGB10_A2UI},[U.UNSIGNED_INT_10F_11F_11F_REV]:{[C.RGB]:e.R11F_G11F_B10F},[U.UNSIGNED_INT_5_9_9_9_REV]:{[C.RGB]:e.RGB9_E5},[U.UNSIGNED_INT_24_8]:{[C.DEPTH_STENCIL]:e.DEPTH24_STENCIL8},[U.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[C.DEPTH_STENCIL]:e.DEPTH32F_STENCIL8}}:t={[U.UNSIGNED_BYTE]:{[C.RGBA]:e.RGBA,[C.RGB]:e.RGB,[C.ALPHA]:e.ALPHA,[C.LUMINANCE]:e.LUMINANCE,[C.LUMINANCE_ALPHA]:e.LUMINANCE_ALPHA},[U.UNSIGNED_SHORT_5_6_5]:{[C.RGB]:e.RGB},[U.UNSIGNED_SHORT_4_4_4_4]:{[C.RGBA]:e.RGBA},[U.UNSIGNED_SHORT_5_5_5_1]:{[C.RGBA]:e.RGBA}},t}class sn{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new X,this.hasIntegerTextures=!1}contextChange(){const t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=Yc(t);const s=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=s;for(let r=0;r<s;r++)this.boundTextures[r]=null;this.emptyTextures={};const i=new Ci(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Ci(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let r=0;r<6;r++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let r=0;r<this.boundTextures.length;r++)this.bind(null,r)}bind(t,s=0){const{gl:i}=this;if(t=t==null?void 0:t.castToBaseTexture(),(t==null?void 0:t.valid)&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;const r=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[s]!==t&&(this.currentLocation!==s&&(this.currentLocation=s,i.activeTexture(i.TEXTURE0+s)),i.bindTexture(t.target,r.texture)),r.dirtyId!==t.dirtyId?(this.currentLocation!==s&&(this.currentLocation=s,i.activeTexture(i.TEXTURE0+s)),this.updateTexture(t)):r.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[s]=t}else this.currentLocation!==s&&(this.currentLocation=s,i.activeTexture(i.TEXTURE0+s)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[s]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){const{gl:s,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let r=0;r<i.length;r++)i[r]===this.unknownTexture&&this.bind(null,r)}for(let r=0;r<i.length;r++)i[r]===t&&(this.currentLocation!==r&&(s.activeTexture(s.TEXTURE0+r),this.currentLocation=r),s.bindTexture(t.target,this.emptyTextures[t.target].texture),i[r]=null)}ensureSamplerType(t){const{boundTextures:s,hasIntegerTextures:i,CONTEXT_UID:r}=this;if(!!i)for(let n=t-1;n>=0;--n){const o=s[n];o&&o._glTextures[r].samplerType!==Qs.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const s=new Ci(this.gl.createTexture());return s.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=s,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),s}initTextureType(t,s){var i,r;s.internalFormat=(r=(i=this.internalFormats[t.type])==null?void 0:i[t.format])!=null?r:t.format,this.webGLVersion===2&&t.type===U.HALF_FLOAT?s.type=this.gl.HALF_FLOAT:s.type=t.type}updateTexture(t){var r;const s=t._glTextures[this.CONTEXT_UID];if(!s)return;const i=this.renderer;if(this.initTextureType(t,s),(r=t.resource)!=null&&r.upload(i,t,s))s.samplerType!==Qs.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,o=t.realHeight,a=i.gl;(s.width!==n||s.height!==o||s.dirtyId<0)&&(s.width=n,s.height=o,a.texImage2D(t.target,0,s.internalFormat,n,o,0,t.format,s.type,null))}t.dirtyStyleId!==s.dirtyStyleId&&this.updateTextureStyle(t),s.dirtyId=t.dirtyId}destroyTexture(t,s){const{gl:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!s)){const r=this.managedTextures.indexOf(t);r!==-1&&Se(this.managedTextures,r,1)}}updateTextureStyle(t){var i;const s=t._glTextures[this.CONTEXT_UID];!s||((t.mipmap===Ht.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?s.mipmap=!1:s.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?s.wrapMode=te.CLAMP:s.wrapMode=t.wrapMode,(i=t.resource)!=null&&i.style(this.renderer,t,s)||this.setStyle(t,s),s.dirtyStyleId=t.dirtyStyleId)}setStyle(t,s){const i=this.gl;if(s.mipmap&&t.mipmap!==Ht.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,s.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,s.wrapMode),s.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Qt.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const r=this.renderer.context.extensions.anisotropicFiltering;if(r&&t.anisotropicLevel>0&&t.scaleMode===Qt.LINEAR){const n=Math.min(t.anisotropicLevel,i.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,r.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Qt.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===Qt.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}sn.extension={type:P.RendererSystem,name:"texture"},O.add(sn);class rn{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:s,CONTEXT_UID:i}=this,r=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,r)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,s){const{gl:i,renderer:r}=this;s&&r.shader.bind(s),i.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:s,renderer:i,CONTEXT_UID:r}=this,n=s.createTransformFeedback();t._glTransformFeedbacks[r]=n,s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,n);for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];!a||(i.buffer.update(a),a._glBuffers[r].refCount++,s.bindBufferBase(s.TRANSFORM_FEEDBACK_BUFFER,o,a._glBuffers[r].buffer||null))}return s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,s){const i=t._glTransformFeedbacks[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];if(!a)continue;const h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!s&&n.dispose(a,s))}!i||(s||r.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}rn.extension={type:P.RendererSystem,name:"transformFeedback"},O.add(rn);class Ss{constructor(t){this.renderer=t}init(t){this.screen=new W(0,0,t.width,t.height),this.element=t.view||I.ADAPTER.createCanvas(),this.resolution=t.resolution||I.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,s){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(s*this.resolution);const i=this.element.width/this.resolution,r=this.element.height/this.resolution;this.screen.width=i,this.screen.height=r,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${r}px`),this.renderer.emit("resize",i,r),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){var s;t&&((s=this.element.parentNode)==null||s.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}Ss.defaultOptions={width:800,height:600,resolution:I.RESOLUTION,autoDensity:!1},Ss.extension={type:[P.RendererSystem,P.CanvasRendererSystem],name:"_view"},O.add(Ss),I.PREFER_ENV=ge.WEBGL2,I.STRICT_TEXTURE_CACHE=!1,I.RENDER_OPTIONS=yt(yt(yt(yt({},Ts.defaultOptions),bs.defaultOptions),Ss.defaultOptions),ws.defaultOptions),Object.defineProperties(I,{WRAP_MODE:{get(){return X.defaultOptions.wrapMode},set(e){V("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),X.defaultOptions.wrapMode=e}},SCALE_MODE:{get(){return X.defaultOptions.scaleMode},set(e){V("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),X.defaultOptions.scaleMode=e}},MIPMAP_TEXTURES:{get(){return X.defaultOptions.mipmap},set(e){V("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),X.defaultOptions.mipmap=e}},ANISOTROPIC_LEVEL:{get(){return X.defaultOptions.anisotropicLevel},set(e){V("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),X.defaultOptions.anisotropicLevel=e}},FILTER_RESOLUTION:{get(){return V("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),_t.defaultResolution},set(e){_t.defaultResolution=e}},FILTER_MULTISAMPLE:{get(){return V("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),_t.defaultMultisample},set(e){_t.defaultMultisample=e}},SPRITE_MAX_TEXTURES:{get(){return Ft.defaultMaxTextures},set(e){V("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Ft.defaultMaxTextures=e}},SPRITE_BATCH_SIZE:{get(){return Ft.defaultBatchSize},set(e){V("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Ft.defaultBatchSize=e}},CAN_UPLOAD_SAME_BUFFER:{get(){return Ft.canUploadSameBuffer},set(e){V("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Ft.canUploadSameBuffer=e}},GC_MODE:{get(){return Lt.defaultMode},set(e){V("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Lt.defaultMode=e}},GC_MAX_IDLE:{get(){return Lt.defaultMaxIdle},set(e){V("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Lt.defaultMaxIdle=e}},GC_MAX_CHECK_COUNT:{get(){return Lt.defaultCheckCountMax},set(e){V("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Lt.defaultCheckCountMax=e}},PRECISION_VERTEX:{get(){return Nt.defaultVertexPrecision},set(e){V("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),Nt.defaultVertexPrecision=e}},PRECISION_FRAGMENT:{get(){return Nt.defaultFragmentPrecision},set(e){V("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),Nt.defaultFragmentPrecision=e}}});var ue=(e=>(e[e.INTERACTION=50]="INTERACTION",e[e.HIGH=25]="HIGH",e[e.NORMAL=0]="NORMAL",e[e.LOW=-25]="LOW",e[e.UTILITY=-50]="UTILITY",e))(ue||{});class nn{constructor(t,s=null,i=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=s,this.priority=i,this.once=r}match(t,s=null){return this.fn===t&&this.context===s}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const s=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),s}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const s=this.next;return this.next=t?null:s,this.previous=null,s}}const Pt=class{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new nn(null,null,1/0),this.deltaMS=1/Pt.targetFPMS,this.elapsedMS=1/Pt.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(e,t,s=ue.NORMAL){return this._addListener(new nn(e,t,s))}addOnce(e,t,s=ue.NORMAL){return this._addListener(new nn(e,t,s,!0))}_addListener(e){let t=this._head.next,s=this._head;if(!t)e.connect(s);else{for(;t;){if(e.priority>t.priority){e.connect(s);break}s=t,t=t.next}e.previous||e.connect(s)}return this._startIfPossible(),this}remove(e,t){let s=this._head.next;for(;s;)s.match(e,t)?s=s.destroy():s=s.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,t=this._head;for(;t=t.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){const r=e-this._lastFrame|0;if(r<this._minElapsedMS)return;this._lastFrame=e-r%this._minElapsedMS}this.deltaMS=t,this.deltaTime=this.deltaMS*Pt.targetFPMS;const s=this._head;let i=s.next;for(;i;)i=i.emit(this.deltaTime);s.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const t=Math.min(this.maxFPS,e),s=Math.min(Math.max(0,t)/1e3,Pt.targetFPMS);this._maxElapsedMS=1/s}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){if(e===0)this._minElapsedMS=0;else{const t=Math.max(this.minFPS,e);this._minElapsedMS=1/(t/1e3)}}static get shared(){if(!Pt._shared){const e=Pt._shared=new Pt;e.autoStart=!0,e._protected=!0}return Pt._shared}static get system(){if(!Pt._system){const e=Pt._system=new Pt;e.autoStart=!0,e._protected=!0}return Pt._system}};let at=Pt;at.targetFPMS=.06,Object.defineProperties(I,{TARGET_FPMS:{get(){return at.targetFPMS},set(e){V("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),at.targetFPMS=e}}});class on{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(s){this._ticker&&this._ticker.remove(this.render,this),this._ticker=s,s&&s.add(this.render,this,ue.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?at.shared:new at,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}on.extension=P.Application,O.add(on);const Sa=[];O.handleByList(P.Renderer,Sa);function Aa(e){for(const t of Sa)if(t.test(e))return new t(e);throw new Error("Unable to auto-detect a suitable renderer.")}var qc=`attribute vec2 aVertexPosition;
492
+ `))}}let Gc=0;const Si={textureCount:0,uboCount:0};class Qr{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=Gc++}systemCheck(){if(!na())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,s){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const i=t.program,r=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(r.program)),s||(Si.textureCount=0,Si.uboCount=0,this.syncUniformGroup(t.uniformGroup,Si)),r}setUniforms(t){const s=this.shader.program,i=s.glPrograms[this.renderer.CONTEXT_UID];s.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,s){const i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,s))}syncUniforms(t,s,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(s.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){const s=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[s]||(this.cache[s]=xc(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[s],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,s){const i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;const r=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,s);t.buffer.update(),r(i.uniformData,t.uniforms,this.renderer,Si,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[s])}createSyncBufferGroup(t,s,i){const{gl:r}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(s.program,i);s.uniformBufferBindings[i]=this.shader.uniformBindCount,r.uniformBlockBinding(s.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const o=this.getSignature(t,this.shader.program.uniformData,"ubo");let a=this._uboCache[o];if(a||(a=this._uboCache[o]=Ea(t,this.shader.program.uniformData)),t.autoManage){const h=new Float32Array(a.size/4);t.buffer.update(h)}return s.uniformGroups[t.id]=a.syncFunc,s.uniformGroups[t.id]}getSignature(t,s,i){const r=t.uniforms,n=[`${i}-`];for(const o in r)n.push(o),s[o]&&n.push(s[o].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const s=this.gl,i=t.program,r=ya(s,i);return i.glPrograms[this.renderer.CONTEXT_UID]=r,r}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}Qr.extension={type:P.RendererSystem,name:"shader"},O.add(Qr);class ws{constructor(t){this.renderer=t}run(t){const{renderer:s}=this;s.runners.init.emit(s.options),t.hello&&console.log(`PixiJS 7.2.1 - ${s.rendererLogId} - https://pixijs.com`),s.resize(s.screen.width,s.screen.height)}destroy(){}}ws.defaultOptions={hello:!1},ws.extension={type:[P.RendererSystem,P.CanvasRendererSystem],name:"startup"},O.add(ws);function Hc(e,t=[]){return t[k.NORMAL]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.ADD]=[e.ONE,e.ONE],t[k.MULTIPLY]=[e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.SCREEN]=[e.ONE,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.OVERLAY]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.DARKEN]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.LIGHTEN]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.COLOR_DODGE]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.COLOR_BURN]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.HARD_LIGHT]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.SOFT_LIGHT]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.DIFFERENCE]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.EXCLUSION]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.HUE]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.SATURATION]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.COLOR]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.LUMINOSITY]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.NONE]=[0,0],t[k.NORMAL_NPM]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.ADD_NPM]=[e.SRC_ALPHA,e.ONE,e.ONE,e.ONE],t[k.SCREEN_NPM]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],t[k.SRC_IN]=[e.DST_ALPHA,e.ZERO],t[k.SRC_OUT]=[e.ONE_MINUS_DST_ALPHA,e.ZERO],t[k.SRC_ATOP]=[e.DST_ALPHA,e.ONE_MINUS_SRC_ALPHA],t[k.DST_OVER]=[e.ONE_MINUS_DST_ALPHA,e.ONE],t[k.DST_IN]=[e.ZERO,e.SRC_ALPHA],t[k.DST_OUT]=[e.ZERO,e.ONE_MINUS_SRC_ALPHA],t[k.DST_ATOP]=[e.ONE_MINUS_DST_ALPHA,e.SRC_ALPHA],t[k.XOR]=[e.ONE_MINUS_DST_ALPHA,e.ONE_MINUS_SRC_ALPHA],t[k.SUBTRACT]=[e.ONE,e.ONE,e.ONE,e.ONE,e.FUNC_REVERSE_SUBTRACT,e.FUNC_ADD],t}const Xc=0,Vc=1,zc=2,Wc=3,$c=4,jc=5,tn=class{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=k.NONE,this._blendEq=!1,this.map=[],this.map[Xc]=this.setBlend,this.map[Vc]=this.setOffset,this.map[zc]=this.setCullFace,this.map[Wc]=this.setDepthTest,this.map[$c]=this.setFrontFace,this.map[jc]=this.setDepthMask,this.checks=[],this.defaultState=new ne,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=Hc(e),this.set(this.defaultState),this.reset()}set(e){if(e=e||this.defaultState,this.stateId!==e.data){let t=this.stateId^e.data,s=0;for(;t;)t&1&&this.map[s].call(this,!!(e.data&1<<s)),t=t>>1,s++;this.stateId=e.data}for(let t=0;t<this.checks.length;t++)this.checks[t](this,e)}forceState(e){e=e||this.defaultState;for(let t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(let t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data}setBlend(e){this.updateCheck(tn.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this.updateCheck(tn.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this.gl[e?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(e){this.gl.frontFace(this.gl[e?"CW":"CCW"])}setBlendMode(e){if(e===this.blendMode)return;this.blendMode=e;const t=this.blendModes[e],s=this.gl;t.length===2?s.blendFunc(t[0],t[1]):s.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,s.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,s.blendEquationSeparate(s.FUNC_ADD,s.FUNC_ADD))}setPolygonOffset(e,t){this.gl.polygonOffset(e,t)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(e,t){const s=this.checks.indexOf(e);t&&s===-1?this.checks.push(e):!t&&s!==-1&&this.checks.splice(s,1)}static checkBlendMode(e,t){e.setBlendMode(t.blendMode)}static checkPolygonOffset(e,t){e.setPolygonOffset(1,t.polygonOffset)}destroy(){this.gl=null}};let en=tn;en.extension={type:P.RendererSystem,name:"state"},O.add(en);class wa extends Ge{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){var r;this.addRunners(...t.runners);const s=((r=t.priority)!=null?r:[]).filter(n=>t.systems[n]),i=[...s,...Object.keys(t.systems).filter(n=>!s.includes(n))];for(const n of i)this.addSystem(t.systems[n],n)}addRunners(...t){t.forEach(s=>{this.runners[s]=new It(s)})}addSystem(t,s){const i=new t(this);if(this[s])throw new Error(`Whoops! The name "${s}" is already in use`);this[s]=i,this._systemsHash[s]=i;for(const r in this.runners)this.runners[r].add(i);return this}emitWithCustomOptions(t,s){const i=Object.keys(this._systemsHash);t.items.forEach(r=>{const n=i.find(o=>this._systemsHash[o]===r);r[t.name](s[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const Ai=class{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=Ai.defaultMaxIdle,this.checkCountMax=Ai.defaultCheckCountMax,this.mode=Ai.defaultMode}postrender(){!this.renderer.objectRenderer.renderingToScreen||(this.count++,this.mode!==ti.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const e=this.renderer.texture,t=e.managedTextures;let s=!1;for(let i=0;i<t.length;i++){const r=t[i];!r.framebuffer&&this.count-r.touched>this.maxIdle&&(e.destroyTexture(r,!0),t[i]=null,s=!0)}if(s){let i=0;for(let r=0;r<t.length;r++)t[r]!==null&&(t[i++]=t[r]);t.length=i}}unload(e){const t=this.renderer.texture,s=e._texture;s&&!s.framebuffer&&t.destroyTexture(s);for(let i=e.children.length-1;i>=0;i--)this.unload(e.children[i])}destroy(){this.renderer=null}};let Lt=Ai;Lt.defaultMode=ti.AUTO,Lt.defaultMaxIdle=60*60,Lt.defaultCheckCountMax=60*10,Lt.extension={type:P.RendererSystem,name:"textureGC"},O.add(Lt);class Ci{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=U.UNSIGNED_BYTE,this.internalFormat=C.RGBA,this.samplerType=0}}function Yc(e){let t;return"WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext?t={[U.UNSIGNED_BYTE]:{[C.RGBA]:e.RGBA8,[C.RGB]:e.RGB8,[C.RG]:e.RG8,[C.RED]:e.R8,[C.RGBA_INTEGER]:e.RGBA8UI,[C.RGB_INTEGER]:e.RGB8UI,[C.RG_INTEGER]:e.RG8UI,[C.RED_INTEGER]:e.R8UI,[C.ALPHA]:e.ALPHA,[C.LUMINANCE]:e.LUMINANCE,[C.LUMINANCE_ALPHA]:e.LUMINANCE_ALPHA},[U.BYTE]:{[C.RGBA]:e.RGBA8_SNORM,[C.RGB]:e.RGB8_SNORM,[C.RG]:e.RG8_SNORM,[C.RED]:e.R8_SNORM,[C.RGBA_INTEGER]:e.RGBA8I,[C.RGB_INTEGER]:e.RGB8I,[C.RG_INTEGER]:e.RG8I,[C.RED_INTEGER]:e.R8I},[U.UNSIGNED_SHORT]:{[C.RGBA_INTEGER]:e.RGBA16UI,[C.RGB_INTEGER]:e.RGB16UI,[C.RG_INTEGER]:e.RG16UI,[C.RED_INTEGER]:e.R16UI,[C.DEPTH_COMPONENT]:e.DEPTH_COMPONENT16},[U.SHORT]:{[C.RGBA_INTEGER]:e.RGBA16I,[C.RGB_INTEGER]:e.RGB16I,[C.RG_INTEGER]:e.RG16I,[C.RED_INTEGER]:e.R16I},[U.UNSIGNED_INT]:{[C.RGBA_INTEGER]:e.RGBA32UI,[C.RGB_INTEGER]:e.RGB32UI,[C.RG_INTEGER]:e.RG32UI,[C.RED_INTEGER]:e.R32UI,[C.DEPTH_COMPONENT]:e.DEPTH_COMPONENT24},[U.INT]:{[C.RGBA_INTEGER]:e.RGBA32I,[C.RGB_INTEGER]:e.RGB32I,[C.RG_INTEGER]:e.RG32I,[C.RED_INTEGER]:e.R32I},[U.FLOAT]:{[C.RGBA]:e.RGBA32F,[C.RGB]:e.RGB32F,[C.RG]:e.RG32F,[C.RED]:e.R32F,[C.DEPTH_COMPONENT]:e.DEPTH_COMPONENT32F},[U.HALF_FLOAT]:{[C.RGBA]:e.RGBA16F,[C.RGB]:e.RGB16F,[C.RG]:e.RG16F,[C.RED]:e.R16F},[U.UNSIGNED_SHORT_5_6_5]:{[C.RGB]:e.RGB565},[U.UNSIGNED_SHORT_4_4_4_4]:{[C.RGBA]:e.RGBA4},[U.UNSIGNED_SHORT_5_5_5_1]:{[C.RGBA]:e.RGB5_A1},[U.UNSIGNED_INT_2_10_10_10_REV]:{[C.RGBA]:e.RGB10_A2,[C.RGBA_INTEGER]:e.RGB10_A2UI},[U.UNSIGNED_INT_10F_11F_11F_REV]:{[C.RGB]:e.R11F_G11F_B10F},[U.UNSIGNED_INT_5_9_9_9_REV]:{[C.RGB]:e.RGB9_E5},[U.UNSIGNED_INT_24_8]:{[C.DEPTH_STENCIL]:e.DEPTH24_STENCIL8},[U.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[C.DEPTH_STENCIL]:e.DEPTH32F_STENCIL8}}:t={[U.UNSIGNED_BYTE]:{[C.RGBA]:e.RGBA,[C.RGB]:e.RGB,[C.ALPHA]:e.ALPHA,[C.LUMINANCE]:e.LUMINANCE,[C.LUMINANCE_ALPHA]:e.LUMINANCE_ALPHA},[U.UNSIGNED_SHORT_5_6_5]:{[C.RGB]:e.RGB},[U.UNSIGNED_SHORT_4_4_4_4]:{[C.RGBA]:e.RGBA},[U.UNSIGNED_SHORT_5_5_5_1]:{[C.RGBA]:e.RGBA}},t}class sn{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new X,this.hasIntegerTextures=!1}contextChange(){const t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=Yc(t);const s=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=s;for(let r=0;r<s;r++)this.boundTextures[r]=null;this.emptyTextures={};const i=new Ci(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Ci(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let r=0;r<6;r++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let r=0;r<this.boundTextures.length;r++)this.bind(null,r)}bind(t,s=0){const{gl:i}=this;if(t=t==null?void 0:t.castToBaseTexture(),(t==null?void 0:t.valid)&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;const r=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[s]!==t&&(this.currentLocation!==s&&(this.currentLocation=s,i.activeTexture(i.TEXTURE0+s)),i.bindTexture(t.target,r.texture)),r.dirtyId!==t.dirtyId?(this.currentLocation!==s&&(this.currentLocation=s,i.activeTexture(i.TEXTURE0+s)),this.updateTexture(t)):r.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[s]=t}else this.currentLocation!==s&&(this.currentLocation=s,i.activeTexture(i.TEXTURE0+s)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[s]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){const{gl:s,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let r=0;r<i.length;r++)i[r]===this.unknownTexture&&this.bind(null,r)}for(let r=0;r<i.length;r++)i[r]===t&&(this.currentLocation!==r&&(s.activeTexture(s.TEXTURE0+r),this.currentLocation=r),s.bindTexture(t.target,this.emptyTextures[t.target].texture),i[r]=null)}ensureSamplerType(t){const{boundTextures:s,hasIntegerTextures:i,CONTEXT_UID:r}=this;if(!!i)for(let n=t-1;n>=0;--n){const o=s[n];o&&o._glTextures[r].samplerType!==Qs.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const s=new Ci(this.gl.createTexture());return s.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=s,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),s}initTextureType(t,s){var i,r;s.internalFormat=(r=(i=this.internalFormats[t.type])==null?void 0:i[t.format])!=null?r:t.format,this.webGLVersion===2&&t.type===U.HALF_FLOAT?s.type=this.gl.HALF_FLOAT:s.type=t.type}updateTexture(t){var r;const s=t._glTextures[this.CONTEXT_UID];if(!s)return;const i=this.renderer;if(this.initTextureType(t,s),(r=t.resource)!=null&&r.upload(i,t,s))s.samplerType!==Qs.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,o=t.realHeight,a=i.gl;(s.width!==n||s.height!==o||s.dirtyId<0)&&(s.width=n,s.height=o,a.texImage2D(t.target,0,s.internalFormat,n,o,0,t.format,s.type,null))}t.dirtyStyleId!==s.dirtyStyleId&&this.updateTextureStyle(t),s.dirtyId=t.dirtyId}destroyTexture(t,s){const{gl:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!s)){const r=this.managedTextures.indexOf(t);r!==-1&&Se(this.managedTextures,r,1)}}updateTextureStyle(t){var i;const s=t._glTextures[this.CONTEXT_UID];!s||((t.mipmap===Ht.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?s.mipmap=!1:s.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?s.wrapMode=te.CLAMP:s.wrapMode=t.wrapMode,(i=t.resource)!=null&&i.style(this.renderer,t,s)||this.setStyle(t,s),s.dirtyStyleId=t.dirtyStyleId)}setStyle(t,s){const i=this.gl;if(s.mipmap&&t.mipmap!==Ht.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,s.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,s.wrapMode),s.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Qt.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const r=this.renderer.context.extensions.anisotropicFiltering;if(r&&t.anisotropicLevel>0&&t.scaleMode===Qt.LINEAR){const n=Math.min(t.anisotropicLevel,i.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,r.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Qt.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===Qt.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}sn.extension={type:P.RendererSystem,name:"texture"},O.add(sn);class rn{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:s,CONTEXT_UID:i}=this,r=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,r)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,s){const{gl:i,renderer:r}=this;s&&r.shader.bind(s),i.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:s,renderer:i,CONTEXT_UID:r}=this,n=s.createTransformFeedback();t._glTransformFeedbacks[r]=n,s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,n);for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];!a||(i.buffer.update(a),a._glBuffers[r].refCount++,s.bindBufferBase(s.TRANSFORM_FEEDBACK_BUFFER,o,a._glBuffers[r].buffer||null))}return s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,s){const i=t._glTransformFeedbacks[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];if(!a)continue;const h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!s&&n.dispose(a,s))}!i||(s||r.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}rn.extension={type:P.RendererSystem,name:"transformFeedback"},O.add(rn);class Ss{constructor(t){this.renderer=t}init(t){this.screen=new W(0,0,t.width,t.height),this.element=t.view||I.ADAPTER.createCanvas(),this.resolution=t.resolution||I.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,s){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(s*this.resolution);const i=this.element.width/this.resolution,r=this.element.height/this.resolution;this.screen.width=i,this.screen.height=r,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${r}px`),this.renderer.emit("resize",i,r),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){var s;t&&((s=this.element.parentNode)==null||s.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}Ss.defaultOptions={width:800,height:600,resolution:I.RESOLUTION,autoDensity:!1},Ss.extension={type:[P.RendererSystem,P.CanvasRendererSystem],name:"_view"},O.add(Ss),I.PREFER_ENV=ge.WEBGL2,I.STRICT_TEXTURE_CACHE=!1,I.RENDER_OPTIONS=yt(yt(yt(yt({},Ts.defaultOptions),bs.defaultOptions),Ss.defaultOptions),ws.defaultOptions),Object.defineProperties(I,{WRAP_MODE:{get(){return X.defaultOptions.wrapMode},set(e){V("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),X.defaultOptions.wrapMode=e}},SCALE_MODE:{get(){return X.defaultOptions.scaleMode},set(e){V("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),X.defaultOptions.scaleMode=e}},MIPMAP_TEXTURES:{get(){return X.defaultOptions.mipmap},set(e){V("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),X.defaultOptions.mipmap=e}},ANISOTROPIC_LEVEL:{get(){return X.defaultOptions.anisotropicLevel},set(e){V("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),X.defaultOptions.anisotropicLevel=e}},FILTER_RESOLUTION:{get(){return V("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),_t.defaultResolution},set(e){_t.defaultResolution=e}},FILTER_MULTISAMPLE:{get(){return V("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),_t.defaultMultisample},set(e){_t.defaultMultisample=e}},SPRITE_MAX_TEXTURES:{get(){return Ft.defaultMaxTextures},set(e){V("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Ft.defaultMaxTextures=e}},SPRITE_BATCH_SIZE:{get(){return Ft.defaultBatchSize},set(e){V("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Ft.defaultBatchSize=e}},CAN_UPLOAD_SAME_BUFFER:{get(){return Ft.canUploadSameBuffer},set(e){V("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Ft.canUploadSameBuffer=e}},GC_MODE:{get(){return Lt.defaultMode},set(e){V("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Lt.defaultMode=e}},GC_MAX_IDLE:{get(){return Lt.defaultMaxIdle},set(e){V("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Lt.defaultMaxIdle=e}},GC_MAX_CHECK_COUNT:{get(){return Lt.defaultCheckCountMax},set(e){V("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Lt.defaultCheckCountMax=e}},PRECISION_VERTEX:{get(){return Nt.defaultVertexPrecision},set(e){V("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),Nt.defaultVertexPrecision=e}},PRECISION_FRAGMENT:{get(){return Nt.defaultFragmentPrecision},set(e){V("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),Nt.defaultFragmentPrecision=e}}});var ue=(e=>(e[e.INTERACTION=50]="INTERACTION",e[e.HIGH=25]="HIGH",e[e.NORMAL=0]="NORMAL",e[e.LOW=-25]="LOW",e[e.UTILITY=-50]="UTILITY",e))(ue||{});class nn{constructor(t,s=null,i=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=s,this.priority=i,this.once=r}match(t,s=null){return this.fn===t&&this.context===s}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const s=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),s}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const s=this.next;return this.next=t?null:s,this.previous=null,s}}const Pt=class{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new nn(null,null,1/0),this.deltaMS=1/Pt.targetFPMS,this.elapsedMS=1/Pt.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(e,t,s=ue.NORMAL){return this._addListener(new nn(e,t,s))}addOnce(e,t,s=ue.NORMAL){return this._addListener(new nn(e,t,s,!0))}_addListener(e){let t=this._head.next,s=this._head;if(!t)e.connect(s);else{for(;t;){if(e.priority>t.priority){e.connect(s);break}s=t,t=t.next}e.previous||e.connect(s)}return this._startIfPossible(),this}remove(e,t){let s=this._head.next;for(;s;)s.match(e,t)?s=s.destroy():s=s.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,t=this._head;for(;t=t.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){const r=e-this._lastFrame|0;if(r<this._minElapsedMS)return;this._lastFrame=e-r%this._minElapsedMS}this.deltaMS=t,this.deltaTime=this.deltaMS*Pt.targetFPMS;const s=this._head;let i=s.next;for(;i;)i=i.emit(this.deltaTime);s.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const t=Math.min(this.maxFPS,e),s=Math.min(Math.max(0,t)/1e3,Pt.targetFPMS);this._maxElapsedMS=1/s}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){if(e===0)this._minElapsedMS=0;else{const t=Math.max(this.minFPS,e);this._minElapsedMS=1/(t/1e3)}}static get shared(){if(!Pt._shared){const e=Pt._shared=new Pt;e.autoStart=!0,e._protected=!0}return Pt._shared}static get system(){if(!Pt._system){const e=Pt._system=new Pt;e.autoStart=!0,e._protected=!0}return Pt._system}};let at=Pt;at.targetFPMS=.06,Object.defineProperties(I,{TARGET_FPMS:{get(){return at.targetFPMS},set(e){V("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),at.targetFPMS=e}}});class on{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(s){this._ticker&&this._ticker.remove(this.render,this),this._ticker=s,s&&s.add(this.render,this,ue.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?at.shared:new at,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}on.extension=P.Application,O.add(on);const Sa=[];O.handleByList(P.Renderer,Sa);function Aa(e){for(const t of Sa)if(t.test(e))return new t(e);throw new Error("Unable to auto-detect a suitable renderer.")}var qc=`attribute vec2 aVertexPosition;
493
493
  attribute vec2 aTextureCoord;
494
494
 
495
495
  uniform mat3 projectionMatrix;
@@ -526,7 +526,7 @@ void main(void)
526
526
  gl_Position = filterVertexPosition();
527
527
  vTextureCoord = filterTextureCoord();
528
528
  }
529
- `;const Ca=qc,an=Kc;class hn{constructor(t){this.renderer=t}contextChange(t){let s;if(this.renderer.context.webGLVersion===1){const i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),s=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{const i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),s=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}s>=it.HIGH?this.multisample=it.HIGH:s>=it.MEDIUM?this.multisample=it.MEDIUM:s>=it.LOW?this.multisample=it.LOW:this.multisample=it.NONE}destroy(){}}hn.extension={type:P.RendererSystem,name:"_multisample"},O.add(hn);class Zc{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class ln{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:s,CONTEXT_UID:i}=this,r=t._glBuffers[i]||this.createGLBuffer(t);s.bindBuffer(t.type,r.buffer)}unbind(t){const{gl:s}=this;s.bindBuffer(t,null)}bindBufferBase(t,s){const{gl:i,CONTEXT_UID:r}=this;if(this.boundBufferBases[s]!==t){const n=t._glBuffers[r]||this.createGLBuffer(t);this.boundBufferBases[s]=t,i.bindBufferBase(i.UNIFORM_BUFFER,s,n.buffer)}}bindBufferRange(t,s,i){const{gl:r,CONTEXT_UID:n}=this;i=i||0;const o=t._glBuffers[n]||this.createGLBuffer(t);r.bindBufferRange(r.UNIFORM_BUFFER,s||0,o.buffer,i*256,256)}update(t){const{gl:s,CONTEXT_UID:i}=this,r=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==r.updateID)if(r.updateID=t._updateID,s.bindBuffer(t.type,r.buffer),r.byteLength>=t.data.byteLength)s.bufferSubData(t.type,0,t.data);else{const n=t.static?s.STATIC_DRAW:s.DYNAMIC_DRAW;r.byteLength=t.data.byteLength,s.bufferData(t.type,t.data,n)}}dispose(t,s){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const i=t._glBuffers[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this),i&&(s||r.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const s=Object.keys(this.managedBuffers);for(let i=0;i<s.length;i++)this.dispose(this.managedBuffers[s[i]],t)}createGLBuffer(t){const{CONTEXT_UID:s,gl:i}=this;return t._glBuffers[s]=new Zc(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[s]}}ln.extension={type:P.RendererSystem,name:"buffer"},O.add(ln);class cn{constructor(t){this.renderer=t}render(t,s){const i=this.renderer;let r,n,o,a;if(s&&(r=s.renderTexture,n=s.clear,o=s.transform,a=s.skipUpdateTransform),this.renderingToScreen=!r,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=o,!i.context.isLost){if(r||(this.lastObjectRendered=t),!a){const h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}i.renderTexture.bind(r),i.batch.currentRenderer.start(),(n!=null?n:i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),r&&(s.blit&&i.framebuffer.blit(),r.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}cn.extension={type:P.RendererSystem,name:"objectRenderer"},O.add(cn);const un=class extends wa{constructor(e){super(),this.type=er.WEBGL,e=Object.assign({},I.RENDER_OPTIONS,e),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new kt({projectionMatrix:new Q},!0);const t={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:un.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(t),"useContextAlpha"in e&&(V("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),e.premultipliedAlpha=e.useContextAlpha&&e.useContextAlpha!=="notMultiplied",e.backgroundAlpha=e.useContextAlpha===!1?1:e.backgroundAlpha),this._plugin.rendererPlugins=un.__plugins,this.options=e,this.startup.run(this.options)}static test(e){return e!=null&&e.forceCanvas?!1:bo()}render(e,t){this.objectRenderer.render(e,t)}resize(e,t){this._view.resizeView(e,t)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(e=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:e}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(e){this._view.resolution=e,this.runners.resolutionChange.emit(e)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return V("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return V("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return V("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return V("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(e){V("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=e}get backgroundAlpha(){return V("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(e){V("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=e}get powerPreference(){return V("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(e,t){return this.textureGenerator.generateTexture(e,t)}};let Be=un;Be.extension={type:P.Renderer,priority:1},Be.__plugins={},Be.__systems={},O.handleByMap(P.RendererPlugin,Be.__plugins),O.handleByMap(P.RendererSystem,Be.__systems),O.add(Be);class dn extends ze{constructor(t,s){const{width:i,height:r}=s||{};super(i,r),this.items=[],this.itemDirtyIds=[];for(let n=0;n<t;n++){const o=new X;this.items.push(o),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,s){for(let i=0;i<this.length;i++)!t[i]||(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof ze?this.addResourceAt(t[i],i):this.addResourceAt(Mr(t[i],s),i))}dispose(){for(let t=0,s=this.length;t<s;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,s){if(!this.items[s])throw new Error(`Index ${s} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[s].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let s=0;s<this.length;s++)this.items[s].parentTextureArray=t,this.items[s].on("update",t.update,t)}unbind(t){super.unbind(t);for(let s=0;s<this.length;s++)this.items[s].parentTextureArray=null,this.items[s].off("update",t.update,t)}load(){if(this._load)return this._load;const s=this.items.map(i=>i.resource).filter(i=>i).map(i=>i.load());return this._load=Promise.all(s).then(()=>{const{realWidth:i,realHeight:r}=this.items[0];return this.resize(i,r),Promise.resolve(this)}),this._load}}class Ra extends dn{constructor(t,s){const{width:i,height:r}=s||{};let n,o;Array.isArray(t)?(n=t,o=t.length):o=t,super(o,{width:i,height:r}),n&&this.initFromArray(n,s)}addBaseTextureAt(t,s){if(t.resource)this.addResourceAt(t.resource,s);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=Ee.TEXTURE_2D_ARRAY}upload(t,s,i){const{length:r,itemDirtyIds:n,items:o}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,r,0,s.format,i.type,null);for(let h=0;h<r;h++){const l=o[h];n[h]<l.dirtyId&&(n[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,s.format,i.type,l.resource.source))}return!0}}class Ia extends ce{constructor(t){super(t)}static test(t){const{OffscreenCanvas:s}=globalThis;return s&&t instanceof s?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const As=class extends dn{constructor(e,t){const{width:s,height:i,autoLoad:r,linkBaseTexture:n}=t||{};if(e&&e.length!==As.SIDES)throw new Error(`Invalid length. Got ${e.length}, expected 6`);super(6,{width:s,height:i});for(let o=0;o<As.SIDES;o++)this.items[o].target=Ee.TEXTURE_CUBE_MAP_POSITIVE_X+o;this.linkBaseTexture=n!==!1,e&&this.initFromArray(e,t),r!==!1&&this.load()}bind(e){super.bind(e),e.target=Ee.TEXTURE_CUBE_MAP}addBaseTextureAt(e,t,s){if(s===void 0&&(s=this.linkBaseTexture),!this.items[t])throw new Error(`Index ${t} is out of bounds`);if(!this.linkBaseTexture||e.parentTextureArray||Object.keys(e._glTextures).length>0)if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=Ee.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.parentTextureArray=this.baseTexture,this.items[t]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[t]=e,this}upload(e,t,s){const i=this.itemDirtyIds;for(let r=0;r<As.SIDES;r++){const n=this.items[r];(i[r]<n.dirtyId||s.dirtyId<t.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(e,n,s),i[r]=n.dirtyId):i[r]<-1&&(e.gl.texImage2D(n.target,0,s.internalFormat,t.realWidth,t.realHeight,0,t.format,s.type,null),i[r]=-1))}return!0}static test(e){return Array.isArray(e)&&e.length===As.SIDES}};let fn=As;fn.SIDES=6;class Ue extends ce{constructor(t,s){var n;s=s||{};let i,r;typeof t=="string"?(i=Ue.EMPTY,r=t):(i=t,r=null),super(i),this.url=r,this.crossOrigin=(n=s.crossOrigin)!=null?n:!0,this.alphaMode=typeof s.alphaMode=="number"?s.alphaMode:null,this._load=null,s.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,s)=>{if(this.url===null){t(this);return}try{const i=await I.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const r=await i.blob();if(this.destroyed)return;const n=await createImageBitmap(r,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Mt.UNPACK?"premultiply":"none"});if(this.destroyed)return;this.source=n,this.update(),t(this)}catch(i){if(this.destroyed)return;s(i),this.onError.emit(i)}}),this._load)}upload(t,s,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(s.alphaMode=this.alphaMode),super.upload(t,s,i)):(this.load(),!1)}dispose(){this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap!="undefined"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){var t;return Ue._EMPTY=(t=Ue._EMPTY)!=null?t:I.ADAPTER.createCanvas(0,0),Ue._EMPTY}}const Ri=class extends ce{constructor(e,t){t=t||{},super(I.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=e,this.scale=t.scale||1,this._overrideWidth=t.width,this._overrideHeight=t.height,this._resolve=null,this._crossorigin=t.crossorigin,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(e=>{if(this._resolve=()=>{this.resize(this.source.width,this.source.height),e(this)},Ri.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){const e=new Image;ce.crossOrigin(e,this.svg,this._crossorigin),e.src=this.svg,e.onerror=t=>{!this._resolve||(e.onerror=null,this.onError.emit(t))},e.onload=()=>{if(!this._resolve)return;const t=e.width,s=e.height;if(!t||!s)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let i=t*this.scale,r=s*this.scale;(this._overrideWidth||this._overrideHeight)&&(i=this._overrideWidth||this._overrideHeight/s*t,r=this._overrideHeight||this._overrideWidth/t*s),i=Math.round(i),r=Math.round(r);const n=this.source;n.width=i,n.height=r,n._pixiId=`canvas_${xe()}`,n.getContext("2d").drawImage(e,0,0,t,s,0,0,i,r),this._resolve(),this._resolve=null}}static getSize(e){const t=Ri.SVG_SIZE.exec(e),s={};return t&&(s[t[1]]=Math.round(parseFloat(t[3])),s[t[5]]=Math.round(parseFloat(t[7]))),s}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(e,t){return t==="svg"||typeof e=="string"&&e.startsWith("data:image/svg+xml")||typeof e=="string"&&Ri.SVG_XML.test(e)}};let qe=Ri;qe.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,qe.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;const pn=class extends ce{constructor(e,t){if(t=t||{},!(e instanceof HTMLVideoElement)){const s=document.createElement("video");s.setAttribute("preload","auto"),s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline",""),typeof e=="string"&&(e=[e]);const i=e[0].src||e[0];ce.crossOrigin(s,i,t.crossorigin);for(let r=0;r<e.length;++r){const n=document.createElement("source");let{src:o,mime:a}=e[r];o=o||e[r];const h=o.split("?").shift().toLowerCase(),l=h.slice(h.lastIndexOf(".")+1);a=a||pn.MIME_TYPES[l]||`video/${l}`,n.src=o,n.type=a,s.appendChild(n)}e=s}super(e),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this._load=null,this._resolve=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),t.autoLoad!==!1&&this.load()}update(e=0){if(!this.destroyed){const t=at.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t),(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}load(){if(this._load)return this._load;const e=this.source;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart.bind(this)),e.addEventListener("pause",this._onPlayStop.bind(this)),this._isSourceReady()?this._onCanPlay():(e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlay),e.addEventListener("error",this._onError,!0)),this._load=new Promise(t=>{this.valid?t(this):(this._resolve=t,e.load())}),this._load}_onError(e){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(e)}_isSourcePlaying(){const e=this.source;return!e.paused&&!e.ended&&this._isSourceReady()}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(at.shared.add(this.update,this),this._isConnectedToTicker=!0)}_onPlayStop(){this._isConnectedToTicker&&(at.shared.remove(this.update,this),this._isConnectedToTicker=!1)}_onCanPlay(){const e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);const t=this.valid;this.resize(e.videoWidth,e.videoHeight),!t&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()}dispose(){this._isConnectedToTicker&&(at.shared.remove(this.update,this),this._isConnectedToTicker=!1);const e=this.source;e&&(e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(at.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(at.shared.add(this.update,this),this._isConnectedToTicker=!0))}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e)}static test(e,t){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||pn.TYPES.includes(t)}};let Ii=pn;Ii.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Ii.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},di.push(Ue,Or,Ia,Ii,qe,We,fn,Ra);class Jc{constructor(){this._glTransformFeedbacks={},this.buffers=[],this.disposeRunner=new It("disposeTransformFeedback")}bindBuffer(t,s){this.buffers[t]=s}destroy(){this.disposeRunner.emit(this,!1)}}const Qc="7.2.0";class Cs{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(t){return this.minX>this.maxX||this.minY>this.maxY?W.EMPTY:(t=t||new W(0,0,1,1),t.x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)}addPointMatrix(t,s){const{a:i,b:r,c:n,d:o,tx:a,ty:h}=t,l=i*s.x+n*s.y+a,c=r*s.x+o*s.y+h;this.minX=Math.min(this.minX,l),this.maxX=Math.max(this.maxX,l),this.minY=Math.min(this.minY,c),this.maxY=Math.max(this.maxY,c)}addQuad(t){let s=this.minX,i=this.minY,r=this.maxX,n=this.maxY,o=t[0],a=t[1];s=o<s?o:s,i=a<i?a:i,r=o>r?o:r,n=a>n?a:n,o=t[2],a=t[3],s=o<s?o:s,i=a<i?a:i,r=o>r?o:r,n=a>n?a:n,o=t[4],a=t[5],s=o<s?o:s,i=a<i?a:i,r=o>r?o:r,n=a>n?a:n,o=t[6],a=t[7],s=o<s?o:s,i=a<i?a:i,r=o>r?o:r,n=a>n?a:n,this.minX=s,this.minY=i,this.maxX=r,this.maxY=n}addFrame(t,s,i,r,n){this.addFrameMatrix(t.worldTransform,s,i,r,n)}addFrameMatrix(t,s,i,r,n){const o=t.a,a=t.b,h=t.c,l=t.d,c=t.tx,u=t.ty;let d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,_=o*s+h*i+c,x=a*s+l*i+u;d=_<d?_:d,f=x<f?x:f,p=_>p?_:p,m=x>m?x:m,_=o*r+h*i+c,x=a*r+l*i+u,d=_<d?_:d,f=x<f?x:f,p=_>p?_:p,m=x>m?x:m,_=o*s+h*n+c,x=a*s+l*n+u,d=_<d?_:d,f=x<f?x:f,p=_>p?_:p,m=x>m?x:m,_=o*r+h*n+c,x=a*r+l*n+u,d=_<d?_:d,f=x<f?x:f,p=_>p?_:p,m=x>m?x:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(t,s,i){let r=this.minX,n=this.minY,o=this.maxX,a=this.maxY;for(let h=s;h<i;h+=2){const l=t[h],c=t[h+1];r=l<r?l:r,n=c<n?c:n,o=l>o?l:o,a=c>a?c:a}this.minX=r,this.minY=n,this.maxX=o,this.maxY=a}addVertices(t,s,i,r){this.addVerticesMatrix(t.worldTransform,s,i,r)}addVerticesMatrix(t,s,i,r,n=0,o=n){const a=t.a,h=t.b,l=t.c,c=t.d,u=t.tx,d=t.ty;let f=this.minX,p=this.minY,m=this.maxX,_=this.maxY;for(let x=i;x<r;x+=2){const v=s[x],g=s[x+1],y=a*v+l*g+u,S=c*g+h*v+d;f=Math.min(f,y-n),m=Math.max(m,y+n),p=Math.min(p,S-o),_=Math.max(_,S+o)}this.minX=f,this.minY=p,this.maxX=m,this.maxY=_}addBounds(t){const s=this.minX,i=this.minY,r=this.maxX,n=this.maxY;this.minX=t.minX<s?t.minX:s,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>r?t.maxX:r,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,s){const i=t.minX>s.minX?t.minX:s.minX,r=t.minY>s.minY?t.minY:s.minY,n=t.maxX<s.maxX?t.maxX:s.maxX,o=t.maxY<s.maxY?t.maxY:s.maxY;if(i<=n&&r<=o){const a=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=i<a?i:a,this.minY=r<h?r:h,this.maxX=n>l?n:l,this.maxY=o>c?o:c}}addBoundsMatrix(t,s){this.addFrameMatrix(s,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,s){const i=t.minX>s.x?t.minX:s.x,r=t.minY>s.y?t.minY:s.y,n=t.maxX<s.x+s.width?t.maxX:s.x+s.width,o=t.maxY<s.y+s.height?t.maxY:s.y+s.height;if(i<=n&&r<=o){const a=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=i<a?i:a,this.minY=r<h?r:h,this.maxX=n>l?n:l,this.maxY=o>c?o:c}}pad(t=0,s=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=s,this.maxY+=s)}addFramePad(t,s,i,r,n,o){t-=n,s-=o,i+=n,r+=o,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<s?this.minY:s,this.maxY=this.maxY>r?this.maxY:r}}class st extends Ge{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new gs,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new Cs,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const s=Object.keys(t);for(let i=0;i<s.length;++i){const r=s[i];Object.defineProperty(st.prototype,r,Object.getOwnPropertyDescriptor(t,r))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(t,s){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),s||(this._boundsRect||(this._boundsRect=new W),s=this._boundsRect),this._bounds.getRectangle(s)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new W),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Cs);const s=this.transform,i=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;const r=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const o=this.getBounds(!1,t);return this.parent=i,this.transform=s,this._bounds=r,this._bounds.updateID+=this._boundsID-n,o}toGlobal(t,s,i=!1){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,s)}toLocal(t,s,i,r){return s&&(t=s.toGlobal(t,i,r)),r||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,i)}setParent(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){var t;(t=this.parent)==null||t.removeChild(this)}setTransform(t=0,s=0,i=1,r=1,n=0,o=0,a=0,h=0,l=0){return this.position.x=t,this.position.y=s,this.scale.x=i||1,this.scale.y=r||1,this.rotation=n,this.skew.x=o,this.skew.y=a,this.pivot.x=h,this.pivot.y=l,this}destroy(t){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new Pa),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*$o}set angle(t){this.transform.rotation=t*jo}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex=t,this.parent&&(this.parent.sortDirty=!0)}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){const s=this._mask.isMaskData?this._mask.maskObject:this._mask;s&&(s._maskRefCount--,s._maskRefCount===0&&(s.renderable=!0,s.isMask=!1))}if(this._mask=t,this._mask){const s=this._mask.isMaskData?this._mask.maskObject:this._mask;s&&(s._maskRefCount===0&&(s.renderable=!1,s.isMask=!0),s._maskRefCount++)}}}}class Pa extends st{constructor(){super(...arguments),this.sortDirty=null}}st.prototype.displayObjectUpdateTransform=st.prototype.updateTransform;const tu=new Q;function eu(e,t){return e.zIndex===t.zIndex?e._lastSortedIndex-t._lastSortedIndex:e.zIndex-t.zIndex}const mn=class extends st{constructor(){super(),this.children=[],this.sortableChildren=mn.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(e){}addChild(...e){if(e.length>1)for(let t=0;t<e.length;t++)this.addChild(e[t]);else{const t=e[0];t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.push(t),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",t,this,this.children.length-1),t.emit("added",this)}return e[0]}addChildAt(e,t){if(t<0||t>this.children.length)throw new Error(`${e}addChildAt: The index ${t} supplied is out of bounds ${this.children.length}`);return e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.splice(t,0,e),this._boundsID++,this.onChildrenChange(t),e.emit("added",this),this.emit("childAdded",e,this,t),e}swapChildren(e,t){if(e===t)return;const s=this.getChildIndex(e),i=this.getChildIndex(t);this.children[s]=t,this.children[i]=e,this.onChildrenChange(s<i?s:i)}getChildIndex(e){const t=this.children.indexOf(e);if(t===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return t}setChildIndex(e,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);const s=this.getChildIndex(e);Se(this.children,s,1),this.children.splice(t,0,e),this.onChildrenChange(t)}getChildAt(e){if(e<0||e>=this.children.length)throw new Error(`getChildAt: Index (${e}) does not exist.`);return this.children[e]}removeChild(...e){if(e.length>1)for(let t=0;t<e.length;t++)this.removeChild(e[t]);else{const t=e[0],s=this.children.indexOf(t);if(s===-1)return null;t.parent=null,t.transform._parentID=-1,Se(this.children,s,1),this._boundsID++,this.onChildrenChange(s),t.emit("removed",this),this.emit("childRemoved",t,this,s)}return e[0]}removeChildAt(e){const t=this.getChildAt(e);return t.parent=null,t.transform._parentID=-1,Se(this.children,e,1),this._boundsID++,this.onChildrenChange(e),t.emit("removed",this),this.emit("childRemoved",t,this,e),t}removeChildren(e=0,t=this.children.length){const s=e,i=t,r=i-s;let n;if(r>0&&r<=i){n=this.children.splice(s,r);for(let o=0;o<n.length;++o)n[o].parent=null,n[o].transform&&(n[o].transform._parentID=-1);this._boundsID++,this.onChildrenChange(e);for(let o=0;o<n.length;++o)n[o].emit("removed",this),this.emit("childRemoved",n[o],this,o);return n}else if(r===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let e=!1;for(let t=0,s=this.children.length;t<s;++t){const i=this.children[t];i._lastSortedIndex=t,!e&&i.zIndex!==0&&(e=!0)}e&&this.children.length>1&&this.children.sort(eu),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let e=0,t=this.children.length;e<t;++e){const s=this.children[e];s.visible&&s.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let e=0;e<this.children.length;e++){const t=this.children[e];if(!(!t.visible||!t.renderable))if(t.calculateBounds(),t._mask){const s=t._mask.isMaskData?t._mask.maskObject:t._mask;s?(s.calculateBounds(),this._bounds.addBoundsMask(t._bounds,s._bounds)):this._bounds.addBounds(t._bounds)}else t.filterArea?this._bounds.addBoundsArea(t._bounds,t.filterArea):this._bounds.addBounds(t._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(e,t=!1){const s=super.getLocalBounds(e);if(!t)for(let i=0,r=this.children.length;i<r;++i){const n=this.children[i];n.visible&&n.updateTransform()}return s}_calculateBounds(){}_renderWithCulling(e){const t=e.renderTexture.sourceFrame;if(!(t.width>0&&t.height>0))return;let s,i;this.cullArea?(s=this.cullArea,i=this.worldTransform):this._render!==mn.prototype._render&&(s=this.getBounds(!0));const r=e.projection.transform;if(r&&(i?(i=tu.copyFrom(i),i.prepend(r)):i=r),s&&t.intersects(s,i))this._render(e);else if(this.cullArea)return;for(let n=0,o=this.children.length;n<o;++n){const a=this.children[n],h=a.cullable;a.cullable=h||!this.cullArea,a.render(e),a.cullable=h}}render(e){var t;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||((t=this.filters)==null?void 0:t.length))this.renderAdvanced(e);else if(this.cullable)this._renderWithCulling(e);else{this._render(e);for(let s=0,i=this.children.length;s<i;++s)this.children[s].render(e)}}renderAdvanced(e){var r,n,o;const t=this.filters,s=this._mask;if(t){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let a=0;a<t.length;a++)t[a].enabled&&this._enabledFilters.push(t[a])}const i=t&&((r=this._enabledFilters)==null?void 0:r.length)||s&&(!s.isMaskData||s.enabled&&(s.autoDetect||s.type!==ct.NONE));if(i&&e.batch.flush(),t&&((n=this._enabledFilters)==null?void 0:n.length)&&e.filter.push(this,this._enabledFilters),s&&e.mask.push(this,this._mask),this.cullable)this._renderWithCulling(e);else{this._render(e);for(let a=0,h=this.children.length;a<h;++a)this.children[a].render(e)}i&&e.batch.flush(),s&&e.mask.pop(this),t&&((o=this._enabledFilters)==null?void 0:o.length)&&e.filter.pop()}_render(e){}destroy(e){super.destroy(),this.sortDirty=!1;const t=typeof e=="boolean"?e:e==null?void 0:e.children,s=this.removeChildren(0,this.children.length);if(t)for(let i=0;i<s.length;++i)s[i].destroy(e)}get width(){return this.scale.x*this.getLocalBounds().width}set width(e){const t=this.getLocalBounds().width;t!==0?this.scale.x=e/t:this.scale.x=1,this._width=e}get height(){return this.scale.y*this.getLocalBounds().height}set height(e){const t=this.getLocalBounds().height;t!==0?this.scale.y=e/t:this.scale.y=1,this._height=e}};let wt=mn;wt.defaultSortableChildren=!1,wt.prototype.containerUpdateTransform=wt.prototype.updateTransform,Object.defineProperties(I,{SORTABLE_CHILDREN:{get(){return wt.defaultSortableChildren},set(e){V("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),wt.defaultSortableChildren=e}}});const Rs=new Y,su=new Uint16Array([0,1,2,0,2,3]);class me extends wt{constructor(t){super(),this._anchor=new fe(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new j(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=k.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||M.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=su,this.pluginName="batch",this.isSprite=!0,this._roundPixels=I.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=he(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=he(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const t=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===t._updateID)return;this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;const s=this.transform.worldTransform,i=s.a,r=s.b,n=s.c,o=s.d,a=s.tx,h=s.ty,l=this.vertexData,c=t.trim,u=t.orig,d=this._anchor;let f=0,p=0,m=0,_=0;if(c?(p=c.x-d._x*u.width,f=p+c.width,_=c.y-d._y*u.height,m=_+c.height):(p=-d._x*u.width,f=p+u.width,_=-d._y*u.height,m=_+u.height),l[0]=i*p+n*_+a,l[1]=o*_+r*p+h,l[2]=i*f+n*_+a,l[3]=o*_+r*f+h,l[4]=i*f+n*m+a,l[5]=o*m+r*f+h,l[6]=i*p+n*m+a,l[7]=o*m+r*p+h,this._roundPixels){const x=I.RESOLUTION;for(let v=0;v<l.length;++v)l[v]=Math.round(l[v]*x)/x}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,s=this.vertexTrimmedData,i=t.orig,r=this._anchor,n=this.transform.worldTransform,o=n.a,a=n.b,h=n.c,l=n.d,c=n.tx,u=n.ty,d=-r._x*i.width,f=d+i.width,p=-r._y*i.height,m=p+i.height;s[0]=o*d+h*p+c,s[1]=l*p+a*d+u,s[2]=o*f+h*p+c,s[3]=l*p+a*f+u,s[4]=o*f+h*m+c,s[5]=l*m+a*f+u,s[6]=o*d+h*m+c,s[7]=l*m+a*d+u}_render(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)}_calculateBounds(){const t=this._texture.trim,s=this._texture.orig;!t||t.width===s.width&&t.height===s.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(t){return this.children.length===0?(this._localBounds||(this._localBounds=new Cs),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new W),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,Rs);const s=this._texture.orig.width,i=this._texture.orig.height,r=-s*this.anchor.x;let n=0;return Rs.x>=r&&Rs.x<r+s&&(n=-i*this.anchor.y,Rs.y>=n&&Rs.y<n+i)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const i=typeof t=="boolean"?t:t==null?void 0:t.baseTexture;this._texture.destroy(!!i)}this._texture=null}static from(t,s){const i=t instanceof M?t:M.from(t,s);return new me(i)}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){const s=he(this.scale.x)||1;this.scale.x=s*t/this._texture.orig.width,this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){const s=he(this.scale.y)||1;this.scale.y=s*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||M.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const Ma=new Q;st.prototype._cacheAsBitmap=!1,st.prototype._cacheData=null,st.prototype._cacheAsBitmapResolution=null,st.prototype._cacheAsBitmapMultisample=null;class iu{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(st.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(e){e!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=e,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(e){e!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=e,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(e){if(this._cacheAsBitmap===e)return;this._cacheAsBitmap=e;let t;e?(this._cacheData||(this._cacheData=new iu),t=this._cacheData,t.originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(t=this._cacheData,t.sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea)}}}),st.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},st.prototype._initCachedDisplayObject=function(t){var d,f,p;if((d=this._cacheData)!=null&&d.sprite)return;const s=this.alpha;this.alpha=1,t.batch.flush();const i=this.getLocalBounds(null,!0).clone();if((f=this.filters)!=null&&f.length){const m=this.filters[0].padding;i.pad(m)}i.ceil(I.RESOLUTION);const r=t.renderTexture.current,n=t.renderTexture.sourceFrame.clone(),o=t.renderTexture.destinationFrame.clone(),a=t.projection.transform,h=pe.create({width:i.width,height:i.height,resolution:this.cacheAsBitmapResolution||t.resolution,multisample:(p=this.cacheAsBitmapMultisample)!=null?p:t.multisample}),l=`cacheAsBitmap_${xe()}`;this._cacheData.textureCacheId=l,X.addToCache(h.baseTexture,l),M.addToCache(h,l);const c=this.transform.localTransform.copyTo(Ma).invert().translate(-i.x,-i.y);this.render=this._cacheData.originalRender,t.render(this,{renderTexture:h,clear:!0,transform:c,skipUpdateTransform:!1}),t.framebuffer.blit(),t.projection.transform=a,t.renderTexture.bind(r,n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=s;const u=new me(h);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(i.x/i.width),u.anchor.y=-(i.y/i.height),u.alpha=s,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=u.containsPoint.bind(u)},st.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},st.prototype._initCachedDisplayObjectCanvas=function(t){var c;if((c=this._cacheData)!=null&&c.sprite)return;const s=this.getLocalBounds(null,!0),i=this.alpha;this.alpha=1;const r=t.canvasContext.activeContext,n=t._projTransform;s.ceil(I.RESOLUTION);const o=pe.create({width:s.width,height:s.height}),a=`cacheAsBitmap_${xe()}`;this._cacheData.textureCacheId=a,X.addToCache(o.baseTexture,a),M.addToCache(o,a);const h=Ma;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=s.x,h.ty-=s.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,{renderTexture:o,clear:!0,transform:h,skipUpdateTransform:!1}),t.canvasContext.activeContext=r,t._projTransform=n,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=i;const l=new me(o);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(s.x/s.width),l.anchor.y=-(s.y/s.height),l.alpha=i,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)},st.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},st.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},st.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,X.removeFromCache(this._cacheData.textureCacheId),M.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},st.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},st.prototype.name=null,wt.prototype.getChildByName=function(t,s){for(let i=0,r=this.children.length;i<r;i++)if(this.children[i].name===t)return this.children[i];if(s)for(let i=0,r=this.children.length;i<r;i++){const n=this.children[i];if(!n.getChildByName)continue;const o=n.getChildByName(t,!0);if(o)return o}return null},st.prototype.getGlobalPosition=function(t=new Y,s=!1){return this.parent?this.parent.toGlobal(this.position,t,s):(t.x=this.position.x,t.y=this.position.y),t};var ru=`varying vec2 vTextureCoord;
529
+ `;const Ca=qc,an=Kc;class hn{constructor(t){this.renderer=t}contextChange(t){let s;if(this.renderer.context.webGLVersion===1){const i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),s=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{const i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),s=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}s>=it.HIGH?this.multisample=it.HIGH:s>=it.MEDIUM?this.multisample=it.MEDIUM:s>=it.LOW?this.multisample=it.LOW:this.multisample=it.NONE}destroy(){}}hn.extension={type:P.RendererSystem,name:"_multisample"},O.add(hn);class Zc{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class ln{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:s,CONTEXT_UID:i}=this,r=t._glBuffers[i]||this.createGLBuffer(t);s.bindBuffer(t.type,r.buffer)}unbind(t){const{gl:s}=this;s.bindBuffer(t,null)}bindBufferBase(t,s){const{gl:i,CONTEXT_UID:r}=this;if(this.boundBufferBases[s]!==t){const n=t._glBuffers[r]||this.createGLBuffer(t);this.boundBufferBases[s]=t,i.bindBufferBase(i.UNIFORM_BUFFER,s,n.buffer)}}bindBufferRange(t,s,i){const{gl:r,CONTEXT_UID:n}=this;i=i||0;const o=t._glBuffers[n]||this.createGLBuffer(t);r.bindBufferRange(r.UNIFORM_BUFFER,s||0,o.buffer,i*256,256)}update(t){const{gl:s,CONTEXT_UID:i}=this,r=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==r.updateID)if(r.updateID=t._updateID,s.bindBuffer(t.type,r.buffer),r.byteLength>=t.data.byteLength)s.bufferSubData(t.type,0,t.data);else{const n=t.static?s.STATIC_DRAW:s.DYNAMIC_DRAW;r.byteLength=t.data.byteLength,s.bufferData(t.type,t.data,n)}}dispose(t,s){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const i=t._glBuffers[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this),i&&(s||r.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const s=Object.keys(this.managedBuffers);for(let i=0;i<s.length;i++)this.dispose(this.managedBuffers[s[i]],t)}createGLBuffer(t){const{CONTEXT_UID:s,gl:i}=this;return t._glBuffers[s]=new Zc(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[s]}}ln.extension={type:P.RendererSystem,name:"buffer"},O.add(ln);class cn{constructor(t){this.renderer=t}render(t,s){const i=this.renderer;let r,n,o,a;if(s&&(r=s.renderTexture,n=s.clear,o=s.transform,a=s.skipUpdateTransform),this.renderingToScreen=!r,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=o,!i.context.isLost){if(r||(this.lastObjectRendered=t),!a){const h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}i.renderTexture.bind(r),i.batch.currentRenderer.start(),(n!=null?n:i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),r&&(s.blit&&i.framebuffer.blit(),r.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}cn.extension={type:P.RendererSystem,name:"objectRenderer"},O.add(cn);const un=class extends wa{constructor(e){super(),this.type=er.WEBGL,e=Object.assign({},I.RENDER_OPTIONS,e),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new kt({projectionMatrix:new Q},!0);const t={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:un.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(t),"useContextAlpha"in e&&(V("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),e.premultipliedAlpha=e.useContextAlpha&&e.useContextAlpha!=="notMultiplied",e.backgroundAlpha=e.useContextAlpha===!1?1:e.backgroundAlpha),this._plugin.rendererPlugins=un.__plugins,this.options=e,this.startup.run(this.options)}static test(e){return e!=null&&e.forceCanvas?!1:bo()}render(e,t){this.objectRenderer.render(e,t)}resize(e,t){this._view.resizeView(e,t)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(e=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:e}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(e){this._view.resolution=e,this.runners.resolutionChange.emit(e)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return V("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return V("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return V("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return V("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(e){V("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=e}get backgroundAlpha(){return V("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(e){V("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=e}get powerPreference(){return V("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(e,t){return this.textureGenerator.generateTexture(e,t)}};let Be=un;Be.extension={type:P.Renderer,priority:1},Be.__plugins={},Be.__systems={},O.handleByMap(P.RendererPlugin,Be.__plugins),O.handleByMap(P.RendererSystem,Be.__systems),O.add(Be);class dn extends ze{constructor(t,s){const{width:i,height:r}=s||{};super(i,r),this.items=[],this.itemDirtyIds=[];for(let n=0;n<t;n++){const o=new X;this.items.push(o),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,s){for(let i=0;i<this.length;i++)!t[i]||(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof ze?this.addResourceAt(t[i],i):this.addResourceAt(Mr(t[i],s),i))}dispose(){for(let t=0,s=this.length;t<s;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,s){if(!this.items[s])throw new Error(`Index ${s} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[s].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let s=0;s<this.length;s++)this.items[s].parentTextureArray=t,this.items[s].on("update",t.update,t)}unbind(t){super.unbind(t);for(let s=0;s<this.length;s++)this.items[s].parentTextureArray=null,this.items[s].off("update",t.update,t)}load(){if(this._load)return this._load;const s=this.items.map(i=>i.resource).filter(i=>i).map(i=>i.load());return this._load=Promise.all(s).then(()=>{const{realWidth:i,realHeight:r}=this.items[0];return this.resize(i,r),Promise.resolve(this)}),this._load}}class Ra extends dn{constructor(t,s){const{width:i,height:r}=s||{};let n,o;Array.isArray(t)?(n=t,o=t.length):o=t,super(o,{width:i,height:r}),n&&this.initFromArray(n,s)}addBaseTextureAt(t,s){if(t.resource)this.addResourceAt(t.resource,s);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=Ee.TEXTURE_2D_ARRAY}upload(t,s,i){const{length:r,itemDirtyIds:n,items:o}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,r,0,s.format,i.type,null);for(let h=0;h<r;h++){const l=o[h];n[h]<l.dirtyId&&(n[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,s.format,i.type,l.resource.source))}return!0}}class Ia extends ce{constructor(t){super(t)}static test(t){const{OffscreenCanvas:s}=globalThis;return s&&t instanceof s?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const As=class extends dn{constructor(e,t){const{width:s,height:i,autoLoad:r,linkBaseTexture:n}=t||{};if(e&&e.length!==As.SIDES)throw new Error(`Invalid length. Got ${e.length}, expected 6`);super(6,{width:s,height:i});for(let o=0;o<As.SIDES;o++)this.items[o].target=Ee.TEXTURE_CUBE_MAP_POSITIVE_X+o;this.linkBaseTexture=n!==!1,e&&this.initFromArray(e,t),r!==!1&&this.load()}bind(e){super.bind(e),e.target=Ee.TEXTURE_CUBE_MAP}addBaseTextureAt(e,t,s){if(s===void 0&&(s=this.linkBaseTexture),!this.items[t])throw new Error(`Index ${t} is out of bounds`);if(!this.linkBaseTexture||e.parentTextureArray||Object.keys(e._glTextures).length>0)if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=Ee.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.parentTextureArray=this.baseTexture,this.items[t]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[t]=e,this}upload(e,t,s){const i=this.itemDirtyIds;for(let r=0;r<As.SIDES;r++){const n=this.items[r];(i[r]<n.dirtyId||s.dirtyId<t.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(e,n,s),i[r]=n.dirtyId):i[r]<-1&&(e.gl.texImage2D(n.target,0,s.internalFormat,t.realWidth,t.realHeight,0,t.format,s.type,null),i[r]=-1))}return!0}static test(e){return Array.isArray(e)&&e.length===As.SIDES}};let fn=As;fn.SIDES=6;class Ue extends ce{constructor(t,s){var n;s=s||{};let i,r;typeof t=="string"?(i=Ue.EMPTY,r=t):(i=t,r=null),super(i),this.url=r,this.crossOrigin=(n=s.crossOrigin)!=null?n:!0,this.alphaMode=typeof s.alphaMode=="number"?s.alphaMode:null,this._load=null,s.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,s)=>{if(this.url===null){t(this);return}try{const i=await I.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const r=await i.blob();if(this.destroyed)return;const n=await createImageBitmap(r,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Mt.UNPACK?"premultiply":"none"});if(this.destroyed)return;this.source=n,this.update(),t(this)}catch(i){if(this.destroyed)return;s(i),this.onError.emit(i)}}),this._load)}upload(t,s,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(s.alphaMode=this.alphaMode),super.upload(t,s,i)):(this.load(),!1)}dispose(){this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap!="undefined"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){var t;return Ue._EMPTY=(t=Ue._EMPTY)!=null?t:I.ADAPTER.createCanvas(0,0),Ue._EMPTY}}const Ri=class extends ce{constructor(e,t){t=t||{},super(I.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=e,this.scale=t.scale||1,this._overrideWidth=t.width,this._overrideHeight=t.height,this._resolve=null,this._crossorigin=t.crossorigin,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(e=>{if(this._resolve=()=>{this.resize(this.source.width,this.source.height),e(this)},Ri.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){const e=new Image;ce.crossOrigin(e,this.svg,this._crossorigin),e.src=this.svg,e.onerror=t=>{!this._resolve||(e.onerror=null,this.onError.emit(t))},e.onload=()=>{if(!this._resolve)return;const t=e.width,s=e.height;if(!t||!s)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let i=t*this.scale,r=s*this.scale;(this._overrideWidth||this._overrideHeight)&&(i=this._overrideWidth||this._overrideHeight/s*t,r=this._overrideHeight||this._overrideWidth/t*s),i=Math.round(i),r=Math.round(r);const n=this.source;n.width=i,n.height=r,n._pixiId=`canvas_${xe()}`,n.getContext("2d").drawImage(e,0,0,t,s,0,0,i,r),this._resolve(),this._resolve=null}}static getSize(e){const t=Ri.SVG_SIZE.exec(e),s={};return t&&(s[t[1]]=Math.round(parseFloat(t[3])),s[t[5]]=Math.round(parseFloat(t[7]))),s}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(e,t){return t==="svg"||typeof e=="string"&&e.startsWith("data:image/svg+xml")||typeof e=="string"&&Ri.SVG_XML.test(e)}};let qe=Ri;qe.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,qe.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;const pn=class extends ce{constructor(e,t){if(t=t||{},!(e instanceof HTMLVideoElement)){const s=document.createElement("video");s.setAttribute("preload","auto"),s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline",""),typeof e=="string"&&(e=[e]);const i=e[0].src||e[0];ce.crossOrigin(s,i,t.crossorigin);for(let r=0;r<e.length;++r){const n=document.createElement("source");let{src:o,mime:a}=e[r];o=o||e[r];const h=o.split("?").shift().toLowerCase(),l=h.slice(h.lastIndexOf(".")+1);a=a||pn.MIME_TYPES[l]||`video/${l}`,n.src=o,n.type=a,s.appendChild(n)}e=s}super(e),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this._load=null,this._resolve=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),t.autoLoad!==!1&&this.load()}update(e=0){if(!this.destroyed){const t=at.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t),(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}load(){if(this._load)return this._load;const e=this.source;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart.bind(this)),e.addEventListener("pause",this._onPlayStop.bind(this)),this._isSourceReady()?this._onCanPlay():(e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlay),e.addEventListener("error",this._onError,!0)),this._load=new Promise(t=>{this.valid?t(this):(this._resolve=t,e.load())}),this._load}_onError(e){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(e)}_isSourcePlaying(){const e=this.source;return!e.paused&&!e.ended&&this._isSourceReady()}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(at.shared.add(this.update,this),this._isConnectedToTicker=!0)}_onPlayStop(){this._isConnectedToTicker&&(at.shared.remove(this.update,this),this._isConnectedToTicker=!1)}_onCanPlay(){const e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);const t=this.valid;this.resize(e.videoWidth,e.videoHeight),!t&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()}dispose(){this._isConnectedToTicker&&(at.shared.remove(this.update,this),this._isConnectedToTicker=!1);const e=this.source;e&&(e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(at.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(at.shared.add(this.update,this),this._isConnectedToTicker=!0))}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e)}static test(e,t){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||pn.TYPES.includes(t)}};let Ii=pn;Ii.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Ii.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},di.push(Ue,Or,Ia,Ii,qe,We,fn,Ra);class Jc{constructor(){this._glTransformFeedbacks={},this.buffers=[],this.disposeRunner=new It("disposeTransformFeedback")}bindBuffer(t,s){this.buffers[t]=s}destroy(){this.disposeRunner.emit(this,!1)}}const Qc="7.2.1";class Cs{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(t){return this.minX>this.maxX||this.minY>this.maxY?W.EMPTY:(t=t||new W(0,0,1,1),t.x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)}addPointMatrix(t,s){const{a:i,b:r,c:n,d:o,tx:a,ty:h}=t,l=i*s.x+n*s.y+a,c=r*s.x+o*s.y+h;this.minX=Math.min(this.minX,l),this.maxX=Math.max(this.maxX,l),this.minY=Math.min(this.minY,c),this.maxY=Math.max(this.maxY,c)}addQuad(t){let s=this.minX,i=this.minY,r=this.maxX,n=this.maxY,o=t[0],a=t[1];s=o<s?o:s,i=a<i?a:i,r=o>r?o:r,n=a>n?a:n,o=t[2],a=t[3],s=o<s?o:s,i=a<i?a:i,r=o>r?o:r,n=a>n?a:n,o=t[4],a=t[5],s=o<s?o:s,i=a<i?a:i,r=o>r?o:r,n=a>n?a:n,o=t[6],a=t[7],s=o<s?o:s,i=a<i?a:i,r=o>r?o:r,n=a>n?a:n,this.minX=s,this.minY=i,this.maxX=r,this.maxY=n}addFrame(t,s,i,r,n){this.addFrameMatrix(t.worldTransform,s,i,r,n)}addFrameMatrix(t,s,i,r,n){const o=t.a,a=t.b,h=t.c,l=t.d,c=t.tx,u=t.ty;let d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,_=o*s+h*i+c,x=a*s+l*i+u;d=_<d?_:d,f=x<f?x:f,p=_>p?_:p,m=x>m?x:m,_=o*r+h*i+c,x=a*r+l*i+u,d=_<d?_:d,f=x<f?x:f,p=_>p?_:p,m=x>m?x:m,_=o*s+h*n+c,x=a*s+l*n+u,d=_<d?_:d,f=x<f?x:f,p=_>p?_:p,m=x>m?x:m,_=o*r+h*n+c,x=a*r+l*n+u,d=_<d?_:d,f=x<f?x:f,p=_>p?_:p,m=x>m?x:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(t,s,i){let r=this.minX,n=this.minY,o=this.maxX,a=this.maxY;for(let h=s;h<i;h+=2){const l=t[h],c=t[h+1];r=l<r?l:r,n=c<n?c:n,o=l>o?l:o,a=c>a?c:a}this.minX=r,this.minY=n,this.maxX=o,this.maxY=a}addVertices(t,s,i,r){this.addVerticesMatrix(t.worldTransform,s,i,r)}addVerticesMatrix(t,s,i,r,n=0,o=n){const a=t.a,h=t.b,l=t.c,c=t.d,u=t.tx,d=t.ty;let f=this.minX,p=this.minY,m=this.maxX,_=this.maxY;for(let x=i;x<r;x+=2){const v=s[x],g=s[x+1],y=a*v+l*g+u,S=c*g+h*v+d;f=Math.min(f,y-n),m=Math.max(m,y+n),p=Math.min(p,S-o),_=Math.max(_,S+o)}this.minX=f,this.minY=p,this.maxX=m,this.maxY=_}addBounds(t){const s=this.minX,i=this.minY,r=this.maxX,n=this.maxY;this.minX=t.minX<s?t.minX:s,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>r?t.maxX:r,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,s){const i=t.minX>s.minX?t.minX:s.minX,r=t.minY>s.minY?t.minY:s.minY,n=t.maxX<s.maxX?t.maxX:s.maxX,o=t.maxY<s.maxY?t.maxY:s.maxY;if(i<=n&&r<=o){const a=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=i<a?i:a,this.minY=r<h?r:h,this.maxX=n>l?n:l,this.maxY=o>c?o:c}}addBoundsMatrix(t,s){this.addFrameMatrix(s,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,s){const i=t.minX>s.x?t.minX:s.x,r=t.minY>s.y?t.minY:s.y,n=t.maxX<s.x+s.width?t.maxX:s.x+s.width,o=t.maxY<s.y+s.height?t.maxY:s.y+s.height;if(i<=n&&r<=o){const a=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=i<a?i:a,this.minY=r<h?r:h,this.maxX=n>l?n:l,this.maxY=o>c?o:c}}pad(t=0,s=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=s,this.maxY+=s)}addFramePad(t,s,i,r,n,o){t-=n,s-=o,i+=n,r+=o,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<s?this.minY:s,this.maxY=this.maxY>r?this.maxY:r}}class st extends Ge{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new gs,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new Cs,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const s=Object.keys(t);for(let i=0;i<s.length;++i){const r=s[i];Object.defineProperty(st.prototype,r,Object.getOwnPropertyDescriptor(t,r))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(t,s){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),s||(this._boundsRect||(this._boundsRect=new W),s=this._boundsRect),this._bounds.getRectangle(s)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new W),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Cs);const s=this.transform,i=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;const r=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const o=this.getBounds(!1,t);return this.parent=i,this.transform=s,this._bounds=r,this._bounds.updateID+=this._boundsID-n,o}toGlobal(t,s,i=!1){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,s)}toLocal(t,s,i,r){return s&&(t=s.toGlobal(t,i,r)),r||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,i)}setParent(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){var t;(t=this.parent)==null||t.removeChild(this)}setTransform(t=0,s=0,i=1,r=1,n=0,o=0,a=0,h=0,l=0){return this.position.x=t,this.position.y=s,this.scale.x=i||1,this.scale.y=r||1,this.rotation=n,this.skew.x=o,this.skew.y=a,this.pivot.x=h,this.pivot.y=l,this}destroy(t){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new Pa),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*$o}set angle(t){this.transform.rotation=t*jo}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex=t,this.parent&&(this.parent.sortDirty=!0)}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){const s=this._mask.isMaskData?this._mask.maskObject:this._mask;s&&(s._maskRefCount--,s._maskRefCount===0&&(s.renderable=!0,s.isMask=!1))}if(this._mask=t,this._mask){const s=this._mask.isMaskData?this._mask.maskObject:this._mask;s&&(s._maskRefCount===0&&(s.renderable=!1,s.isMask=!0),s._maskRefCount++)}}}}class Pa extends st{constructor(){super(...arguments),this.sortDirty=null}}st.prototype.displayObjectUpdateTransform=st.prototype.updateTransform;const tu=new Q;function eu(e,t){return e.zIndex===t.zIndex?e._lastSortedIndex-t._lastSortedIndex:e.zIndex-t.zIndex}const mn=class extends st{constructor(){super(),this.children=[],this.sortableChildren=mn.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(e){}addChild(...e){if(e.length>1)for(let t=0;t<e.length;t++)this.addChild(e[t]);else{const t=e[0];t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.push(t),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",t,this,this.children.length-1),t.emit("added",this)}return e[0]}addChildAt(e,t){if(t<0||t>this.children.length)throw new Error(`${e}addChildAt: The index ${t} supplied is out of bounds ${this.children.length}`);return e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.splice(t,0,e),this._boundsID++,this.onChildrenChange(t),e.emit("added",this),this.emit("childAdded",e,this,t),e}swapChildren(e,t){if(e===t)return;const s=this.getChildIndex(e),i=this.getChildIndex(t);this.children[s]=t,this.children[i]=e,this.onChildrenChange(s<i?s:i)}getChildIndex(e){const t=this.children.indexOf(e);if(t===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return t}setChildIndex(e,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);const s=this.getChildIndex(e);Se(this.children,s,1),this.children.splice(t,0,e),this.onChildrenChange(t)}getChildAt(e){if(e<0||e>=this.children.length)throw new Error(`getChildAt: Index (${e}) does not exist.`);return this.children[e]}removeChild(...e){if(e.length>1)for(let t=0;t<e.length;t++)this.removeChild(e[t]);else{const t=e[0],s=this.children.indexOf(t);if(s===-1)return null;t.parent=null,t.transform._parentID=-1,Se(this.children,s,1),this._boundsID++,this.onChildrenChange(s),t.emit("removed",this),this.emit("childRemoved",t,this,s)}return e[0]}removeChildAt(e){const t=this.getChildAt(e);return t.parent=null,t.transform._parentID=-1,Se(this.children,e,1),this._boundsID++,this.onChildrenChange(e),t.emit("removed",this),this.emit("childRemoved",t,this,e),t}removeChildren(e=0,t=this.children.length){const s=e,i=t,r=i-s;let n;if(r>0&&r<=i){n=this.children.splice(s,r);for(let o=0;o<n.length;++o)n[o].parent=null,n[o].transform&&(n[o].transform._parentID=-1);this._boundsID++,this.onChildrenChange(e);for(let o=0;o<n.length;++o)n[o].emit("removed",this),this.emit("childRemoved",n[o],this,o);return n}else if(r===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let e=!1;for(let t=0,s=this.children.length;t<s;++t){const i=this.children[t];i._lastSortedIndex=t,!e&&i.zIndex!==0&&(e=!0)}e&&this.children.length>1&&this.children.sort(eu),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let e=0,t=this.children.length;e<t;++e){const s=this.children[e];s.visible&&s.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let e=0;e<this.children.length;e++){const t=this.children[e];if(!(!t.visible||!t.renderable))if(t.calculateBounds(),t._mask){const s=t._mask.isMaskData?t._mask.maskObject:t._mask;s?(s.calculateBounds(),this._bounds.addBoundsMask(t._bounds,s._bounds)):this._bounds.addBounds(t._bounds)}else t.filterArea?this._bounds.addBoundsArea(t._bounds,t.filterArea):this._bounds.addBounds(t._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(e,t=!1){const s=super.getLocalBounds(e);if(!t)for(let i=0,r=this.children.length;i<r;++i){const n=this.children[i];n.visible&&n.updateTransform()}return s}_calculateBounds(){}_renderWithCulling(e){const t=e.renderTexture.sourceFrame;if(!(t.width>0&&t.height>0))return;let s,i;this.cullArea?(s=this.cullArea,i=this.worldTransform):this._render!==mn.prototype._render&&(s=this.getBounds(!0));const r=e.projection.transform;if(r&&(i?(i=tu.copyFrom(i),i.prepend(r)):i=r),s&&t.intersects(s,i))this._render(e);else if(this.cullArea)return;for(let n=0,o=this.children.length;n<o;++n){const a=this.children[n],h=a.cullable;a.cullable=h||!this.cullArea,a.render(e),a.cullable=h}}render(e){var t;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||((t=this.filters)==null?void 0:t.length))this.renderAdvanced(e);else if(this.cullable)this._renderWithCulling(e);else{this._render(e);for(let s=0,i=this.children.length;s<i;++s)this.children[s].render(e)}}renderAdvanced(e){var r,n,o;const t=this.filters,s=this._mask;if(t){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let a=0;a<t.length;a++)t[a].enabled&&this._enabledFilters.push(t[a])}const i=t&&((r=this._enabledFilters)==null?void 0:r.length)||s&&(!s.isMaskData||s.enabled&&(s.autoDetect||s.type!==ct.NONE));if(i&&e.batch.flush(),t&&((n=this._enabledFilters)==null?void 0:n.length)&&e.filter.push(this,this._enabledFilters),s&&e.mask.push(this,this._mask),this.cullable)this._renderWithCulling(e);else{this._render(e);for(let a=0,h=this.children.length;a<h;++a)this.children[a].render(e)}i&&e.batch.flush(),s&&e.mask.pop(this),t&&((o=this._enabledFilters)==null?void 0:o.length)&&e.filter.pop()}_render(e){}destroy(e){super.destroy(),this.sortDirty=!1;const t=typeof e=="boolean"?e:e==null?void 0:e.children,s=this.removeChildren(0,this.children.length);if(t)for(let i=0;i<s.length;++i)s[i].destroy(e)}get width(){return this.scale.x*this.getLocalBounds().width}set width(e){const t=this.getLocalBounds().width;t!==0?this.scale.x=e/t:this.scale.x=1,this._width=e}get height(){return this.scale.y*this.getLocalBounds().height}set height(e){const t=this.getLocalBounds().height;t!==0?this.scale.y=e/t:this.scale.y=1,this._height=e}};let wt=mn;wt.defaultSortableChildren=!1,wt.prototype.containerUpdateTransform=wt.prototype.updateTransform,Object.defineProperties(I,{SORTABLE_CHILDREN:{get(){return wt.defaultSortableChildren},set(e){V("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),wt.defaultSortableChildren=e}}});const Rs=new Y,su=new Uint16Array([0,1,2,0,2,3]);class me extends wt{constructor(t){super(),this._anchor=new fe(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new j(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=k.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||M.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=su,this.pluginName="batch",this.isSprite=!0,this._roundPixels=I.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=he(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=he(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const t=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===t._updateID)return;this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;const s=this.transform.worldTransform,i=s.a,r=s.b,n=s.c,o=s.d,a=s.tx,h=s.ty,l=this.vertexData,c=t.trim,u=t.orig,d=this._anchor;let f=0,p=0,m=0,_=0;if(c?(p=c.x-d._x*u.width,f=p+c.width,_=c.y-d._y*u.height,m=_+c.height):(p=-d._x*u.width,f=p+u.width,_=-d._y*u.height,m=_+u.height),l[0]=i*p+n*_+a,l[1]=o*_+r*p+h,l[2]=i*f+n*_+a,l[3]=o*_+r*f+h,l[4]=i*f+n*m+a,l[5]=o*m+r*f+h,l[6]=i*p+n*m+a,l[7]=o*m+r*p+h,this._roundPixels){const x=I.RESOLUTION;for(let v=0;v<l.length;++v)l[v]=Math.round(l[v]*x)/x}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,s=this.vertexTrimmedData,i=t.orig,r=this._anchor,n=this.transform.worldTransform,o=n.a,a=n.b,h=n.c,l=n.d,c=n.tx,u=n.ty,d=-r._x*i.width,f=d+i.width,p=-r._y*i.height,m=p+i.height;s[0]=o*d+h*p+c,s[1]=l*p+a*d+u,s[2]=o*f+h*p+c,s[3]=l*p+a*f+u,s[4]=o*f+h*m+c,s[5]=l*m+a*f+u,s[6]=o*d+h*m+c,s[7]=l*m+a*d+u}_render(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)}_calculateBounds(){const t=this._texture.trim,s=this._texture.orig;!t||t.width===s.width&&t.height===s.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(t){return this.children.length===0?(this._localBounds||(this._localBounds=new Cs),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new W),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,Rs);const s=this._texture.orig.width,i=this._texture.orig.height,r=-s*this.anchor.x;let n=0;return Rs.x>=r&&Rs.x<r+s&&(n=-i*this.anchor.y,Rs.y>=n&&Rs.y<n+i)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const i=typeof t=="boolean"?t:t==null?void 0:t.baseTexture;this._texture.destroy(!!i)}this._texture=null}static from(t,s){const i=t instanceof M?t:M.from(t,s);return new me(i)}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){const s=he(this.scale.x)||1;this.scale.x=s*t/this._texture.orig.width,this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){const s=he(this.scale.y)||1;this.scale.y=s*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||M.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const Ma=new Q;st.prototype._cacheAsBitmap=!1,st.prototype._cacheData=null,st.prototype._cacheAsBitmapResolution=null,st.prototype._cacheAsBitmapMultisample=null;class iu{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(st.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(e){e!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=e,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(e){e!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=e,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(e){if(this._cacheAsBitmap===e)return;this._cacheAsBitmap=e;let t;e?(this._cacheData||(this._cacheData=new iu),t=this._cacheData,t.originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(t=this._cacheData,t.sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea)}}}),st.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},st.prototype._initCachedDisplayObject=function(t){var d,f,p;if((d=this._cacheData)!=null&&d.sprite)return;const s=this.alpha;this.alpha=1,t.batch.flush();const i=this.getLocalBounds(null,!0).clone();if((f=this.filters)!=null&&f.length){const m=this.filters[0].padding;i.pad(m)}i.ceil(I.RESOLUTION);const r=t.renderTexture.current,n=t.renderTexture.sourceFrame.clone(),o=t.renderTexture.destinationFrame.clone(),a=t.projection.transform,h=pe.create({width:i.width,height:i.height,resolution:this.cacheAsBitmapResolution||t.resolution,multisample:(p=this.cacheAsBitmapMultisample)!=null?p:t.multisample}),l=`cacheAsBitmap_${xe()}`;this._cacheData.textureCacheId=l,X.addToCache(h.baseTexture,l),M.addToCache(h,l);const c=this.transform.localTransform.copyTo(Ma).invert().translate(-i.x,-i.y);this.render=this._cacheData.originalRender,t.render(this,{renderTexture:h,clear:!0,transform:c,skipUpdateTransform:!1}),t.framebuffer.blit(),t.projection.transform=a,t.renderTexture.bind(r,n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=s;const u=new me(h);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(i.x/i.width),u.anchor.y=-(i.y/i.height),u.alpha=s,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=u.containsPoint.bind(u)},st.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},st.prototype._initCachedDisplayObjectCanvas=function(t){var c;if((c=this._cacheData)!=null&&c.sprite)return;const s=this.getLocalBounds(null,!0),i=this.alpha;this.alpha=1;const r=t.canvasContext.activeContext,n=t._projTransform;s.ceil(I.RESOLUTION);const o=pe.create({width:s.width,height:s.height}),a=`cacheAsBitmap_${xe()}`;this._cacheData.textureCacheId=a,X.addToCache(o.baseTexture,a),M.addToCache(o,a);const h=Ma;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=s.x,h.ty-=s.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,{renderTexture:o,clear:!0,transform:h,skipUpdateTransform:!1}),t.canvasContext.activeContext=r,t._projTransform=n,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=i;const l=new me(o);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(s.x/s.width),l.anchor.y=-(s.y/s.height),l.alpha=i,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)},st.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},st.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},st.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,X.removeFromCache(this._cacheData.textureCacheId),M.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},st.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},st.prototype.name=null,wt.prototype.getChildByName=function(t,s){for(let i=0,r=this.children.length;i<r;i++)if(this.children[i].name===t)return this.children[i];if(s)for(let i=0,r=this.children.length;i<r;i++){const n=this.children[i];if(!n.getChildByName)continue;const o=n.getChildByName(t,!0);if(o)return o}return null},st.prototype.getGlobalPosition=function(t=new Y,s=!1){return this.parent?this.parent.toGlobal(this.position,t,s):(t.x=this.position.x,t.y=this.position.y),t};var ru=`varying vec2 vTextureCoord;
530
530
 
531
531
  uniform sampler2D uSampler;
532
532
  uniform float uAlpha;
@@ -866,7 +866,7 @@ void main()
866
866
 
867
867
  gl_FragColor = color;
868
868
  }
869
- `;class La extends _t{constructor(t=.5,s=Math.random()){super(an,mu,{uNoise:0,uSeed:0}),this.noise=t,this.seed=s}get noise(){return this.uniforms.uNoise}set noise(t){this.uniforms.uNoise=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}}const _n={AlphaFilter:Ba,BlurFilter:Da,BlurFilterPass:Pi,ColorMatrixFilter:Mi,DisplacementFilter:Na,FXAAFilter:Fa,NoiseFilter:La};Object.entries(_n).forEach(([e,t])=>{Object.defineProperty(_n,e,{get(){return t}})});class _u{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this.tickerAdded||!this.domElement||(at.system.add(this.tickerUpdate,this,ue.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){!this.tickerAdded||(at.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}}const De=new _u;class ns{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=ns.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new Y,this.page=new Y,this.AT_TARGET=1,this.BUBBLING_PHASE=2,this.CAPTURING_PHASE=3,this.NONE=0,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,s,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,s,i,r,n){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}class Is extends ns{constructor(){super(...arguments),this.client=new Y,this.movement=new Y,this.offset=new Y,this.global=new Y,this.screen=new Y}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,s,i){return t.worldTransform.applyInverse(i||this.global,s)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,s,i,r,n,o,a,h,l,c,u,d,f,p,m){throw new Error("Method not implemented.")}}class Ot extends Is{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class Ne extends Is{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}Ne.DOM_DELTA_PIXEL=0,Ne.DOM_DELTA_LINE=1,Ne.DOM_DELTA_PAGE=2;const gu=2048,xu=new Y,gn=new Y;class Oa{constructor(t){this.dispatch=new Ge,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._collectInteractiveElements=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,s){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:s,priority:0}),this.mappingTable[t].sort((i,r)=>i.priority-r.priority)}dispatchEvent(t,s){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,s),this.dispatch.emit(s||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const s=this.mappingTable[t.type];if(s)for(let i=0,r=s.length;i<r;i++)s[i].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,s){De.pauseUpdate=!0;const i=this.hitTestRecursive(this.rootTarget,this.rootTarget.eventMode,xu.set(t,s),this.hitTestFn,this.hitPruneFn);return i&&i[0]}propagate(t,s){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let r=0,n=i.length-1;r<n;r++)if(t.currentTarget=i[r],this.notifyTarget(t,s),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,s),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let r=i.length-2;r>=0;r--)if(t.currentTarget=i[r],this.notifyTarget(t,s),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,s,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const r=Array.isArray(s)?s:[s];for(let n=i.length-1;n>=0;n--)r.forEach(o=>{t.currentTarget=i[n],this.notifyTarget(t,o)})}propagationPath(t){const s=[t];for(let i=0;i<gu&&t!==this.rootTarget;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");s.push(t.parent),t=t.parent}return s.reverse(),s}hitTestRecursive(t,s,i,r,n){if(n(t,i))return null;if((t.eventMode==="dynamic"||s==="dynamic")&&(De.pauseUpdate=!1),t.interactiveChildren&&t.children){const h=t.children;for(let l=h.length-1;l>=0;l--){const c=h[l],u=this.hitTestRecursive(c,this._isInteractive(s)?s:c.eventMode,i,r,n);if(u){if(u.length>0&&!u[u.length-1].parent)continue;const d=t.isInteractive();if((u.length>0||d)&&(this._collectInteractiveElements&&d&&this._allInteractiveElements.push(t),u.push(t)),this._collectInteractiveElements&&this._hitElements.length===0&&(this._hitElements=u),!this._collectInteractiveElements)return u}}}const o=this._isInteractive(s),a=t.isInteractive();return this._collectInteractiveElements&&(o&&a&&this._allInteractiveElements.push(t),this._hitElements.length>0)?null:o&&r(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}hitPruneFn(t,s){var i;if(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)return!0;if(this._collectInteractiveElements&&this._hitElements.length>0)return!1;if(t.hitArea&&(t.worldTransform.applyInverse(s,gn),!t.hitArea.contains(gn.x,gn.y)))return!0;if(t._mask){const r=t._mask.isMaskData?t._mask.maskObject:t._mask;if(r&&!((i=r.containsPoint)!=null&&i.call(r,s)))return!0}return!1}hitTestFn(t,s){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(s):!1}notifyTarget(t,s){var n,o;s=s!=null?s:t.type;const i=`on${s}`;(o=(n=t.currentTarget)[i])==null||o.call(n,t);const r=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${s}capture`:s;this.notifyListeners(t,r),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,s)}mapPointerDown(t){if(!(t instanceof Ot)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const s=this.createPointerEvent(t);if(this.dispatchEvent(s,"pointerdown"),s.pointerType==="touch")this.dispatchEvent(s,"touchstart");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const r=s.button===2;this.dispatchEvent(s,r?"rightdown":"mousedown")}const i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=s.composedPath(),this.freeEvent(s)}mapPointerMove(t){var h,l,c;if(!(t instanceof Ot)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._collectInteractiveElements=!0;const s=this.createPointerEvent(t);this._collectInteractiveElements=!1;const i=s.pointerType==="mouse"||s.pointerType==="pen",r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.overTargets);if(((h=r.overTargets)==null?void 0:h.length)>0&&n!==s.target){const u=t.type==="mousemove"?"mouseout":"pointerout",d=this.createPointerEvent(t,u,n);if(this.dispatchEvent(d,"pointerout"),i&&this.dispatchEvent(d,"mouseout"),!s.composedPath().includes(n)){const f=this.createPointerEvent(t,"pointerleave",n);for(f.eventPhase=f.AT_TARGET;f.target&&!s.composedPath().includes(f.target);)f.currentTarget=f.target,this.notifyTarget(f),i&&this.notifyTarget(f,"mouseleave"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(d)}if(n!==s.target){const u=t.type==="mousemove"?"mouseover":"pointerover",d=this.clonePointerEvent(s,u);this.dispatchEvent(d,"pointerover"),i&&this.dispatchEvent(d,"mouseover");let f=n==null?void 0:n.parent;for(;f&&f!==this.rootTarget.parent&&f!==s.target;)f=f.parent;if(!f||f===this.rootTarget.parent){const m=this.clonePointerEvent(s,"pointerenter");for(m.eventPhase=m.AT_TARGET;m.target&&m.target!==n&&m.target!==this.rootTarget.parent;)m.currentTarget=m.target,this.notifyTarget(m),i&&this.notifyTarget(m,"mouseenter"),m.target=m.target.parent;this.freeEvent(m)}this.freeEvent(d)}const o=[],a=(l=this.enableGlobalMoveEvents)!=null?l:!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(s,"pointermove"),a&&o.push("globalpointermove"),s.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(s,"touchmove"),a&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(s,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(c=s.target)==null?void 0:c.cursor),o.length>0&&this.all(s,o),this._allInteractiveElements.length=0,this._hitElements.length=0,r.overTargets=s.composedPath(),this.freeEvent(s)}mapPointerOver(t){var o;if(!(t instanceof Ot)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const s=this.trackingData(t.pointerId),i=this.createPointerEvent(t),r=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(o=i.target)==null?void 0:o.cursor);const n=this.clonePointerEvent(i,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;s.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof Ot)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const s=this.trackingData(t.pointerId);if(s.overTargets){const i=t.pointerType==="mouse"||t.pointerType==="pen",r=this.findMountedTarget(s.overTargets),n=this.createPointerEvent(t,"pointerout",r);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");const o=this.createPointerEvent(t,"pointerleave",r);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;s.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Ot)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const s=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=n;if(n&&!i.composedPath().includes(n)){let a=n;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const h=i.button===2;this.notifyTarget(i,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete r.pressTargetsByButton[t.button],o=a}if(o){const a=this.clonePointerEvent(i,"click");a.target=o,a.path=null,r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:s});const h=r.clicksByButton[t.button];if(h.target===a.target&&s-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=s,a.detail=h.clickCount,a.pointerType==="mouse"){const l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof Ot)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const s=this.trackingData(t.pointerId),i=this.findMountedTarget(s.pressTargetsByButton[t.button]),r=this.createPointerEvent(t);if(i){let n=i;for(;n;)r.currentTarget=n,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch"?this.notifyTarget(r,"touchendoutside"):(r.pointerType==="mouse"||r.pointerType==="pen")&&this.notifyTarget(r,r.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete s.pressTargetsByButton[t.button]}this.freeEvent(r)}mapWheel(t){if(!(t instanceof Ne)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const s=this.createWheelEvent(t);this.dispatchEvent(s),this.freeEvent(s)}findMountedTarget(t){if(!t)return null;let s=t[0];for(let i=1;i<t.length&&t[i].parent===s;i++)s=t[i];return s}createPointerEvent(t,s,i){var n;const r=this.allocateEvent(Ot);return this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.nativeEvent=t.nativeEvent,r.originalEvent=t,r.target=(n=i!=null?i:this.hitTest(r.global.x,r.global.y))!=null?n:this._hitElements[0],typeof s=="string"&&(r.type=s),r}createWheelEvent(t){const s=this.allocateEvent(Ne);return this.copyWheelData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=this.hitTest(s.global.x,s.global.y),s}clonePointerEvent(t,s){const i=this.allocateEvent(Ot);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=s!=null?s:i.type,i}copyWheelData(t,s){s.deltaMode=t.deltaMode,s.deltaX=t.deltaX,s.deltaY=t.deltaY,s.deltaZ=t.deltaZ}copyPointerData(t,s){t instanceof Ot&&s instanceof Ot&&(s.pointerId=t.pointerId,s.width=t.width,s.height=t.height,s.isPrimary=t.isPrimary,s.pointerType=t.pointerType,s.pressure=t.pressure,s.tangentialPressure=t.tangentialPressure,s.tiltX=t.tiltX,s.tiltY=t.tiltY,s.twist=t.twist)}copyMouseData(t,s){t instanceof Is&&s instanceof Is&&(s.altKey=t.altKey,s.button=t.button,s.buttons=t.buttons,s.client.copyFrom(t.client),s.ctrlKey=t.ctrlKey,s.metaKey=t.metaKey,s.movement.copyFrom(t.movement),s.screen.copyFrom(t.screen),s.shiftKey=t.shiftKey,s.global.copyFrom(t.global))}copyData(t,s){s.isTrusted=t.isTrusted,s.srcElement=t.srcElement,s.timeStamp=performance.now(),s.type=t.type,s.detail=t.detail,s.view=t.view,s.which=t.which,s.layer.copyFrom(t.layer),s.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);const s=this.eventPool.get(t).pop()||new t(this);return s.eventPhase=s.NONE,s.currentTarget=null,s.path=null,s.target=null,s}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const s=t.constructor;this.eventPool.has(s)||this.eventPool.set(s,[]),this.eventPool.get(s).push(t)}notifyListeners(t,s){const i=t.currentTarget._events[s];if(!!i&&!!t.currentTarget.isInteractive())if("fn"in i)i.once&&t.currentTarget.removeListener(s,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let r=0,n=i.length;r<n&&!t.propagationImmediatelyStopped;r++)i[r].once&&t.currentTarget.removeListener(s,i[r].fn,void 0,!0),i[r].fn.call(i[r].context,t)}}const yu=1,vu={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},xn=class{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new Oa(null),De.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Ot(null),this.rootWheelEvent=new Ne(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy(yt({},xn.defaultEventFeatures),{set:(t,s,i)=>(s==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=i),t[s]=i,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){var i,r;const{view:t,resolution:s}=this.renderer;this.setTargetElement(t),this.resolution=s,xn._defaultEventMode=(i=e.eventMode)!=null?i:"auto",Object.assign(this.features,(r=e.eventFeatures)!=null?r:{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(e){e=e||"default";let t=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(t=!1),this.currentCursor===e)return;this.currentCursor=e;const s=this.cursorStyles[e];if(s)switch(typeof s){case"string":t&&(this.domElement.style.cursor=s);break;case"function":s(e);break;case"object":t&&Object.assign(this.domElement.style,s);break}else t&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this.rootPointerEvent}onPointerDown(e){if(!this.features.click||(this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.supportsTouchEvents&&e.pointerType==="touch"))return;const t=this.normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let s=0,i=t.length;s<i;s++){const r=t[s],n=this.bootstrapEvent(this.rootPointerEvent,r);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(e){if(!this.features.move||(this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.supportsTouchEvents&&e.pointerType==="touch"))return;De.pointerMoved();const t=this.normalizeToPointerData(e);for(let s=0,i=t.length;s<i;s++){const r=this.bootstrapEvent(this.rootPointerEvent,t[s]);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(e){if(!this.features.click||(this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.supportsTouchEvents&&e.pointerType==="touch"))return;let t=e.target;e.composedPath&&e.composedPath().length>0&&(t=e.composedPath()[0]);const s=t!==this.domElement?"outside":"",i=this.normalizeToPointerData(e);for(let r=0,n=i.length;r<n;r++){const o=this.bootstrapEvent(this.rootPointerEvent,i[r]);o.type+=s,this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(e){if(!this.features.click||(this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.supportsTouchEvents&&e.pointerType==="touch"))return;const t=this.normalizeToPointerData(e);for(let s=0,i=t.length;s<i;s++){const r=this.bootstrapEvent(this.rootPointerEvent,t[s]);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}onWheel(e){if(!this.features.wheel)return;const t=this.normalizeWheelEvent(e);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(t)}setTargetElement(e){this.removeEvents(),this.domElement=e,De.domElement=e,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;De.addTickerListener();const e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):this.supportsPointerEvents&&(e.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0)),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;De.removeTickerListener();const e=this.domElement.style;globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):this.supportsPointerEvents&&(e.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0)),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(e,t,s){let i;this.domElement.parentElement?i=this.domElement.getBoundingClientRect():i={x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0};const r=1/this.resolution;e.x=(t-i.left)*(this.domElement.width/i.width)*r,e.y=(s-i.top)*(this.domElement.height/i.height)*r}normalizeToPointerData(e){const t=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(let s=0,i=e.changedTouches.length;s<i;s++){const r=e.changedTouches[s];typeof r.button=="undefined"&&(r.button=0),typeof r.buttons=="undefined"&&(r.buttons=1),typeof r.isPrimary=="undefined"&&(r.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof r.width=="undefined"&&(r.width=r.radiusX||1),typeof r.height=="undefined"&&(r.height=r.radiusY||1),typeof r.tiltX=="undefined"&&(r.tiltX=0),typeof r.tiltY=="undefined"&&(r.tiltY=0),typeof r.pointerType=="undefined"&&(r.pointerType="touch"),typeof r.pointerId=="undefined"&&(r.pointerId=r.identifier||0),typeof r.pressure=="undefined"&&(r.pressure=r.force||.5),typeof r.twist=="undefined"&&(r.twist=0),typeof r.tangentialPressure=="undefined"&&(r.tangentialPressure=0),typeof r.layerX=="undefined"&&(r.layerX=r.offsetX=r.clientX),typeof r.layerY=="undefined"&&(r.layerY=r.offsetY=r.clientY),r.isNormalized=!0,r.type=e.type,t.push(r)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){const s=e;typeof s.isPrimary=="undefined"&&(s.isPrimary=!0),typeof s.width=="undefined"&&(s.width=1),typeof s.height=="undefined"&&(s.height=1),typeof s.tiltX=="undefined"&&(s.tiltX=0),typeof s.tiltY=="undefined"&&(s.tiltY=0),typeof s.pointerType=="undefined"&&(s.pointerType="mouse"),typeof s.pointerId=="undefined"&&(s.pointerId=yu),typeof s.pressure=="undefined"&&(s.pressure=.5),typeof s.twist=="undefined"&&(s.twist=0),typeof s.tangentialPressure=="undefined"&&(s.tangentialPressure=0),s.isNormalized=!0,t.push(s)}else t.push(e);return t}normalizeWheelEvent(e){const t=this.rootWheelEvent;return this.transferMouseData(t,e),t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ,t.deltaMode=e.deltaMode,this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.nativeEvent=e,t.type=e.type,t}bootstrapEvent(e,t){return e.originalEvent=null,e.nativeEvent=t,e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist,this.transferMouseData(e,t),this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=t.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=vu[e.type]||e.type),e}transferMouseData(e,t){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null,e.shiftKey=t.shiftKey}};let Ke=xn;Ke.extension={name:"events",type:[P.RendererSystem,P.CanvasRendererSystem]},Ke.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0},O.add(Ke);function Ua(e){return e==="dynamic"||e==="static"}const ka={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){var e;return(e=this._internalInteractive)!=null?e:Ua(Ke.defaultEventMode)},set interactive(e){V("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=e,this.eventMode=e?"static":"auto"},_internalEventMode:void 0,get eventMode(){var e;return(e=this._internalEventMode)!=null?e:Ke.defaultEventMode},set eventMode(e){this._internalInteractive=Ua(e),this._internalEventMode=e},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(e,t,s){const i=typeof s=="boolean"&&s||typeof s=="object"&&s.capture,r=typeof t=="function"?void 0:t;e=i?`${e}capture`:e,t=typeof t=="function"?t:t.handleEvent,this.on(e,t,r)},removeEventListener(e,t,s){const i=typeof s=="boolean"&&s||typeof s=="object"&&s.capture,r=typeof t=="function"?void 0:t;e=i?`${e}capture`:e,t=typeof t=="function"?t:t.handleEvent,this.off(e,t,r)},dispatchEvent(e){if(!(e instanceof ns))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return e.defaultPrevented=!1,e.path=null,e.target=this,e.manager.dispatchEvent(e),!e.defaultPrevented}};st.mixin(ka);const Ga={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};st.mixin(Ga);const bu=9,Bi=100,Tu=0,Eu=0,Ha=2,Xa=1,wu=-1e3,Su=-1e3,Au=2;class yn{constructor(t){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(zt.tablet||zt.phone)&&this.createTouchHook();const s=document.createElement("div");s.style.width=`${Bi}px`,s.style.height=`${Bi}px`,s.style.position="absolute",s.style.top=`${Tu}px`,s.style.left=`${Eu}px`,s.style.zIndex=Ha.toString(),this.div=s,this.renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}createTouchHook(){const t=document.createElement("button");t.style.width=`${Xa}px`,t.style.height=`${Xa}px`,t.style.position="absolute",t.style.top=`${wu}px`,t.style.left=`${Su}px`,t.style.zIndex=Au.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}destroyTouchHook(){!this._hookDiv||(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(t=this.renderer.view.parentNode)==null||t.appendChild(this.div))}deactivate(){var t;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(t=this.div.parentNode)==null||t.removeChild(this.div))}updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);const s=t.children;if(s)for(let i=0;i<s.length;i++)this.updateAccessibleObjects(s[i])}update(){const t=performance.now();if(zt.android.device&&t<this.androidUpdateCount||(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:s,y:i,width:r,height:n}=this.renderer.view.getBoundingClientRect(),{width:o,height:a,resolution:h}=this.renderer,l=r/o*h,c=n/a*h;let u=this.div;u.style.left=`${s}px`,u.style.top=`${i}px`,u.style.width=`${o}px`,u.style.height=`${a}px`;for(let d=0;d<this.children.length;d++){const f=this.children[d];if(f.renderId!==this.renderId)f._accessibleActive=!1,Se(this.children,d,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,d--;else{u=f._accessibleDiv;let p=f.hitArea;const m=f.worldTransform;f.hitArea?(u.style.left=`${(m.tx+p.x*m.a)*l}px`,u.style.top=`${(m.ty+p.y*m.d)*c}px`,u.style.width=`${p.width*m.a*l}px`,u.style.height=`${p.height*m.d*c}px`):(p=f.getBounds(),this.capHitArea(p),u.style.left=`${p.x*l}px`,u.style.top=`${p.y*c}px`,u.style.width=`${p.width*l}px`,u.style.height=`${p.height*c}px`,u.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(u.title=f.accessibleTitle),u.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&u.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==u.title||f.tabIndex!==u.tabIndex)&&(u.title=f.accessibleTitle,u.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(u))}}this.renderId++}updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:s,height:i}=this.renderer;t.x+t.width>s&&(t.width=s-t.x),t.y+t.height>i&&(t.height=i-t.y)}addChild(t){let s=this.pool.pop();s||(s=document.createElement("button"),s.style.width=`${Bi}px`,s.style.height=`${Bi}px`,s.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",s.style.position="absolute",s.style.zIndex=Ha.toString(),s.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?s.setAttribute("aria-live","off"):s.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?s.setAttribute("aria-relevant","additions"):s.setAttribute("aria-relevant","text"),s.addEventListener("click",this._onClick.bind(this)),s.addEventListener("focus",this._onFocus.bind(this)),s.addEventListener("focusout",this._onFocusOut.bind(this))),s.style.pointerEvents=t.accessiblePointerEvents,s.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?s.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(s.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&s.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(s),t._accessibleActive=!0,t._accessibleDiv=s,s.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,s){const{displayObject:i}=t.target,r=this.renderer.events.rootBoundary,n=Object.assign(new ns(r),{target:i});r.rootTarget=this.renderer.lastObjectRendered,s.forEach(o=>r.dispatchEvent(n,o))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode===bu&&this.activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}yn.extension={name:"accessibility",type:[P.RendererPlugin,P.CanvasRendererPlugin]},O.add(yn);const vn=class{constructor(e){this.stage=new wt,e=Object.assign({forceCanvas:!1},e),this.renderer=Aa(e),vn._plugins.forEach(t=>{t.init.call(this,e)})}render(){this.renderer.render(this.stage)}get view(){return this.renderer.view}get screen(){return this.renderer.screen}destroy(e,t){const s=vn._plugins.slice(0);s.reverse(),s.forEach(i=>{i.destroy.call(this)}),this.stage.destroy(t),this.stage=null,this.renderer.destroy(e),this.renderer=null}};let bn=vn;bn._plugins=[],O.handleByList(P.Application,bn._plugins);class Tn{static init(t){Object.defineProperty(this,"resizeTo",{set(s){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=s,s&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{!this._resizeTo||(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let s,i;if(this._resizeTo===globalThis.window)s=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:r,clientHeight:n}=this._resizeTo;s=r,i=n}this.renderer.resize(s,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}Tn.extension=P.Application,O.add(Tn);const Va={loader:P.LoadParser,resolver:P.ResolveParser,cache:P.CacheParser,detection:P.DetectionParser};O.handle(P.Asset,e=>{const t=e.ref;Object.entries(Va).filter(([s])=>!!t[s]).forEach(([s,i])=>{var r;return O.add(Object.assign(t[s],{extension:(r=t[s].extension)!=null?r:i}))})},e=>{const t=e.ref;Object.keys(Va).filter(s=>!!t[s]).forEach(s=>O.remove(t[s]))});class Cu{constructor(t,s=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=s}add(t){t.forEach(s=>{this._assetList.push(s)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],s=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<s;i++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}function Ze(e,t){if(Array.isArray(t)){for(const s of t)if(e.startsWith(`data:${s}`))return!0;return!1}return e.startsWith(`data:${t}`)}function ye(e,t){const s=e.split("?")[0],i=vt.extname(s).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const ie=(e,t)=>(Array.isArray(e)||(e=[e]),t?e.map(s=>typeof s=="string"?t(s):s):e),Di=(e,t)=>{const s=t.split("?")[1];return s&&(e+=`?${s}`),e};function za(e,t,s,i,r){const n=t[s];for(let o=0;o<n.length;o++){const a=n[o];s<t.length-1?za(e.replace(i[s],a),t,s+1,i,r):r.push(e.replace(i[s],a))}}function Wa(e){const t=/\{(.*?)\}/g,s=e.match(t),i=[];if(s){const r=[];s.forEach(n=>{const o=n.substring(1,n.length-1).split(",");r.push(o)}),za(e,r,0,s,i)}else i.push(e);return i}const Ps=e=>!Array.isArray(e);class Ru{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const s=this._cache.get(t);return s||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),s}set(t,s){const i=ie(t);let r;for(let a=0;a<this.parsers.length;a++){const h=this.parsers[a];if(h.test(s)){r=h.getCacheableAssets(i,s);break}}r||(r={},i.forEach(a=>{r[a]=s}));const n=Object.keys(r),o={cacheKeys:n,keys:i};if(i.forEach(a=>{this._cacheMap.set(a,o)}),n.forEach(a=>{this._cache.has(a)&&this._cache.get(a)!==s&&console.warn("[Cache] already has key:",a),this._cache.set(a,r[a])}),s instanceof M){const a=s;i.forEach(h=>{a.baseTexture!==M.EMPTY.baseTexture&&X.addToCache(a.baseTexture,h),M.addToCache(a,h)})}}remove(t){if(this._cacheMap.get(t),!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);return}const s=this._cacheMap.get(t);s.cacheKeys.forEach(r=>{this._cache.delete(r)}),s.keys.forEach(r=>{this._cacheMap.delete(r)})}get parsers(){return this._parsers}}const Je=new Ru;class Iu{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,s,i)=>(this._parsersValidated=!1,t[s]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,s){const i={promise:null,parser:null};return i.promise=(async()=>{var o,a;let r=null,n=null;if(s.loadParser&&(n=this._parserHash[s.loadParser],n||console.warn(`[Assets] specified load parser "${s.loadParser}" not found while loading ${t}`)),!n){for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];if(l.load&&((o=l.test)==null?void 0:o.call(l,t,s,this))){n=l;break}}if(!n)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}r=await n.load(t,s,this),i.parser=n;for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];l.parse&&l.parse&&await((a=l.testParse)==null?void 0:a.call(l,r,s,this))&&(r=await l.parse(r,s,this)||r,i.parser=l)}return r})(),i}async load(t,s){this._parsersValidated||this._validateParsers();let i=0;const r={},n=Ps(t),o=ie(t,l=>({src:l})),a=o.length,h=o.map(async l=>{const c=vt.toAbsolute(l.src);if(!r[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),r[l.src]=await this.promiseCache[c].promise,s&&s(++i/a)}catch(u){throw delete this.promiseCache[c],delete r[l.src],new Error(`[Loader.load] Failed to load ${c}.
869
+ `;class La extends _t{constructor(t=.5,s=Math.random()){super(an,mu,{uNoise:0,uSeed:0}),this.noise=t,this.seed=s}get noise(){return this.uniforms.uNoise}set noise(t){this.uniforms.uNoise=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}}const _n={AlphaFilter:Ba,BlurFilter:Da,BlurFilterPass:Pi,ColorMatrixFilter:Mi,DisplacementFilter:Na,FXAAFilter:Fa,NoiseFilter:La};Object.entries(_n).forEach(([e,t])=>{Object.defineProperty(_n,e,{get(){return t}})});class _u{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this.tickerAdded||!this.domElement||(at.system.add(this.tickerUpdate,this,ue.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){!this.tickerAdded||(at.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}}const De=new _u;class ns{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=ns.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new Y,this.page=new Y,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,s,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,s,i,r,n){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}class Is extends ns{constructor(){super(...arguments),this.client=new Y,this.movement=new Y,this.offset=new Y,this.global=new Y,this.screen=new Y}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,s,i){return t.worldTransform.applyInverse(i||this.global,s)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,s,i,r,n,o,a,h,l,c,u,d,f,p,m){throw new Error("Method not implemented.")}}class Ot extends Is{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class Ne extends Is{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}Ne.DOM_DELTA_PIXEL=0,Ne.DOM_DELTA_LINE=1,Ne.DOM_DELTA_PAGE=2;const gu=2048,xu=new Y,gn=new Y;class Oa{constructor(t){this.dispatch=new Ge,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._collectInteractiveElements=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,s){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:s,priority:0}),this.mappingTable[t].sort((i,r)=>i.priority-r.priority)}dispatchEvent(t,s){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,s),this.dispatch.emit(s||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const s=this.mappingTable[t.type];if(s)for(let i=0,r=s.length;i<r;i++)s[i].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,s){De.pauseUpdate=!0;const i=this.hitTestRecursive(this.rootTarget,this.rootTarget.eventMode,xu.set(t,s),this.hitTestFn,this.hitPruneFn);return i&&i[0]}propagate(t,s){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let r=0,n=i.length-1;r<n;r++)if(t.currentTarget=i[r],this.notifyTarget(t,s),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,s),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let r=i.length-2;r>=0;r--)if(t.currentTarget=i[r],this.notifyTarget(t,s),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,s,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const r=Array.isArray(s)?s:[s];for(let n=i.length-1;n>=0;n--)r.forEach(o=>{t.currentTarget=i[n],this.notifyTarget(t,o)})}propagationPath(t){const s=[t];for(let i=0;i<gu&&t!==this.rootTarget;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");s.push(t.parent),t=t.parent}return s.reverse(),s}hitTestRecursive(t,s,i,r,n){if(n(t,i))return null;if((t.eventMode==="dynamic"||s==="dynamic")&&(De.pauseUpdate=!1),t.interactiveChildren&&t.children){const h=t.children;for(let l=h.length-1;l>=0;l--){const c=h[l],u=this.hitTestRecursive(c,this._isInteractive(s)?s:c.eventMode,i,r,n);if(u){if(u.length>0&&!u[u.length-1].parent)continue;const d=t.isInteractive();if((u.length>0||d)&&(this._collectInteractiveElements&&d&&this._allInteractiveElements.push(t),u.push(t)),this._collectInteractiveElements&&this._hitElements.length===0&&(this._hitElements=u),!this._collectInteractiveElements)return u}}}const o=this._isInteractive(s),a=t.isInteractive();return this._collectInteractiveElements&&(o&&a&&this._allInteractiveElements.push(t),this._hitElements.length>0)?null:o&&r(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}hitPruneFn(t,s){var i;if(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)return!0;if(this._collectInteractiveElements)return!1;if(t.hitArea&&(t.worldTransform.applyInverse(s,gn),!t.hitArea.contains(gn.x,gn.y)))return!0;if(t._mask){const r=t._mask.isMaskData?t._mask.maskObject:t._mask;if(r&&!((i=r.containsPoint)!=null&&i.call(r,s)))return!0}return!1}hitTestFn(t,s){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(s):!1}notifyTarget(t,s){var n,o;s=s!=null?s:t.type;const i=`on${s}`;(o=(n=t.currentTarget)[i])==null||o.call(n,t);const r=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${s}capture`:s;this.notifyListeners(t,r),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,s)}mapPointerDown(t){if(!(t instanceof Ot)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const s=this.createPointerEvent(t);if(this.dispatchEvent(s,"pointerdown"),s.pointerType==="touch")this.dispatchEvent(s,"touchstart");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const r=s.button===2;this.dispatchEvent(s,r?"rightdown":"mousedown")}const i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=s.composedPath(),this.freeEvent(s)}mapPointerMove(t){var h,l,c;if(!(t instanceof Ot)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._collectInteractiveElements=!0;const s=this.createPointerEvent(t);this._collectInteractiveElements=!1;const i=s.pointerType==="mouse"||s.pointerType==="pen",r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.overTargets);if(((h=r.overTargets)==null?void 0:h.length)>0&&n!==s.target){const u=t.type==="mousemove"?"mouseout":"pointerout",d=this.createPointerEvent(t,u,n);if(this.dispatchEvent(d,"pointerout"),i&&this.dispatchEvent(d,"mouseout"),!s.composedPath().includes(n)){const f=this.createPointerEvent(t,"pointerleave",n);for(f.eventPhase=f.AT_TARGET;f.target&&!s.composedPath().includes(f.target);)f.currentTarget=f.target,this.notifyTarget(f),i&&this.notifyTarget(f,"mouseleave"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(d)}if(n!==s.target){const u=t.type==="mousemove"?"mouseover":"pointerover",d=this.clonePointerEvent(s,u);this.dispatchEvent(d,"pointerover"),i&&this.dispatchEvent(d,"mouseover");let f=n==null?void 0:n.parent;for(;f&&f!==this.rootTarget.parent&&f!==s.target;)f=f.parent;if(!f||f===this.rootTarget.parent){const m=this.clonePointerEvent(s,"pointerenter");for(m.eventPhase=m.AT_TARGET;m.target&&m.target!==n&&m.target!==this.rootTarget.parent;)m.currentTarget=m.target,this.notifyTarget(m),i&&this.notifyTarget(m,"mouseenter"),m.target=m.target.parent;this.freeEvent(m)}this.freeEvent(d)}const o=[],a=(l=this.enableGlobalMoveEvents)!=null?l:!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(s,"pointermove"),a&&o.push("globalpointermove"),s.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(s,"touchmove"),a&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(s,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(c=s.target)==null?void 0:c.cursor),o.length>0&&this.all(s,o),this._allInteractiveElements.length=0,this._hitElements.length=0,r.overTargets=s.composedPath(),this.freeEvent(s)}mapPointerOver(t){var o;if(!(t instanceof Ot)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const s=this.trackingData(t.pointerId),i=this.createPointerEvent(t),r=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(o=i.target)==null?void 0:o.cursor);const n=this.clonePointerEvent(i,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;s.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof Ot)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const s=this.trackingData(t.pointerId);if(s.overTargets){const i=t.pointerType==="mouse"||t.pointerType==="pen",r=this.findMountedTarget(s.overTargets),n=this.createPointerEvent(t,"pointerout",r);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");const o=this.createPointerEvent(t,"pointerleave",r);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;s.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Ot)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const s=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=n;if(n&&!i.composedPath().includes(n)){let a=n;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const h=i.button===2;this.notifyTarget(i,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete r.pressTargetsByButton[t.button],o=a}if(o){const a=this.clonePointerEvent(i,"click");a.target=o,a.path=null,r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:s});const h=r.clicksByButton[t.button];if(h.target===a.target&&s-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=s,a.detail=h.clickCount,a.pointerType==="mouse"){const l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof Ot)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const s=this.trackingData(t.pointerId),i=this.findMountedTarget(s.pressTargetsByButton[t.button]),r=this.createPointerEvent(t);if(i){let n=i;for(;n;)r.currentTarget=n,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch"?this.notifyTarget(r,"touchendoutside"):(r.pointerType==="mouse"||r.pointerType==="pen")&&this.notifyTarget(r,r.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete s.pressTargetsByButton[t.button]}this.freeEvent(r)}mapWheel(t){if(!(t instanceof Ne)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const s=this.createWheelEvent(t);this.dispatchEvent(s),this.freeEvent(s)}findMountedTarget(t){if(!t)return null;let s=t[0];for(let i=1;i<t.length&&t[i].parent===s;i++)s=t[i];return s}createPointerEvent(t,s,i){var n;const r=this.allocateEvent(Ot);return this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.nativeEvent=t.nativeEvent,r.originalEvent=t,r.target=(n=i!=null?i:this.hitTest(r.global.x,r.global.y))!=null?n:this._hitElements[0],typeof s=="string"&&(r.type=s),r}createWheelEvent(t){const s=this.allocateEvent(Ne);return this.copyWheelData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=this.hitTest(s.global.x,s.global.y),s}clonePointerEvent(t,s){const i=this.allocateEvent(Ot);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=s!=null?s:i.type,i}copyWheelData(t,s){s.deltaMode=t.deltaMode,s.deltaX=t.deltaX,s.deltaY=t.deltaY,s.deltaZ=t.deltaZ}copyPointerData(t,s){t instanceof Ot&&s instanceof Ot&&(s.pointerId=t.pointerId,s.width=t.width,s.height=t.height,s.isPrimary=t.isPrimary,s.pointerType=t.pointerType,s.pressure=t.pressure,s.tangentialPressure=t.tangentialPressure,s.tiltX=t.tiltX,s.tiltY=t.tiltY,s.twist=t.twist)}copyMouseData(t,s){t instanceof Is&&s instanceof Is&&(s.altKey=t.altKey,s.button=t.button,s.buttons=t.buttons,s.client.copyFrom(t.client),s.ctrlKey=t.ctrlKey,s.metaKey=t.metaKey,s.movement.copyFrom(t.movement),s.screen.copyFrom(t.screen),s.shiftKey=t.shiftKey,s.global.copyFrom(t.global))}copyData(t,s){s.isTrusted=t.isTrusted,s.srcElement=t.srcElement,s.timeStamp=performance.now(),s.type=t.type,s.detail=t.detail,s.view=t.view,s.which=t.which,s.layer.copyFrom(t.layer),s.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);const s=this.eventPool.get(t).pop()||new t(this);return s.eventPhase=s.NONE,s.currentTarget=null,s.path=null,s.target=null,s}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const s=t.constructor;this.eventPool.has(s)||this.eventPool.set(s,[]),this.eventPool.get(s).push(t)}notifyListeners(t,s){const i=t.currentTarget._events[s];if(!!i&&!!t.currentTarget.isInteractive())if("fn"in i)i.once&&t.currentTarget.removeListener(s,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let r=0,n=i.length;r<n&&!t.propagationImmediatelyStopped;r++)i[r].once&&t.currentTarget.removeListener(s,i[r].fn,void 0,!0),i[r].fn.call(i[r].context,t)}}const yu=1,vu={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},xn=class{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new Oa(null),De.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Ot(null),this.rootWheelEvent=new Ne(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy(yt({},xn.defaultEventFeatures),{set:(t,s,i)=>(s==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=i),t[s]=i,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){var i,r;const{view:t,resolution:s}=this.renderer;this.setTargetElement(t),this.resolution=s,xn._defaultEventMode=(i=e.eventMode)!=null?i:"auto",Object.assign(this.features,(r=e.eventFeatures)!=null?r:{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(e){e=e||"default";let t=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(t=!1),this.currentCursor===e)return;this.currentCursor=e;const s=this.cursorStyles[e];if(s)switch(typeof s){case"string":t&&(this.domElement.style.cursor=s);break;case"function":s(e);break;case"object":t&&Object.assign(this.domElement.style,s);break}else t&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this.rootPointerEvent}onPointerDown(e){if(!this.features.click||(this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.supportsTouchEvents&&e.pointerType==="touch"))return;const t=this.normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let s=0,i=t.length;s<i;s++){const r=t[s],n=this.bootstrapEvent(this.rootPointerEvent,r);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(e){if(!this.features.move||(this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.supportsTouchEvents&&e.pointerType==="touch"))return;De.pointerMoved();const t=this.normalizeToPointerData(e);for(let s=0,i=t.length;s<i;s++){const r=this.bootstrapEvent(this.rootPointerEvent,t[s]);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(e){if(!this.features.click||(this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.supportsTouchEvents&&e.pointerType==="touch"))return;let t=e.target;e.composedPath&&e.composedPath().length>0&&(t=e.composedPath()[0]);const s=t!==this.domElement?"outside":"",i=this.normalizeToPointerData(e);for(let r=0,n=i.length;r<n;r++){const o=this.bootstrapEvent(this.rootPointerEvent,i[r]);o.type+=s,this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(e){if(!this.features.click||(this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.supportsTouchEvents&&e.pointerType==="touch"))return;const t=this.normalizeToPointerData(e);for(let s=0,i=t.length;s<i;s++){const r=this.bootstrapEvent(this.rootPointerEvent,t[s]);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}onWheel(e){if(!this.features.wheel)return;const t=this.normalizeWheelEvent(e);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(t)}setTargetElement(e){this.removeEvents(),this.domElement=e,De.domElement=e,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;De.addTickerListener();const e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):this.supportsPointerEvents&&(e.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0)),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;De.removeTickerListener();const e=this.domElement.style;globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):this.supportsPointerEvents&&(e.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0)),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(e,t,s){let i;this.domElement.parentElement?i=this.domElement.getBoundingClientRect():i={x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0};const r=1/this.resolution;e.x=(t-i.left)*(this.domElement.width/i.width)*r,e.y=(s-i.top)*(this.domElement.height/i.height)*r}normalizeToPointerData(e){const t=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(let s=0,i=e.changedTouches.length;s<i;s++){const r=e.changedTouches[s];typeof r.button=="undefined"&&(r.button=0),typeof r.buttons=="undefined"&&(r.buttons=1),typeof r.isPrimary=="undefined"&&(r.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof r.width=="undefined"&&(r.width=r.radiusX||1),typeof r.height=="undefined"&&(r.height=r.radiusY||1),typeof r.tiltX=="undefined"&&(r.tiltX=0),typeof r.tiltY=="undefined"&&(r.tiltY=0),typeof r.pointerType=="undefined"&&(r.pointerType="touch"),typeof r.pointerId=="undefined"&&(r.pointerId=r.identifier||0),typeof r.pressure=="undefined"&&(r.pressure=r.force||.5),typeof r.twist=="undefined"&&(r.twist=0),typeof r.tangentialPressure=="undefined"&&(r.tangentialPressure=0),typeof r.layerX=="undefined"&&(r.layerX=r.offsetX=r.clientX),typeof r.layerY=="undefined"&&(r.layerY=r.offsetY=r.clientY),r.isNormalized=!0,r.type=e.type,t.push(r)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){const s=e;typeof s.isPrimary=="undefined"&&(s.isPrimary=!0),typeof s.width=="undefined"&&(s.width=1),typeof s.height=="undefined"&&(s.height=1),typeof s.tiltX=="undefined"&&(s.tiltX=0),typeof s.tiltY=="undefined"&&(s.tiltY=0),typeof s.pointerType=="undefined"&&(s.pointerType="mouse"),typeof s.pointerId=="undefined"&&(s.pointerId=yu),typeof s.pressure=="undefined"&&(s.pressure=.5),typeof s.twist=="undefined"&&(s.twist=0),typeof s.tangentialPressure=="undefined"&&(s.tangentialPressure=0),s.isNormalized=!0,t.push(s)}else t.push(e);return t}normalizeWheelEvent(e){const t=this.rootWheelEvent;return this.transferMouseData(t,e),t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ,t.deltaMode=e.deltaMode,this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.nativeEvent=e,t.type=e.type,t}bootstrapEvent(e,t){return e.originalEvent=null,e.nativeEvent=t,e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist,this.transferMouseData(e,t),this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=t.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=vu[e.type]||e.type),e}transferMouseData(e,t){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null,e.shiftKey=t.shiftKey}};let Ke=xn;Ke.extension={name:"events",type:[P.RendererSystem,P.CanvasRendererSystem]},Ke.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0},O.add(Ke);function Ua(e){return e==="dynamic"||e==="static"}const ka={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){var e;return(e=this._internalInteractive)!=null?e:Ua(Ke.defaultEventMode)},set interactive(e){V("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=e,this.eventMode=e?"static":"auto"},_internalEventMode:void 0,get eventMode(){var e;return(e=this._internalEventMode)!=null?e:Ke.defaultEventMode},set eventMode(e){this._internalInteractive=Ua(e),this._internalEventMode=e},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(e,t,s){const i=typeof s=="boolean"&&s||typeof s=="object"&&s.capture,r=typeof t=="function"?void 0:t;e=i?`${e}capture`:e,t=typeof t=="function"?t:t.handleEvent,this.on(e,t,r)},removeEventListener(e,t,s){const i=typeof s=="boolean"&&s||typeof s=="object"&&s.capture,r=typeof t=="function"?void 0:t;e=i?`${e}capture`:e,t=typeof t=="function"?t:t.handleEvent,this.off(e,t,r)},dispatchEvent(e){if(!(e instanceof ns))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return e.defaultPrevented=!1,e.path=null,e.target=this,e.manager.dispatchEvent(e),!e.defaultPrevented}};st.mixin(ka);const Ga={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};st.mixin(Ga);const bu=9,Bi=100,Tu=0,Eu=0,Ha=2,Xa=1,wu=-1e3,Su=-1e3,Au=2;class yn{constructor(t){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(zt.tablet||zt.phone)&&this.createTouchHook();const s=document.createElement("div");s.style.width=`${Bi}px`,s.style.height=`${Bi}px`,s.style.position="absolute",s.style.top=`${Tu}px`,s.style.left=`${Eu}px`,s.style.zIndex=Ha.toString(),this.div=s,this.renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}createTouchHook(){const t=document.createElement("button");t.style.width=`${Xa}px`,t.style.height=`${Xa}px`,t.style.position="absolute",t.style.top=`${wu}px`,t.style.left=`${Su}px`,t.style.zIndex=Au.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}destroyTouchHook(){!this._hookDiv||(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(t=this.renderer.view.parentNode)==null||t.appendChild(this.div))}deactivate(){var t;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(t=this.div.parentNode)==null||t.removeChild(this.div))}updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);const s=t.children;if(s)for(let i=0;i<s.length;i++)this.updateAccessibleObjects(s[i])}update(){const t=performance.now();if(zt.android.device&&t<this.androidUpdateCount||(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:s,y:i,width:r,height:n}=this.renderer.view.getBoundingClientRect(),{width:o,height:a,resolution:h}=this.renderer,l=r/o*h,c=n/a*h;let u=this.div;u.style.left=`${s}px`,u.style.top=`${i}px`,u.style.width=`${o}px`,u.style.height=`${a}px`;for(let d=0;d<this.children.length;d++){const f=this.children[d];if(f.renderId!==this.renderId)f._accessibleActive=!1,Se(this.children,d,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,d--;else{u=f._accessibleDiv;let p=f.hitArea;const m=f.worldTransform;f.hitArea?(u.style.left=`${(m.tx+p.x*m.a)*l}px`,u.style.top=`${(m.ty+p.y*m.d)*c}px`,u.style.width=`${p.width*m.a*l}px`,u.style.height=`${p.height*m.d*c}px`):(p=f.getBounds(),this.capHitArea(p),u.style.left=`${p.x*l}px`,u.style.top=`${p.y*c}px`,u.style.width=`${p.width*l}px`,u.style.height=`${p.height*c}px`,u.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(u.title=f.accessibleTitle),u.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&u.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==u.title||f.tabIndex!==u.tabIndex)&&(u.title=f.accessibleTitle,u.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(u))}}this.renderId++}updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:s,height:i}=this.renderer;t.x+t.width>s&&(t.width=s-t.x),t.y+t.height>i&&(t.height=i-t.y)}addChild(t){let s=this.pool.pop();s||(s=document.createElement("button"),s.style.width=`${Bi}px`,s.style.height=`${Bi}px`,s.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",s.style.position="absolute",s.style.zIndex=Ha.toString(),s.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?s.setAttribute("aria-live","off"):s.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?s.setAttribute("aria-relevant","additions"):s.setAttribute("aria-relevant","text"),s.addEventListener("click",this._onClick.bind(this)),s.addEventListener("focus",this._onFocus.bind(this)),s.addEventListener("focusout",this._onFocusOut.bind(this))),s.style.pointerEvents=t.accessiblePointerEvents,s.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?s.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(s.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&s.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(s),t._accessibleActive=!0,t._accessibleDiv=s,s.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,s){const{displayObject:i}=t.target,r=this.renderer.events.rootBoundary,n=Object.assign(new ns(r),{target:i});r.rootTarget=this.renderer.lastObjectRendered,s.forEach(o=>r.dispatchEvent(n,o))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode===bu&&this.activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}yn.extension={name:"accessibility",type:[P.RendererPlugin,P.CanvasRendererPlugin]},O.add(yn);const vn=class{constructor(e){this.stage=new wt,e=Object.assign({forceCanvas:!1},e),this.renderer=Aa(e),vn._plugins.forEach(t=>{t.init.call(this,e)})}render(){this.renderer.render(this.stage)}get view(){return this.renderer.view}get screen(){return this.renderer.screen}destroy(e,t){const s=vn._plugins.slice(0);s.reverse(),s.forEach(i=>{i.destroy.call(this)}),this.stage.destroy(t),this.stage=null,this.renderer.destroy(e),this.renderer=null}};let bn=vn;bn._plugins=[],O.handleByList(P.Application,bn._plugins);class Tn{static init(t){Object.defineProperty(this,"resizeTo",{set(s){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=s,s&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{!this._resizeTo||(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let s,i;if(this._resizeTo===globalThis.window)s=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:r,clientHeight:n}=this._resizeTo;s=r,i=n}this.renderer.resize(s,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}Tn.extension=P.Application,O.add(Tn);const Va={loader:P.LoadParser,resolver:P.ResolveParser,cache:P.CacheParser,detection:P.DetectionParser};O.handle(P.Asset,e=>{const t=e.ref;Object.entries(Va).filter(([s])=>!!t[s]).forEach(([s,i])=>{var r;return O.add(Object.assign(t[s],{extension:(r=t[s].extension)!=null?r:i}))})},e=>{const t=e.ref;Object.keys(Va).filter(s=>!!t[s]).forEach(s=>O.remove(t[s]))});class Cu{constructor(t,s=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=s}add(t){t.forEach(s=>{this._assetList.push(s)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],s=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<s;i++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}function Ze(e,t){if(Array.isArray(t)){for(const s of t)if(e.startsWith(`data:${s}`))return!0;return!1}return e.startsWith(`data:${t}`)}function ye(e,t){const s=e.split("?")[0],i=vt.extname(s).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const ie=(e,t)=>(Array.isArray(e)||(e=[e]),t?e.map(s=>typeof s=="string"?t(s):s):e),Di=(e,t)=>{const s=t.split("?")[1];return s&&(e+=`?${s}`),e};function za(e,t,s,i,r){const n=t[s];for(let o=0;o<n.length;o++){const a=n[o];s<t.length-1?za(e.replace(i[s],a),t,s+1,i,r):r.push(e.replace(i[s],a))}}function Wa(e){const t=/\{(.*?)\}/g,s=e.match(t),i=[];if(s){const r=[];s.forEach(n=>{const o=n.substring(1,n.length-1).split(",");r.push(o)}),za(e,r,0,s,i)}else i.push(e);return i}const Ps=e=>!Array.isArray(e);class Ru{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const s=this._cache.get(t);return s||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),s}set(t,s){const i=ie(t);let r;for(let a=0;a<this.parsers.length;a++){const h=this.parsers[a];if(h.test(s)){r=h.getCacheableAssets(i,s);break}}r||(r={},i.forEach(a=>{r[a]=s}));const n=Object.keys(r),o={cacheKeys:n,keys:i};if(i.forEach(a=>{this._cacheMap.set(a,o)}),n.forEach(a=>{this._cache.has(a)&&this._cache.get(a)!==s&&console.warn("[Cache] already has key:",a),this._cache.set(a,r[a])}),s instanceof M){const a=s;i.forEach(h=>{a.baseTexture!==M.EMPTY.baseTexture&&X.addToCache(a.baseTexture,h),M.addToCache(a,h)})}}remove(t){if(this._cacheMap.get(t),!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);return}const s=this._cacheMap.get(t);s.cacheKeys.forEach(r=>{this._cache.delete(r)}),s.keys.forEach(r=>{this._cacheMap.delete(r)})}get parsers(){return this._parsers}}const Je=new Ru;class Iu{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,s,i)=>(this._parsersValidated=!1,t[s]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,s){const i={promise:null,parser:null};return i.promise=(async()=>{var o,a;let r=null,n=null;if(s.loadParser&&(n=this._parserHash[s.loadParser],n||console.warn(`[Assets] specified load parser "${s.loadParser}" not found while loading ${t}`)),!n){for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];if(l.load&&((o=l.test)==null?void 0:o.call(l,t,s,this))){n=l;break}}if(!n)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}r=await n.load(t,s,this),i.parser=n;for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];l.parse&&l.parse&&await((a=l.testParse)==null?void 0:a.call(l,r,s,this))&&(r=await l.parse(r,s,this)||r,i.parser=l)}return r})(),i}async load(t,s){this._parsersValidated||this._validateParsers();let i=0;const r={},n=Ps(t),o=ie(t,l=>({src:l})),a=o.length,h=o.map(async l=>{const c=vt.toAbsolute(l.src);if(!r[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),r[l.src]=await this.promiseCache[c].promise,s&&s(++i/a)}catch(u){throw delete this.promiseCache[c],delete r[l.src],new Error(`[Loader.load] Failed to load ${c}.
870
870
  ${u}`)}});return await Promise.all(h),n?r[o[0].src]:r}async unload(t){const i=ie(t,r=>({src:r})).map(async r=>{var a,h;const n=vt.toAbsolute(r.src),o=this.promiseCache[n];if(o){const l=await o.promise;(h=(a=o.parser)==null?void 0:a.unload)==null||h.call(a,l,r,this),delete this.promiseCache[n]}});await Promise.all(i)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,s)=>(t[s.name]&&console.warn(`[Assets] loadParser name conflict "${s.name}"`),as(yt({},t),{[s.name]:s})),{})}}var jt=(e=>(e[e.Low=0]="Low",e[e.Normal=1]="Normal",e[e.High=2]="High",e))(jt||{});const Pu=".json",Mu="application/json",$a={extension:{type:P.LoadParser,priority:jt.Low},name:"loadJson",test(e){return Ze(e,Mu)||ye(e,Pu)},async load(e){return await(await I.ADAPTER.fetch(e)).json()}};O.add($a);const Bu=".txt",Du="text/plain",ja={name:"loadTxt",extension:{type:P.LoadParser,priority:jt.Low},test(e){return Ze(e,Du)||ye(e,Bu)},async load(e){return await(await I.ADAPTER.fetch(e)).text()}};O.add(ja);const Nu=["normal","bold","100","200","300","400","500","600","700","800","900"],Fu=[".ttf",".otf",".woff",".woff2"],Lu=["font/ttf","font/otf","font/woff","font/woff2"];function Ya(e){const t=vt.extname(e);return vt.basename(e,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}const qa={extension:{type:P.LoadParser,priority:jt.Low},name:"loadWebFont",test(e){return Ze(e,Lu)||ye(e,Fu)},async load(e,t){var i,r,n,o,a,h;const s=I.ADAPTER.getFontFaceSet();if(s){const l=[],c=(r=(i=t.data)==null?void 0:i.family)!=null?r:Ya(e),u=(a=(o=(n=t.data)==null?void 0:n.weights)==null?void 0:o.filter(f=>Nu.includes(f)))!=null?a:["normal"],d=(h=t.data)!=null?h:{};for(let f=0;f<u.length;f++){const p=u[f],m=new FontFace(c,`url(${encodeURI(e)})`,as(yt({},d),{weight:p}));await m.load(),s.add(m),l.push(m)}return l.length===1?l[0]:l}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(e){(Array.isArray(e)?e:[e]).forEach(t=>I.ADAPTER.getFontFaceSet().delete(t))}};O.add(qa);let Ka=0,En;const Ou="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=",Uu={id:"checkImageBitmap",code:`
871
871
  async function checkImageBitmap()
872
872
  {