route-graphics 0.0.7 → 0.0.8

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.
@@ -1086,10 +1086,10 @@ fn mainFragment(
1086
1086
  cv = cu.value;
1087
1087
  v = uv["${r}"];
1088
1088
  ${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
1089
- `))}var FA=g(()=>{Mc();Ae();om();BA()});var Za,GA=g(()=>{C();FA();Za=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,r){let s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,r))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let r=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),r[e._key]=this._cache[s],r[e._key]}_generateUniformsSync(t,e){return IA(t,e)}_getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};Za.extension={type:[_.WebGLSystem],name:"uniformGroup"}});function UA(i){let t={};if(t.normal=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t.add=[i.ONE,i.ONE],t.multiply=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.screen=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t["screen-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.erase=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],!(i instanceof $.get().getWebGLRenderingContext()))t.min=[i.ONE,i.ONE,i.ONE,i.ONE,i.MIN,i.MIN],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,i.MAX,i.MAX];else{let r=i.getExtension("EXT_blend_minmax");r&&(t.min=[i.ONE,i.ONE,i.ONE,i.ONE,r.MIN_EXT,r.MIN_EXT],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,r.MAX_EXT,r.MAX_EXT])}return t}var kA=g(()=>{Mt()});var QB,JB,tI,eI,rI,iI,OA,LA,DA=g(()=>{C();gr();kA();QB=0,JB=1,tI=2,eI=3,rI=4,iI=5,OA=class wm{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[QB]=this.setBlend,this.map[JB]=this.setOffset,this.map[tI]=this.setCullFace,this.map[eI]=this.setDepthTest,this.map[rI]=this.setFrontFace,this.map[iI]=this.setDepthMask,this.checks=[],this.defaultState=Xt.for2d(),t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){this._invertFrontFace=!t.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(t){this.gl=t,this.blendModesMap=UA(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e>>=1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t||(t=this.defaultState);for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(wm._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(wm._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;let e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;let e=this.blendModesMap[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};OA.extension={type:[_.WebGLSystem],name:"state"};LA=OA});var $c,NA=g(()=>{xm();$c=class{constructor(t){this.target=gm.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=mt.UNSIGNED_BYTE,this.internalFormat=Lc.RGBA,this.format=Lc.RGBA,this.samplerType=0}}});var HA,VA=g(()=>{"use strict";HA={id:"buffer",upload(i,t,e){t.width===i.width||t.height===i.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,i.width,i.height,0,t.format,t.type,i.resource),t.width=i.width,t.height=i.height}}});var sI,WA,zA=g(()=>{"use strict";sI={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},WA={id:"compressed",upload(i,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let r=i.pixelWidth,s=i.pixelHeight,o=!!sI[i.format];for(let n=0;n<i.resource.length;n++){let a=i.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,t.format,t.type,a),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Xc,Cm=g(()=>{"use strict";Xc={id:"image",upload(i,t,e,r){let s=t.width,o=t.height,n=i.pixelWidth,a=i.pixelHeight,h=i.resourceWidth,l=i.resourceHeight;h<n||l<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),r===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,h,l,t.format,t.type,i.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource):r===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,i.resource),t.width=n,t.height=a}}});var $A,XA=g(()=>{Cm();$A={id:"video",upload(i,t,e,r){if(!i.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Xc.upload(i,t,e,r)}}});var Pm,jA,jc,YA,qA=g(()=>{"use strict";Pm={linear:9729,nearest:9728},jA={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},jc={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},YA={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Rm(i,t,e,r,s,o,n,a){let h=o;if(!a||i.addressModeU!=="repeat"||i.addressModeV!=="repeat"||i.addressModeW!=="repeat"){let l=jc[n?"clamp-to-edge":i.addressModeU],c=jc[n?"clamp-to-edge":i.addressModeV],u=jc[n?"clamp-to-edge":i.addressModeW];t[s](h,t.TEXTURE_WRAP_S,l),t[s](h,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](h,t.TEXTURE_WRAP_R,u)}if((!a||i.magFilter!=="linear")&&t[s](h,t.TEXTURE_MAG_FILTER,Pm[i.magFilter]),e){if(!a||i.mipmapFilter!=="linear"){let l=jA[i.minFilter][i.mipmapFilter];t[s](h,t.TEXTURE_MIN_FILTER,l)}}else t[s](h,t.TEXTURE_MIN_FILTER,Pm[i.minFilter]);if(r&&i.maxAnisotropy>1){let l=Math.min(i.maxAnisotropy,t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](h,r.TEXTURE_MAX_ANISOTROPY_EXT,l)}i.compare&&t[s](h,t.TEXTURE_COMPARE_FUNC,YA[i.compare])}var KA=g(()=>{qA()});function ZA(i){return{r8unorm:i.RED,r8snorm:i.RED,r8uint:i.RED,r8sint:i.RED,r16uint:i.RED,r16sint:i.RED,r16float:i.RED,rg8unorm:i.RG,rg8snorm:i.RG,rg8uint:i.RG,rg8sint:i.RG,r32uint:i.RED,r32sint:i.RED,r32float:i.RED,rg16uint:i.RG,rg16sint:i.RG,rg16float:i.RG,rgba8unorm:i.RGBA,"rgba8unorm-srgb":i.RGBA,rgba8snorm:i.RGBA,rgba8uint:i.RGBA,rgba8sint:i.RGBA,bgra8unorm:i.RGBA,"bgra8unorm-srgb":i.RGBA,rgb9e5ufloat:i.RGB,rgb10a2unorm:i.RGBA,rg11b10ufloat:i.RGB,rg32uint:i.RG,rg32sint:i.RG,rg32float:i.RG,rgba16uint:i.RGBA,rgba16sint:i.RGBA,rgba16float:i.RGBA,rgba32uint:i.RGBA,rgba32sint:i.RGBA,rgba32float:i.RGBA,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT,depth24plus:i.DEPTH_COMPONENT,"depth24plus-stencil8":i.DEPTH_STENCIL,depth32float:i.DEPTH_COMPONENT,"depth32float-stencil8":i.DEPTH_STENCIL}}var QA=g(()=>{"use strict"});function JA(i,t){let e={},r=i.RGBA;return i instanceof $.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":i.SRGB8_ALPHA8,"bgra8unorm-srgb":i.SRGB8_ALPHA8},r=i.RGBA8),{r8unorm:i.R8,r8snorm:i.R8_SNORM,r8uint:i.R8UI,r8sint:i.R8I,r16uint:i.R16UI,r16sint:i.R16I,r16float:i.R16F,rg8unorm:i.RG8,rg8snorm:i.RG8_SNORM,rg8uint:i.RG8UI,rg8sint:i.RG8I,r32uint:i.R32UI,r32sint:i.R32I,r32float:i.R32F,rg16uint:i.RG16UI,rg16sint:i.RG16I,rg16float:i.RG16F,rgba8unorm:i.RGBA,...e,rgba8snorm:i.RGBA8_SNORM,rgba8uint:i.RGBA8UI,rgba8sint:i.RGBA8I,bgra8unorm:r,rgb9e5ufloat:i.RGB9_E5,rgb10a2unorm:i.RGB10_A2,rg11b10ufloat:i.R11F_G11F_B10F,rg32uint:i.RG32UI,rg32sint:i.RG32I,rg32float:i.RG32F,rgba16uint:i.RGBA16UI,rgba16sint:i.RGBA16I,rgba16float:i.RGBA16F,rgba32uint:i.RGBA32UI,rgba32sint:i.RGBA32I,rgba32float:i.RGBA32F,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT16,depth24plus:i.DEPTH_COMPONENT24,"depth24plus-stencil8":i.DEPTH24_STENCIL8,depth32float:i.DEPTH_COMPONENT32F,"depth32float-stencil8":i.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var tw=g(()=>{Mt()});function ew(i){return{r8unorm:i.UNSIGNED_BYTE,r8snorm:i.BYTE,r8uint:i.UNSIGNED_BYTE,r8sint:i.BYTE,r16uint:i.UNSIGNED_SHORT,r16sint:i.SHORT,r16float:i.HALF_FLOAT,rg8unorm:i.UNSIGNED_BYTE,rg8snorm:i.BYTE,rg8uint:i.UNSIGNED_BYTE,rg8sint:i.BYTE,r32uint:i.UNSIGNED_INT,r32sint:i.INT,r32float:i.FLOAT,rg16uint:i.UNSIGNED_SHORT,rg16sint:i.SHORT,rg16float:i.HALF_FLOAT,rgba8unorm:i.UNSIGNED_BYTE,"rgba8unorm-srgb":i.UNSIGNED_BYTE,rgba8snorm:i.BYTE,rgba8uint:i.UNSIGNED_BYTE,rgba8sint:i.BYTE,bgra8unorm:i.UNSIGNED_BYTE,"bgra8unorm-srgb":i.UNSIGNED_BYTE,rgb9e5ufloat:i.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:i.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:i.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:i.UNSIGNED_INT,rg32sint:i.INT,rg32float:i.FLOAT,rgba16uint:i.UNSIGNED_SHORT,rgba16sint:i.SHORT,rgba16float:i.HALF_FLOAT,rgba32uint:i.UNSIGNED_INT,rgba32sint:i.INT,rgba32float:i.FLOAT,stencil8:i.UNSIGNED_BYTE,depth16unorm:i.UNSIGNED_SHORT,depth24plus:i.UNSIGNED_INT,"depth24plus-stencil8":i.UNSIGNED_INT_24_8,depth32float:i.FLOAT,"depth32float-stencil8":i.FLOAT_32_UNSIGNED_INT_24_8_REV}}var rw=g(()=>{"use strict"});var oI,Qa,iw=g(()=>{Mt();C();bt();NA();VA();zA();Cm();XA();KA();QA();tw();rw();oI=4,Qa=class{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:Xc,buffer:HA,video:$A,compressed:WA},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=JA(t,this._renderer.context.extensions),this._mapFormatToType=ew(t),this._mapFormatToFormat=ZA(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(E.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let r=t.source;t?(this.bindSource(r,e),this._useSeparateSamplers&&this._bindSampler(r.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let r=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=E.EMPTY.source);let s=this.getGlSource(t);r.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let r=this._gl;if(!t){this._boundSamplers[e]=null,r.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,r.bindSampler(e,s))}unbind(t){let e=t.source,r=this._boundTextures,s=this._gl;for(let o=0;o<r.length;o++)if(r[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),r[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,r=new $c(e.createTexture());if(r.type=this._mapFormatToType[t.format],r.internalFormat=this._mapFormatToInternalFormat[t.format],r.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=r,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),r}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let r=this._gl,s=this.getGlSource(t);r.bindTexture(r.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,Rm(t.style,r,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,r=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=t;let s=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,r,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);let r=this.getGlSource(t);this._gl.generateMipmap(r.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){let e=this._gl,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,Rm(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:r,height:s}=this.getPixels(t),o=$.get().createCanvas();o.width=r,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(r,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,r=t.frame,s=Math.max(Math.round(r.width*e),1),o=Math.max(Math.round(r.height*e),1),n=new Uint8Array(oI*s*o),a=this._renderer,h=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(h),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,l.resolveTargetFramebuffer),c.readPixels(Math.round(r.x*e),Math.round(r.y*e),s,o,c.RGBA,c.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(E.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};Qa.extension={type:[_.WebGLSystem],name:"texture"}});var aw={};nx(aw,{WebGLRenderer:()=>Mm});var nI,aI,hI,sw,ow,nw,Mm,hw=g(()=>{C();OE();LE();DE();sa();rm();Br();VE();$E();qE();QE();JE();tA();eA();aA();cA();PA();GA();DA();iw();nI=[...Cc,Ya,ZE,zE,Wa,Qa,qa,za,Za,Ka,Xa,LA,ja,$a],aI=[...Pc],hI=[Ha,Na,Da],sw=[],ow=[],nw=[];G.handleByNamedList(_.WebGLSystem,sw);G.handleByNamedList(_.WebGLPipes,ow);G.handleByNamedList(_.WebGLPipesAdaptor,nw);G.add(...nI,...aI,...hI);Mm=class extends Ai{constructor(){let t={name:"webgl",type:Qt.WEBGL,systems:sw,renderPipes:ow,renderPipeAdaptors:nw};super(t)}}});var h1=K((wnt,Wm)=>{"use strict";var oF=Object.prototype.hasOwnProperty,Re="~";function sh(){}Object.create&&(sh.prototype=Object.create(null),new sh().__proto__||(Re=!1));function nF(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function a1(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new nF(e,r||i,s),n=Re?Re+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function su(i,t){--i._eventsCount===0?i._events=new sh:delete i._events[t]}function be(){this._events=new sh,this._eventsCount=0}be.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)oF.call(e,r)&&t.push(Re?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};be.prototype.listeners=function(t){var e=Re?Re+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};be.prototype.listenerCount=function(t){var e=Re?Re+t:t,r=this._events[e];return r?r.fn?1:r.length:0};be.prototype.emit=function(t,e,r,s,o,n){var a=Re?Re+t:t;if(!this._events[a])return!1;var h=this._events[a],l=arguments.length,c,u;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),l){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,r),!0;case 4:return h.fn.call(h.context,e,r,s),!0;case 5:return h.fn.call(h.context,e,r,s,o),!0;case 6:return h.fn.call(h.context,e,r,s,o,n),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];h.fn.apply(h.context,c)}else{var d=h.length,f;for(u=0;u<d;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,!0),l){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,r);break;case 4:h[u].fn.call(h[u].context,e,r,s);break;default:if(!c)for(f=1,c=new Array(l-1);f<l;f++)c[f-1]=arguments[f];h[u].fn.apply(h[u].context,c)}}return!0};be.prototype.on=function(t,e,r){return a1(this,t,e,r,!1)};be.prototype.once=function(t,e,r){return a1(this,t,e,r,!0)};be.prototype.removeListener=function(t,e,r,s){var o=Re?Re+t:t;if(!this._events[o])return this;if(!e)return su(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&su(this,o);else{for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:su(this,o)}return this};be.prototype.removeAllListeners=function(t){var e;return t?(e=Re?Re+t:t,this._events[e]&&su(this,e)):(this._events=new sh,this._eventsCount=0),this};be.prototype.off=be.prototype.removeListener;be.prototype.addListener=be.prototype.on;be.prefixed=Re;be.EventEmitter=be;typeof Wm<"u"&&(Wm.exports=be)});var l1=K((Mo,Bo)=>{(function(i){var t=typeof Mo=="object"&&Mo&&!Mo.nodeType&&Mo,e=typeof Bo=="object"&&Bo&&!Bo.nodeType&&Bo,r=typeof global=="object"&&global;(r.global===r||r.window===r||r.self===r)&&(i=r);var s,o=2147483647,n=36,a=1,h=26,l=38,c=700,u=72,d=128,f="-",p=/^xn--/,m=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=n-a,b=Math.floor,T=String.fromCharCode,w;function S(D){throw new RangeError(v[D])}function A(D,k){for(var tt=D.length,pt=[];tt--;)pt[tt]=k(D[tt]);return pt}function R(D,k){var tt=D.split("@"),pt="";tt.length>1&&(pt=tt[0]+"@",D=tt[1]),D=D.replace(x,".");var dt=D.split("."),Ut=A(dt,k).join(".");return pt+Ut}function I(D){for(var k=[],tt=0,pt=D.length,dt,Ut;tt<pt;)dt=D.charCodeAt(tt++),dt>=55296&&dt<=56319&&tt<pt?(Ut=D.charCodeAt(tt++),(Ut&64512)==56320?k.push(((dt&1023)<<10)+(Ut&1023)+65536):(k.push(dt),tt--)):k.push(dt);return k}function P(D){return A(D,function(k){var tt="";return k>65535&&(k-=65536,tt+=T(k>>>10&1023|55296),k=56320|k&1023),tt+=T(k),tt}).join("")}function B(D){return D-48<10?D-22:D-65<26?D-65:D-97<26?D-97:n}function W(D,k){return D+22+75*(D<26)-((k!=0)<<5)}function N(D,k,tt){var pt=0;for(D=tt?b(D/c):D>>1,D+=b(D/k);D>y*h>>1;pt+=n)D=b(D/y);return b(pt+(y+1)*D/(D+l))}function nt(D){var k=[],tt=D.length,pt,dt=0,Ut=d,Ht=u,qt,Kt,Tt,St,at,Rt,re,$t,ae;for(qt=D.lastIndexOf(f),qt<0&&(qt=0),Kt=0;Kt<qt;++Kt)D.charCodeAt(Kt)>=128&&S("not-basic"),k.push(D.charCodeAt(Kt));for(Tt=qt>0?qt+1:0;Tt<tt;){for(St=dt,at=1,Rt=n;Tt>=tt&&S("invalid-input"),re=B(D.charCodeAt(Tt++)),(re>=n||re>b((o-dt)/at))&&S("overflow"),dt+=re*at,$t=Rt<=Ht?a:Rt>=Ht+h?h:Rt-Ht,!(re<$t);Rt+=n)ae=n-$t,at>b(o/ae)&&S("overflow"),at*=ae;pt=k.length+1,Ht=N(dt-St,pt,St==0),b(dt/pt)>o-Ut&&S("overflow"),Ut+=b(dt/pt),dt%=pt,k.splice(dt++,0,Ut)}return P(k)}function j(D){var k,tt,pt,dt,Ut,Ht,qt,Kt,Tt,St,at,Rt=[],re,$t,ae,ur;for(D=I(D),re=D.length,k=d,tt=0,Ut=u,Ht=0;Ht<re;++Ht)at=D[Ht],at<128&&Rt.push(T(at));for(pt=dt=Rt.length,dt&&Rt.push(f);pt<re;){for(qt=o,Ht=0;Ht<re;++Ht)at=D[Ht],at>=k&&at<qt&&(qt=at);for($t=pt+1,qt-k>b((o-tt)/$t)&&S("overflow"),tt+=(qt-k)*$t,k=qt,Ht=0;Ht<re;++Ht)if(at=D[Ht],at<k&&++tt>o&&S("overflow"),at==k){for(Kt=tt,Tt=n;St=Tt<=Ut?a:Tt>=Ut+h?h:Tt-Ut,!(Kt<St);Tt+=n)ur=Kt-St,ae=n-St,Rt.push(T(W(St+ur%ae,0))),Kt=b(ur/ae);Rt.push(T(W(Kt,0))),Ut=N(tt,$t,pt==dt),tt=0,++pt}++tt,++k}return Rt.join("")}function F(D){return R(D,function(k){return p.test(k)?nt(k.slice(4).toLowerCase()):k})}function H(D){return R(D,function(k){return m.test(k)?"xn--"+j(k):k})}if(s={version:"1.4.1",ucs2:{decode:I,encode:P},decode:nt,encode:j,toASCII:H,toUnicode:F},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(t&&e)if(Bo.exports==t)e.exports=s;else for(w in s)s.hasOwnProperty(w)&&(t[w]=s[w]);else i.punycode=s})(Mo)});var is=K((Cnt,c1)=>{"use strict";c1.exports=TypeError});var u1=K(()=>{});var lh=K((Mnt,B1)=>{var Jm=typeof Map=="function"&&Map.prototype,zm=Object.getOwnPropertyDescriptor&&Jm?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,nu=Jm&&zm&&typeof zm.get=="function"?zm.get:null,d1=Jm&&Map.prototype.forEach,tg=typeof Set=="function"&&Set.prototype,$m=Object.getOwnPropertyDescriptor&&tg?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,au=tg&&$m&&typeof $m.get=="function"?$m.get:null,f1=tg&&Set.prototype.forEach,aF=typeof WeakMap=="function"&&WeakMap.prototype,nh=aF?WeakMap.prototype.has:null,hF=typeof WeakSet=="function"&&WeakSet.prototype,ah=hF?WeakSet.prototype.has:null,lF=typeof WeakRef=="function"&&WeakRef.prototype,p1=lF?WeakRef.prototype.deref:null,cF=Boolean.prototype.valueOf,uF=Object.prototype.toString,dF=Function.prototype.toString,fF=String.prototype.match,eg=String.prototype.slice,Ri=String.prototype.replace,pF=String.prototype.toUpperCase,m1=String.prototype.toLowerCase,E1=RegExp.prototype.test,g1=Array.prototype.concat,kr=Array.prototype.join,mF=Array.prototype.slice,x1=Math.floor,Ym=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Xm=Object.getOwnPropertySymbols,qm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Io=typeof Symbol=="function"&&typeof Symbol.iterator=="object",hh=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Io||!0)?Symbol.toStringTag:null,A1=Object.prototype.propertyIsEnumerable,_1=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(i){return i.__proto__}:null);function y1(i,t){if(i===1/0||i===-1/0||i!==i||i&&i>-1e3&&i<1e3||E1.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof i=="number"){var r=i<0?-x1(-i):x1(i);if(r!==i){var s=String(r),o=eg.call(t,s.length+1);return Ri.call(s,e,"$&_")+"."+Ri.call(Ri.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Ri.call(t,e,"$&_")}var Km=u1(),b1=Km.custom,v1=P1(b1)?b1:null,w1={__proto__:null,double:'"',single:"'"},gF={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};B1.exports=function i(t,e,r,s){var o=e||{};if(ii(o,"quoteStyle")&&!ii(w1,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ii(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var n=ii(o,"customInspect")?o.customInspect:!0;if(typeof n!="boolean"&&n!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ii(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ii(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return M1(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?y1(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?y1(t,l):l}var c=typeof o.depth>"u"?5:o.depth;if(typeof r>"u"&&(r=0),r>=c&&c>0&&typeof t=="object")return Zm(t)?"[Array]":"[Object]";var u=GF(o,r);if(typeof s>"u")s=[];else if(R1(s,t)>=0)return"[Circular]";function d(N,nt,j){if(nt&&(s=mF.call(s),s.push(nt)),j){var F={depth:o.depth};return ii(o,"quoteStyle")&&(F.quoteStyle=o.quoteStyle),i(N,F,r+1,s)}return i(N,o,r+1,s)}if(typeof t=="function"&&!T1(t)){var f=AF(t),p=ou(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+kr.call(p,", ")+" }":"")}if(P1(t)){var m=Io?Ri.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):qm.call(t);return typeof t=="object"&&!Io?oh(m):m}if(BF(t)){for(var x="<"+m1.call(String(t.nodeName)),v=t.attributes||[],y=0;y<v.length;y++)x+=" "+v[y].name+"="+C1(xF(v[y].value),"double",o);return x+=">",t.childNodes&&t.childNodes.length&&(x+="..."),x+="</"+m1.call(String(t.nodeName))+">",x}if(Zm(t)){if(t.length===0)return"[]";var b=ou(t,d);return u&&!FF(b)?"["+Qm(b,u)+"]":"[ "+kr.call(b,", ")+" ]"}if(yF(t)){var T=ou(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!A1.call(t,"cause")?"{ ["+String(t)+"] "+kr.call(g1.call("[cause]: "+d(t.cause),T),", ")+" }":T.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+kr.call(T,", ")+" }"}if(typeof t=="object"&&n){if(v1&&typeof t[v1]=="function"&&Km)return Km(t,{depth:c-r});if(n!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(wF(t)){var w=[];return d1&&d1.call(t,function(N,nt){w.push(d(nt,t,!0)+" => "+d(N,t))}),S1("Map",nu.call(t),w,u)}if(RF(t)){var S=[];return f1&&f1.call(t,function(N){S.push(d(N,t))}),S1("Set",au.call(t),S,u)}if(CF(t))return jm("WeakMap");if(MF(t))return jm("WeakSet");if(PF(t))return jm("WeakRef");if(vF(t))return oh(d(Number(t)));if(SF(t))return oh(d(Ym.call(t)));if(TF(t))return oh(cF.call(t));if(bF(t))return oh(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof global<"u"&&t===global)return"{ [object globalThis] }";if(!_F(t)&&!T1(t)){var A=ou(t,d),R=_1?_1(t)===Object.prototype:t instanceof Object||t.constructor===Object,I=t instanceof Object?"":"null prototype",P=!R&&hh&&Object(t)===t&&hh in t?eg.call(Mi(t),8,-1):I?"Object":"",B=R||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",W=B+(P||I?"["+kr.call(g1.call([],P||[],I||[]),": ")+"] ":"");return A.length===0?W+"{}":u?W+"{"+Qm(A,u)+"}":W+"{ "+kr.call(A,", ")+" }"}return String(t)};function C1(i,t,e){var r=e.quoteStyle||t,s=w1[r];return s+i+s}function xF(i){return Ri.call(String(i),/"/g,"&quot;")}function ss(i){return!hh||!(typeof i=="object"&&(hh in i||typeof i[hh]<"u"))}function Zm(i){return Mi(i)==="[object Array]"&&ss(i)}function _F(i){return Mi(i)==="[object Date]"&&ss(i)}function T1(i){return Mi(i)==="[object RegExp]"&&ss(i)}function yF(i){return Mi(i)==="[object Error]"&&ss(i)}function bF(i){return Mi(i)==="[object String]"&&ss(i)}function vF(i){return Mi(i)==="[object Number]"&&ss(i)}function TF(i){return Mi(i)==="[object Boolean]"&&ss(i)}function P1(i){if(Io)return i&&typeof i=="object"&&i instanceof Symbol;if(typeof i=="symbol")return!0;if(!i||typeof i!="object"||!qm)return!1;try{return qm.call(i),!0}catch{}return!1}function SF(i){if(!i||typeof i!="object"||!Ym)return!1;try{return Ym.call(i),!0}catch{}return!1}var EF=Object.prototype.hasOwnProperty||function(i){return i in this};function ii(i,t){return EF.call(i,t)}function Mi(i){return uF.call(i)}function AF(i){if(i.name)return i.name;var t=fF.call(dF.call(i),/^function\s*([\w$]+)/);return t?t[1]:null}function R1(i,t){if(i.indexOf)return i.indexOf(t);for(var e=0,r=i.length;e<r;e++)if(i[e]===t)return e;return-1}function wF(i){if(!nu||!i||typeof i!="object")return!1;try{nu.call(i);try{au.call(i)}catch{return!0}return i instanceof Map}catch{}return!1}function CF(i){if(!nh||!i||typeof i!="object")return!1;try{nh.call(i,nh);try{ah.call(i,ah)}catch{return!0}return i instanceof WeakMap}catch{}return!1}function PF(i){if(!p1||!i||typeof i!="object")return!1;try{return p1.call(i),!0}catch{}return!1}function RF(i){if(!au||!i||typeof i!="object")return!1;try{au.call(i);try{nu.call(i)}catch{return!0}return i instanceof Set}catch{}return!1}function MF(i){if(!ah||!i||typeof i!="object")return!1;try{ah.call(i,ah);try{nh.call(i,nh)}catch{return!0}return i instanceof WeakSet}catch{}return!1}function BF(i){return!i||typeof i!="object"?!1:typeof HTMLElement<"u"&&i instanceof HTMLElement?!0:typeof i.nodeName=="string"&&typeof i.getAttribute=="function"}function M1(i,t){if(i.length>t.maxStringLength){var e=i.length-t.maxStringLength,r="... "+e+" more character"+(e>1?"s":"");return M1(eg.call(i,0,t.maxStringLength),t)+r}var s=gF[t.quoteStyle||"single"];s.lastIndex=0;var o=Ri.call(Ri.call(i,s,"\\$1"),/[\x00-\x1f]/g,IF);return C1(o,"single",t)}function IF(i){var t=i.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+pF.call(t.toString(16))}function oh(i){return"Object("+i+")"}function jm(i){return i+" { ? }"}function S1(i,t,e,r){var s=r?Qm(e,r):kr.call(e,", ");return i+" ("+t+") {"+s+"}"}function FF(i){for(var t=0;t<i.length;t++)if(R1(i[t],`
1089
+ `))}var FA=g(()=>{Mc();Ae();om();BA()});var Za,GA=g(()=>{C();FA();Za=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,r){let s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,r))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let r=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),r[e._key]=this._cache[s],r[e._key]}_generateUniformsSync(t,e){return IA(t,e)}_getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};Za.extension={type:[_.WebGLSystem],name:"uniformGroup"}});function UA(i){let t={};if(t.normal=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t.add=[i.ONE,i.ONE],t.multiply=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.screen=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t["screen-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.erase=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],!(i instanceof $.get().getWebGLRenderingContext()))t.min=[i.ONE,i.ONE,i.ONE,i.ONE,i.MIN,i.MIN],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,i.MAX,i.MAX];else{let r=i.getExtension("EXT_blend_minmax");r&&(t.min=[i.ONE,i.ONE,i.ONE,i.ONE,r.MIN_EXT,r.MIN_EXT],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,r.MAX_EXT,r.MAX_EXT])}return t}var kA=g(()=>{Mt()});var QB,JB,tI,eI,rI,iI,OA,LA,DA=g(()=>{C();gr();kA();QB=0,JB=1,tI=2,eI=3,rI=4,iI=5,OA=class wm{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[QB]=this.setBlend,this.map[JB]=this.setOffset,this.map[tI]=this.setCullFace,this.map[eI]=this.setDepthTest,this.map[rI]=this.setFrontFace,this.map[iI]=this.setDepthMask,this.checks=[],this.defaultState=Xt.for2d(),t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){this._invertFrontFace=!t.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(t){this.gl=t,this.blendModesMap=UA(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e>>=1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t||(t=this.defaultState);for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(wm._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(wm._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;let e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;let e=this.blendModesMap[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};OA.extension={type:[_.WebGLSystem],name:"state"};LA=OA});var $c,NA=g(()=>{xm();$c=class{constructor(t){this.target=gm.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=mt.UNSIGNED_BYTE,this.internalFormat=Lc.RGBA,this.format=Lc.RGBA,this.samplerType=0}}});var HA,VA=g(()=>{"use strict";HA={id:"buffer",upload(i,t,e){t.width===i.width||t.height===i.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,i.width,i.height,0,t.format,t.type,i.resource),t.width=i.width,t.height=i.height}}});var sI,WA,zA=g(()=>{"use strict";sI={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},WA={id:"compressed",upload(i,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let r=i.pixelWidth,s=i.pixelHeight,o=!!sI[i.format];for(let n=0;n<i.resource.length;n++){let a=i.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,t.format,t.type,a),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Xc,Cm=g(()=>{"use strict";Xc={id:"image",upload(i,t,e,r){let s=t.width,o=t.height,n=i.pixelWidth,a=i.pixelHeight,h=i.resourceWidth,l=i.resourceHeight;h<n||l<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),r===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,h,l,t.format,t.type,i.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource):r===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,i.resource),t.width=n,t.height=a}}});var $A,XA=g(()=>{Cm();$A={id:"video",upload(i,t,e,r){if(!i.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Xc.upload(i,t,e,r)}}});var Pm,jA,jc,YA,qA=g(()=>{"use strict";Pm={linear:9729,nearest:9728},jA={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},jc={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},YA={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Rm(i,t,e,r,s,o,n,a){let h=o;if(!a||i.addressModeU!=="repeat"||i.addressModeV!=="repeat"||i.addressModeW!=="repeat"){let l=jc[n?"clamp-to-edge":i.addressModeU],c=jc[n?"clamp-to-edge":i.addressModeV],u=jc[n?"clamp-to-edge":i.addressModeW];t[s](h,t.TEXTURE_WRAP_S,l),t[s](h,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](h,t.TEXTURE_WRAP_R,u)}if((!a||i.magFilter!=="linear")&&t[s](h,t.TEXTURE_MAG_FILTER,Pm[i.magFilter]),e){if(!a||i.mipmapFilter!=="linear"){let l=jA[i.minFilter][i.mipmapFilter];t[s](h,t.TEXTURE_MIN_FILTER,l)}}else t[s](h,t.TEXTURE_MIN_FILTER,Pm[i.minFilter]);if(r&&i.maxAnisotropy>1){let l=Math.min(i.maxAnisotropy,t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](h,r.TEXTURE_MAX_ANISOTROPY_EXT,l)}i.compare&&t[s](h,t.TEXTURE_COMPARE_FUNC,YA[i.compare])}var KA=g(()=>{qA()});function ZA(i){return{r8unorm:i.RED,r8snorm:i.RED,r8uint:i.RED,r8sint:i.RED,r16uint:i.RED,r16sint:i.RED,r16float:i.RED,rg8unorm:i.RG,rg8snorm:i.RG,rg8uint:i.RG,rg8sint:i.RG,r32uint:i.RED,r32sint:i.RED,r32float:i.RED,rg16uint:i.RG,rg16sint:i.RG,rg16float:i.RG,rgba8unorm:i.RGBA,"rgba8unorm-srgb":i.RGBA,rgba8snorm:i.RGBA,rgba8uint:i.RGBA,rgba8sint:i.RGBA,bgra8unorm:i.RGBA,"bgra8unorm-srgb":i.RGBA,rgb9e5ufloat:i.RGB,rgb10a2unorm:i.RGBA,rg11b10ufloat:i.RGB,rg32uint:i.RG,rg32sint:i.RG,rg32float:i.RG,rgba16uint:i.RGBA,rgba16sint:i.RGBA,rgba16float:i.RGBA,rgba32uint:i.RGBA,rgba32sint:i.RGBA,rgba32float:i.RGBA,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT,depth24plus:i.DEPTH_COMPONENT,"depth24plus-stencil8":i.DEPTH_STENCIL,depth32float:i.DEPTH_COMPONENT,"depth32float-stencil8":i.DEPTH_STENCIL}}var QA=g(()=>{"use strict"});function JA(i,t){let e={},r=i.RGBA;return i instanceof $.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":i.SRGB8_ALPHA8,"bgra8unorm-srgb":i.SRGB8_ALPHA8},r=i.RGBA8),{r8unorm:i.R8,r8snorm:i.R8_SNORM,r8uint:i.R8UI,r8sint:i.R8I,r16uint:i.R16UI,r16sint:i.R16I,r16float:i.R16F,rg8unorm:i.RG8,rg8snorm:i.RG8_SNORM,rg8uint:i.RG8UI,rg8sint:i.RG8I,r32uint:i.R32UI,r32sint:i.R32I,r32float:i.R32F,rg16uint:i.RG16UI,rg16sint:i.RG16I,rg16float:i.RG16F,rgba8unorm:i.RGBA,...e,rgba8snorm:i.RGBA8_SNORM,rgba8uint:i.RGBA8UI,rgba8sint:i.RGBA8I,bgra8unorm:r,rgb9e5ufloat:i.RGB9_E5,rgb10a2unorm:i.RGB10_A2,rg11b10ufloat:i.R11F_G11F_B10F,rg32uint:i.RG32UI,rg32sint:i.RG32I,rg32float:i.RG32F,rgba16uint:i.RGBA16UI,rgba16sint:i.RGBA16I,rgba16float:i.RGBA16F,rgba32uint:i.RGBA32UI,rgba32sint:i.RGBA32I,rgba32float:i.RGBA32F,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT16,depth24plus:i.DEPTH_COMPONENT24,"depth24plus-stencil8":i.DEPTH24_STENCIL8,depth32float:i.DEPTH_COMPONENT32F,"depth32float-stencil8":i.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var tw=g(()=>{Mt()});function ew(i){return{r8unorm:i.UNSIGNED_BYTE,r8snorm:i.BYTE,r8uint:i.UNSIGNED_BYTE,r8sint:i.BYTE,r16uint:i.UNSIGNED_SHORT,r16sint:i.SHORT,r16float:i.HALF_FLOAT,rg8unorm:i.UNSIGNED_BYTE,rg8snorm:i.BYTE,rg8uint:i.UNSIGNED_BYTE,rg8sint:i.BYTE,r32uint:i.UNSIGNED_INT,r32sint:i.INT,r32float:i.FLOAT,rg16uint:i.UNSIGNED_SHORT,rg16sint:i.SHORT,rg16float:i.HALF_FLOAT,rgba8unorm:i.UNSIGNED_BYTE,"rgba8unorm-srgb":i.UNSIGNED_BYTE,rgba8snorm:i.BYTE,rgba8uint:i.UNSIGNED_BYTE,rgba8sint:i.BYTE,bgra8unorm:i.UNSIGNED_BYTE,"bgra8unorm-srgb":i.UNSIGNED_BYTE,rgb9e5ufloat:i.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:i.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:i.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:i.UNSIGNED_INT,rg32sint:i.INT,rg32float:i.FLOAT,rgba16uint:i.UNSIGNED_SHORT,rgba16sint:i.SHORT,rgba16float:i.HALF_FLOAT,rgba32uint:i.UNSIGNED_INT,rgba32sint:i.INT,rgba32float:i.FLOAT,stencil8:i.UNSIGNED_BYTE,depth16unorm:i.UNSIGNED_SHORT,depth24plus:i.UNSIGNED_INT,"depth24plus-stencil8":i.UNSIGNED_INT_24_8,depth32float:i.FLOAT,"depth32float-stencil8":i.FLOAT_32_UNSIGNED_INT_24_8_REV}}var rw=g(()=>{"use strict"});var oI,Qa,iw=g(()=>{Mt();C();bt();NA();VA();zA();Cm();XA();KA();QA();tw();rw();oI=4,Qa=class{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:Xc,buffer:HA,video:$A,compressed:WA},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=JA(t,this._renderer.context.extensions),this._mapFormatToType=ew(t),this._mapFormatToFormat=ZA(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(E.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let r=t.source;t?(this.bindSource(r,e),this._useSeparateSamplers&&this._bindSampler(r.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let r=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=E.EMPTY.source);let s=this.getGlSource(t);r.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let r=this._gl;if(!t){this._boundSamplers[e]=null,r.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,r.bindSampler(e,s))}unbind(t){let e=t.source,r=this._boundTextures,s=this._gl;for(let o=0;o<r.length;o++)if(r[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),r[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,r=new $c(e.createTexture());if(r.type=this._mapFormatToType[t.format],r.internalFormat=this._mapFormatToInternalFormat[t.format],r.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=r,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),r}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let r=this._gl,s=this.getGlSource(t);r.bindTexture(r.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,Rm(t.style,r,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,r=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=t;let s=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,r,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);let r=this.getGlSource(t);this._gl.generateMipmap(r.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){let e=this._gl,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,Rm(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:r,height:s}=this.getPixels(t),o=$.get().createCanvas();o.width=r,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(r,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,r=t.frame,s=Math.max(Math.round(r.width*e),1),o=Math.max(Math.round(r.height*e),1),n=new Uint8Array(oI*s*o),a=this._renderer,h=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(h),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,l.resolveTargetFramebuffer),c.readPixels(Math.round(r.x*e),Math.round(r.y*e),s,o,c.RGBA,c.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(E.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};Qa.extension={type:[_.WebGLSystem],name:"texture"}});var aw={};nx(aw,{WebGLRenderer:()=>Mm});var nI,aI,hI,sw,ow,nw,Mm,hw=g(()=>{C();OE();LE();DE();sa();rm();Br();VE();$E();qE();QE();JE();tA();eA();aA();cA();PA();GA();DA();iw();nI=[...Cc,Ya,ZE,zE,Wa,Qa,qa,za,Za,Ka,Xa,LA,ja,$a],aI=[...Pc],hI=[Ha,Na,Da],sw=[],ow=[],nw=[];G.handleByNamedList(_.WebGLSystem,sw);G.handleByNamedList(_.WebGLPipes,ow);G.handleByNamedList(_.WebGLPipesAdaptor,nw);G.add(...nI,...aI,...hI);Mm=class extends Ai{constructor(){let t={name:"webgl",type:Qt.WEBGL,systems:sw,renderPipes:ow,renderPipeAdaptors:nw};super(t)}}});var h1=K((Cnt,Wm)=>{"use strict";var oF=Object.prototype.hasOwnProperty,Re="~";function sh(){}Object.create&&(sh.prototype=Object.create(null),new sh().__proto__||(Re=!1));function nF(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function a1(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new nF(e,r||i,s),n=Re?Re+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function su(i,t){--i._eventsCount===0?i._events=new sh:delete i._events[t]}function be(){this._events=new sh,this._eventsCount=0}be.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)oF.call(e,r)&&t.push(Re?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};be.prototype.listeners=function(t){var e=Re?Re+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};be.prototype.listenerCount=function(t){var e=Re?Re+t:t,r=this._events[e];return r?r.fn?1:r.length:0};be.prototype.emit=function(t,e,r,s,o,n){var a=Re?Re+t:t;if(!this._events[a])return!1;var h=this._events[a],l=arguments.length,c,u;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),l){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,r),!0;case 4:return h.fn.call(h.context,e,r,s),!0;case 5:return h.fn.call(h.context,e,r,s,o),!0;case 6:return h.fn.call(h.context,e,r,s,o,n),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];h.fn.apply(h.context,c)}else{var d=h.length,f;for(u=0;u<d;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,!0),l){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,r);break;case 4:h[u].fn.call(h[u].context,e,r,s);break;default:if(!c)for(f=1,c=new Array(l-1);f<l;f++)c[f-1]=arguments[f];h[u].fn.apply(h[u].context,c)}}return!0};be.prototype.on=function(t,e,r){return a1(this,t,e,r,!1)};be.prototype.once=function(t,e,r){return a1(this,t,e,r,!0)};be.prototype.removeListener=function(t,e,r,s){var o=Re?Re+t:t;if(!this._events[o])return this;if(!e)return su(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&su(this,o);else{for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:su(this,o)}return this};be.prototype.removeAllListeners=function(t){var e;return t?(e=Re?Re+t:t,this._events[e]&&su(this,e)):(this._events=new sh,this._eventsCount=0),this};be.prototype.off=be.prototype.removeListener;be.prototype.addListener=be.prototype.on;be.prefixed=Re;be.EventEmitter=be;typeof Wm<"u"&&(Wm.exports=be)});var l1=K((Mo,Bo)=>{(function(i){var t=typeof Mo=="object"&&Mo&&!Mo.nodeType&&Mo,e=typeof Bo=="object"&&Bo&&!Bo.nodeType&&Bo,r=typeof global=="object"&&global;(r.global===r||r.window===r||r.self===r)&&(i=r);var s,o=2147483647,n=36,a=1,h=26,l=38,c=700,u=72,d=128,f="-",p=/^xn--/,m=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=n-a,b=Math.floor,T=String.fromCharCode,w;function S(D){throw new RangeError(v[D])}function A(D,k){for(var tt=D.length,pt=[];tt--;)pt[tt]=k(D[tt]);return pt}function R(D,k){var tt=D.split("@"),pt="";tt.length>1&&(pt=tt[0]+"@",D=tt[1]),D=D.replace(x,".");var dt=D.split("."),Ut=A(dt,k).join(".");return pt+Ut}function I(D){for(var k=[],tt=0,pt=D.length,dt,Ut;tt<pt;)dt=D.charCodeAt(tt++),dt>=55296&&dt<=56319&&tt<pt?(Ut=D.charCodeAt(tt++),(Ut&64512)==56320?k.push(((dt&1023)<<10)+(Ut&1023)+65536):(k.push(dt),tt--)):k.push(dt);return k}function P(D){return A(D,function(k){var tt="";return k>65535&&(k-=65536,tt+=T(k>>>10&1023|55296),k=56320|k&1023),tt+=T(k),tt}).join("")}function B(D){return D-48<10?D-22:D-65<26?D-65:D-97<26?D-97:n}function W(D,k){return D+22+75*(D<26)-((k!=0)<<5)}function N(D,k,tt){var pt=0;for(D=tt?b(D/c):D>>1,D+=b(D/k);D>y*h>>1;pt+=n)D=b(D/y);return b(pt+(y+1)*D/(D+l))}function nt(D){var k=[],tt=D.length,pt,dt=0,Ut=d,Ht=u,qt,Kt,Tt,St,at,Rt,re,$t,ae;for(qt=D.lastIndexOf(f),qt<0&&(qt=0),Kt=0;Kt<qt;++Kt)D.charCodeAt(Kt)>=128&&S("not-basic"),k.push(D.charCodeAt(Kt));for(Tt=qt>0?qt+1:0;Tt<tt;){for(St=dt,at=1,Rt=n;Tt>=tt&&S("invalid-input"),re=B(D.charCodeAt(Tt++)),(re>=n||re>b((o-dt)/at))&&S("overflow"),dt+=re*at,$t=Rt<=Ht?a:Rt>=Ht+h?h:Rt-Ht,!(re<$t);Rt+=n)ae=n-$t,at>b(o/ae)&&S("overflow"),at*=ae;pt=k.length+1,Ht=N(dt-St,pt,St==0),b(dt/pt)>o-Ut&&S("overflow"),Ut+=b(dt/pt),dt%=pt,k.splice(dt++,0,Ut)}return P(k)}function j(D){var k,tt,pt,dt,Ut,Ht,qt,Kt,Tt,St,at,Rt=[],re,$t,ae,ur;for(D=I(D),re=D.length,k=d,tt=0,Ut=u,Ht=0;Ht<re;++Ht)at=D[Ht],at<128&&Rt.push(T(at));for(pt=dt=Rt.length,dt&&Rt.push(f);pt<re;){for(qt=o,Ht=0;Ht<re;++Ht)at=D[Ht],at>=k&&at<qt&&(qt=at);for($t=pt+1,qt-k>b((o-tt)/$t)&&S("overflow"),tt+=(qt-k)*$t,k=qt,Ht=0;Ht<re;++Ht)if(at=D[Ht],at<k&&++tt>o&&S("overflow"),at==k){for(Kt=tt,Tt=n;St=Tt<=Ut?a:Tt>=Ut+h?h:Tt-Ut,!(Kt<St);Tt+=n)ur=Kt-St,ae=n-St,Rt.push(T(W(St+ur%ae,0))),Kt=b(ur/ae);Rt.push(T(W(Kt,0))),Ut=N(tt,$t,pt==dt),tt=0,++pt}++tt,++k}return Rt.join("")}function F(D){return R(D,function(k){return p.test(k)?nt(k.slice(4).toLowerCase()):k})}function H(D){return R(D,function(k){return m.test(k)?"xn--"+j(k):k})}if(s={version:"1.4.1",ucs2:{decode:I,encode:P},decode:nt,encode:j,toASCII:H,toUnicode:F},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(t&&e)if(Bo.exports==t)e.exports=s;else for(w in s)s.hasOwnProperty(w)&&(t[w]=s[w]);else i.punycode=s})(Mo)});var is=K((Pnt,c1)=>{"use strict";c1.exports=TypeError});var u1=K(()=>{});var lh=K((Bnt,B1)=>{var Jm=typeof Map=="function"&&Map.prototype,zm=Object.getOwnPropertyDescriptor&&Jm?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,nu=Jm&&zm&&typeof zm.get=="function"?zm.get:null,d1=Jm&&Map.prototype.forEach,tg=typeof Set=="function"&&Set.prototype,$m=Object.getOwnPropertyDescriptor&&tg?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,au=tg&&$m&&typeof $m.get=="function"?$m.get:null,f1=tg&&Set.prototype.forEach,aF=typeof WeakMap=="function"&&WeakMap.prototype,nh=aF?WeakMap.prototype.has:null,hF=typeof WeakSet=="function"&&WeakSet.prototype,ah=hF?WeakSet.prototype.has:null,lF=typeof WeakRef=="function"&&WeakRef.prototype,p1=lF?WeakRef.prototype.deref:null,cF=Boolean.prototype.valueOf,uF=Object.prototype.toString,dF=Function.prototype.toString,fF=String.prototype.match,eg=String.prototype.slice,Ri=String.prototype.replace,pF=String.prototype.toUpperCase,m1=String.prototype.toLowerCase,E1=RegExp.prototype.test,g1=Array.prototype.concat,kr=Array.prototype.join,mF=Array.prototype.slice,x1=Math.floor,Ym=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Xm=Object.getOwnPropertySymbols,qm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Io=typeof Symbol=="function"&&typeof Symbol.iterator=="object",hh=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Io||!0)?Symbol.toStringTag:null,A1=Object.prototype.propertyIsEnumerable,_1=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(i){return i.__proto__}:null);function y1(i,t){if(i===1/0||i===-1/0||i!==i||i&&i>-1e3&&i<1e3||E1.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof i=="number"){var r=i<0?-x1(-i):x1(i);if(r!==i){var s=String(r),o=eg.call(t,s.length+1);return Ri.call(s,e,"$&_")+"."+Ri.call(Ri.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Ri.call(t,e,"$&_")}var Km=u1(),b1=Km.custom,v1=P1(b1)?b1:null,w1={__proto__:null,double:'"',single:"'"},gF={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};B1.exports=function i(t,e,r,s){var o=e||{};if(ii(o,"quoteStyle")&&!ii(w1,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ii(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var n=ii(o,"customInspect")?o.customInspect:!0;if(typeof n!="boolean"&&n!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ii(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ii(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return M1(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?y1(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?y1(t,l):l}var c=typeof o.depth>"u"?5:o.depth;if(typeof r>"u"&&(r=0),r>=c&&c>0&&typeof t=="object")return Zm(t)?"[Array]":"[Object]";var u=GF(o,r);if(typeof s>"u")s=[];else if(R1(s,t)>=0)return"[Circular]";function d(N,nt,j){if(nt&&(s=mF.call(s),s.push(nt)),j){var F={depth:o.depth};return ii(o,"quoteStyle")&&(F.quoteStyle=o.quoteStyle),i(N,F,r+1,s)}return i(N,o,r+1,s)}if(typeof t=="function"&&!T1(t)){var f=AF(t),p=ou(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+kr.call(p,", ")+" }":"")}if(P1(t)){var m=Io?Ri.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):qm.call(t);return typeof t=="object"&&!Io?oh(m):m}if(BF(t)){for(var x="<"+m1.call(String(t.nodeName)),v=t.attributes||[],y=0;y<v.length;y++)x+=" "+v[y].name+"="+C1(xF(v[y].value),"double",o);return x+=">",t.childNodes&&t.childNodes.length&&(x+="..."),x+="</"+m1.call(String(t.nodeName))+">",x}if(Zm(t)){if(t.length===0)return"[]";var b=ou(t,d);return u&&!FF(b)?"["+Qm(b,u)+"]":"[ "+kr.call(b,", ")+" ]"}if(yF(t)){var T=ou(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!A1.call(t,"cause")?"{ ["+String(t)+"] "+kr.call(g1.call("[cause]: "+d(t.cause),T),", ")+" }":T.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+kr.call(T,", ")+" }"}if(typeof t=="object"&&n){if(v1&&typeof t[v1]=="function"&&Km)return Km(t,{depth:c-r});if(n!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(wF(t)){var w=[];return d1&&d1.call(t,function(N,nt){w.push(d(nt,t,!0)+" => "+d(N,t))}),S1("Map",nu.call(t),w,u)}if(RF(t)){var S=[];return f1&&f1.call(t,function(N){S.push(d(N,t))}),S1("Set",au.call(t),S,u)}if(CF(t))return jm("WeakMap");if(MF(t))return jm("WeakSet");if(PF(t))return jm("WeakRef");if(vF(t))return oh(d(Number(t)));if(SF(t))return oh(d(Ym.call(t)));if(TF(t))return oh(cF.call(t));if(bF(t))return oh(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof global<"u"&&t===global)return"{ [object globalThis] }";if(!_F(t)&&!T1(t)){var A=ou(t,d),R=_1?_1(t)===Object.prototype:t instanceof Object||t.constructor===Object,I=t instanceof Object?"":"null prototype",P=!R&&hh&&Object(t)===t&&hh in t?eg.call(Mi(t),8,-1):I?"Object":"",B=R||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",W=B+(P||I?"["+kr.call(g1.call([],P||[],I||[]),": ")+"] ":"");return A.length===0?W+"{}":u?W+"{"+Qm(A,u)+"}":W+"{ "+kr.call(A,", ")+" }"}return String(t)};function C1(i,t,e){var r=e.quoteStyle||t,s=w1[r];return s+i+s}function xF(i){return Ri.call(String(i),/"/g,"&quot;")}function ss(i){return!hh||!(typeof i=="object"&&(hh in i||typeof i[hh]<"u"))}function Zm(i){return Mi(i)==="[object Array]"&&ss(i)}function _F(i){return Mi(i)==="[object Date]"&&ss(i)}function T1(i){return Mi(i)==="[object RegExp]"&&ss(i)}function yF(i){return Mi(i)==="[object Error]"&&ss(i)}function bF(i){return Mi(i)==="[object String]"&&ss(i)}function vF(i){return Mi(i)==="[object Number]"&&ss(i)}function TF(i){return Mi(i)==="[object Boolean]"&&ss(i)}function P1(i){if(Io)return i&&typeof i=="object"&&i instanceof Symbol;if(typeof i=="symbol")return!0;if(!i||typeof i!="object"||!qm)return!1;try{return qm.call(i),!0}catch{}return!1}function SF(i){if(!i||typeof i!="object"||!Ym)return!1;try{return Ym.call(i),!0}catch{}return!1}var EF=Object.prototype.hasOwnProperty||function(i){return i in this};function ii(i,t){return EF.call(i,t)}function Mi(i){return uF.call(i)}function AF(i){if(i.name)return i.name;var t=fF.call(dF.call(i),/^function\s*([\w$]+)/);return t?t[1]:null}function R1(i,t){if(i.indexOf)return i.indexOf(t);for(var e=0,r=i.length;e<r;e++)if(i[e]===t)return e;return-1}function wF(i){if(!nu||!i||typeof i!="object")return!1;try{nu.call(i);try{au.call(i)}catch{return!0}return i instanceof Map}catch{}return!1}function CF(i){if(!nh||!i||typeof i!="object")return!1;try{nh.call(i,nh);try{ah.call(i,ah)}catch{return!0}return i instanceof WeakMap}catch{}return!1}function PF(i){if(!p1||!i||typeof i!="object")return!1;try{return p1.call(i),!0}catch{}return!1}function RF(i){if(!au||!i||typeof i!="object")return!1;try{au.call(i);try{nu.call(i)}catch{return!0}return i instanceof Set}catch{}return!1}function MF(i){if(!ah||!i||typeof i!="object")return!1;try{ah.call(i,ah);try{nh.call(i,nh)}catch{return!0}return i instanceof WeakSet}catch{}return!1}function BF(i){return!i||typeof i!="object"?!1:typeof HTMLElement<"u"&&i instanceof HTMLElement?!0:typeof i.nodeName=="string"&&typeof i.getAttribute=="function"}function M1(i,t){if(i.length>t.maxStringLength){var e=i.length-t.maxStringLength,r="... "+e+" more character"+(e>1?"s":"");return M1(eg.call(i,0,t.maxStringLength),t)+r}var s=gF[t.quoteStyle||"single"];s.lastIndex=0;var o=Ri.call(Ri.call(i,s,"\\$1"),/[\x00-\x1f]/g,IF);return C1(o,"single",t)}function IF(i){var t=i.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+pF.call(t.toString(16))}function oh(i){return"Object("+i+")"}function jm(i){return i+" { ? }"}function S1(i,t,e,r){var s=r?Qm(e,r):kr.call(e,", ");return i+" ("+t+") {"+s+"}"}function FF(i){for(var t=0;t<i.length;t++)if(R1(i[t],`
1090
1090
  `)>=0)return!1;return!0}function GF(i,t){var e;if(i.indent===" ")e=" ";else if(typeof i.indent=="number"&&i.indent>0)e=kr.call(Array(i.indent+1)," ");else return null;return{base:e,prev:kr.call(Array(t+1),e)}}function Qm(i,t){if(i.length===0)return"";var e=`
1091
1091
  `+t.prev+t.base;return e+kr.call(i,","+e)+`
1092
- `+t.prev}function ou(i,t){var e=Zm(i),r=[];if(e){r.length=i.length;for(var s=0;s<i.length;s++)r[s]=ii(i,s)?t(i[s],i):""}var o=typeof Xm=="function"?Xm(i):[],n;if(Io){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var h in i)ii(i,h)&&(e&&String(Number(h))===h&&h<i.length||Io&&n["$"+h]instanceof Symbol||(E1.call(/[^\w$]/,h)?r.push(t(h,i)+": "+t(i[h],i)):r.push(h+": "+t(i[h],i))));if(typeof Xm=="function")for(var l=0;l<o.length;l++)A1.call(i,o[l])&&r.push("["+t(o[l])+"]: "+t(i[o[l]],i));return r}});var F1=K((Bnt,I1)=>{"use strict";var UF=lh(),kF=is(),hu=function(i,t,e){for(var r=i,s;(s=r.next)!=null;r=s)if(s.key===t)return r.next=s.next,e||(s.next=i.next,i.next=s),s},OF=function(i,t){if(i){var e=hu(i,t);return e&&e.value}},LF=function(i,t,e){var r=hu(i,t);r?r.value=e:i.next={key:t,next:i.next,value:e}},DF=function(i,t){return i?!!hu(i,t):!1},NF=function(i,t){if(i)return hu(i,t,!0)};I1.exports=function(){var t,e={assert:function(r){if(!e.has(r))throw new kF("Side channel does not contain "+UF(r))},delete:function(r){var s=t&&t.next,o=NF(t,r);return o&&s&&s===o&&(t=void 0),!!o},get:function(r){return OF(t,r)},has:function(r){return DF(t,r)},set:function(r,s){t||(t={next:void 0}),LF(t,r,s)}};return e}});var rg=K((Int,G1)=>{"use strict";G1.exports=Object});var k1=K((Fnt,U1)=>{"use strict";U1.exports=Error});var L1=K((Gnt,O1)=>{"use strict";O1.exports=EvalError});var N1=K((Unt,D1)=>{"use strict";D1.exports=RangeError});var V1=K((knt,H1)=>{"use strict";H1.exports=ReferenceError});var z1=K((Ont,W1)=>{"use strict";W1.exports=SyntaxError});var X1=K((Lnt,$1)=>{"use strict";$1.exports=URIError});var Y1=K((Dnt,j1)=>{"use strict";j1.exports=Math.abs});var K1=K((Nnt,q1)=>{"use strict";q1.exports=Math.floor});var Q1=K((Hnt,Z1)=>{"use strict";Z1.exports=Math.max});var tC=K((Vnt,J1)=>{"use strict";J1.exports=Math.min});var rC=K((Wnt,eC)=>{"use strict";eC.exports=Math.pow});var sC=K((znt,iC)=>{"use strict";iC.exports=Math.round});var nC=K(($nt,oC)=>{"use strict";oC.exports=Number.isNaN||function(t){return t!==t}});var hC=K((Xnt,aC)=>{"use strict";var HF=nC();aC.exports=function(t){return HF(t)||t===0?t:t<0?-1:1}});var cC=K((jnt,lC)=>{"use strict";lC.exports=Object.getOwnPropertyDescriptor});var ig=K((Ynt,uC)=>{"use strict";var lu=cC();if(lu)try{lu([],"length")}catch{lu=null}uC.exports=lu});var fC=K((qnt,dC)=>{"use strict";var cu=Object.defineProperty||!1;if(cu)try{cu({},"a",{value:1})}catch{cu=!1}dC.exports=cu});var mC=K((Knt,pC)=>{"use strict";pC.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),r=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var _C=K((Znt,xC)=>{"use strict";var gC=typeof Symbol<"u"&&Symbol,VF=mC();xC.exports=function(){return typeof gC!="function"||typeof Symbol!="function"||typeof gC("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:VF()}});var sg=K((Qnt,yC)=>{"use strict";yC.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var og=K((Jnt,bC)=>{"use strict";var WF=rg();bC.exports=WF.getPrototypeOf||null});var SC=K((tat,TC)=>{"use strict";var zF="Function.prototype.bind called on incompatible ",$F=Object.prototype.toString,XF=Math.max,jF="[object Function]",vC=function(t,e){for(var r=[],s=0;s<t.length;s+=1)r[s]=t[s];for(var o=0;o<e.length;o+=1)r[o+t.length]=e[o];return r},YF=function(t,e){for(var r=[],s=e||0,o=0;s<t.length;s+=1,o+=1)r[o]=t[s];return r},qF=function(i,t){for(var e="",r=0;r<i.length;r+=1)e+=i[r],r+1<i.length&&(e+=t);return e};TC.exports=function(t){var e=this;if(typeof e!="function"||$F.apply(e)!==jF)throw new TypeError(zF+e);for(var r=YF(arguments,1),s,o=function(){if(this instanceof s){var c=e.apply(this,vC(r,arguments));return Object(c)===c?c:this}return e.apply(t,vC(r,arguments))},n=XF(0,e.length-r.length),a=[],h=0;h<n;h++)a[h]="$"+h;if(s=Function("binder","return function ("+qF(a,",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var l=function(){};l.prototype=e.prototype,s.prototype=new l,l.prototype=null}return s}});var ch=K((eat,EC)=>{"use strict";var KF=SC();EC.exports=Function.prototype.bind||KF});var uu=K((rat,AC)=>{"use strict";AC.exports=Function.prototype.call});var ng=K((iat,wC)=>{"use strict";wC.exports=Function.prototype.apply});var PC=K((sat,CC)=>{"use strict";CC.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var MC=K((oat,RC)=>{"use strict";var ZF=ch(),QF=ng(),JF=uu(),tG=PC();RC.exports=tG||ZF.call(JF,QF)});var ag=K((nat,BC)=>{"use strict";var eG=ch(),rG=is(),iG=uu(),sG=MC();BC.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new rG("a function is required");return sG(eG,iG,t)}});var OC=K((aat,kC)=>{"use strict";var oG=ag(),IC=ig(),GC;try{GC=[].__proto__===Array.prototype}catch(i){if(!i||typeof i!="object"||!("code"in i)||i.code!=="ERR_PROTO_ACCESS")throw i}var hg=!!GC&&IC&&IC(Object.prototype,"__proto__"),UC=Object,FC=UC.getPrototypeOf;kC.exports=hg&&typeof hg.get=="function"?oG([hg.get]):typeof FC=="function"?function(t){return FC(t==null?t:UC(t))}:!1});var VC=K((hat,HC)=>{"use strict";var LC=sg(),DC=og(),NC=OC();HC.exports=LC?function(t){return LC(t)}:DC?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return DC(t)}:NC?function(t){return NC(t)}:null});var zC=K((lat,WC)=>{"use strict";var nG=Function.prototype.call,aG=Object.prototype.hasOwnProperty,hG=ch();WC.exports=hG.call(nG,aG)});var pu=K((cat,KC)=>{"use strict";var ct,lG=rg(),cG=k1(),uG=L1(),dG=N1(),fG=V1(),ko=z1(),Uo=is(),pG=X1(),mG=Y1(),gG=K1(),xG=Q1(),_G=tC(),yG=rC(),bG=sC(),vG=hC(),YC=Function,lg=function(i){try{return YC('"use strict"; return ('+i+").constructor;")()}catch{}},uh=ig(),TG=fC(),cg=function(){throw new Uo},SG=uh?function(){try{return arguments.callee,cg}catch{try{return uh(arguments,"callee").get}catch{return cg}}}():cg,Fo=_C()(),fe=VC(),EG=og(),AG=sg(),qC=ng(),dh=uu(),Go={},wG=typeof Uint8Array>"u"||!fe?ct:fe(Uint8Array),os={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ct:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ct:ArrayBuffer,"%ArrayIteratorPrototype%":Fo&&fe?fe([][Symbol.iterator]()):ct,"%AsyncFromSyncIteratorPrototype%":ct,"%AsyncFunction%":Go,"%AsyncGenerator%":Go,"%AsyncGeneratorFunction%":Go,"%AsyncIteratorPrototype%":Go,"%Atomics%":typeof Atomics>"u"?ct:Atomics,"%BigInt%":typeof BigInt>"u"?ct:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ct:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ct:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ct:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":cG,"%eval%":eval,"%EvalError%":uG,"%Float16Array%":typeof Float16Array>"u"?ct:Float16Array,"%Float32Array%":typeof Float32Array>"u"?ct:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ct:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ct:FinalizationRegistry,"%Function%":YC,"%GeneratorFunction%":Go,"%Int8Array%":typeof Int8Array>"u"?ct:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ct:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ct:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Fo&&fe?fe(fe([][Symbol.iterator]())):ct,"%JSON%":typeof JSON=="object"?JSON:ct,"%Map%":typeof Map>"u"?ct:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Fo||!fe?ct:fe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":lG,"%Object.getOwnPropertyDescriptor%":uh,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ct:Promise,"%Proxy%":typeof Proxy>"u"?ct:Proxy,"%RangeError%":dG,"%ReferenceError%":fG,"%Reflect%":typeof Reflect>"u"?ct:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ct:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Fo||!fe?ct:fe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ct:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Fo&&fe?fe(""[Symbol.iterator]()):ct,"%Symbol%":Fo?Symbol:ct,"%SyntaxError%":ko,"%ThrowTypeError%":SG,"%TypedArray%":wG,"%TypeError%":Uo,"%Uint8Array%":typeof Uint8Array>"u"?ct:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ct:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ct:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ct:Uint32Array,"%URIError%":pG,"%WeakMap%":typeof WeakMap>"u"?ct:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ct:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ct:WeakSet,"%Function.prototype.call%":dh,"%Function.prototype.apply%":qC,"%Object.defineProperty%":TG,"%Object.getPrototypeOf%":EG,"%Math.abs%":mG,"%Math.floor%":gG,"%Math.max%":xG,"%Math.min%":_G,"%Math.pow%":yG,"%Math.round%":bG,"%Math.sign%":vG,"%Reflect.getPrototypeOf%":AG};if(fe)try{null.error}catch(i){$C=fe(fe(i)),os["%Error.prototype%"]=$C}var $C,CG=function i(t){var e;if(t==="%AsyncFunction%")e=lg("async function () {}");else if(t==="%GeneratorFunction%")e=lg("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=lg("async function* () {}");else if(t==="%AsyncGenerator%"){var r=i("%AsyncGeneratorFunction%");r&&(e=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=i("%AsyncGenerator%");s&&fe&&(e=fe(s.prototype))}return os[t]=e,e},XC={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},fh=ch(),du=zC(),PG=fh.call(dh,Array.prototype.concat),RG=fh.call(qC,Array.prototype.splice),jC=fh.call(dh,String.prototype.replace),fu=fh.call(dh,String.prototype.slice),MG=fh.call(dh,RegExp.prototype.exec),BG=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,IG=/\\(\\)?/g,FG=function(t){var e=fu(t,0,1),r=fu(t,-1);if(e==="%"&&r!=="%")throw new ko("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new ko("invalid intrinsic syntax, expected opening `%`");var s=[];return jC(t,BG,function(o,n,a,h){s[s.length]=a?jC(h,IG,"$1"):n||o}),s},GG=function(t,e){var r=t,s;if(du(XC,r)&&(s=XC[r],r="%"+s[0]+"%"),du(os,r)){var o=os[r];if(o===Go&&(o=CG(r)),typeof o>"u"&&!e)throw new Uo("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:r,value:o}}throw new ko("intrinsic "+t+" does not exist!")};KC.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Uo("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Uo('"allowMissing" argument must be a boolean');if(MG(/^%?[^%]*%?$/,t)===null)throw new ko("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=FG(t),s=r.length>0?r[0]:"",o=GG("%"+s+"%",e),n=o.name,a=o.value,h=!1,l=o.alias;l&&(s=l[0],RG(r,PG([0,1],l)));for(var c=1,u=!0;c<r.length;c+=1){var d=r[c],f=fu(d,0,1),p=fu(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new ko("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(h=!0),s+="."+d,n="%"+s+"%",du(os,n))a=os[n];else if(a!=null){if(!(d in a)){if(!e)throw new Uo("base intrinsic for "+t+" exists, but the property is not available.");return}if(uh&&c+1>=r.length){var m=uh(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=du(a,d),a=a[d];u&&!h&&(os[n]=a)}}return a}});var ug=K((uat,JC)=>{"use strict";var ZC=pu(),QC=ag(),UG=QC([ZC("%String.prototype.indexOf%")]);JC.exports=function(t,e){var r=ZC(t,!!e);return typeof r=="function"&&UG(t,".prototype.")>-1?QC([r]):r}});var dg=K((dat,eP)=>{"use strict";var kG=pu(),ph=ug(),OG=lh(),LG=is(),tP=kG("%Map%",!0),DG=ph("Map.prototype.get",!0),NG=ph("Map.prototype.set",!0),HG=ph("Map.prototype.has",!0),VG=ph("Map.prototype.delete",!0),WG=ph("Map.prototype.size",!0);eP.exports=!!tP&&function(){var t,e={assert:function(r){if(!e.has(r))throw new LG("Side channel does not contain "+OG(r))},delete:function(r){if(t){var s=VG(t,r);return WG(t)===0&&(t=void 0),s}return!1},get:function(r){if(t)return DG(t,r)},has:function(r){return t?HG(t,r):!1},set:function(r,s){t||(t=new tP),NG(t,r,s)}};return e}});var iP=K((fat,rP)=>{"use strict";var zG=pu(),gu=ug(),$G=lh(),mu=dg(),XG=is(),Oo=zG("%WeakMap%",!0),jG=gu("WeakMap.prototype.get",!0),YG=gu("WeakMap.prototype.set",!0),qG=gu("WeakMap.prototype.has",!0),KG=gu("WeakMap.prototype.delete",!0);rP.exports=Oo?function(){var t,e,r={assert:function(s){if(!r.has(s))throw new XG("Side channel does not contain "+$G(s))},delete:function(s){if(Oo&&s&&(typeof s=="object"||typeof s=="function")){if(t)return KG(t,s)}else if(mu&&e)return e.delete(s);return!1},get:function(s){return Oo&&s&&(typeof s=="object"||typeof s=="function")&&t?jG(t,s):e&&e.get(s)},has:function(s){return Oo&&s&&(typeof s=="object"||typeof s=="function")&&t?qG(t,s):!!e&&e.has(s)},set:function(s,o){Oo&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new Oo),YG(t,s,o)):mu&&(e||(e=mu()),e.set(s,o))}};return r}:mu});var oP=K((pat,sP)=>{"use strict";var ZG=is(),QG=lh(),JG=F1(),t2=dg(),e2=iP(),r2=e2||t2||JG;sP.exports=function(){var t,e={assert:function(r){if(!e.has(r))throw new ZG("Side channel does not contain "+QG(r))},delete:function(r){return!!t&&t.delete(r)},get:function(r){return t&&t.get(r)},has:function(r){return!!t&&t.has(r)},set:function(r,s){t||(t=r2()),t.set(r,s)}};return e}});var xu=K((mat,nP)=>{"use strict";var i2=String.prototype.replace,s2=/%20/g,fg={RFC1738:"RFC1738",RFC3986:"RFC3986"};nP.exports={default:fg.RFC3986,formatters:{RFC1738:function(i){return i2.call(i,s2,"+")},RFC3986:function(i){return String(i)}},RFC1738:fg.RFC1738,RFC3986:fg.RFC3986}});var gg=K((gat,hP)=>{"use strict";var o2=xu(),pg=Object.prototype.hasOwnProperty,ns=Array.isArray,Or=function(){for(var i=[],t=0;t<256;++t)i.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return i}(),n2=function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(ns(r)){for(var s=[],o=0;o<r.length;++o)typeof r[o]<"u"&&s.push(r[o]);e.obj[e.prop]=s}}},aP=function(t,e){for(var r=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(r[s]=t[s]);return r},a2=function i(t,e,r){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(ns(t))t.push(e);else if(t&&typeof t=="object")(r&&(r.plainObjects||r.allowPrototypes)||!pg.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return ns(t)&&!ns(e)&&(s=aP(t,r)),ns(t)&&ns(e)?(e.forEach(function(o,n){if(pg.call(t,n)){var a=t[n];a&&typeof a=="object"&&o&&typeof o=="object"?t[n]=i(a,o,r):t.push(o)}else t[n]=o}),t):Object.keys(e).reduce(function(o,n){var a=e[n];return pg.call(o,n)?o[n]=i(o[n],a,r):o[n]=a,o},s)},h2=function(t,e){return Object.keys(e).reduce(function(r,s){return r[s]=e[s],r},t)},l2=function(i,t,e){var r=i.replace(/\+/g," ");if(e==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},mg=1024,c2=function(t,e,r,s,o){if(t.length===0)return t;var n=t;if(typeof t=="symbol"?n=Symbol.prototype.toString.call(t):typeof t!="string"&&(n=String(t)),r==="iso-8859-1")return escape(n).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var a="",h=0;h<n.length;h+=mg){for(var l=n.length>=mg?n.slice(h,h+mg):n,c=[],u=0;u<l.length;++u){var d=l.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===o2.RFC1738&&(d===40||d===41)){c[c.length]=l.charAt(u);continue}if(d<128){c[c.length]=Or[d];continue}if(d<2048){c[c.length]=Or[192|d>>6]+Or[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=Or[224|d>>12]+Or[128|d>>6&63]+Or[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|l.charCodeAt(u)&1023),c[c.length]=Or[240|d>>18]+Or[128|d>>12&63]+Or[128|d>>6&63]+Or[128|d&63]}a+=c.join("")}return a},u2=function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],s=0;s<e.length;++s)for(var o=e[s],n=o.obj[o.prop],a=Object.keys(n),h=0;h<a.length;++h){var l=a[h],c=n[l];typeof c=="object"&&c!==null&&r.indexOf(c)===-1&&(e.push({obj:n,prop:l}),r.push(c))}return n2(e),t},d2=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},f2=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},p2=function(t,e){return[].concat(t,e)},m2=function(t,e){if(ns(t)){for(var r=[],s=0;s<t.length;s+=1)r.push(e(t[s]));return r}return e(t)};hP.exports={arrayToObject:aP,assign:h2,combine:p2,compact:u2,decode:l2,encode:c2,isBuffer:f2,isRegExp:d2,maybeMap:m2,merge:a2}});var pP=K((xat,fP)=>{"use strict";var cP=oP(),_u=gg(),mh=xu(),g2=Object.prototype.hasOwnProperty,uP={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Lr=Array.isArray,x2=Array.prototype.push,dP=function(i,t){x2.apply(i,Lr(t)?t:[t])},_2=Date.prototype.toISOString,lP=mh.default,oe={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:_u.encode,encodeValuesOnly:!1,filter:void 0,format:lP,formatter:mh.formatters[lP],indices:!1,serializeDate:function(t){return _2.call(t)},skipNulls:!1,strictNullHandling:!1},y2=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},xg={},b2=function i(t,e,r,s,o,n,a,h,l,c,u,d,f,p,m,x,v,y){for(var b=t,T=y,w=0,S=!1;(T=T.get(xg))!==void 0&&!S;){var A=T.get(t);if(w+=1,typeof A<"u"){if(A===w)throw new RangeError("Cyclic object value");S=!0}typeof T.get(xg)>"u"&&(w=0)}if(typeof c=="function"?b=c(e,b):b instanceof Date?b=f(b):r==="comma"&&Lr(b)&&(b=_u.maybeMap(b,function(tt){return tt instanceof Date?f(tt):tt})),b===null){if(n)return l&&!x?l(e,oe.encoder,v,"key",p):e;b=""}if(y2(b)||_u.isBuffer(b)){if(l){var R=x?e:l(e,oe.encoder,v,"key",p);return[m(R)+"="+m(l(b,oe.encoder,v,"value",p))]}return[m(e)+"="+m(String(b))]}var I=[];if(typeof b>"u")return I;var P;if(r==="comma"&&Lr(b))x&&l&&(b=_u.maybeMap(b,l)),P=[{value:b.length>0?b.join(",")||null:void 0}];else if(Lr(c))P=c;else{var B=Object.keys(b);P=u?B.sort(u):B}var W=h?String(e).replace(/\./g,"%2E"):String(e),N=s&&Lr(b)&&b.length===1?W+"[]":W;if(o&&Lr(b)&&b.length===0)return N+"[]";for(var nt=0;nt<P.length;++nt){var j=P[nt],F=typeof j=="object"&&j&&typeof j.value<"u"?j.value:b[j];if(!(a&&F===null)){var H=d&&h?String(j).replace(/\./g,"%2E"):String(j),D=Lr(b)?typeof r=="function"?r(N,H):N:N+(d?"."+H:"["+H+"]");y.set(t,w);var k=cP();k.set(xg,y),dP(I,i(F,D,r,s,o,n,a,h,r==="comma"&&x&&Lr(b)?null:l,c,u,d,f,p,m,x,v,k))}}return I},v2=function(t){if(!t)return oe;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||oe.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=mh.default;if(typeof t.format<"u"){if(!g2.call(mh.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var s=mh.formatters[r],o=oe.filter;(typeof t.filter=="function"||Lr(t.filter))&&(o=t.filter);var n;if(t.arrayFormat in uP?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=oe.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:oe.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:oe.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:oe.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:oe.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?oe.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:oe.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:oe.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:oe.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:oe.encodeValuesOnly,filter:o,format:r,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:oe.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:oe.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:oe.strictNullHandling}};fP.exports=function(i,t){var e=i,r=v2(t),s,o;typeof r.filter=="function"?(o=r.filter,e=o("",e)):Lr(r.filter)&&(o=r.filter,s=o);var n=[];if(typeof e!="object"||e===null)return"";var a=uP[r.arrayFormat],h=a==="comma"&&r.commaRoundTrip;s||(s=Object.keys(e)),r.sort&&s.sort(r.sort);for(var l=cP(),c=0;c<s.length;++c){var u=s[c],d=e[u];r.skipNulls&&d===null||dP(n,b2(d,u,a,h,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,l))}var f=n.join(r.delimiter),p=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""}});var _P=K((_at,xP)=>{"use strict";var as=gg(),_g=Object.prototype.hasOwnProperty,mP=Array.isArray,zt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:as.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},T2=function(i){return i.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},gP=function(i,t,e){if(i&&typeof i=="string"&&t.comma&&i.indexOf(",")>-1)return i.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return i},S2="utf8=%26%2310003%3B",E2="utf8=%E2%9C%93",A2=function(t,e){var r={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=e.parameterLimit===1/0?void 0:e.parameterLimit,n=s.split(e.delimiter,e.throwOnLimitExceeded?o+1:o);if(e.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,h,l=e.charset;if(e.charsetSentinel)for(h=0;h<n.length;++h)n[h].indexOf("utf8=")===0&&(n[h]===E2?l="utf-8":n[h]===S2&&(l="iso-8859-1"),a=h,h=n.length);for(h=0;h<n.length;++h)if(h!==a){var c=n[h],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,f,p;d===-1?(f=e.decoder(c,zt.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),zt.decoder,l,"key"),p=as.maybeMap(gP(c.slice(d+1),e,mP(r[f])?r[f].length:0),function(x){return e.decoder(x,zt.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=T2(String(p))),c.indexOf("[]=")>-1&&(p=mP(p)?[p]:p);var m=_g.call(r,f);m&&e.duplicates==="combine"?r[f]=as.combine(r[f],p):(!m||e.duplicates==="last")&&(r[f]=p)}return r},w2=function(i,t,e,r){var s=0;if(i.length>0&&i[i.length-1]==="[]"){var o=i.slice(0,-1).join("");s=Array.isArray(t)&&t[o]?t[o].length:0}for(var n=r?t:gP(t,e,s),a=i.length-1;a>=0;--a){var h,l=i[a];if(l==="[]"&&e.parseArrays)h=e.allowEmptyArrays&&(n===""||e.strictNullHandling&&n===null)?[]:as.combine([],n);else{h=e.plainObjects?{__proto__:null}:{};var c=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,u=e.decodeDotInKeys?c.replace(/%2E/g,"."):c,d=parseInt(u,10);!e.parseArrays&&u===""?h={0:n}:!isNaN(d)&&l!==u&&String(d)===u&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(h=[],h[d]=n):u!=="__proto__"&&(h[u]=n)}n=h}return n},C2=function(t,e,r,s){if(t){var o=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=r.depth>0&&n.exec(o),l=h?o.slice(0,h.index):o,c=[];if(l){if(!r.plainObjects&&_g.call(Object.prototype,l)&&!r.allowPrototypes)return;c.push(l)}for(var u=0;r.depth>0&&(h=a.exec(o))!==null&&u<r.depth;){if(u+=1,!r.plainObjects&&_g.call(Object.prototype,h[1].slice(1,-1))&&!r.allowPrototypes)return;c.push(h[1])}if(h){if(r.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");c.push("["+o.slice(h.index)+"]")}return w2(c,e,r,s)}},P2=function(t){if(!t)return zt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof t.throwOnLimitExceeded<"u"&&typeof t.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=typeof t.charset>"u"?zt.charset:t.charset,r=typeof t.duplicates>"u"?zt.duplicates:t.duplicates;if(r!=="combine"&&r!=="first"&&r!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:zt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:zt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:zt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:zt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:zt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:zt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:zt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:zt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:zt.decoder,delimiter:typeof t.delimiter=="string"||as.isRegExp(t.delimiter)?t.delimiter:zt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:zt.depth,duplicates:r,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:zt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:zt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:zt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:zt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:zt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}};xP.exports=function(i,t){var e=P2(t);if(i===""||i===null||typeof i>"u")return e.plainObjects?{__proto__:null}:{};for(var r=typeof i=="string"?A2(i,e):i,s=e.plainObjects?{__proto__:null}:{},o=Object.keys(r),n=0;n<o.length;++n){var a=o[n],h=C2(a,r[a],e,typeof i=="string");s=as.merge(s,h,e)}return e.allowSparse===!0?s:as.compact(s)}});var bP=K((yat,yP)=>{"use strict";var R2=pP(),M2=_P(),B2=xu();yP.exports={formats:B2,parse:M2,stringify:R2}});var EP=K(Do=>{"use strict";var I2=l1();function ar(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var F2=/^([a-z0-9.+-]+:)/i,G2=/:[0-9]*$/,U2=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,k2=["<",">",'"',"`"," ","\r",`
1092
+ `+t.prev}function ou(i,t){var e=Zm(i),r=[];if(e){r.length=i.length;for(var s=0;s<i.length;s++)r[s]=ii(i,s)?t(i[s],i):""}var o=typeof Xm=="function"?Xm(i):[],n;if(Io){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var h in i)ii(i,h)&&(e&&String(Number(h))===h&&h<i.length||Io&&n["$"+h]instanceof Symbol||(E1.call(/[^\w$]/,h)?r.push(t(h,i)+": "+t(i[h],i)):r.push(h+": "+t(i[h],i))));if(typeof Xm=="function")for(var l=0;l<o.length;l++)A1.call(i,o[l])&&r.push("["+t(o[l])+"]: "+t(i[o[l]],i));return r}});var F1=K((Int,I1)=>{"use strict";var UF=lh(),kF=is(),hu=function(i,t,e){for(var r=i,s;(s=r.next)!=null;r=s)if(s.key===t)return r.next=s.next,e||(s.next=i.next,i.next=s),s},OF=function(i,t){if(i){var e=hu(i,t);return e&&e.value}},LF=function(i,t,e){var r=hu(i,t);r?r.value=e:i.next={key:t,next:i.next,value:e}},DF=function(i,t){return i?!!hu(i,t):!1},NF=function(i,t){if(i)return hu(i,t,!0)};I1.exports=function(){var t,e={assert:function(r){if(!e.has(r))throw new kF("Side channel does not contain "+UF(r))},delete:function(r){var s=t&&t.next,o=NF(t,r);return o&&s&&s===o&&(t=void 0),!!o},get:function(r){return OF(t,r)},has:function(r){return DF(t,r)},set:function(r,s){t||(t={next:void 0}),LF(t,r,s)}};return e}});var rg=K((Fnt,G1)=>{"use strict";G1.exports=Object});var k1=K((Gnt,U1)=>{"use strict";U1.exports=Error});var L1=K((Unt,O1)=>{"use strict";O1.exports=EvalError});var N1=K((knt,D1)=>{"use strict";D1.exports=RangeError});var V1=K((Ont,H1)=>{"use strict";H1.exports=ReferenceError});var z1=K((Lnt,W1)=>{"use strict";W1.exports=SyntaxError});var X1=K((Dnt,$1)=>{"use strict";$1.exports=URIError});var Y1=K((Nnt,j1)=>{"use strict";j1.exports=Math.abs});var K1=K((Hnt,q1)=>{"use strict";q1.exports=Math.floor});var Q1=K((Vnt,Z1)=>{"use strict";Z1.exports=Math.max});var tC=K((Wnt,J1)=>{"use strict";J1.exports=Math.min});var rC=K((znt,eC)=>{"use strict";eC.exports=Math.pow});var sC=K(($nt,iC)=>{"use strict";iC.exports=Math.round});var nC=K((Xnt,oC)=>{"use strict";oC.exports=Number.isNaN||function(t){return t!==t}});var hC=K((jnt,aC)=>{"use strict";var HF=nC();aC.exports=function(t){return HF(t)||t===0?t:t<0?-1:1}});var cC=K((Ynt,lC)=>{"use strict";lC.exports=Object.getOwnPropertyDescriptor});var ig=K((qnt,uC)=>{"use strict";var lu=cC();if(lu)try{lu([],"length")}catch{lu=null}uC.exports=lu});var fC=K((Knt,dC)=>{"use strict";var cu=Object.defineProperty||!1;if(cu)try{cu({},"a",{value:1})}catch{cu=!1}dC.exports=cu});var mC=K((Znt,pC)=>{"use strict";pC.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),r=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var _C=K((Qnt,xC)=>{"use strict";var gC=typeof Symbol<"u"&&Symbol,VF=mC();xC.exports=function(){return typeof gC!="function"||typeof Symbol!="function"||typeof gC("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:VF()}});var sg=K((Jnt,yC)=>{"use strict";yC.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var og=K((tat,bC)=>{"use strict";var WF=rg();bC.exports=WF.getPrototypeOf||null});var SC=K((eat,TC)=>{"use strict";var zF="Function.prototype.bind called on incompatible ",$F=Object.prototype.toString,XF=Math.max,jF="[object Function]",vC=function(t,e){for(var r=[],s=0;s<t.length;s+=1)r[s]=t[s];for(var o=0;o<e.length;o+=1)r[o+t.length]=e[o];return r},YF=function(t,e){for(var r=[],s=e||0,o=0;s<t.length;s+=1,o+=1)r[o]=t[s];return r},qF=function(i,t){for(var e="",r=0;r<i.length;r+=1)e+=i[r],r+1<i.length&&(e+=t);return e};TC.exports=function(t){var e=this;if(typeof e!="function"||$F.apply(e)!==jF)throw new TypeError(zF+e);for(var r=YF(arguments,1),s,o=function(){if(this instanceof s){var c=e.apply(this,vC(r,arguments));return Object(c)===c?c:this}return e.apply(t,vC(r,arguments))},n=XF(0,e.length-r.length),a=[],h=0;h<n;h++)a[h]="$"+h;if(s=Function("binder","return function ("+qF(a,",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var l=function(){};l.prototype=e.prototype,s.prototype=new l,l.prototype=null}return s}});var ch=K((rat,EC)=>{"use strict";var KF=SC();EC.exports=Function.prototype.bind||KF});var uu=K((iat,AC)=>{"use strict";AC.exports=Function.prototype.call});var ng=K((sat,wC)=>{"use strict";wC.exports=Function.prototype.apply});var PC=K((oat,CC)=>{"use strict";CC.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var MC=K((nat,RC)=>{"use strict";var ZF=ch(),QF=ng(),JF=uu(),tG=PC();RC.exports=tG||ZF.call(JF,QF)});var ag=K((aat,BC)=>{"use strict";var eG=ch(),rG=is(),iG=uu(),sG=MC();BC.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new rG("a function is required");return sG(eG,iG,t)}});var OC=K((hat,kC)=>{"use strict";var oG=ag(),IC=ig(),GC;try{GC=[].__proto__===Array.prototype}catch(i){if(!i||typeof i!="object"||!("code"in i)||i.code!=="ERR_PROTO_ACCESS")throw i}var hg=!!GC&&IC&&IC(Object.prototype,"__proto__"),UC=Object,FC=UC.getPrototypeOf;kC.exports=hg&&typeof hg.get=="function"?oG([hg.get]):typeof FC=="function"?function(t){return FC(t==null?t:UC(t))}:!1});var VC=K((lat,HC)=>{"use strict";var LC=sg(),DC=og(),NC=OC();HC.exports=LC?function(t){return LC(t)}:DC?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return DC(t)}:NC?function(t){return NC(t)}:null});var zC=K((cat,WC)=>{"use strict";var nG=Function.prototype.call,aG=Object.prototype.hasOwnProperty,hG=ch();WC.exports=hG.call(nG,aG)});var pu=K((uat,KC)=>{"use strict";var ct,lG=rg(),cG=k1(),uG=L1(),dG=N1(),fG=V1(),ko=z1(),Uo=is(),pG=X1(),mG=Y1(),gG=K1(),xG=Q1(),_G=tC(),yG=rC(),bG=sC(),vG=hC(),YC=Function,lg=function(i){try{return YC('"use strict"; return ('+i+").constructor;")()}catch{}},uh=ig(),TG=fC(),cg=function(){throw new Uo},SG=uh?function(){try{return arguments.callee,cg}catch{try{return uh(arguments,"callee").get}catch{return cg}}}():cg,Fo=_C()(),fe=VC(),EG=og(),AG=sg(),qC=ng(),dh=uu(),Go={},wG=typeof Uint8Array>"u"||!fe?ct:fe(Uint8Array),os={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ct:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ct:ArrayBuffer,"%ArrayIteratorPrototype%":Fo&&fe?fe([][Symbol.iterator]()):ct,"%AsyncFromSyncIteratorPrototype%":ct,"%AsyncFunction%":Go,"%AsyncGenerator%":Go,"%AsyncGeneratorFunction%":Go,"%AsyncIteratorPrototype%":Go,"%Atomics%":typeof Atomics>"u"?ct:Atomics,"%BigInt%":typeof BigInt>"u"?ct:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ct:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ct:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ct:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":cG,"%eval%":eval,"%EvalError%":uG,"%Float16Array%":typeof Float16Array>"u"?ct:Float16Array,"%Float32Array%":typeof Float32Array>"u"?ct:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ct:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ct:FinalizationRegistry,"%Function%":YC,"%GeneratorFunction%":Go,"%Int8Array%":typeof Int8Array>"u"?ct:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ct:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ct:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Fo&&fe?fe(fe([][Symbol.iterator]())):ct,"%JSON%":typeof JSON=="object"?JSON:ct,"%Map%":typeof Map>"u"?ct:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Fo||!fe?ct:fe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":lG,"%Object.getOwnPropertyDescriptor%":uh,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ct:Promise,"%Proxy%":typeof Proxy>"u"?ct:Proxy,"%RangeError%":dG,"%ReferenceError%":fG,"%Reflect%":typeof Reflect>"u"?ct:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ct:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Fo||!fe?ct:fe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ct:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Fo&&fe?fe(""[Symbol.iterator]()):ct,"%Symbol%":Fo?Symbol:ct,"%SyntaxError%":ko,"%ThrowTypeError%":SG,"%TypedArray%":wG,"%TypeError%":Uo,"%Uint8Array%":typeof Uint8Array>"u"?ct:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ct:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ct:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ct:Uint32Array,"%URIError%":pG,"%WeakMap%":typeof WeakMap>"u"?ct:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ct:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ct:WeakSet,"%Function.prototype.call%":dh,"%Function.prototype.apply%":qC,"%Object.defineProperty%":TG,"%Object.getPrototypeOf%":EG,"%Math.abs%":mG,"%Math.floor%":gG,"%Math.max%":xG,"%Math.min%":_G,"%Math.pow%":yG,"%Math.round%":bG,"%Math.sign%":vG,"%Reflect.getPrototypeOf%":AG};if(fe)try{null.error}catch(i){$C=fe(fe(i)),os["%Error.prototype%"]=$C}var $C,CG=function i(t){var e;if(t==="%AsyncFunction%")e=lg("async function () {}");else if(t==="%GeneratorFunction%")e=lg("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=lg("async function* () {}");else if(t==="%AsyncGenerator%"){var r=i("%AsyncGeneratorFunction%");r&&(e=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=i("%AsyncGenerator%");s&&fe&&(e=fe(s.prototype))}return os[t]=e,e},XC={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},fh=ch(),du=zC(),PG=fh.call(dh,Array.prototype.concat),RG=fh.call(qC,Array.prototype.splice),jC=fh.call(dh,String.prototype.replace),fu=fh.call(dh,String.prototype.slice),MG=fh.call(dh,RegExp.prototype.exec),BG=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,IG=/\\(\\)?/g,FG=function(t){var e=fu(t,0,1),r=fu(t,-1);if(e==="%"&&r!=="%")throw new ko("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new ko("invalid intrinsic syntax, expected opening `%`");var s=[];return jC(t,BG,function(o,n,a,h){s[s.length]=a?jC(h,IG,"$1"):n||o}),s},GG=function(t,e){var r=t,s;if(du(XC,r)&&(s=XC[r],r="%"+s[0]+"%"),du(os,r)){var o=os[r];if(o===Go&&(o=CG(r)),typeof o>"u"&&!e)throw new Uo("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:r,value:o}}throw new ko("intrinsic "+t+" does not exist!")};KC.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Uo("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Uo('"allowMissing" argument must be a boolean');if(MG(/^%?[^%]*%?$/,t)===null)throw new ko("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=FG(t),s=r.length>0?r[0]:"",o=GG("%"+s+"%",e),n=o.name,a=o.value,h=!1,l=o.alias;l&&(s=l[0],RG(r,PG([0,1],l)));for(var c=1,u=!0;c<r.length;c+=1){var d=r[c],f=fu(d,0,1),p=fu(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new ko("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(h=!0),s+="."+d,n="%"+s+"%",du(os,n))a=os[n];else if(a!=null){if(!(d in a)){if(!e)throw new Uo("base intrinsic for "+t+" exists, but the property is not available.");return}if(uh&&c+1>=r.length){var m=uh(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=du(a,d),a=a[d];u&&!h&&(os[n]=a)}}return a}});var ug=K((dat,JC)=>{"use strict";var ZC=pu(),QC=ag(),UG=QC([ZC("%String.prototype.indexOf%")]);JC.exports=function(t,e){var r=ZC(t,!!e);return typeof r=="function"&&UG(t,".prototype.")>-1?QC([r]):r}});var dg=K((fat,eP)=>{"use strict";var kG=pu(),ph=ug(),OG=lh(),LG=is(),tP=kG("%Map%",!0),DG=ph("Map.prototype.get",!0),NG=ph("Map.prototype.set",!0),HG=ph("Map.prototype.has",!0),VG=ph("Map.prototype.delete",!0),WG=ph("Map.prototype.size",!0);eP.exports=!!tP&&function(){var t,e={assert:function(r){if(!e.has(r))throw new LG("Side channel does not contain "+OG(r))},delete:function(r){if(t){var s=VG(t,r);return WG(t)===0&&(t=void 0),s}return!1},get:function(r){if(t)return DG(t,r)},has:function(r){return t?HG(t,r):!1},set:function(r,s){t||(t=new tP),NG(t,r,s)}};return e}});var iP=K((pat,rP)=>{"use strict";var zG=pu(),gu=ug(),$G=lh(),mu=dg(),XG=is(),Oo=zG("%WeakMap%",!0),jG=gu("WeakMap.prototype.get",!0),YG=gu("WeakMap.prototype.set",!0),qG=gu("WeakMap.prototype.has",!0),KG=gu("WeakMap.prototype.delete",!0);rP.exports=Oo?function(){var t,e,r={assert:function(s){if(!r.has(s))throw new XG("Side channel does not contain "+$G(s))},delete:function(s){if(Oo&&s&&(typeof s=="object"||typeof s=="function")){if(t)return KG(t,s)}else if(mu&&e)return e.delete(s);return!1},get:function(s){return Oo&&s&&(typeof s=="object"||typeof s=="function")&&t?jG(t,s):e&&e.get(s)},has:function(s){return Oo&&s&&(typeof s=="object"||typeof s=="function")&&t?qG(t,s):!!e&&e.has(s)},set:function(s,o){Oo&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new Oo),YG(t,s,o)):mu&&(e||(e=mu()),e.set(s,o))}};return r}:mu});var oP=K((mat,sP)=>{"use strict";var ZG=is(),QG=lh(),JG=F1(),t2=dg(),e2=iP(),r2=e2||t2||JG;sP.exports=function(){var t,e={assert:function(r){if(!e.has(r))throw new ZG("Side channel does not contain "+QG(r))},delete:function(r){return!!t&&t.delete(r)},get:function(r){return t&&t.get(r)},has:function(r){return!!t&&t.has(r)},set:function(r,s){t||(t=r2()),t.set(r,s)}};return e}});var xu=K((gat,nP)=>{"use strict";var i2=String.prototype.replace,s2=/%20/g,fg={RFC1738:"RFC1738",RFC3986:"RFC3986"};nP.exports={default:fg.RFC3986,formatters:{RFC1738:function(i){return i2.call(i,s2,"+")},RFC3986:function(i){return String(i)}},RFC1738:fg.RFC1738,RFC3986:fg.RFC3986}});var gg=K((xat,hP)=>{"use strict";var o2=xu(),pg=Object.prototype.hasOwnProperty,ns=Array.isArray,Or=function(){for(var i=[],t=0;t<256;++t)i.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return i}(),n2=function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(ns(r)){for(var s=[],o=0;o<r.length;++o)typeof r[o]<"u"&&s.push(r[o]);e.obj[e.prop]=s}}},aP=function(t,e){for(var r=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(r[s]=t[s]);return r},a2=function i(t,e,r){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(ns(t))t.push(e);else if(t&&typeof t=="object")(r&&(r.plainObjects||r.allowPrototypes)||!pg.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return ns(t)&&!ns(e)&&(s=aP(t,r)),ns(t)&&ns(e)?(e.forEach(function(o,n){if(pg.call(t,n)){var a=t[n];a&&typeof a=="object"&&o&&typeof o=="object"?t[n]=i(a,o,r):t.push(o)}else t[n]=o}),t):Object.keys(e).reduce(function(o,n){var a=e[n];return pg.call(o,n)?o[n]=i(o[n],a,r):o[n]=a,o},s)},h2=function(t,e){return Object.keys(e).reduce(function(r,s){return r[s]=e[s],r},t)},l2=function(i,t,e){var r=i.replace(/\+/g," ");if(e==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},mg=1024,c2=function(t,e,r,s,o){if(t.length===0)return t;var n=t;if(typeof t=="symbol"?n=Symbol.prototype.toString.call(t):typeof t!="string"&&(n=String(t)),r==="iso-8859-1")return escape(n).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var a="",h=0;h<n.length;h+=mg){for(var l=n.length>=mg?n.slice(h,h+mg):n,c=[],u=0;u<l.length;++u){var d=l.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===o2.RFC1738&&(d===40||d===41)){c[c.length]=l.charAt(u);continue}if(d<128){c[c.length]=Or[d];continue}if(d<2048){c[c.length]=Or[192|d>>6]+Or[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=Or[224|d>>12]+Or[128|d>>6&63]+Or[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|l.charCodeAt(u)&1023),c[c.length]=Or[240|d>>18]+Or[128|d>>12&63]+Or[128|d>>6&63]+Or[128|d&63]}a+=c.join("")}return a},u2=function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],s=0;s<e.length;++s)for(var o=e[s],n=o.obj[o.prop],a=Object.keys(n),h=0;h<a.length;++h){var l=a[h],c=n[l];typeof c=="object"&&c!==null&&r.indexOf(c)===-1&&(e.push({obj:n,prop:l}),r.push(c))}return n2(e),t},d2=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},f2=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},p2=function(t,e){return[].concat(t,e)},m2=function(t,e){if(ns(t)){for(var r=[],s=0;s<t.length;s+=1)r.push(e(t[s]));return r}return e(t)};hP.exports={arrayToObject:aP,assign:h2,combine:p2,compact:u2,decode:l2,encode:c2,isBuffer:f2,isRegExp:d2,maybeMap:m2,merge:a2}});var pP=K((_at,fP)=>{"use strict";var cP=oP(),_u=gg(),mh=xu(),g2=Object.prototype.hasOwnProperty,uP={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Lr=Array.isArray,x2=Array.prototype.push,dP=function(i,t){x2.apply(i,Lr(t)?t:[t])},_2=Date.prototype.toISOString,lP=mh.default,oe={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:_u.encode,encodeValuesOnly:!1,filter:void 0,format:lP,formatter:mh.formatters[lP],indices:!1,serializeDate:function(t){return _2.call(t)},skipNulls:!1,strictNullHandling:!1},y2=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},xg={},b2=function i(t,e,r,s,o,n,a,h,l,c,u,d,f,p,m,x,v,y){for(var b=t,T=y,w=0,S=!1;(T=T.get(xg))!==void 0&&!S;){var A=T.get(t);if(w+=1,typeof A<"u"){if(A===w)throw new RangeError("Cyclic object value");S=!0}typeof T.get(xg)>"u"&&(w=0)}if(typeof c=="function"?b=c(e,b):b instanceof Date?b=f(b):r==="comma"&&Lr(b)&&(b=_u.maybeMap(b,function(tt){return tt instanceof Date?f(tt):tt})),b===null){if(n)return l&&!x?l(e,oe.encoder,v,"key",p):e;b=""}if(y2(b)||_u.isBuffer(b)){if(l){var R=x?e:l(e,oe.encoder,v,"key",p);return[m(R)+"="+m(l(b,oe.encoder,v,"value",p))]}return[m(e)+"="+m(String(b))]}var I=[];if(typeof b>"u")return I;var P;if(r==="comma"&&Lr(b))x&&l&&(b=_u.maybeMap(b,l)),P=[{value:b.length>0?b.join(",")||null:void 0}];else if(Lr(c))P=c;else{var B=Object.keys(b);P=u?B.sort(u):B}var W=h?String(e).replace(/\./g,"%2E"):String(e),N=s&&Lr(b)&&b.length===1?W+"[]":W;if(o&&Lr(b)&&b.length===0)return N+"[]";for(var nt=0;nt<P.length;++nt){var j=P[nt],F=typeof j=="object"&&j&&typeof j.value<"u"?j.value:b[j];if(!(a&&F===null)){var H=d&&h?String(j).replace(/\./g,"%2E"):String(j),D=Lr(b)?typeof r=="function"?r(N,H):N:N+(d?"."+H:"["+H+"]");y.set(t,w);var k=cP();k.set(xg,y),dP(I,i(F,D,r,s,o,n,a,h,r==="comma"&&x&&Lr(b)?null:l,c,u,d,f,p,m,x,v,k))}}return I},v2=function(t){if(!t)return oe;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||oe.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=mh.default;if(typeof t.format<"u"){if(!g2.call(mh.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var s=mh.formatters[r],o=oe.filter;(typeof t.filter=="function"||Lr(t.filter))&&(o=t.filter);var n;if(t.arrayFormat in uP?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=oe.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:oe.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:oe.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:oe.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:oe.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?oe.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:oe.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:oe.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:oe.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:oe.encodeValuesOnly,filter:o,format:r,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:oe.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:oe.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:oe.strictNullHandling}};fP.exports=function(i,t){var e=i,r=v2(t),s,o;typeof r.filter=="function"?(o=r.filter,e=o("",e)):Lr(r.filter)&&(o=r.filter,s=o);var n=[];if(typeof e!="object"||e===null)return"";var a=uP[r.arrayFormat],h=a==="comma"&&r.commaRoundTrip;s||(s=Object.keys(e)),r.sort&&s.sort(r.sort);for(var l=cP(),c=0;c<s.length;++c){var u=s[c],d=e[u];r.skipNulls&&d===null||dP(n,b2(d,u,a,h,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,l))}var f=n.join(r.delimiter),p=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""}});var _P=K((yat,xP)=>{"use strict";var as=gg(),_g=Object.prototype.hasOwnProperty,mP=Array.isArray,zt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:as.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},T2=function(i){return i.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},gP=function(i,t,e){if(i&&typeof i=="string"&&t.comma&&i.indexOf(",")>-1)return i.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return i},S2="utf8=%26%2310003%3B",E2="utf8=%E2%9C%93",A2=function(t,e){var r={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=e.parameterLimit===1/0?void 0:e.parameterLimit,n=s.split(e.delimiter,e.throwOnLimitExceeded?o+1:o);if(e.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,h,l=e.charset;if(e.charsetSentinel)for(h=0;h<n.length;++h)n[h].indexOf("utf8=")===0&&(n[h]===E2?l="utf-8":n[h]===S2&&(l="iso-8859-1"),a=h,h=n.length);for(h=0;h<n.length;++h)if(h!==a){var c=n[h],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,f,p;d===-1?(f=e.decoder(c,zt.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),zt.decoder,l,"key"),p=as.maybeMap(gP(c.slice(d+1),e,mP(r[f])?r[f].length:0),function(x){return e.decoder(x,zt.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=T2(String(p))),c.indexOf("[]=")>-1&&(p=mP(p)?[p]:p);var m=_g.call(r,f);m&&e.duplicates==="combine"?r[f]=as.combine(r[f],p):(!m||e.duplicates==="last")&&(r[f]=p)}return r},w2=function(i,t,e,r){var s=0;if(i.length>0&&i[i.length-1]==="[]"){var o=i.slice(0,-1).join("");s=Array.isArray(t)&&t[o]?t[o].length:0}for(var n=r?t:gP(t,e,s),a=i.length-1;a>=0;--a){var h,l=i[a];if(l==="[]"&&e.parseArrays)h=e.allowEmptyArrays&&(n===""||e.strictNullHandling&&n===null)?[]:as.combine([],n);else{h=e.plainObjects?{__proto__:null}:{};var c=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,u=e.decodeDotInKeys?c.replace(/%2E/g,"."):c,d=parseInt(u,10);!e.parseArrays&&u===""?h={0:n}:!isNaN(d)&&l!==u&&String(d)===u&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(h=[],h[d]=n):u!=="__proto__"&&(h[u]=n)}n=h}return n},C2=function(t,e,r,s){if(t){var o=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=r.depth>0&&n.exec(o),l=h?o.slice(0,h.index):o,c=[];if(l){if(!r.plainObjects&&_g.call(Object.prototype,l)&&!r.allowPrototypes)return;c.push(l)}for(var u=0;r.depth>0&&(h=a.exec(o))!==null&&u<r.depth;){if(u+=1,!r.plainObjects&&_g.call(Object.prototype,h[1].slice(1,-1))&&!r.allowPrototypes)return;c.push(h[1])}if(h){if(r.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");c.push("["+o.slice(h.index)+"]")}return w2(c,e,r,s)}},P2=function(t){if(!t)return zt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof t.throwOnLimitExceeded<"u"&&typeof t.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=typeof t.charset>"u"?zt.charset:t.charset,r=typeof t.duplicates>"u"?zt.duplicates:t.duplicates;if(r!=="combine"&&r!=="first"&&r!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:zt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:zt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:zt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:zt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:zt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:zt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:zt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:zt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:zt.decoder,delimiter:typeof t.delimiter=="string"||as.isRegExp(t.delimiter)?t.delimiter:zt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:zt.depth,duplicates:r,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:zt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:zt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:zt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:zt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:zt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}};xP.exports=function(i,t){var e=P2(t);if(i===""||i===null||typeof i>"u")return e.plainObjects?{__proto__:null}:{};for(var r=typeof i=="string"?A2(i,e):i,s=e.plainObjects?{__proto__:null}:{},o=Object.keys(r),n=0;n<o.length;++n){var a=o[n],h=C2(a,r[a],e,typeof i=="string");s=as.merge(s,h,e)}return e.allowSparse===!0?s:as.compact(s)}});var bP=K((bat,yP)=>{"use strict";var R2=pP(),M2=_P(),B2=xu();yP.exports={formats:B2,parse:M2,stringify:R2}});var EP=K(Do=>{"use strict";var I2=l1();function ar(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var F2=/^([a-z0-9.+-]+:)/i,G2=/:[0-9]*$/,U2=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,k2=["<",">",'"',"`"," ","\r",`
1093
1093
  `," "],O2=["{","}","|","\\","^","`"].concat(k2),yg=["'"].concat(O2),vP=["%","/","?",";","#"].concat(yg),TP=["/","?","#"],L2=255,SP=/^[+a-z0-9A-Z_-]{0,63}$/,D2=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,N2={javascript:!0,"javascript:":!0},bg={javascript:!0,"javascript:":!0},Lo={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},vg=bP();function gh(i,t,e){if(i&&typeof i=="object"&&i instanceof ar)return i;var r=new ar;return r.parse(i,t,e),r}ar.prototype.parse=function(i,t,e){if(typeof i!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof i);var r=i.indexOf("?"),s=r!==-1&&r<i.indexOf("#")?"?":"#",o=i.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),i=o.join(s);var a=i;if(a=a.trim(),!e&&i.split("#").length===1){var h=U2.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=vg.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=F2.exec(a);if(l){l=l[0];var c=l.toLowerCase();this.protocol=c,a=a.substr(l.length)}if(e||l||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(l&&bg[l])&&(a=a.substr(2),this.slashes=!0)}if(!bg[l]&&(u||l&&!Lo[l])){for(var d=-1,f=0;f<TP.length;f++){var p=a.indexOf(TP[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,x;d===-1?x=a.lastIndexOf("@"):x=a.lastIndexOf("@",d),x!==-1&&(m=a.slice(0,x),a=a.slice(x+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<vP.length;f++){var p=a.indexOf(vP[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var v=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!v)for(var y=this.hostname.split(/\./),f=0,b=y.length;f<b;f++){var T=y[f];if(T&&!T.match(SP)){for(var w="",S=0,A=T.length;S<A;S++)T.charCodeAt(S)>127?w+="x":w+=T[S];if(!w.match(SP)){var R=y.slice(0,f),I=y.slice(f+1),P=T.match(D2);P&&(R.push(P[1]),I.unshift(P[2])),I.length&&(a="/"+I.join(".")+a),this.hostname=R.join(".");break}}}this.hostname.length>L2?this.hostname="":this.hostname=this.hostname.toLowerCase(),v||(this.hostname=I2.toASCII(this.hostname));var B=this.port?":"+this.port:"",W=this.hostname||"";this.host=W+B,this.href+=this.host,v&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!N2[c])for(var f=0,b=yg.length;f<b;f++){var N=yg[f];if(a.indexOf(N)!==-1){var nt=encodeURIComponent(N);nt===N&&(nt=escape(N)),a=a.split(N).join(nt)}}var j=a.indexOf("#");j!==-1&&(this.hash=a.substr(j),a=a.slice(0,j));var F=a.indexOf("?");if(F!==-1?(this.search=a.substr(F),this.query=a.substr(F+1),t&&(this.query=vg.parse(this.query)),a=a.slice(0,F)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Lo[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var B=this.pathname||"",H=this.search||"";this.path=B+H}return this.href=this.format(),this};function H2(i){return typeof i=="string"&&(i=gh(i)),i instanceof ar?i.format():ar.prototype.format.call(i)}ar.prototype.format=function(){var i=this.auth||"";i&&(i=encodeURIComponent(i),i=i.replace(/%3A/i,":"),i+="@");var t=this.protocol||"",e=this.pathname||"",r=this.hash||"",s=!1,o="";this.host?s=i+this.host:this.hostname&&(s=i+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=vg.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Lo[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),r&&r.charAt(0)!=="#"&&(r="#"+r),n&&n.charAt(0)!=="?"&&(n="?"+n),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),t+s+e+n+r};function V2(i,t){return gh(i,!1,!0).resolve(t)}ar.prototype.resolve=function(i){return this.resolveObject(gh(i,!1,!0)).format()};function W2(i,t){return i?gh(i,!1,!0).resolveObject(t):t}ar.prototype.resolveObject=function(i){if(typeof i=="string"){var t=new ar;t.parse(i,!1,!0),i=t}for(var e=new ar,r=Object.keys(this),s=0;s<r.length;s++){var o=r[s];e[o]=this[o]}if(e.hash=i.hash,i.href==="")return e.href=e.format(),e;if(i.slashes&&!i.protocol){for(var n=Object.keys(i),a=0;a<n.length;a++){var h=n[a];h!=="protocol"&&(e[h]=i[h])}return Lo[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(i.protocol&&i.protocol!==e.protocol){if(!Lo[i.protocol]){for(var l=Object.keys(i),c=0;c<l.length;c++){var u=l[c];e[u]=i[u]}return e.href=e.format(),e}if(e.protocol=i.protocol,!i.host&&!bg[i.protocol]){for(var b=(i.pathname||"").split("/");b.length&&!(i.host=b.shift()););i.host||(i.host=""),i.hostname||(i.hostname=""),b[0]!==""&&b.unshift(""),b.length<2&&b.unshift(""),e.pathname=b.join("/")}else e.pathname=i.pathname;if(e.search=i.search,e.query=i.query,e.host=i.host||"",e.auth=i.auth,e.hostname=i.hostname||i.host,e.port=i.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||i.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=i.host||i.pathname&&i.pathname.charAt(0)==="/",x=m||p||e.host&&i.pathname,v=x,y=e.pathname&&e.pathname.split("/")||[],b=i.pathname&&i.pathname.split("/")||[],T=e.protocol&&!Lo[e.protocol];if(T&&(e.hostname="",e.port=null,e.host&&(y[0]===""?y[0]=e.host:y.unshift(e.host)),e.host="",i.protocol&&(i.hostname=null,i.port=null,i.host&&(b[0]===""?b[0]=i.host:b.unshift(i.host)),i.host=null),x=x&&(b[0]===""||y[0]==="")),m)e.host=i.host||i.host===""?i.host:e.host,e.hostname=i.hostname||i.hostname===""?i.hostname:e.hostname,e.search=i.search,e.query=i.query,y=b;else if(b.length)y||(y=[]),y.pop(),y=y.concat(b),e.search=i.search,e.query=i.query;else if(i.search!=null){if(T){e.host=y.shift(),e.hostname=e.host;var w=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;w&&(e.auth=w.shift(),e.hostname=w.shift(),e.host=e.hostname)}return e.search=i.search,e.query=i.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!y.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var S=y.slice(-1)[0],A=(e.host||i.host||y.length>1)&&(S==="."||S==="..")||S==="",R=0,I=y.length;I>=0;I--)S=y[I],S==="."?y.splice(I,1):S===".."?(y.splice(I,1),R++):R&&(y.splice(I,1),R--);if(!x&&!v)for(;R--;R)y.unshift("..");x&&y[0]!==""&&(!y[0]||y[0].charAt(0)!=="/")&&y.unshift(""),A&&y.join("/").substr(-1)!=="/"&&y.push("");var P=y[0]===""||y[0]&&y[0].charAt(0)==="/";if(T){e.hostname=P?"":y.length?y.shift():"",e.host=e.hostname;var w=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;w&&(e.auth=w.shift(),e.hostname=w.shift(),e.host=e.hostname)}return x=x||e.host&&y.length,x&&!P&&y.unshift(""),y.length>0?e.pathname=y.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=i.auth||e.auth,e.slashes=e.slashes||i.slashes,e.href=e.format(),e};ar.prototype.parseHost=function(){var i=this.host,t=G2.exec(i);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),i=i.substr(0,i.length-t.length)),i&&(this.hostname=i)};Do.parse=gh;Do.resolve=V2;Do.resolveObject=W2;Do.format=H2;Do.Url=ar});var bR=()=>{let i=new Map;return{load:async n=>{let a=[];for(let[h,l]of Object.entries(n))i.has(h)||a.push([h,l]);a.length>0&&await Promise.all(a.map(async([h,l])=>{let d={buffer:await(await fetch(l.url)).arrayBuffer(),type:l.type};i.set(h,d)}))},getBufferMap:()=>{let n={};for(let[a,h]of i.entries())n[a]=h;return n},clear:()=>i.clear(),size:()=>i.size,has:n=>i.has(n)}};var ax=({positionX:i=0,positionY:t=0,width:e,height:r,anchorX:s=0,anchorY:o=0})=>{if(typeof e!="number"||typeof r!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:r*o},a=i-n.x,h=t-n.y;return{x:a,y:h,originX:n.x,originY:n.y}};var hx={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"},Zu={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var dr={RECT:"rect",TEXT:"text",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider"};var Ke=i=>{if(typeof i.width!="number"||typeof i.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(dr).includes(i.type))throw new Error("Input Error: Type must be one of "+Object.values(dr).join(", "));if(!i.id)throw new Error("Input Error: Id is missing");let t=i.scaleX?i.scaleX*i.width:i.width,e=i.scaleY?i.scaleY*i.height:i.height;i.type===dr.CONTAINER&&(t=i.width,e=i.height);let{x:r,y:s,originX:o,originY:n}=ax({positionX:i.x,positionY:i.y,width:t,height:e,anchorX:i.anchorX,anchorY:i.anchorY}),a={id:i.id,type:i.type,width:Math.round(t),height:Math.round(e),x:Math.round(r),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:i.alpha??1};return i.hover&&(a.hover=i.hover),i.click&&(a.click=i.click),a};var lx=i=>{let t=i.direction,e=!!i.scroll,r=i.gap||0,s=structuredClone(i.children||[]),o=[],n=0,a=0,h=0,l=0,c=0,u=0,d=0,f=0,p=0,m=0;for(let v=0;v<s.length;v++){let y=v<s.length-1?r:0,b=s[v];v>0?t==="horizontal"?(b.x=h,b.y=d):t==="vertical"&&(b.x=f,b.y=l):(t==="horizontal"||t==="vertical")&&(b.x=0,b.y=0),b=Es([b])[0],t==="horizontal"?(i.width&&b.width+p>i.width&&!e?(h=0,p=0,d+=c+r,c=b.height,b.x=0,b.y=d):c=Math.max(c,b.height),h+=b.width+y,p=b.x+b.width,n=Math.max(h,n),a=Math.max(b.height+b.y,a)):t==="vertical"&&(i.height&&b.height+m>i.height&&!e?(l=0,m=0,f+=u+r,u=b.width,b.x=f,b.y=0):u=Math.max(u,b.width),l+=b.height+y,m=b.y+b.height,n=Math.max(b.width+b.x,n),a=Math.max(l,a)),o.push(b)}return{...Ke({...i,width:i.width?i.width:n,height:i.height?i.height:a}),children:o,direction:t,gap:r,scroll:e,rotation:i.rotation??0}};var cx=i=>{let t=Ke(i),e=t;return i.border&&(e={...t,border:{alpha:i.border?.alpha??1,color:i.border?.color??"black",width:i.border?.width??0}}),{...e,cursor:i.cursor??"",fill:i.fill??"white",pointerDown:i.pointerDown??"",pointerMove:i.pointerMove??"",pointerUp:i.pointerUp??"",rotation:i.rotation??0}};var ux=i=>({...Ke(i),src:i.src??i.url??"",alpha:i.alpha??1,cursor:i.cursor??""});C();var DT={extension:{type:_.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(LT(),PB))}};C();var HT={extension:{type:_.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(NT(),RB))}};C();C();Cl();bl();C();Mt();sa();var vc;function qT(i){return vc!==void 0||(vc=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:i??Ai.defaultOptions.failIfMajorPerformanceCaveat};try{if(!$.get().getWebGLRenderingContext())return!1;let r=$.get().createCanvas().getContext("webgl",t),s=!!r?.getContextAttributes()?.stencil;if(r){let o=r.getExtension("WEBGL_lose_context");o&&o.loseContext()}return r=null,s}catch{return!1}})()),vc}Mt();var Tc;async function KT(i={}){return Tc!==void 0||(Tc=await(async()=>{let t=$.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(i)).requestDevice(),!0}catch{return!1}})()),Tc}sa();var lw=["webgl","webgpu","canvas"];async function cw(i){let t=[];i.preference?(t.push(i.preference),lw.forEach(o=>{o!==i.preference&&t.push(o)})):t=lw.slice();let e,r={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await KT()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(kE(),UE));e=a,r={...i,...i.webgpu};break}else if(n==="webgl"&&qT(i.failIfMajorPerformanceCaveat??Ai.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(hw(),aw));e=a,r={...i,...i.webgl};break}else if(n==="canvas")throw r={...i},new Error("CanvasRenderer is not yet implemented")}if(delete r.webgpu,delete r.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(r),s}fr();Wp();Lt();var uw=class Bm{constructor(...t){this.stage=new vt,t[0]!==void 0&&z(Q,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await cw(t),Bm._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return z(Q,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let r=Bm._plugins.slice(0);r.reverse(),r.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};uw._plugins=[];var Ja=uw;G.handleByList(_.Application,Ja._plugins);G.add(pa);C();qr();Wd();Mt();C();zi();le();bt();yp();Ep();var th=class extends no{constructor(t,e){super();let{textures:r,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=r[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:h}=r[n.page],l=new it(n.x+a.x,n.y+a.y,n.width,n.height),c=new E({source:h,frame:l});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:c}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){Kn.install(t)}static uninstall(t){Kn.uninstall(t)}};var Yc={test(i){return typeof i=="string"&&i.startsWith("info face=")},parse(i){let t=i.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let u in t){let d=t[u].match(/^[a-z]+/gm)[0],f=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),p={};for(let m in f){let x=f[m].split("="),v=x[0],y=x[1].replace(/"/gm,""),b=parseFloat(y),T=isNaN(b)?y:b;p[v]=T}e[d].push(p)}let r={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(r.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),r.fontSize=parseInt(s.size,10),r.fontFamily=s.face,r.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)r.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let h={};r.baseLineOffset=r.lineHeight-parseInt(o.base,10);let l=e.char;for(let u=0;u<l.length;u++){let d=l[u],f=parseInt(d.id,10),p=d.letter??d.char??String.fromCharCode(f);p==="space"&&(p=" "),h[f]=p,r.chars[p]={id:f,page:parseInt(d.page,10)||0,x:parseInt(d.x,10),y:parseInt(d.y,10),width:parseInt(d.width,10),height:parseInt(d.height,10),xOffset:parseInt(d.xoffset,10),yOffset:parseInt(d.yoffset,10),xAdvance:parseInt(d.xadvance,10),kerning:{}}}let c=e.kerning||[];for(let u=0;u<c.length;u++){let d=parseInt(c[u].first,10),f=parseInt(c[u].second,10),p=parseInt(c[u].amount,10);r.chars[h[f]].kerning[h[d]]=p}return r}};Mt();var Im={test(i){let t=i;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(i){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=i.getElementsByTagName("info")[0],r=i.getElementsByTagName("common")[0],s=i.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=i.getElementsByTagName("page"),n=i.getElementsByTagName("char"),a=i.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(r.getAttribute("lineHeight"),10);for(let l=0;l<o.length;l++)t.pages.push({id:parseInt(o[l].getAttribute("id"),10)||0,file:o[l].getAttribute("file")});let h={};t.baseLineOffset=t.lineHeight-parseInt(r.getAttribute("base"),10);for(let l=0;l<n.length;l++){let c=n[l],u=parseInt(c.getAttribute("id"),10),d=c.getAttribute("letter")??c.getAttribute("char")??String.fromCharCode(u);d==="space"&&(d=" "),h[u]=d,t.chars[d]={id:u,page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xOffset:parseInt(c.getAttribute("xoffset"),10),yOffset:parseInt(c.getAttribute("yoffset"),10),xAdvance:parseInt(c.getAttribute("xadvance"),10),kerning:{}}}for(let l=0;l<a.length;l++){let c=parseInt(a[l].getAttribute("first"),10),u=parseInt(a[l].getAttribute("second"),10),d=parseInt(a[l].getAttribute("amount"),10);t.chars[h[u]].kerning[h[c]]=d}return t}};var Fm={test(i){return typeof i=="string"&&i.includes("<font>")?Im.test($.get().parseXML(i)):!1},parse(i){return Im.parse($.get().parseXML(i))}};var lI=[".xml",".fnt"],dw={extension:{type:_.CacheParser,name:"cacheBitmapFont"},test:i=>i instanceof th,getCacheableAssets(i,t){let e={};return i.forEach(r=>{e[r]=t,e[`${r}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},fw={extension:{type:_.LoadParser,priority:ce.Normal},name:"loadBitmapFont",test(i){return lI.includes(ie.extname(i).toLowerCase())},async testParse(i){return Yc.test(i)||Fm.test(i)},async parse(i,t,e){let r=Yc.test(i)?Yc.parse(i):Fm.parse(i),{src:s}=t,{pages:o}=r,n=[],a=r.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;u<o.length;++u){let d=o[u].file,f=ie.join(ie.dirname(s),d);f=En(f,s),n.push({src:f,data:a})}let h=await e.load(n),l=n.map(u=>h[u.src]);return new th({data:r,textures:l},s)},async load(i,t){return await(await $.get().fetch(i)).text()},async unload(i,t,e){await Promise.all(i.pages.map(r=>e.unload(r.texture.source._sourceOrigin))),i.destroy()}};At();var qc=class{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),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;let t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let r=0;r<e;r++)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())}};xi();C();bt();var pw={extension:{type:_.CacheParser,name:"cacheTextureArray"},test:i=>Array.isArray(i)&&i.every(t=>t instanceof E),getCacheableAssets:(i,t)=>{let e={};return i.forEach(r=>{t.forEach((s,o)=>{e[r+(o===0?"":o+1)]=s})}),e}};C();async function Kc(i){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(i)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var mw={extension:{type:_.DetectionParser,priority:1},test:async()=>Kc("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};C();var gw=["png","jpg","jpeg"],xw={extension:{type:_.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...gw],remove:async i=>i.filter(t=>!gw.includes(t))};C();var cI="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function vo(i){return cI?!1:document.createElement("video").canPlayType(i)!==""}var _w={extension:{type:_.DetectionParser,priority:0},test:async()=>vo("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};C();var yw={extension:{type:_.DetectionParser,priority:0},test:async()=>vo("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};C();var bw={extension:{type:_.DetectionParser,priority:0},test:async()=>vo("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};C();var vw={extension:{type:_.DetectionParser,priority:0},test:async()=>Kc("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};At();zi();Sn();yl();var Zc=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,r)=>(this._parsersValidated=!1,t[e]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let r={promise:null,parser:null};return r.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||O(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(t,e,this)){o=a;break}}if(!o)return O(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),r.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,e,this)&&(s=await a.parse(s,e,this)||s,r.parser=a)}return s})(),r}async load(t,e){this._parsersValidated||this._validateParsers();let r=0,s={},o=$i(t),n=Ee(t,l=>({alias:[l],src:l,data:{}})),a=n.length,h=n.map(async l=>{let c=ie.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),s[l.src]=await this.promiseCache[c].promise,e&&e(++r/a)}catch(u){throw delete this.promiseCache[c],delete s[l.src],new Error(`[Loader.load] Failed to load ${c}.
1094
1094
  ${u}`)}});return await Promise.all(h),o?s[n[0].src]:s}async unload(t){let r=Ee(t,s=>({alias:[s],src:s})).map(async s=>{let o=ie.toAbsolute(s.src),n=this.promiseCache[o];if(n){let a=await n.promise;delete this.promiseCache[o],await n.parser?.unload?.(a,s,this)}});await Promise.all(r)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name?t[e.name]&&O(`[Assets] loadParser name conflict "${e.name}"`):O("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}};Mt();C();function ir(i,t){if(Array.isArray(t)){for(let e of t)if(i.startsWith(`data:${e}`))return!0;return!1}return i.startsWith(`data:${t}`)}zi();function sr(i,t){let e=i.split("?")[0],r=ie.extname(e).toLowerCase();return Array.isArray(t)?t.includes(r):r===t}qr();var uI=".json",dI="application/json",Tw={extension:{type:_.LoadParser,priority:ce.Low},name:"loadJson",test(i){return ir(i,dI)||sr(i,uI)},async load(i){return await(await $.get().fetch(i)).json()}};Mt();C();qr();var fI=".txt",pI="text/plain",Sw={name:"loadTxt",extension:{type:_.LoadParser,priority:ce.Low,name:"loadTxt"},test(i){return ir(i,pI)||sr(i,fI)},async load(i){return await(await $.get().fetch(i)).text()}};Mt();C();At();zi();xi();qr();var mI=["normal","bold","100","200","300","400","500","600","700","800","900"],gI=[".ttf",".otf",".woff",".woff2"],xI=["font/ttf","font/otf","font/woff","font/woff2"],_I=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function yI(i){let t=ie.extname(i),s=ie.basename(i,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)),o=s.length>0;for(let a of s)if(!a.match(_I)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var bI=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function vI(i){return bI.test(i)?i:encodeURI(i)}var Ew={extension:{type:_.LoadParser,priority:ce.Low},name:"loadWebFont",test(i){return ir(i,xI)||sr(i,gI)},async load(i,t){let e=$.get().getFontFaceSet();if(e){let r=[],s=t.data?.family??yI(i),o=t.data?.weights?.filter(a=>mI.includes(a))??["normal"],n=t.data??{};for(let a=0;a<o.length;a++){let h=o[a],l=new FontFace(s,`url(${vI(i)})`,{...n,weight:h});await l.load(),e.add(l),r.push(l)}return xt.set(`${s}-and-url`,{url:i,fontFaces:r}),r.length===1?r[0]:r}return O("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(i){(Array.isArray(i)?i:[i]).forEach(t=>{xt.remove(`${t.family}-and-url`),$.get().getFontFaceSet().delete(t)})}};Mt();C();ks();nc();Gs();function To(i,t=1){let e=Ve.RETINA_PREFIX?.exec(i);return e?parseFloat(e[1]):t}qr();bt();At();xi();function So(i,t,e){i.label=e,i._sourceOrigin=e;let r=new E({source:i,label:e}),s=()=>{delete t.promiseCache[e],xt.has(e)&&xt.remove(e)};return r.source.once("destroy",()=>{t.promiseCache[e]&&(O("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),r.once("destroy",()=>{i.destroyed||(O("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),r}var TI=".svg",SI="image/svg+xml",Aw={extension:{type:_.LoadParser,priority:ce.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(i){return ir(i,SI)||sr(i,TI)},async load(i,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?AI(i):EI(i,t,e,this.config.crossOrigin)},unload(i){i.destroy(!0)}};async function EI(i,t,e,r){let o=await(await $.get().fetch(i)).blob(),n=URL.createObjectURL(o),a=new Image;a.src=n,a.crossOrigin=r,await a.decode(),URL.revokeObjectURL(n);let h=document.createElement("canvas"),l=h.getContext("2d"),c=t.data?.resolution||To(i),u=t.data?.width??a.width,d=t.data?.height??a.height;h.width=u*c,h.height=d*c,l.drawImage(a,0,0,u*c,d*c);let{parseAsGraphicsContext:f,...p}=t.data??{},m=new Fe({resource:h,alphaMode:"premultiply-alpha-on-upload",resolution:c,...p});return So(m,e,i)}async function AI(i){let e=await(await $.get().fetch(i)).text(),r=new we;return r.svg(e),r}Mt();C();ks();var wI=`(function () {
1095
1095
  'use strict';
@@ -1141,7 +1141,7 @@ ${u}`)}});return await Promise.all(h),o?s[n[0].src]:s}async unload(t){let r=Ee(t
1141
1141
  };
1142
1142
 
1143
1143
  })();
1144
- `,wo=null,eh=class{constructor(){wo||(wo=URL.createObjectURL(new Blob([CI],{type:"application/javascript"}))),this.worker=new Worker(wo)}};eh.revokeObjectURL=function(){wo&&(URL.revokeObjectURL(wo),wo=null)};var ww=0,Gm,Um=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new Ao;e.addEventListener("message",r=>{e.terminate(),Ao.revokeObjectURL(),t(r.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Gm===void 0&&(Gm=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Gm&&(this._createdWorkers++,t=new eh().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let r=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),r}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),r=e.id;this._resolveHash[ww]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:ww++,id:r})}},km=new Um;qr();var PI=[".jpeg",".jpg",".png",".webp",".avif"],RI=["image/jpeg","image/png","image/webp","image/avif"];async function MI(i,t){let e=await $.get().fetch(i);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${e.status} ${e.statusText}`);let r=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(r,{premultiplyAlpha:"none"}):createImageBitmap(r)}var Qc={name:"loadTextures",extension:{type:_.LoadParser,priority:ce.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return ir(i,RI)||sr(i,PI)},async load(i,t,e){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await km.isImageBitmapSupported()?r=await km.loadImageBitmap(i,t):r=await MI(i,t):r=await new Promise((o,n)=>{r=new Image,r.crossOrigin=this.config.crossOrigin,r.src=i,r.complete?o(r):(r.onload=()=>{o(r)},r.onerror=n)});let s=new Fe({resource:r,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||To(i),...t.data});return So(s,e,i)},unload(i){i.destroy(!0)}};C();Kd();qd();var Cw=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],BI=Cw.map(i=>`video/${i.substring(1)}`);function II(i,t,e){e===void 0&&!t.startsWith("data:")?i.crossOrigin=GI(t):e!==!1&&(i.crossOrigin=typeof e=="string"?e:"anonymous")}function FI(i){return new Promise((t,e)=>{i.addEventListener("canplaythrough",r),i.addEventListener("error",s),i.load();function r(){o(),t()}function s(n){o(),e(n)}function o(){i.removeEventListener("canplaythrough",r),i.removeEventListener("error",s)}})}function GI(i,t=globalThis.location){if(i.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var Pw={name:"loadVideo",extension:{type:_.LoadParser,name:"loadVideo"},test(i){let t=ir(i,BI),e=sr(i,Cw);return t||e},async load(i,t,e){let r={...Os.defaultOptions,resolution:t.data?.resolution||To(i),alphaMode:t.data?.alphaMode||await Al(),...t.data},s=document.createElement("video"),o={preload:r.autoLoad!==!1?"auto":void 0,"webkit-playsinline":r.playsinline!==!1?"":void 0,playsinline:r.playsinline!==!1?"":void 0,muted:r.muted===!0?"":void 0,loop:r.loop===!0?"":void 0,autoplay:r.autoPlay!==!1?"":void 0};Object.keys(o).forEach(h=>{let l=o[h];l!==void 0&&s.setAttribute(h,l)}),r.muted===!0&&(s.muted=!0),II(s,i,r.crossorigin);let n=document.createElement("source"),a;if(i.startsWith("data:"))a=i.slice(5,i.indexOf(";"));else if(!i.startsWith("blob:")){let h=i.split("?")[0].slice(i.lastIndexOf(".")+1).toLowerCase();a=Os.MIME_TYPES[h]||`video/${h}`}return n.src=i,a&&(n.type=a),new Promise(h=>{let l=async()=>{let c=new Os({...r,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await FI(s),h(So(c,e,i))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(i){i.destroy(!0)}};C();Gs();C();Gs();var Jc={extension:{type:_.ResolveParser,name:"resolveTexture"},test:Qc.test,parse:i=>({resolution:parseFloat(Ve.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};var Rw={extension:{type:_.ResolveParser,priority:-2,name:"resolveJson"},test:i=>Ve.RETINA_PREFIX.test(i)&&i.endsWith(".json"),parse:Jc.parse};Gs();Sn();yl();var tu=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Ve,this.loader=new Zc,this.cache=xt,this._backgroundLoader=new qc(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){O("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,r=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:r}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let r=$i(t),s=Ee(t).map(a=>{if(typeof a!="string"){let h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return r?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;typeof t=="string"&&(r=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,h=0,l=()=>{e?.(++a/h)},c=n.map(u=>{let d=s[u];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{o[u]=f})});return await Promise.all(c),r?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(r=>{this._backgroundLoader.add(Object.values(r))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return xt.get(t);let e={};for(let r=0;r<t.length;r++)e[r]=xt.get(t[r]);return e}async _mapLoadToResolve(t,e){let r=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(r,e);this._backgroundLoader.active=!0;let o={};return r.forEach(n=>{let a=s[n.src],h=[n.src];n.alias&&h.push(...n.alias),h.forEach(l=>{o[l]=a}),xt.set(h,a)}),o}async unload(t){this._initialized||await this.init();let e=Ee(t).map(s=>typeof s!="string"?s.src:s),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=Ee(t);let e=this.resolver.resolveBundle(t),r=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(r)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(r=>{xt.remove(r.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let r of t.detections)t.skipDetections||await r.test()?e=await r.add(e):t.skipDetections||(e=await r.remove(e));return e=e.filter((r,s)=>e.indexOf(r)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(r=>r in t).forEach(r=>{e.config[r]=t[r]})})}},or=new tu;G.handleByList(_.LoadParser,or.loader.parsers).handleByList(_.ResolveParser,or.resolver.parsers).handleByList(_.CacheParser,or.cache.parsers).handleByList(_.DetectionParser,or.detections);G.add(pw,xw,mw,vw,_w,yw,bw,Tw,Sw,Ew,Aw,Qc,Pw,fw,dw,Jc,Rw);var Mw={loader:_.LoadParser,resolver:_.ResolveParser,cache:_.CacheParser,detection:_.DetectionParser};G.handle(_.Asset,i=>{let t=i.ref;Object.entries(Mw).filter(([e])=>!!t[e]).forEach(([e,r])=>G.add(Object.assign(t[e],{extension:t[e].extension??r})))},i=>{let t=i.ref;Object.keys(Mw).filter(e=>!!t[e]).forEach(e=>G.remove(t[e]))});Jh();Lt();_l();var eu=class extends gi{constructor(t,e){let{text:r,resolution:s,style:o,anchor:n,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=r??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new me({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=l??!1,a!==void 0&&(this.width=a),h!==void 0&&(this.height=h)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,r=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-r*this.anchor.y,t.y>=o&&t.y<=o+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function Bw(i,t){let e=i[0]??{};return(typeof e=="string"||i[1])&&(z(Q,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}Yn();ts();var yr=class extends eu{constructor(...t){let e=Bw(t,"Text");super(e,Bt),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,r=jt.measureText(this._text,this._style),{width:s,height:o}=r;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};qr();bt();Jd();fr();gp();Tl();Yn();ts();_e();var UI=Ui(Vl(),1);G.add(DT,HT);var Iw=i=>{let e={...{fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!0,breakWords:!0},...i.textStyle};e.lineHeight=Math.round(e.fontSize*e.lineHeight),i.width&&(e.wordWrapWidth=i.width,e.wordWrap=!0);let{width:r,height:s}=jt.measureText(i.content??"",new Bt(e)),o=Math.round(r),n=Math.round(s);return{...Ke({...i,width:o,height:n}),content:i.content??"",textStyle:{...e}}};var kI=(i,t)=>{let e=[],r=[],s=0,o=0,n=0,a=0,h=[...i],l=new WeakSet;for(;h.length>0;){let u=h[0];if(!u.text||u.text.length===0){h.shift();continue}let d=t-s,f={...u.textStyle,wordWrapWidth:d},p=jt.measureText(u.text,new Bt(f));if(p.lineWidths[0]>d&&r.length>0){e.push({lineParts:[...r],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,r=[];continue}let m=p.lines[0];p.lines.length===1&&u.text.endsWith(" ")&&!m.endsWith(" ")&&(m+=" ");let x=jt.measureText(m,new Bt({...u.textStyle,wordWrap:!1,breakWords:!1})),v={text:m,textStyle:f,height:x.height,x:s,y:o};if(u.furigana&&!l.has(u)){l.add(u);let b=jt.measureText(u.furigana.text,new Bt(u.furigana.textStyle)),T=-b.height+o+2,w={text:u.furigana.text,textStyle:u.furigana.textStyle,x:s+(p.lineWidths[0]-b.width)/2,y:T};v.furigana=w}r.push(v),n=Math.max(n,x.height),s+=p.lineWidths[0],a=Math.max(a,s);let y=p.lines.slice(1).join(" ");y&&y.length>0?u.text=y:h.shift()}r.length>0&&e.push({lineParts:r,y:o,lineMaxHeight:n});for(let u=0;u<e.length;u++){let d=e[u].lineMaxHeight;e[u].lineParts=e[u].lineParts.map(f=>{let p=f.height;f.height&&delete f.height;let m=f.y+(d-p),x=f.furigana;return x&&(x.y=x.y-f.y+m),{...f,...x&&{furigana:x},y:m}})}let c=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:c}},Fw=i=>{let t={fill:"black",fontFamily:"Roboto",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!0},e=(i.content||[]).map(c=>{let u={...t,...c.textStyle||{}};i.width&&(u.wordWrapWidth=i.width,u.wordWrap=!0);let d=null;if(c.furigana){let f={...t,...c.furigana.textStyle||{}};i.width&&(f.wordWrapWidth=i.width,f.wordWrap=!0),d={text:c.furigana.text,textStyle:f}}return{text:c.text.replace(/ +$/,f=>"\xA0".repeat(f.length)),textStyle:u,...d&&{furigana:d}}}),r=i.width||500,{chunks:s,width:o,height:n}=kI(e,r),a=i.width||o,l=Ke({...i,width:a,height:n});if(l.alpha=i.alpha??1,i.indicator){let c=i.indicator;l.indicator={revealing:{src:c.revealing?.src??"",width:c.revealing?.width??12,height:c.revealing?.height??12},complete:{src:c.complete?.src??"",width:c.complete?.width??12,height:c.complete?.height??12},offset:c.offset??12}}return{...l,content:s,textStyle:{...t,...i.textStyle||{}},speed:i.speed??50,revealEffect:i.revealEffect??"typewriter",...i.width!==void 0&&{width:i.width}}};var Gw=i=>{let t=Ke(i),e=i.min??0,r=i.max??100;if(r<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");return{...t,direction:i.direction??"horizontal",thumbSrc:i.thumbSrc??"",barSrc:i.barSrc??"",alpha:i.alpha??1,min:e,max:r,step:i.step??1,initialValue:i.initialValue??0,...i.hover&&{hover:i.hover},...i.drag&&{drag:i.drag},...i.dragStart&&{dragStart:i.dragStart},...i.dragEnd&&{dragEnd:i.dragEnd}}};var OI=i=>i.map(e=>{switch(e.type){case dr.RECT:return cx(e);case dr.CONTAINER:return lx(e);case dr.TEXT:return Iw(e);case dr.TEXT_REVEALING:return Fw(e);case dr.SPRITE:return ux(e);case dr.SLIDER:return Gw(e);default:throw new Error(`Unsupported element type: ${e.type}`)}}),Es=OI;var LI=new(window.AudioContext||window.webkitAudioContext),Om={},DI=async(i,t)=>{if(!Om[i]&&t.byteLength!==0)try{let e=await LI.decodeAudioData(t);Om[i]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${i}:`,e)}},NI=i=>Om[i],Co={load:DI,getAsset:NI};var We=({type:i,add:t,update:e,delete:r})=>({type:i,add:t,update:e,delete:r});var Lm=({type:i,animate:t})=>({type:i,animate:t});var Dm=({type:i,add:t,update:e,delete:r})=>({type:i,add:t,update:e,delete:r});var Oe=(i,t)=>{let e={fill:t.fill,fontFamily:t.fontFamily,fontSize:t.fontSize,align:t.align,lineHeight:t.lineHeight,wordWrap:t.wordWrap,breakWords:t.breakWords,wordWrapWidth:t.wordWrapWidth,strokeColor:t.strokeColor,strokeWidth:t.strokeWidth};i.style=e};async function _t(i,t,{app:e,element:r,animations:s,signal:o}){let n=[];for(let a of s)if(a.elementId===i){let h=t.find(l=>l.type===a.type);if(!h)throw new Error(`No animation plugin found for type: ${a.type}`);n.push(h.animate({app:e,element:r,animation:a,signal:o}))}return Promise.all(n)}var Uw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,signal:n})=>{if(n?.aborted)return;let a=new yr({label:e.id}),h=()=>{a.text=e.content,Oe(a,e.textStyle),a.alpha=e.alpha,a.x=e.x,a.y=e.y};n.addEventListener("abort",()=>{h()}),h();let l=e?.hover,c=e?.click;if(s&&l){let{cursor:u,soundSrc:d,actionPayload:f}=l;a.eventMode="static";let p=()=>{f&&s(`${a.label}-pointer-over`,{_event:{id:a.label},...f}),u&&(a.cursor=u),d&&i.audioStage.add({id:`hover-${Date.now()}`,url:d,loop:!1}),l?.textStyle&&Oe(a,l.textStyle)},m=()=>{a.cursor="auto",Oe(a,e.textStyle)};a.on("pointerover",p),a.on("pointerout",m)}if(s&&c){let{soundSrc:u,actionPayload:d}=c;a.eventMode="static";let f=()=>{c?.textStyle&&Oe(a,c.textStyle)},p=()=>{Oe(a,e.textStyle),d&&s(`${a.label}-click`,{_event:{id:a.label},...d}),u&&i.audioStage.add({id:`click-${Date.now()}`,url:u,loop:!1})},m=()=>{Oe(a,e.textStyle)};a.on("pointerdown",f),a.on("pointerup",p),a.on("pointerupoutside",m)}t.addChild(a),r&&r.length>0&&await _t(e.id,o,{app:i,element:a,animations:r,signal:n})};var kw=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.text=r.content,Oe(h,r.textStyle),h.x=r.x,h.y=r.y,h.alpha=r.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup");let c=r?.hover,u=r?.click;if(s&&c){let{cursor:d,soundSrc:f,actionPayload:p}=c;h.eventMode="static";let m=()=>{p&&s(`${h.label}-pointer-over`,{_event:{id:h.label},...p}),d&&(h.cursor=d),f&&i.audioStage.add({id:`hover-${Date.now()}`,url:f,loop:!1}),c?.textStyle&&Oe(h,c.textStyle)},x=()=>{h.cursor="auto",Oe(h,r.textStyle)};h.on("pointerover",m),h.on("pointerout",x)}if(s&&u){let{soundSrc:d,actionPayload:f}=u;h.eventMode="static";let p=()=>{u?.textStyle&&Oe(h,u.textStyle)},m=()=>{Oe(h,r.textStyle),f&&s(`${h.label}-click`,{_event:{id:h.label},...f}),d&&i.audioStage.add({id:`click-${Date.now()}`,url:d,loop:!1})},x=()=>{Oe(h,r.textStyle)};h.on("pointerdown",p),h.on("pointerup",m),h.on("pointerupoutside",x)}}};a.addEventListener("abort",()=>{l()}),h&&(o&&o.length>0&&await _t(r.id,n,{app:i,element:h,animations:o,signal:a}),l())};var Ow=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=()=>{n&&!n.destroyed&&n.destroy()};o.addEventListener("abort",()=>{a()}),e.animations&&e.animations.length>0&&await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a()}};var HI=We({type:"text",add:Uw,update:kw,delete:Ow});var Lw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,eventHandler:o,signal:n})=>{if(n?.aborted)return;let{id:a,x:h,y:l,width:c,height:u,fill:d,border:f,originX:p,originY:m,rotation:x,alpha:v}=e,y=new _r;y.label=a;let b=()=>{y.clear(),y.rect(0,0,Math.round(c),Math.round(u)).fill(d),y.x=Math.round(h),y.y=Math.round(l),y.alpha=v,f&&y.stroke({color:f.color,alpha:f.alpha,width:Math.round(f.width)})};n.addEventListener("abort",()=>{b()}),b();let T=e?.hover,w=e?.click;if(o&&T){let{cursor:S,soundSrc:A,actionPayload:R}=T;y.eventMode="static";let I=()=>{R&&o(`${y.label}-pointer-over`,{_event:{id:y.label},...R}),S&&(y.cursor=S),A&&i.audioStage.add({id:`hover-${Date.now()}`,url:A,loop:!1})},P=()=>{y.cursor="auto"};y.on("pointerover",I),y.on("pointerout",P)}if(o&&w){let{soundSrc:S,actionPayload:A}=w;y.eventMode="static";let R=()=>{A&&o(`${y.label}-click`,{_event:{id:y.label},...A}),S&&i.audioStage.add({id:`click-${Date.now()}`,url:S,loop:!1})};y.on("pointerup",R)}t.addChild(y),r&&r.length>0&&await _t(a,s,{app:i,element:y,animations:r,signal:n})};var Dw=async({app:i,parent:t,prevElement:e,nextElement:r,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.clear(),h.rect(0,0,Math.round(r.width),Math.round(r.height)).fill(r.fill),h.x=Math.round(r.x),h.y=Math.round(r.y),h.alpha=r.alpha,r.border&&h.stroke({color:r.border.color,alpha:r.border.alpha,width:Math.round(r.border.width)}),h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup");let c=r?.hover,u=r?.click;if(n&&c){let{cursor:d,soundSrc:f,actionPayload:p}=c;h.eventMode="static";let m=()=>{p&&n(`${h.label}-pointer-over`,{_event:{id:h.label},...p}),d&&(h.cursor=d),f&&i.audioStage.add({id:`hover-${Date.now()}`,url:f,loop:!1})},x=()=>{h.cursor="auto"};h.on("pointerover",m),h.on("pointerout",x)}if(n&&u){let{soundSrc:d,actionPayload:f}=u;h.eventMode="static";let p=()=>{f&&n(`${h.label}-click`,{_event:{id:h.label},...f}),d&&i.audioStage.add({id:`click-${Date.now()}`,url:d,loop:!1})};h.on("pointerup",p)}}};a.addEventListener("abort",()=>{l()}),h&&(s&&s.length>0&&await _t(e.id,o,{app:i,element:h,animations:s,signal:a}),l())};var Nw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=()=>{n&&!n.destroyed&&n.destroy()};o.addEventListener("abort",()=>{a()}),r&&r.length>0&&await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a()}};var VI=We({type:"rect",add:Lw,update:Dw,delete:Nw});var Hw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,signal:n})=>{if(n?.aborted)return;let{id:a,x:h,y:l,width:c,height:u,src:d,alpha:f}=e,p=d?E.from(d):E.EMPTY,m=new se(p);m.label=a;let x=()=>{m.x=Math.round(h),m.y=Math.round(l),m.width=Math.round(c),m.height=Math.round(u),m.alpha=f};n.addEventListener("abort",()=>{x()}),x();let v=e?.hover,y=e?.click;if(s&&v){let{cursor:b,soundSrc:T,actionPayload:w}=v;m.eventMode="static";let S=()=>{if(w&&s(`${m.label}-pointer-over`,{_event:{id:m.label},...w}),b&&(m.cursor=b),T&&i.audioStage.add({id:`hover-${Date.now()}`,url:T,loop:!1}),v?.src){let R=v.src?E.from(v.src):E.EMPTY;m.texture=R}},A=()=>{m.cursor="auto",m.texture=p};m.on("pointerover",S),m.on("pointerout",A)}if(s&&y){let{soundSrc:b,actionPayload:T}=y;m.eventMode="static";let w=()=>{if(y?.src){let R=y.src?E.from(y.src):E.EMPTY;m.texture=R}},S=()=>{m.texture=p,T&&s(`${m.label}-click`,{_event:{id:m.label},...T}),b&&i.audioStage.add({id:`click-${Date.now()}`,url:b,loop:!1})},A=()=>{m.texture=p};m.on("pointerdown",w),m.on("pointerup",S),m.on("pointerupoutside",A)}t.addChild(m),r&&r.length>0&&await _t(a,o,{app:i,element:m,animations:r,signal:n})};var Vw=async({app:i,parent:t,prevElement:e,nextElement:r,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){if(e.src!==r.src){let d=r.src?E.from(r.src):E.EMPTY;h.texture=d}h.x=Math.round(r.x),h.y=Math.round(r.y),h.width=Math.round(r.width),h.height=Math.round(r.height),h.alpha=r.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup");let c=r?.hover,u=r?.click;if(n&&c){let{cursor:d,soundSrc:f,actionPayload:p}=c;h.eventMode="static";let m=()=>{if(p&&n(`${h.label}-pointer-over`,{_event:{id:h.label},...p}),d&&(h.cursor=d),f&&i.audioStage.add({id:`hover-${Date.now()}`,url:f,loop:!1}),c?.src){let v=c.src?E.from(c.src):E.EMPTY;h.texture=v}},x=()=>{h.cursor="auto",h.texture=r.src?E.from(r.src):E.EMPTY};h.on("pointerover",m),h.on("pointerout",x)}if(n&&u){let{soundSrc:d,actionPayload:f}=u;h.eventMode="static";let p=()=>{if(u?.src){let v=u.src?E.from(u.src):E.EMPTY;h.texture=v}},m=()=>{h.texture=r.src?E.from(r.src):E.EMPTY,f&&n(`${h.label}-click`,{_event:{id:h.label},...f}),d&&i.audioStage.add({id:`click-${Date.now()}`,url:d,loop:!1})},x=()=>{h.texture=r.src?E.from(r.src):E.EMPTY};h.on("pointerdown",p),h.on("pointerup",m),h.on("pointerupoutside",x)}}};a.addEventListener("abort",()=>{l()}),h&&(s&&s.length>0&&await _t(e.id,o,{app:i,element:h,animations:s,signal:a}),l())};var Ww=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{if(o?.aborted)return;let n=t.children.find(a=>a.label===e.id);n&&(r&&r.length>0&&await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),t.removeChild(n),n.destroy())};var WI=We({type:"sprite",add:Hw,update:Vw,delete:Ww});var zw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,eventHandler:o,signal:n})=>{if(n?.aborted)return;let{id:a,x:h,y:l,width:c,height:u,alpha:d,thumbSrc:f,barSrc:p,direction:m,min:x,max:v,step:y,initialValue:b,originX:T,originY:w,hover:S,drag:A,dragStart:R,dragEnd:I}=e,P=new vt;P.label=a,P.x=h,P.y=l,P.alpha=d,P.sortableChildren=!0,P.eventMode="static";let B=0,W=p?E.from(p):E.EMPTY,N=new se(W);N.label=`${a}-bar`,N.eventMode="static";let nt=f?E.from(f):E.EMPTY,j=new se(nt);j.label=`${a}-thumb`,j.eventMode="static";let F=b??x,H=v-x,D=Tt=>{let St=(Tt-x)/H;m==="horizontal"?(j.x=St*(N.width-j.width),j.y=(N.height-j.height)/2):(j.x=(N.width-j.width)/2,j.y=St*(N.height-j.height))},k=()=>{N.width=c,N.height=u;let Tt=m==="horizontal"?u-B*2:c-B*2,St=f?E.from(f):E.EMPTY,at=St.width,Rt=St.height,re=Tt/at,$t=Tt/Rt,ae=Math.min(re,$t);j.width=at*ae,j.height=Rt*ae,D(F)};n.addEventListener("abort",k),k();let tt=nt,pt=W,dt=!1,Ut=Tt=>{let St;if(m==="horizontal"){let Rt=Tt.x-j.width/2;St=Math.max(0,Math.min(1,Rt/(N.width-j.width)))}else{let Rt=Tt.y-j.height/2;St=Math.max(0,Math.min(1,Rt/(N.height-j.height)))}let at=x+St*H;return y>0&&(at=Math.round((at-x)/y)*y+x,at=Math.max(x,Math.min(v,at))),at},Ht=Tt=>{dt=!0;let St=P.toLocal(Tt.global),at=Ut(St);at!==F&&(F=at,D(F),R?.actionPayload&&o(`${a}-drag-start`,{_event:{id:a,value:F},...R.actionPayload}))},qt=Tt=>{if(!dt)return;let St=P.toLocal(Tt.global),at=Ut(St);at!==F&&(F=at,D(F),A?.actionPayload&&o(`${a}-drag`,{_event:{id:a,value:F},...A.actionPayload,currentValue:F}))},Kt=()=>{dt&&(dt=!1,I?.actionPayload&&o(`${a}-drag-end`,{_event:{id:a,value:F},...I.actionPayload}))};if(P.on("pointerdown",Ht),P.on("globalpointermove",qt),P.on("pointerup",Kt),P.on("pointerupoutside",Kt),S){let{cursor:Tt,soundSrc:St,thumbSrc:at,barSrc:Rt}=S,re=()=>{Tt&&(N.cursor=Tt,j.cursor=Tt),St&&i.audioStage.add({id:`hover-${Date.now()}`,url:St,loop:!1}),at&&(j.texture=E.from(at)),Rt&&(N.texture=E.from(Rt))},$t=()=>{dt||(N.cursor="auto",j.cursor="auto",j.texture=tt,N.texture=pt)};P.on("pointerover",re),P.on("pointerout",$t),P.on("pointerupoutside",$t)}P.addChild(N),P.addChild(j),t.addChild(P),r&&r.length>0&&await _t(a,s,{app:i,element:P,animations:r,signal:n})};var $w=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.x=r.x,h.y=r.y,h.alpha=r.alpha,h.label=r.id,h.pivot.set(r.originX,r.originY);let c=h.getChildByLabel(`${r.id}-bar`),u=h.getChildByLabel(`${r.id}-thumb`);if(c&&u){c.width=r.width,c.height=r.height;let d=0,f=r.direction==="horizontal"?r.height-d*2:r.width-d*2,p=r.thumbSrc?E.from(r.thumbSrc):E.EMPTY,m=p.width||16,x=p.height||16,v=f/m,y=f/x,b=Math.min(v,y);if(u.width=m*b,u.height=x*b,e.barSrc!==r.barSrc){let S=r.barSrc?E.from(r.barSrc):E.EMPTY;c.texture=S}if(e.thumbSrc!==r.thumbSrc){let S=r.thumbSrc?E.from(r.thumbSrc):E.EMPTY;u.texture=S}let T=r.max-r.min,w=(r.initialValue-r.min)/T;r.direction==="horizontal"?(u.x=w*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=w*(c.height-u.height))}if(h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),s){let{hover:d,drag:f,dragStart:p,dragEnd:m,min:x,max:v,step:y,direction:b,initialValue:T}=r,w=T??x,S=v-x;h.eventMode="static";let A=j=>{let F=(j-x)/S;b==="horizontal"?(u.x=F*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=F*(c.height-u.height))},R=j=>{let F;if(b==="horizontal"){let D=j.x-u.width/2;F=Math.max(0,Math.min(1,D/(c.width-u.width)))}else{let D=j.y-u.height/2;F=Math.max(0,Math.min(1,D/(c.height-u.height)))}let H=x+F*S;return y>0&&(H=Math.round((H-x)/y)*y+x,H=Math.max(x,Math.min(v,H))),H},I=u.texture,P=c.texture,B=!1,W=j=>{B=!0;let F=h.toLocal(j.global),H=R(F);H!==w&&(w=H,A(w),p?.actionPayload&&s(`${r.id}-drag-start`,{_event:{id:r.id},value:w,...p.actionPayload}))},N=j=>{if(!B)return;let F=h.toLocal(j.global),H=R(F);H!==w&&(w=H,A(w),f?.actionPayload&&s(`${r.id}-drag`,{_event:{id:r.id},value:w,...f.actionPayload,currentValue:w}))},nt=()=>{B&&(B=!1,m?.actionPayload&&s(`${r.id}-drag-end`,{_event:{id:r.id},value:w,...m.actionPayload}))};if(h.on("pointerdown",W),h.on("globalpointermove",N),h.on("pointerup",nt),h.on("pointerupoutside",nt),d){let{cursor:j,soundSrc:F,actionPayload:H,thumbSrc:D,barSrc:k}=d,tt=()=>{H&&s(`${r.id}-pointer-over`,{_event:{id:r.id},...H}),j&&(h.cursor=j,u.cursor=j),F&&i.audioStage.add({id:`hover-${Date.now()}`,url:F,loop:!1}),D&&(u.texture=E.from(D)),k&&(c.texture=E.from(k))},pt=()=>{h.cursor="auto",u.cursor="auto",u.texture=I,c.texture=P},dt=()=>{B||(h.cursor="auto",u.cursor="auto",u.texture=I,c.texture=P)};h.on("pointerover",tt),h.on("pointerout",dt),h.on("pointerup",pt),h.on("pointerupoutside",pt)}}}};a.addEventListener("abort",()=>{l()}),h&&(o&&o.length>0&&await _t(e.id,n,{app:i,element:h,animations:o,signal:a}),l())};var Xw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=()=>{n&&!n.destroyed&&n.destroy({children:!0})};o.addEventListener("abort",()=>{a()}),r&&r.length>0&&await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a()}};var zI=We({type:"slider",add:zw,update:$w,delete:Xw});var jw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,elementPlugins:n,signal:a})=>{if(a?.aborted)return;let{id:h,x:l,y:c,children:u,scroll:d,alpha:f}=e,p=new vt;p.label=h;let m=()=>{p.x=Math.round(l),p.y=Math.round(c),p.alpha=f};if(a.addEventListener("abort",()=>{m()}),m(),t.addChild(p),u&&u.length>0)for(let x of u){let v=n.find(y=>y.type===x.type);if(!v)throw new Error(`No plugin found for child element type: ${x.type}`);await v.add({app:i,parent:p,element:x,animations:r,eventHandler:s,animateElements:_t,elementPlugins:n,signal:a})}d&&$I({container:p,element:e}),r&&r.length>0&&await _t(h,o,{app:i,element:p,animations:r,signal:a})},$I=({container:i,element:t})=>{let e=0,r=0;t.children.forEach(n=>{e=Math.max(n.width+n.x,e),r=Math.max(n.height+n.y,r)});let s=t.scroll&&t.height&&r>t.height,o=t.scroll&&t.width&&e>t.width;if(s||o){let n=new vt;[...i.children].forEach(f=>{n.addChild(f)}),i.addChild(n);let h=new _r().rect(0,0,t.width||e,t.height||r).fill({color:16711680,alpha:0});i.addChild(h),n.mask=h,i.eventMode="static";let l=0,c=0,u=-(r-(t.height||r)),d=-(e-(t.width||e));i.on("wheel",f=>{if(f.preventDefault(),s&&f.deltaY!==0){let p=l-f.deltaY;p>0?l=0:p<u?l=u:l=p,n.y=l}if(o&&(f.deltaX!==0||f.shiftKey&&f.deltaY!==0)){let p=f.deltaX!==0?f.deltaX:f.deltaY,m=c-p;m>0?c=0:m<d?c=d:c=m,n.x=c}})}};var Yw=(i,t,e=[])=>{let r=new Set,s=new Map,o=new Map,n=[],a=[],h=[];for(let l of i)r.add(l.id),s.set(l.id,l);for(let l of t)r.add(l.id),o.set(l.id,l);for(let l of r){let c=s.get(l),u=o.get(l);!c&&u?n.push(u):c&&!u?a.push(c):(JSON.stringify(c)!==JSON.stringify(u)||e.find(d=>d.elementId===u.id))&&h.push({prev:c,next:u})}return{toAddElement:n,toDeleteElement:a,toUpdateElement:h}};var rh=async({app:i,parent:t,prevASTTree:e,nextASTTree:r,animations:s,animationPlugins:o,eventHandler:n,elementPlugins:a,signal:h})=>{let{toAddElement:l,toDeleteElement:c,toUpdateElement:u}=Yw(e,r,[]),d=[];for(let f of c){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.delete({app:i,parent:t,element:f,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}for(let f of l){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.add({app:i,parent:t,element:f,animations:s,eventHandler:n,signal:h,animationPlugins:o,elementPlugins:a}))}for(let{prev:f,next:p}of u){let m=a.find(x=>x.type===p.type);if(!m)throw new Error(`No plugin found for element type: ${p.type}`);d.push(m.update({app:i,parent:t,prevElement:f,nextElement:p,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}await Promise.all(d),XI(t,r)},XI=(i,t)=>{i.children.sort((e,r)=>{let s=t.findIndex(n=>n.id===e.label),o=t.findIndex(n=>n.id===r.label);if(s!==-1&&o!==-1)return s-o;if(s===-1&&o===-1)return 0;if(s===-1)return-1;if(o===-1)return 1})};var qw=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,elementPlugins:a,signal:h})=>{if(h?.aborted)return;let l=t.children.find(u=>u.label===e.id),c=async()=>{JSON.stringify(e)!==JSON.stringify(r)&&(l.x=Math.round(r.x),l.y=Math.round(r.y),l.label=r.id,l.alpha=r.alpha,JSON.stringify(e.children)!==JSON.stringify(r.children)&&rh({app:i,parent:l,nextASTTree:r.children,prevASTTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationPlugins:n,signal:h}))};h.addEventListener("abort",()=>{c()}),l&&(o&&o.length>0&&await _t(e.id,n,{app:i,element:l,animations:o,signal:h}),await c())};var Kw=async({app:i,parent:t,element:e,animationPlugins:r,animations:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=()=>{n&&!n.destroyed&&n.destroy({children:!0})};o.addEventListener("abort",()=>{a()}),s&&s.length>0&&await _t(e.id,r,{app:i,element:n,animations:s,signal:o}),a()}};var jI=We({type:"container",add:jw,update:qw,delete:Kw});function Po(i,t){let e=i.text.substring(0,t),s=jt.measureText(e,i.style).width;return i.x+s}var Zw=i=>new Promise(t=>setTimeout(t,i)),Qw=async({parent:i,element:t,signal:e})=>{if(e?.aborted)return;let r=t.speed??50,s=t.revealEffect??"typewriter",o=t?.indicator?.offset??12,n=s==="none",a=n?0:Math.max(1,Math.floor(1e3/r)),h=n?0:Math.max(1,Math.floor(4e3/r));if(e?.aborted)return;let l=new vt;l.label=t.id;let c=new se(E.EMPTY);if(t?.indicator?.revealing?.src){let u=t.indicator.revealing.src?E.from(t.indicator.revealing.src):E.EMPTY;c=new se(u),c.width=t.indicator.revealing.width??u.width,c.height=t.indicator.revealing.height??u.height}l.addChild(c),t.x!==void 0&&(l.x=Math.round(t.x)),t.y!==void 0&&(l.y=Math.round(t.y)),t.alpha!==void 0&&(l.alpha=t.alpha),i.addChild(l);for(let u=0;u<t.content.length;u++){let d=t.content[u];c.x=o,c.y=d.y+(d.lineMaxHeight-c.height);for(let f=0;f<d.lineParts.length;f++){let p=d.lineParts[f],m=new Bt(p.textStyle),x=new yr({text:"",style:m,x:Math.round(p.x),y:Math.round(p.y)}),v=null;if(p.furigana){let T=new Bt(p.furigana.textStyle);v=new yr({text:"",style:T,x:Math.round(p.furigana.x),y:Math.round(p.furigana.y)}),l.addChild(v)}l.addChild(x);let y=p.text,b=p.furigana?.text||"";if(n||e?.aborted)x.text=y,c.x=Po(x,y.length-1)+o,v&&(v.text=b);else{let T=b.length;for(let w=0;w<y.length;w++){if(e?.aborted)return;x.text=y.substring(0,w+1),c.x=Po(x,w)+o;let S=Math.round((w+1)/y.length*T);v&&(v.text=b.substring(0,S)),w<y.length-1&&await Zw(a)}}}u<t.content.length-1&&await Zw(h)}if(t?.indicator?.complete?.src){let u=t.indicator.complete.src?E.from(t.indicator.complete.src):E.EMPTY;c.texture=u,c.width=t.indicator.complete.width??u.width,c.height=t.indicator.complete.height??u.height}};var Jw=i=>new Promise(t=>setTimeout(t,i)),t1=async i=>{let{parent:t,nextElement:e,signal:r}=i,s=e.speed??50,o=e.revealEffect??"typewriter",n=e?.indicator?.offset??12,a=o==="none",h=a?0:Math.max(1,Math.floor(1e3/s)),l=a?0:Math.max(1,Math.floor(4e3/s));if(r?.aborted)return;let c=t.children.find(u=>u.label===e.id);if(c){c.removeChildren();let u=new se(E.EMPTY);if(e?.indicator?.revealing?.src){let d=e.indicator.revealing.src?E.from(e.indicator.revealing.src):E.EMPTY;u=new se(d),u.width=e.indicator.revealing.width??d.width,u.height=e.indicator.revealing.height??d.height}c.addChild(u),e.x!==void 0&&(c.x=e.x),e.y!==void 0&&(c.y=e.y),e.alpha!==void 0&&(c.alpha=e.alpha);for(let d=0;d<e.content.length;d++){let f=e.content[d];u.x=n,u.y=f.y+(f.lineMaxHeight-u.height);for(let p=0;p<f.lineParts.length;p++){if(r?.aborted)return;let m=f.lineParts[p],x=new Bt(m.textStyle),v=new yr({text:"",style:x,x:m.x,y:m.y}),y=null;if(m.furigana){let w=new Bt(m.furigana.textStyle);y=new yr({text:"",style:w,x:m.furigana.x,y:m.furigana.y}),c.addChild(y)}c.addChild(v);let b=m.text,T=m.furigana?.text||"";if(a||r?.aborted)v.text=b,u.x=Po(v,b.length-1)+n,y&&(y.text=T);else{let w=T.length;for(let S=0;S<b.length;S++){v.text=b.substring(0,S+1),u.x=Po(v,S)+n;let A=Math.round((S+1)/b.length*w);y&&(y.text=T.substring(0,A)),S<b.length-1&&await Jw(h)}}}d<e.content.length-1&&await Jw(l)}if(e?.indicator?.complete?.src){let d=e.indicator.complete.src?E.from(e.indicator.complete.src):E.EMPTY;u.texture=d,u.width=e.indicator.complete.width??d.width,u.height=e.indicator.complete.height??d.height}}};var e1=async({parent:i,element:t,signal:e})=>{if(e?.aborted)return;let r=i.getChildByLabel(t.id);if(r){let s=()=>{r&&!r.destroyed&&r.destroy({children:!0})};e.addEventListener("abort",()=>{s()}),s()}};var YI=We({type:"text-revealing",add:Qw,update:t1,delete:e1});var qI={linear:i=>i},KI=(i,t,e,r)=>i+(t-i)*qI[r](e),ZI=(i,t,e)=>{typeof t=="string"&&(t=Zu[t]);let r=i;for(let s of t){if(r==null)return e;r=r[s]}return r===void 0?e:r},QI=(i,t,e)=>{typeof t=="string"&&(t=Zu[t]);let r=i;for(let s=0;s<t.length-1;s++){let o=t[s];o in r||(r[o]={}),r=r[o]}return r[t[t.length-1]]=e,i},JI=i=>{let t=[],e=0,r;return i.forEach(({value:s,duration:o,easing:n,relative:a},h)=>{h===0?(r=s,t.push({time:e,value:s,easing:"linear"})):o!==void 0&&n!==void 0&&(e+=o,a?r=r+s:r=s,t.push({time:e,value:r,easing:n}))}),t},tF=(i,t)=>{if(i.length===0)return 0;if(t<=i[0].time)return i[0].value;if(t>=i[i.length-1].time)return i[i.length-1].value;for(let e=0;e<i.length-1;e++){let{time:r,value:s,easing:o}=i[e],{time:n,value:a}=i[e+1];if(t>=r&&t<=n){let h=(t-r)/(n-r);return KI(s,a,h,o)}}return i[i.length-1].value},eF=i=>Math.max.apply(null,i),r1=async({app:i,element:t,animation:e,signal:r})=>new Promise((s,o)=>{if(r?.aborted){i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"));return}let{properties:n}=e,a=Object.entries(n).map(([m,x])=>{if(!hx[m])throw new Error(`${m} is not a supported property for transition.`);return{...x,property:m}}),h=a.map(m=>m.keyframes.reduce((x,v)=>x+v.duration||0,0)),l=eF(h),c={};a.forEach(m=>{c[m.property]=ZI(t,m.property)});let u=a.map(m=>{let x=[];m.initialValue!==void 0?x=[{value:m.initialValue}]:x=[{value:c[m.property]}],x=x.concat(m.keyframes);let v=JI(x);return{property:m.property,timeline:v}}),d=0,f=m=>{u.forEach(({property:x,timeline:v})=>{let y=tF(v,m);t&&!t.destroyed&&QI(t,x,y)})};r&&r.addEventListener("abort",()=>{i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"))});let p=m=>{if(d+=m.deltaMS,d>=l){i.ticker.remove(p),s();return}f(d)};if(r?.aborted){i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"));return}i.ticker.add(p)});var rF=Lm({type:"tween",animate:r1});var i1=({app:i,element:t,signal:e})=>{if(e?.aborted)return;let r={id:t.id,url:t.src,loop:t.loop??!1,volume:(t.volume??800)/1e3};t.delay&&t.delay>0?setTimeout(()=>{e?.aborted||i.audioStage.add(r)},t.delay):i.audioStage.add(r)};var s1=({app:i,prevElement:t,nextElement:e,signal:r})=>{if(!r?.aborted&&(t.src!==e.src||t.volume!==e.volume)){let s=i.audioStage.getById(t.id);s&&(s.url=e.src,s.volume=(e.volume??800)/1e3)}};var o1=({app:i,element:t,signal:e})=>{e?.aborted||i.audioStage.remove(t.id)};var iF=Dm({type:"sound",add:i1,update:s1,delete:o1});var n1=(i=[],t=[])=>{let e=new Set,r=new Map,s=new Map,o=[],n=[],a=[];for(let h of i)e.add(h.id),r.set(h.id,h);for(let h of t)e.add(h.id),s.set(h.id,h);for(let h of e){let l=r.get(h),c=s.get(h);!l&&c?o.push(c):l&&!c?n.push(l):(l.src!==c.src||l.volume!==c.volume||l.loop!==c.loop||l.delay!==c.delay)&&a.push({prev:l,next:c})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var Nm=async({app:i,prevAudioTree:t,nextAudioTree:e,audioPlugins:r,signal:s})=>{let{toAddElement:o,toDeleteElement:n,toUpdateElement:a}=n1(t,e),h=[];for(let l of n){let c=r.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.delete({app:i,element:l,signal:s}))}for(let l of o){let c=r.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.add({app:i,element:l,signal:s}))}for(let{prev:l,next:c}of a){let u=r.find(d=>d.type===c.type);if(!u)throw new Error(`No audio plugin found for type: ${c.type}`);h.push(u.update({app:i,prevElement:l,nextElement:c,signal:s}))}await Promise.all(h)};var ze=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))(ze||{}),Hm=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(Hm||{}),ru=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(ru||{}),Z=(i=>(i[i.NORMAL=0]="NORMAL",i[i.ADD=1]="ADD",i[i.MULTIPLY=2]="MULTIPLY",i[i.SCREEN=3]="SCREEN",i[i.OVERLAY=4]="OVERLAY",i[i.DARKEN=5]="DARKEN",i[i.LIGHTEN=6]="LIGHTEN",i[i.COLOR_DODGE=7]="COLOR_DODGE",i[i.COLOR_BURN=8]="COLOR_BURN",i[i.HARD_LIGHT=9]="HARD_LIGHT",i[i.SOFT_LIGHT=10]="SOFT_LIGHT",i[i.DIFFERENCE=11]="DIFFERENCE",i[i.EXCLUSION=12]="EXCLUSION",i[i.HUE=13]="HUE",i[i.SATURATION=14]="SATURATION",i[i.COLOR=15]="COLOR",i[i.LUMINOSITY=16]="LUMINOSITY",i[i.NORMAL_NPM=17]="NORMAL_NPM",i[i.ADD_NPM=18]="ADD_NPM",i[i.SCREEN_NPM=19]="SCREEN_NPM",i[i.NONE=20]="NONE",i[i.SRC_OVER=0]="SRC_OVER",i[i.SRC_IN=21]="SRC_IN",i[i.SRC_OUT=22]="SRC_OUT",i[i.SRC_ATOP=23]="SRC_ATOP",i[i.DST_OVER=24]="DST_OVER",i[i.DST_IN=25]="DST_IN",i[i.DST_OUT=26]="DST_OUT",i[i.DST_ATOP=27]="DST_ATOP",i[i.ERASE=26]="ERASE",i[i.SUBTRACT=28]="SUBTRACT",i[i.XOR=29]="XOR",i))(Z||{}),Ro=(i=>(i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i))(Ro||{}),U=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(U||{}),ri=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(ri||{}),rt=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(rt||{}),L=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(L||{}),nr=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(nr||{}),ih=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(ih||{}),br=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(br||{}),$e=(i=>(i[i.NPM=0]="NPM",i[i.UNPACK=1]="UNPACK",i[i.PMA=2]="PMA",i[i.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",i[i.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",i[i.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",i))($e||{}),Pi=(i=>(i[i.NO=0]="NO",i[i.YES=1]="YES",i[i.AUTO=2]="AUTO",i[i.BLEND=0]="BLEND",i[i.CLEAR=1]="CLEAR",i[i.BLIT=2]="BLIT",i))(Pi||{}),iu=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(iu||{}),Pe=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(Pe||{}),Jt=(i=>(i[i.NONE=0]="NONE",i[i.SCISSOR=1]="SCISSOR",i[i.STENCIL=2]="STENCIL",i[i.SPRITE=3]="SPRITE",i[i.COLOR=4]="COLOR",i))(Jt||{});var Ct=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(Ct||{}),Le=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(Le||{});var Vm={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")};var Y={ADAPTER:Vm,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};Fd();var sF=pi.default??pi,vr=sF(globalThis.navigator);Y.RETINA_PREFIX=/@([0-9\.]+)x/;Y.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var ls=Ui(h1(),1),q2=Ui(Vl(),1);var Tg=Ui(EP(),1);var AP={};function lt(i,t,e=3){if(AP[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1144
+ `,wo=null,eh=class{constructor(){wo||(wo=URL.createObjectURL(new Blob([CI],{type:"application/javascript"}))),this.worker=new Worker(wo)}};eh.revokeObjectURL=function(){wo&&(URL.revokeObjectURL(wo),wo=null)};var ww=0,Gm,Um=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new Ao;e.addEventListener("message",r=>{e.terminate(),Ao.revokeObjectURL(),t(r.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Gm===void 0&&(Gm=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Gm&&(this._createdWorkers++,t=new eh().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let r=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),r}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),r=e.id;this._resolveHash[ww]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:ww++,id:r})}},km=new Um;qr();var PI=[".jpeg",".jpg",".png",".webp",".avif"],RI=["image/jpeg","image/png","image/webp","image/avif"];async function MI(i,t){let e=await $.get().fetch(i);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${e.status} ${e.statusText}`);let r=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(r,{premultiplyAlpha:"none"}):createImageBitmap(r)}var Qc={name:"loadTextures",extension:{type:_.LoadParser,priority:ce.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return ir(i,RI)||sr(i,PI)},async load(i,t,e){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await km.isImageBitmapSupported()?r=await km.loadImageBitmap(i,t):r=await MI(i,t):r=await new Promise((o,n)=>{r=new Image,r.crossOrigin=this.config.crossOrigin,r.src=i,r.complete?o(r):(r.onload=()=>{o(r)},r.onerror=n)});let s=new Fe({resource:r,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||To(i),...t.data});return So(s,e,i)},unload(i){i.destroy(!0)}};C();Kd();qd();var Cw=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],BI=Cw.map(i=>`video/${i.substring(1)}`);function II(i,t,e){e===void 0&&!t.startsWith("data:")?i.crossOrigin=GI(t):e!==!1&&(i.crossOrigin=typeof e=="string"?e:"anonymous")}function FI(i){return new Promise((t,e)=>{i.addEventListener("canplaythrough",r),i.addEventListener("error",s),i.load();function r(){o(),t()}function s(n){o(),e(n)}function o(){i.removeEventListener("canplaythrough",r),i.removeEventListener("error",s)}})}function GI(i,t=globalThis.location){if(i.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var Pw={name:"loadVideo",extension:{type:_.LoadParser,name:"loadVideo"},test(i){let t=ir(i,BI),e=sr(i,Cw);return t||e},async load(i,t,e){let r={...Os.defaultOptions,resolution:t.data?.resolution||To(i),alphaMode:t.data?.alphaMode||await Al(),...t.data},s=document.createElement("video"),o={preload:r.autoLoad!==!1?"auto":void 0,"webkit-playsinline":r.playsinline!==!1?"":void 0,playsinline:r.playsinline!==!1?"":void 0,muted:r.muted===!0?"":void 0,loop:r.loop===!0?"":void 0,autoplay:r.autoPlay!==!1?"":void 0};Object.keys(o).forEach(h=>{let l=o[h];l!==void 0&&s.setAttribute(h,l)}),r.muted===!0&&(s.muted=!0),II(s,i,r.crossorigin);let n=document.createElement("source"),a;if(i.startsWith("data:"))a=i.slice(5,i.indexOf(";"));else if(!i.startsWith("blob:")){let h=i.split("?")[0].slice(i.lastIndexOf(".")+1).toLowerCase();a=Os.MIME_TYPES[h]||`video/${h}`}return n.src=i,a&&(n.type=a),new Promise(h=>{let l=async()=>{let c=new Os({...r,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await FI(s),h(So(c,e,i))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(i){i.destroy(!0)}};C();Gs();C();Gs();var Jc={extension:{type:_.ResolveParser,name:"resolveTexture"},test:Qc.test,parse:i=>({resolution:parseFloat(Ve.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};var Rw={extension:{type:_.ResolveParser,priority:-2,name:"resolveJson"},test:i=>Ve.RETINA_PREFIX.test(i)&&i.endsWith(".json"),parse:Jc.parse};Gs();Sn();yl();var tu=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Ve,this.loader=new Zc,this.cache=xt,this._backgroundLoader=new qc(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){O("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,r=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:r}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let r=$i(t),s=Ee(t).map(a=>{if(typeof a!="string"){let h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return r?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;typeof t=="string"&&(r=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,h=0,l=()=>{e?.(++a/h)},c=n.map(u=>{let d=s[u];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{o[u]=f})});return await Promise.all(c),r?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(r=>{this._backgroundLoader.add(Object.values(r))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return xt.get(t);let e={};for(let r=0;r<t.length;r++)e[r]=xt.get(t[r]);return e}async _mapLoadToResolve(t,e){let r=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(r,e);this._backgroundLoader.active=!0;let o={};return r.forEach(n=>{let a=s[n.src],h=[n.src];n.alias&&h.push(...n.alias),h.forEach(l=>{o[l]=a}),xt.set(h,a)}),o}async unload(t){this._initialized||await this.init();let e=Ee(t).map(s=>typeof s!="string"?s.src:s),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=Ee(t);let e=this.resolver.resolveBundle(t),r=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(r)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(r=>{xt.remove(r.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let r of t.detections)t.skipDetections||await r.test()?e=await r.add(e):t.skipDetections||(e=await r.remove(e));return e=e.filter((r,s)=>e.indexOf(r)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(r=>r in t).forEach(r=>{e.config[r]=t[r]})})}},or=new tu;G.handleByList(_.LoadParser,or.loader.parsers).handleByList(_.ResolveParser,or.resolver.parsers).handleByList(_.CacheParser,or.cache.parsers).handleByList(_.DetectionParser,or.detections);G.add(pw,xw,mw,vw,_w,yw,bw,Tw,Sw,Ew,Aw,Qc,Pw,fw,dw,Jc,Rw);var Mw={loader:_.LoadParser,resolver:_.ResolveParser,cache:_.CacheParser,detection:_.DetectionParser};G.handle(_.Asset,i=>{let t=i.ref;Object.entries(Mw).filter(([e])=>!!t[e]).forEach(([e,r])=>G.add(Object.assign(t[e],{extension:t[e].extension??r})))},i=>{let t=i.ref;Object.keys(Mw).filter(e=>!!t[e]).forEach(e=>G.remove(t[e]))});Jh();Lt();_l();var eu=class extends gi{constructor(t,e){let{text:r,resolution:s,style:o,anchor:n,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=r??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new me({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=l??!1,a!==void 0&&(this.width=a),h!==void 0&&(this.height=h)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,r=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-r*this.anchor.y,t.y>=o&&t.y<=o+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function Bw(i,t){let e=i[0]??{};return(typeof e=="string"||i[1])&&(z(Q,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}Yn();ts();var yr=class extends eu{constructor(...t){let e=Bw(t,"Text");super(e,Bt),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,r=jt.measureText(this._text,this._style),{width:s,height:o}=r;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};qr();bt();Jd();fr();gp();Tl();Yn();ts();_e();var UI=Ui(Vl(),1);G.add(DT,HT);var Iw=i=>{let e={...{fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!0,breakWords:!0},...i.textStyle};e.lineHeight=Math.round(e.fontSize*e.lineHeight),i.width&&(e.wordWrapWidth=i.width,e.wordWrap=!0);let{width:r,height:s}=jt.measureText(i.content??"",new Bt(e)),o=Math.round(r),n=Math.round(s);return{...Ke({...i,width:o,height:n}),content:i.content??"",textStyle:{...e}}};var kI=(i,t)=>{let e=[],r=[],s=0,o=0,n=0,a=0,h=[...i],l=new WeakSet;for(;h.length>0;){let u=h[0];if(!u.text||u.text.length===0){h.shift();continue}let d=t-s,f={...u.textStyle,wordWrapWidth:d},p=jt.measureText(u.text,new Bt(f));if(p.lineWidths[0]>d&&r.length>0){e.push({lineParts:[...r],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,r=[];continue}let m=p.lines[0];p.lines.length===1&&u.text.endsWith(" ")&&!m.endsWith(" ")&&(m+=" ");let x=jt.measureText(m,new Bt({...u.textStyle,wordWrap:!1,breakWords:!1})),v={text:m,textStyle:f,height:x.height,x:s,y:o};if(u.furigana&&!l.has(u)){l.add(u);let b=jt.measureText(u.furigana.text,new Bt(u.furigana.textStyle)),T=-b.height+o+2,w={text:u.furigana.text,textStyle:u.furigana.textStyle,x:s+(p.lineWidths[0]-b.width)/2,y:T};v.furigana=w}r.push(v),n=Math.max(n,x.height),s+=p.lineWidths[0],a=Math.max(a,s);let y=p.lines.slice(1).join(" ");y&&y.length>0?u.text=y:h.shift()}r.length>0&&e.push({lineParts:r,y:o,lineMaxHeight:n});for(let u=0;u<e.length;u++){let d=e[u].lineMaxHeight;e[u].lineParts=e[u].lineParts.map(f=>{let p=f.height;f.height&&delete f.height;let m=f.y+(d-p),x=f.furigana;return x&&(x.y=x.y-f.y+m),{...f,...x&&{furigana:x},y:m}})}let c=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:c}},Fw=i=>{let t={fill:"black",fontFamily:"Roboto",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!0},e=(i.content||[]).map(c=>{let u={...t,...c.textStyle||{}};i.width&&(u.wordWrapWidth=i.width,u.wordWrap=!0);let d=null;if(c.furigana){let f={...t,...c.furigana.textStyle||{}};i.width&&(f.wordWrapWidth=i.width,f.wordWrap=!0),d={text:c.furigana.text,textStyle:f}}return{text:c.text.replace(/ +$/,f=>"\xA0".repeat(f.length)),textStyle:u,...d&&{furigana:d}}}),r=i.width||500,{chunks:s,width:o,height:n}=kI(e,r),a=i.width||o,l=Ke({...i,width:a,height:n});if(l.alpha=i.alpha??1,i.indicator){let c=i.indicator;l.indicator={revealing:{src:c.revealing?.src??"",width:c.revealing?.width??12,height:c.revealing?.height??12},complete:{src:c.complete?.src??"",width:c.complete?.width??12,height:c.complete?.height??12},offset:c.offset??12}}return{...l,content:s,textStyle:{...t,...i.textStyle||{}},speed:i.speed??50,revealEffect:i.revealEffect??"typewriter",...i.width!==void 0&&{width:i.width}}};var Gw=i=>{let t=Ke(i),e=i.min??0,r=i.max??100;if(r<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");return{...t,direction:i.direction??"horizontal",thumbSrc:i.thumbSrc??"",barSrc:i.barSrc??"",alpha:i.alpha??1,min:e,max:r,step:i.step??1,initialValue:i.initialValue??0,...i.hover&&{hover:i.hover},...i.drag&&{drag:i.drag},...i.dragStart&&{dragStart:i.dragStart},...i.dragEnd&&{dragEnd:i.dragEnd}}};var OI=i=>i.map(e=>{switch(e.type){case dr.RECT:return cx(e);case dr.CONTAINER:return lx(e);case dr.TEXT:return Iw(e);case dr.TEXT_REVEALING:return Fw(e);case dr.SPRITE:return ux(e);case dr.SLIDER:return Gw(e);default:throw new Error(`Unsupported element type: ${e.type}`)}}),Es=OI;var LI=new(window.AudioContext||window.webkitAudioContext),Om={},DI=async(i,t)=>{if(!Om[i]&&t.byteLength!==0)try{let e=await LI.decodeAudioData(t);Om[i]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${i}:`,e)}},NI=i=>Om[i],Co={load:DI,getAsset:NI};var We=({type:i,add:t,update:e,delete:r})=>({type:i,add:t,update:e,delete:r});var Lm=({type:i,animate:t})=>({type:i,animate:t});var Dm=({type:i,add:t,update:e,delete:r})=>({type:i,add:t,update:e,delete:r});var Oe=(i,t)=>{let e={fill:t.fill,fontFamily:t.fontFamily,fontSize:t.fontSize,align:t.align,lineHeight:t.lineHeight,wordWrap:t.wordWrap,breakWords:t.breakWords,wordWrapWidth:t.wordWrapWidth,strokeColor:t.strokeColor,strokeWidth:t.strokeWidth};i.style=e};async function _t(i,t,{app:e,element:r,animations:s,signal:o}){let n=[];for(let a of s)if(a.elementId===i){let h=t.find(l=>l.type===a.type);if(!h)throw new Error(`No animation plugin found for type: ${a.type}`);n.push(h.animate({app:e,element:r,animation:a,signal:o}))}return Promise.all(n)}var Uw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,signal:n})=>{if(n?.aborted)return;let a=new yr({label:e.id}),h=()=>{a.text=e.content,Oe(a,e.textStyle),a.alpha=e.alpha,a.x=e.x,a.y=e.y};n.addEventListener("abort",()=>{h()}),h();let l=e?.hover,c=e?.click;if(l){let{cursor:u,soundSrc:d,actionPayload:f}=l;a.eventMode="static";let p=()=>{f&&s&&s(`${a.label}-pointer-over`,{_event:{id:a.label},...f}),u&&(a.cursor=u),d&&i.audioStage.add({id:`hover-${Date.now()}`,url:d,loop:!1}),l?.textStyle&&Oe(a,l.textStyle)},m=()=>{a.cursor="auto",Oe(a,e.textStyle)};a.on("pointerover",p),a.on("pointerout",m)}if(c){let{soundSrc:u,actionPayload:d}=c;a.eventMode="static";let f=()=>{c?.textStyle&&Oe(a,c.textStyle)},p=()=>{Oe(a,e.textStyle),d&&s&&s(`${a.label}-click`,{_event:{id:a.label},...d}),u&&i.audioStage.add({id:`click-${Date.now()}`,url:u,loop:!1})},m=()=>{Oe(a,e.textStyle)};a.on("pointerdown",f),a.on("pointerup",p),a.on("pointerupoutside",m)}t.addChild(a),r&&r.length>0&&await _t(e.id,o,{app:i,element:a,animations:r,signal:n})};var kw=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.text=r.content,Oe(h,r.textStyle),h.x=r.x,h.y=r.y,h.alpha=r.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup");let c=r?.hover,u=r?.click;if(c){let{cursor:d,soundSrc:f,actionPayload:p}=c;h.eventMode="static";let m=()=>{p&&s&&s(`${h.label}-pointer-over`,{_event:{id:h.label},...p}),d&&(h.cursor=d),f&&i.audioStage.add({id:`hover-${Date.now()}`,url:f,loop:!1}),c?.textStyle&&Oe(h,c.textStyle)},x=()=>{h.cursor="auto",Oe(h,r.textStyle)};h.on("pointerover",m),h.on("pointerout",x)}if(u){let{soundSrc:d,actionPayload:f}=u;h.eventMode="static";let p=()=>{u?.textStyle&&Oe(h,u.textStyle)},m=()=>{Oe(h,r.textStyle),f&&s&&s(`${h.label}-click`,{_event:{id:h.label},...f}),d&&i.audioStage.add({id:`click-${Date.now()}`,url:d,loop:!1})},x=()=>{Oe(h,r.textStyle)};h.on("pointerdown",p),h.on("pointerup",m),h.on("pointerupoutside",x)}}};a.addEventListener("abort",()=>{l()}),h&&(o&&o.length>0&&await _t(r.id,n,{app:i,element:h,animations:o,signal:a}),l())};var Ow=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=()=>{n&&!n.destroyed&&n.destroy()};o.addEventListener("abort",()=>{a()}),e.animations&&e.animations.length>0&&await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a()}};var HI=We({type:"text",add:Uw,update:kw,delete:Ow});var Lw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,eventHandler:o,signal:n})=>{if(n?.aborted)return;let{id:a,x:h,y:l,width:c,height:u,fill:d,border:f,originX:p,originY:m,rotation:x,alpha:v}=e,y=new _r;y.label=a;let b=()=>{y.clear(),y.rect(0,0,Math.round(c),Math.round(u)).fill(d),y.x=Math.round(h),y.y=Math.round(l),y.alpha=v,f&&y.stroke({color:f.color,alpha:f.alpha,width:Math.round(f.width)})};n.addEventListener("abort",()=>{b()}),b();let T=e?.hover,w=e?.click;if(T){let{cursor:S,soundSrc:A,actionPayload:R}=T;y.eventMode="static";let I=()=>{R&&o&&o(`${y.label}-pointer-over`,{_event:{id:y.label},...R}),S&&(y.cursor=S),A&&i.audioStage.add({id:`hover-${Date.now()}`,url:A,loop:!1})},P=()=>{y.cursor="auto"};y.on("pointerover",I),y.on("pointerout",P)}if(w){let{soundSrc:S,actionPayload:A}=w;y.eventMode="static";let R=()=>{A&&o&&o(`${y.label}-click`,{_event:{id:y.label},...A}),S&&i.audioStage.add({id:`click-${Date.now()}`,url:S,loop:!1})};y.on("pointerup",R)}t.addChild(y),r&&r.length>0&&await _t(a,s,{app:i,element:y,animations:r,signal:n})};var Dw=async({app:i,parent:t,prevElement:e,nextElement:r,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.clear(),h.rect(0,0,Math.round(r.width),Math.round(r.height)).fill(r.fill),h.x=Math.round(r.x),h.y=Math.round(r.y),h.alpha=r.alpha,r.border&&h.stroke({color:r.border.color,alpha:r.border.alpha,width:Math.round(r.border.width)}),h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup");let c=r?.hover,u=r?.click;if(c){let{cursor:d,soundSrc:f,actionPayload:p}=c;h.eventMode="static";let m=()=>{p&&n&&n(`${h.label}-pointer-over`,{_event:{id:h.label},...p}),d&&(h.cursor=d),f&&i.audioStage.add({id:`hover-${Date.now()}`,url:f,loop:!1})},x=()=>{h.cursor="auto"};h.on("pointerover",m),h.on("pointerout",x)}if(u){let{soundSrc:d,actionPayload:f}=u;h.eventMode="static";let p=()=>{f&&n&&n(`${h.label}-click`,{_event:{id:h.label},...f}),d&&i.audioStage.add({id:`click-${Date.now()}`,url:d,loop:!1})};h.on("pointerup",p)}}};a.addEventListener("abort",()=>{l()}),h&&(s&&s.length>0&&await _t(e.id,o,{app:i,element:h,animations:s,signal:a}),l())};var Nw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=()=>{n&&!n.destroyed&&n.destroy()};o.addEventListener("abort",()=>{a()}),r&&r.length>0&&await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a()}};var VI=We({type:"rect",add:Lw,update:Dw,delete:Nw});var Hw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,signal:n})=>{if(n?.aborted)return;let{id:a,x:h,y:l,width:c,height:u,src:d,alpha:f}=e,p=d?E.from(d):E.EMPTY,m=new se(p);m.label=a;let x=()=>{m.x=Math.round(h),m.y=Math.round(l),m.width=Math.round(c),m.height=Math.round(u),m.alpha=f};n.addEventListener("abort",()=>{x()}),x();let v=e?.hover,y=e?.click;if(console.log("Adding sprite with hover events:",v),console.log("Adding sprite with click events:",y),v){let{cursor:b,soundSrc:T,actionPayload:w}=v;m.eventMode="static";let S=()=>{if(w&&s&&s(`${m.label}-pointer-over`,{_event:{id:m.label},...w}),b&&(m.cursor=b),T&&i.audioStage.add({id:`hover-${Date.now()}`,url:T,loop:!1}),v?.src){let R=v.src?E.from(v.src):E.EMPTY;m.texture=R}},A=()=>{m.cursor="auto",m.texture=p};m.on("pointerover",S),m.on("pointerout",A)}if(y){let{soundSrc:b,actionPayload:T}=y;m.eventMode="static";let w=()=>{if(y?.src){let R=y.src?E.from(y.src):E.EMPTY;m.texture=R}},S=()=>{m.texture=p,T&&s&&s(`${m.label}-click`,{_event:{id:m.label},...T}),b&&i.audioStage.add({id:`click-${Date.now()}`,url:b,loop:!1})},A=()=>{m.texture=p};m.on("pointerdown",w),m.on("pointerup",S),m.on("pointerupoutside",A)}t.addChild(m),r&&r.length>0&&await _t(a,o,{app:i,element:m,animations:r,signal:n})};var Vw=async({app:i,parent:t,prevElement:e,nextElement:r,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){if(e.src!==r.src){let d=r.src?E.from(r.src):E.EMPTY;h.texture=d}h.x=Math.round(r.x),h.y=Math.round(r.y),h.width=Math.round(r.width),h.height=Math.round(r.height),h.alpha=r.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup");let c=r?.hover,u=r?.click;if(c){let{cursor:d,soundSrc:f,actionPayload:p}=c;h.eventMode="static";let m=()=>{if(p&&n&&n(`${h.label}-pointer-over`,{_event:{id:h.label},...p}),d&&(h.cursor=d),f&&i.audioStage.add({id:`hover-${Date.now()}`,url:f,loop:!1}),c?.src){let v=c.src?E.from(c.src):E.EMPTY;h.texture=v}},x=()=>{h.cursor="auto",h.texture=r.src?E.from(r.src):E.EMPTY};h.on("pointerover",m),h.on("pointerout",x)}if(u){let{soundSrc:d,actionPayload:f}=u;h.eventMode="static";let p=()=>{if(u?.src){let v=u.src?E.from(u.src):E.EMPTY;h.texture=v}},m=()=>{h.texture=r.src?E.from(r.src):E.EMPTY,f&&n&&n(`${h.label}-click`,{_event:{id:h.label},...f}),d&&i.audioStage.add({id:`click-${Date.now()}`,url:d,loop:!1})},x=()=>{h.texture=r.src?E.from(r.src):E.EMPTY};h.on("pointerdown",p),h.on("pointerup",m),h.on("pointerupoutside",x)}}};a.addEventListener("abort",()=>{l()}),h&&(s&&s.length>0&&await _t(e.id,o,{app:i,element:h,animations:s,signal:a}),l())};var Ww=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{if(o?.aborted)return;let n=t.children.find(a=>a.label===e.id);n&&(r&&r.length>0&&await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),t.removeChild(n),n.destroy())};var WI=We({type:"sprite",add:Hw,update:Vw,delete:Ww});var zw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,eventHandler:o,signal:n})=>{if(n?.aborted)return;let{id:a,x:h,y:l,width:c,height:u,alpha:d,thumbSrc:f,barSrc:p,direction:m,min:x,max:v,step:y,initialValue:b,originX:T,originY:w,hover:S,drag:A,dragStart:R,dragEnd:I}=e,P=new vt;P.label=a,P.x=h,P.y=l,P.alpha=d,P.sortableChildren=!0,P.eventMode="static";let B=0,W=p?E.from(p):E.EMPTY,N=new se(W);N.label=`${a}-bar`,N.eventMode="static";let nt=f?E.from(f):E.EMPTY,j=new se(nt);j.label=`${a}-thumb`,j.eventMode="static";let F=b??x,H=v-x,D=Tt=>{let St=(Tt-x)/H;m==="horizontal"?(j.x=St*(N.width-j.width),j.y=(N.height-j.height)/2):(j.x=(N.width-j.width)/2,j.y=St*(N.height-j.height))},k=()=>{N.width=c,N.height=u;let Tt=m==="horizontal"?u-B*2:c-B*2,St=f?E.from(f):E.EMPTY,at=St.width,Rt=St.height,re=Tt/at,$t=Tt/Rt,ae=Math.min(re,$t);j.width=at*ae,j.height=Rt*ae,D(F)};n.addEventListener("abort",k),k();let tt=nt,pt=W,dt=!1,Ut=Tt=>{let St;if(m==="horizontal"){let Rt=Tt.x-j.width/2;St=Math.max(0,Math.min(1,Rt/(N.width-j.width)))}else{let Rt=Tt.y-j.height/2;St=Math.max(0,Math.min(1,Rt/(N.height-j.height)))}let at=x+St*H;return y>0&&(at=Math.round((at-x)/y)*y+x,at=Math.max(x,Math.min(v,at))),at},Ht=Tt=>{dt=!0;let St=P.toLocal(Tt.global),at=Ut(St);at!==F&&(F=at,D(F),R?.actionPayload&&o&&o(`${a}-drag-start`,{_event:{id:a,value:F},...R.actionPayload}))},qt=Tt=>{if(!dt)return;let St=P.toLocal(Tt.global),at=Ut(St);at!==F&&(F=at,D(F),A?.actionPayload&&o&&o(`${a}-drag`,{_event:{id:a,value:F},...A.actionPayload,currentValue:F}))},Kt=()=>{dt&&(dt=!1,I?.actionPayload&&o&&o(`${a}-drag-end`,{_event:{id:a,value:F},...I.actionPayload}))};if(P.on("pointerdown",Ht),P.on("globalpointermove",qt),P.on("pointerup",Kt),P.on("pointerupoutside",Kt),S){let{cursor:Tt,soundSrc:St,thumbSrc:at,barSrc:Rt}=S,re=()=>{Tt&&(N.cursor=Tt,j.cursor=Tt),St&&i.audioStage.add({id:`hover-${Date.now()}`,url:St,loop:!1}),at&&(j.texture=E.from(at)),Rt&&(N.texture=E.from(Rt))},$t=()=>{dt||(N.cursor="auto",j.cursor="auto",j.texture=tt,N.texture=pt)};P.on("pointerover",re),P.on("pointerout",$t),P.on("pointerupoutside",$t)}P.addChild(N),P.addChild(j),t.addChild(P),r&&r.length>0&&await _t(a,s,{app:i,element:P,animations:r,signal:n})};var $w=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.x=r.x,h.y=r.y,h.alpha=r.alpha,h.label=r.id,h.pivot.set(r.originX,r.originY);let c=h.getChildByLabel(`${r.id}-bar`),u=h.getChildByLabel(`${r.id}-thumb`);if(c&&u){c.width=r.width,c.height=r.height;let d=0,f=r.direction==="horizontal"?r.height-d*2:r.width-d*2,p=r.thumbSrc?E.from(r.thumbSrc):E.EMPTY,m=p.width||16,x=p.height||16,v=f/m,y=f/x,b=Math.min(v,y);if(u.width=m*b,u.height=x*b,e.barSrc!==r.barSrc){let S=r.barSrc?E.from(r.barSrc):E.EMPTY;c.texture=S}if(e.thumbSrc!==r.thumbSrc){let S=r.thumbSrc?E.from(r.thumbSrc):E.EMPTY;u.texture=S}let T=r.max-r.min,w=(r.initialValue-r.min)/T;r.direction==="horizontal"?(u.x=w*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=w*(c.height-u.height))}if(h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),s){let{hover:d,drag:f,dragStart:p,dragEnd:m,min:x,max:v,step:y,direction:b,initialValue:T}=r,w=T??x,S=v-x;h.eventMode="static";let A=j=>{let F=(j-x)/S;b==="horizontal"?(u.x=F*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=F*(c.height-u.height))},R=j=>{let F;if(b==="horizontal"){let D=j.x-u.width/2;F=Math.max(0,Math.min(1,D/(c.width-u.width)))}else{let D=j.y-u.height/2;F=Math.max(0,Math.min(1,D/(c.height-u.height)))}let H=x+F*S;return y>0&&(H=Math.round((H-x)/y)*y+x,H=Math.max(x,Math.min(v,H))),H},I=u.texture,P=c.texture,B=!1,W=j=>{B=!0;let F=h.toLocal(j.global),H=R(F);H!==w&&(w=H,A(w),p?.actionPayload&&s&&s(`${r.id}-drag-start`,{_event:{id:r.id},value:w,...p.actionPayload}))},N=j=>{if(!B)return;let F=h.toLocal(j.global),H=R(F);H!==w&&(w=H,A(w),f?.actionPayload&&s&&s(`${r.id}-drag`,{_event:{id:r.id},value:w,...f.actionPayload,currentValue:w}))},nt=()=>{B&&(B=!1,m?.actionPayload&&s&&s(`${r.id}-drag-end`,{_event:{id:r.id},value:w,...m.actionPayload}))};if(h.on("pointerdown",W),h.on("globalpointermove",N),h.on("pointerup",nt),h.on("pointerupoutside",nt),d){let{cursor:j,soundSrc:F,actionPayload:H,thumbSrc:D,barSrc:k}=d,tt=()=>{H&&s(`${r.id}-pointer-over`,{_event:{id:r.id},...H}),j&&(h.cursor=j,u.cursor=j),F&&i.audioStage.add({id:`hover-${Date.now()}`,url:F,loop:!1}),D&&(u.texture=E.from(D)),k&&(c.texture=E.from(k))},pt=()=>{h.cursor="auto",u.cursor="auto",u.texture=I,c.texture=P},dt=()=>{B||(h.cursor="auto",u.cursor="auto",u.texture=I,c.texture=P)};h.on("pointerover",tt),h.on("pointerout",dt),h.on("pointerup",pt),h.on("pointerupoutside",pt)}}}};a.addEventListener("abort",()=>{l()}),h&&(o&&o.length>0&&await _t(e.id,n,{app:i,element:h,animations:o,signal:a}),l())};var Xw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=()=>{n&&!n.destroyed&&n.destroy({children:!0})};o.addEventListener("abort",()=>{a()}),r&&r.length>0&&await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a()}};var zI=We({type:"slider",add:zw,update:$w,delete:Xw});var jw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,elementPlugins:n,signal:a})=>{if(a?.aborted)return;let{id:h,x:l,y:c,children:u,scroll:d,alpha:f}=e,p=new vt;p.label=h;let m=()=>{p.x=Math.round(l),p.y=Math.round(c),p.alpha=f};if(a.addEventListener("abort",()=>{m()}),m(),t.addChild(p),u&&u.length>0)for(let x of u){let v=n.find(y=>y.type===x.type);if(!v)throw new Error(`No plugin found for child element type: ${x.type}`);await v.add({app:i,parent:p,element:x,animations:r,eventHandler:s,animateElements:_t,elementPlugins:n,signal:a})}d&&$I({container:p,element:e}),r&&r.length>0&&await _t(h,o,{app:i,element:p,animations:r,signal:a})},$I=({container:i,element:t})=>{let e=0,r=0;t.children.forEach(n=>{e=Math.max(n.width+n.x,e),r=Math.max(n.height+n.y,r)});let s=t.scroll&&t.height&&r>t.height,o=t.scroll&&t.width&&e>t.width;if(s||o){let n=new vt;[...i.children].forEach(f=>{n.addChild(f)}),i.addChild(n);let h=new _r().rect(0,0,t.width||e,t.height||r).fill({color:16711680,alpha:0});i.addChild(h),n.mask=h,i.eventMode="static";let l=0,c=0,u=-(r-(t.height||r)),d=-(e-(t.width||e));i.on("wheel",f=>{if(f.preventDefault(),s&&f.deltaY!==0){let p=l-f.deltaY;p>0?l=0:p<u?l=u:l=p,n.y=l}if(o&&(f.deltaX!==0||f.shiftKey&&f.deltaY!==0)){let p=f.deltaX!==0?f.deltaX:f.deltaY,m=c-p;m>0?c=0:m<d?c=d:c=m,n.x=c}})}};var Yw=(i,t,e=[])=>{let r=new Set,s=new Map,o=new Map,n=[],a=[],h=[];for(let l of i)r.add(l.id),s.set(l.id,l);for(let l of t)r.add(l.id),o.set(l.id,l);for(let l of r){let c=s.get(l),u=o.get(l);!c&&u?n.push(u):c&&!u?a.push(c):(JSON.stringify(c)!==JSON.stringify(u)||e.find(d=>d.elementId===u.id))&&h.push({prev:c,next:u})}return{toAddElement:n,toDeleteElement:a,toUpdateElement:h}};var rh=async({app:i,parent:t,prevASTTree:e,nextASTTree:r,animations:s,animationPlugins:o,eventHandler:n,elementPlugins:a,signal:h})=>{let{toAddElement:l,toDeleteElement:c,toUpdateElement:u}=Yw(e,r,[]),d=[];for(let f of c){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.delete({app:i,parent:t,element:f,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}for(let f of l){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.add({app:i,parent:t,element:f,animations:s,eventHandler:n,signal:h,animationPlugins:o,elementPlugins:a}))}for(let{prev:f,next:p}of u){let m=a.find(x=>x.type===p.type);if(!m)throw new Error(`No plugin found for element type: ${p.type}`);d.push(m.update({app:i,parent:t,prevElement:f,nextElement:p,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}await Promise.all(d),XI(t,r)},XI=(i,t)=>{i.children.sort((e,r)=>{let s=t.findIndex(n=>n.id===e.label),o=t.findIndex(n=>n.id===r.label);if(s!==-1&&o!==-1)return s-o;if(s===-1&&o===-1)return 0;if(s===-1)return-1;if(o===-1)return 1})};var qw=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,elementPlugins:a,signal:h})=>{if(h?.aborted)return;let l=t.children.find(u=>u.label===e.id),c=async()=>{JSON.stringify(e)!==JSON.stringify(r)&&(l.x=Math.round(r.x),l.y=Math.round(r.y),l.label=r.id,l.alpha=r.alpha,JSON.stringify(e.children)!==JSON.stringify(r.children)&&rh({app:i,parent:l,nextASTTree:r.children,prevASTTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationPlugins:n,signal:h}))};h.addEventListener("abort",()=>{c()}),l&&(o&&o.length>0&&await _t(e.id,n,{app:i,element:l,animations:o,signal:h}),await c())};var Kw=async({app:i,parent:t,element:e,animationPlugins:r,animations:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=()=>{n&&!n.destroyed&&n.destroy({children:!0})};o.addEventListener("abort",()=>{a()}),s&&s.length>0&&await _t(e.id,r,{app:i,element:n,animations:s,signal:o}),a()}};var jI=We({type:"container",add:jw,update:qw,delete:Kw});function Po(i,t){let e=i.text.substring(0,t),s=jt.measureText(e,i.style).width;return i.x+s}var Zw=i=>new Promise(t=>setTimeout(t,i)),Qw=async({parent:i,element:t,signal:e})=>{if(e?.aborted)return;let r=t.speed??50,s=t.revealEffect??"typewriter",o=t?.indicator?.offset??12,n=s==="none",a=n?0:Math.max(1,Math.floor(1e3/r)),h=n?0:Math.max(1,Math.floor(4e3/r));if(e?.aborted)return;let l=new vt;l.label=t.id;let c=new se(E.EMPTY);if(t?.indicator?.revealing?.src){let u=t.indicator.revealing.src?E.from(t.indicator.revealing.src):E.EMPTY;c=new se(u),c.width=t.indicator.revealing.width??u.width,c.height=t.indicator.revealing.height??u.height}l.addChild(c),t.x!==void 0&&(l.x=Math.round(t.x)),t.y!==void 0&&(l.y=Math.round(t.y)),t.alpha!==void 0&&(l.alpha=t.alpha),i.addChild(l);for(let u=0;u<t.content.length;u++){let d=t.content[u];c.x=o,c.y=d.y+(d.lineMaxHeight-c.height);for(let f=0;f<d.lineParts.length;f++){let p=d.lineParts[f],m=new Bt(p.textStyle),x=new yr({text:"",style:m,x:Math.round(p.x),y:Math.round(p.y)}),v=null;if(p.furigana){let T=new Bt(p.furigana.textStyle);v=new yr({text:"",style:T,x:Math.round(p.furigana.x),y:Math.round(p.furigana.y)}),l.addChild(v)}l.addChild(x);let y=p.text,b=p.furigana?.text||"";if(n||e?.aborted)x.text=y,c.x=Po(x,y.length-1)+o,v&&(v.text=b);else{let T=b.length;for(let w=0;w<y.length;w++){if(e?.aborted)return;x.text=y.substring(0,w+1),c.x=Po(x,w)+o;let S=Math.round((w+1)/y.length*T);v&&(v.text=b.substring(0,S)),w<y.length-1&&await Zw(a)}}}u<t.content.length-1&&await Zw(h)}if(t?.indicator?.complete?.src){let u=t.indicator.complete.src?E.from(t.indicator.complete.src):E.EMPTY;c.texture=u,c.width=t.indicator.complete.width??u.width,c.height=t.indicator.complete.height??u.height}};var Jw=i=>new Promise(t=>setTimeout(t,i)),t1=async i=>{let{parent:t,nextElement:e,signal:r}=i,s=e.speed??50,o=e.revealEffect??"typewriter",n=e?.indicator?.offset??12,a=o==="none",h=a?0:Math.max(1,Math.floor(1e3/s)),l=a?0:Math.max(1,Math.floor(4e3/s));if(r?.aborted)return;let c=t.children.find(u=>u.label===e.id);if(c){c.removeChildren();let u=new se(E.EMPTY);if(e?.indicator?.revealing?.src){let d=e.indicator.revealing.src?E.from(e.indicator.revealing.src):E.EMPTY;u=new se(d),u.width=e.indicator.revealing.width??d.width,u.height=e.indicator.revealing.height??d.height}c.addChild(u),e.x!==void 0&&(c.x=e.x),e.y!==void 0&&(c.y=e.y),e.alpha!==void 0&&(c.alpha=e.alpha);for(let d=0;d<e.content.length;d++){let f=e.content[d];u.x=n,u.y=f.y+(f.lineMaxHeight-u.height);for(let p=0;p<f.lineParts.length;p++){if(r?.aborted)return;let m=f.lineParts[p],x=new Bt(m.textStyle),v=new yr({text:"",style:x,x:m.x,y:m.y}),y=null;if(m.furigana){let w=new Bt(m.furigana.textStyle);y=new yr({text:"",style:w,x:m.furigana.x,y:m.furigana.y}),c.addChild(y)}c.addChild(v);let b=m.text,T=m.furigana?.text||"";if(a||r?.aborted)v.text=b,u.x=Po(v,b.length-1)+n,y&&(y.text=T);else{let w=T.length;for(let S=0;S<b.length;S++){v.text=b.substring(0,S+1),u.x=Po(v,S)+n;let A=Math.round((S+1)/b.length*w);y&&(y.text=T.substring(0,A)),S<b.length-1&&await Jw(h)}}}d<e.content.length-1&&await Jw(l)}if(e?.indicator?.complete?.src){let d=e.indicator.complete.src?E.from(e.indicator.complete.src):E.EMPTY;u.texture=d,u.width=e.indicator.complete.width??d.width,u.height=e.indicator.complete.height??d.height}}};var e1=async({parent:i,element:t,signal:e})=>{if(e?.aborted)return;let r=i.getChildByLabel(t.id);if(r){let s=()=>{r&&!r.destroyed&&r.destroy({children:!0})};e.addEventListener("abort",()=>{s()}),s()}};var YI=We({type:"text-revealing",add:Qw,update:t1,delete:e1});var qI={linear:i=>i},KI=(i,t,e,r)=>i+(t-i)*qI[r](e),ZI=(i,t,e)=>{typeof t=="string"&&(t=Zu[t]);let r=i;for(let s of t){if(r==null)return e;r=r[s]}return r===void 0?e:r},QI=(i,t,e)=>{typeof t=="string"&&(t=Zu[t]);let r=i;for(let s=0;s<t.length-1;s++){let o=t[s];o in r||(r[o]={}),r=r[o]}return r[t[t.length-1]]=e,i},JI=i=>{let t=[],e=0,r;return i.forEach(({value:s,duration:o,easing:n,relative:a},h)=>{h===0?(r=s,t.push({time:e,value:s,easing:"linear"})):o!==void 0&&n!==void 0&&(e+=o,a?r=r+s:r=s,t.push({time:e,value:r,easing:n}))}),t},tF=(i,t)=>{if(i.length===0)return 0;if(t<=i[0].time)return i[0].value;if(t>=i[i.length-1].time)return i[i.length-1].value;for(let e=0;e<i.length-1;e++){let{time:r,value:s,easing:o}=i[e],{time:n,value:a}=i[e+1];if(t>=r&&t<=n){let h=(t-r)/(n-r);return KI(s,a,h,o)}}return i[i.length-1].value},eF=i=>Math.max.apply(null,i),r1=async({app:i,element:t,animation:e,signal:r})=>new Promise((s,o)=>{if(r?.aborted){i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"));return}let{properties:n}=e,a=Object.entries(n).map(([m,x])=>{if(!hx[m])throw new Error(`${m} is not a supported property for transition.`);return{...x,property:m}}),h=a.map(m=>m.keyframes.reduce((x,v)=>x+v.duration||0,0)),l=eF(h),c={};a.forEach(m=>{c[m.property]=ZI(t,m.property)});let u=a.map(m=>{let x=[];m.initialValue!==void 0?x=[{value:m.initialValue}]:x=[{value:c[m.property]}],x=x.concat(m.keyframes);let v=JI(x);return{property:m.property,timeline:v}}),d=0,f=m=>{u.forEach(({property:x,timeline:v})=>{let y=tF(v,m);t&&!t.destroyed&&QI(t,x,y)})};r&&r.addEventListener("abort",()=>{i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"))});let p=m=>{if(d+=m.deltaMS,d>=l){i.ticker.remove(p),s();return}f(d)};if(r?.aborted){i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"));return}i.ticker.add(p)});var rF=Lm({type:"tween",animate:r1});var i1=({app:i,element:t,signal:e})=>{if(e?.aborted)return;let r={id:t.id,url:t.src,loop:t.loop??!1,volume:(t.volume??800)/1e3};t.delay&&t.delay>0?setTimeout(()=>{e?.aborted||i.audioStage.add(r)},t.delay):i.audioStage.add(r)};var s1=({app:i,prevElement:t,nextElement:e,signal:r})=>{if(!r?.aborted&&(t.src!==e.src||t.volume!==e.volume)){let s=i.audioStage.getById(t.id);s&&(s.url=e.src,s.volume=(e.volume??800)/1e3)}};var o1=({app:i,element:t,signal:e})=>{e?.aborted||i.audioStage.remove(t.id)};var iF=Dm({type:"sound",add:i1,update:s1,delete:o1});var n1=(i=[],t=[])=>{let e=new Set,r=new Map,s=new Map,o=[],n=[],a=[];for(let h of i)e.add(h.id),r.set(h.id,h);for(let h of t)e.add(h.id),s.set(h.id,h);for(let h of e){let l=r.get(h),c=s.get(h);!l&&c?o.push(c):l&&!c?n.push(l):(l.src!==c.src||l.volume!==c.volume||l.loop!==c.loop||l.delay!==c.delay)&&a.push({prev:l,next:c})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var Nm=async({app:i,prevAudioTree:t,nextAudioTree:e,audioPlugins:r,signal:s})=>{let{toAddElement:o,toDeleteElement:n,toUpdateElement:a}=n1(t,e),h=[];for(let l of n){let c=r.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.delete({app:i,element:l,signal:s}))}for(let l of o){let c=r.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.add({app:i,element:l,signal:s}))}for(let{prev:l,next:c}of a){let u=r.find(d=>d.type===c.type);if(!u)throw new Error(`No audio plugin found for type: ${c.type}`);h.push(u.update({app:i,prevElement:l,nextElement:c,signal:s}))}await Promise.all(h)};var ze=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))(ze||{}),Hm=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(Hm||{}),ru=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(ru||{}),Z=(i=>(i[i.NORMAL=0]="NORMAL",i[i.ADD=1]="ADD",i[i.MULTIPLY=2]="MULTIPLY",i[i.SCREEN=3]="SCREEN",i[i.OVERLAY=4]="OVERLAY",i[i.DARKEN=5]="DARKEN",i[i.LIGHTEN=6]="LIGHTEN",i[i.COLOR_DODGE=7]="COLOR_DODGE",i[i.COLOR_BURN=8]="COLOR_BURN",i[i.HARD_LIGHT=9]="HARD_LIGHT",i[i.SOFT_LIGHT=10]="SOFT_LIGHT",i[i.DIFFERENCE=11]="DIFFERENCE",i[i.EXCLUSION=12]="EXCLUSION",i[i.HUE=13]="HUE",i[i.SATURATION=14]="SATURATION",i[i.COLOR=15]="COLOR",i[i.LUMINOSITY=16]="LUMINOSITY",i[i.NORMAL_NPM=17]="NORMAL_NPM",i[i.ADD_NPM=18]="ADD_NPM",i[i.SCREEN_NPM=19]="SCREEN_NPM",i[i.NONE=20]="NONE",i[i.SRC_OVER=0]="SRC_OVER",i[i.SRC_IN=21]="SRC_IN",i[i.SRC_OUT=22]="SRC_OUT",i[i.SRC_ATOP=23]="SRC_ATOP",i[i.DST_OVER=24]="DST_OVER",i[i.DST_IN=25]="DST_IN",i[i.DST_OUT=26]="DST_OUT",i[i.DST_ATOP=27]="DST_ATOP",i[i.ERASE=26]="ERASE",i[i.SUBTRACT=28]="SUBTRACT",i[i.XOR=29]="XOR",i))(Z||{}),Ro=(i=>(i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i))(Ro||{}),U=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(U||{}),ri=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(ri||{}),rt=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(rt||{}),L=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(L||{}),nr=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(nr||{}),ih=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(ih||{}),br=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(br||{}),$e=(i=>(i[i.NPM=0]="NPM",i[i.UNPACK=1]="UNPACK",i[i.PMA=2]="PMA",i[i.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",i[i.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",i[i.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",i))($e||{}),Pi=(i=>(i[i.NO=0]="NO",i[i.YES=1]="YES",i[i.AUTO=2]="AUTO",i[i.BLEND=0]="BLEND",i[i.CLEAR=1]="CLEAR",i[i.BLIT=2]="BLIT",i))(Pi||{}),iu=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(iu||{}),Pe=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(Pe||{}),Jt=(i=>(i[i.NONE=0]="NONE",i[i.SCISSOR=1]="SCISSOR",i[i.STENCIL=2]="STENCIL",i[i.SPRITE=3]="SPRITE",i[i.COLOR=4]="COLOR",i))(Jt||{});var Ct=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(Ct||{}),Le=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(Le||{});var Vm={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")};var Y={ADAPTER:Vm,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};Fd();var sF=pi.default??pi,vr=sF(globalThis.navigator);Y.RETINA_PREFIX=/@([0-9\.]+)x/;Y.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var ls=Ui(h1(),1),q2=Ui(Vl(),1);var Tg=Ui(EP(),1);var AP={};function lt(i,t,e=3){if(AP[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1145
1145
  Deprecated since v${i}`):(r=r.split(`
1146
1146
  `).splice(e).join(`
1147
1147
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
@@ -1625,7 +1625,7 @@ void main(void)
1625
1625
  `)}}return o.push(`
1626
1626
  renderer.buffer.update(buffer);
1627
1627
  `),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join(`
1628
- `))}}var mU=0,Wu={textureCount:0,uboCount:0},Ii=class{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=mU++}systemCheck(){if(!Lu())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,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;let r=t.program,s=r.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==r&&(this.program=r,this.gl.useProgram(s.program)),e||(Wu.textureCount=0,Wu.uboCount=0,this.syncUniformGroup(t.uniformGroup,Wu)),s}setUniforms(t){let e=this.shader.program,r=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(r.uniformData,t,this.renderer)}syncUniformGroup(t,e){let r=this.getGlProgram();(!t.static||t.dirtyId!==r.uniformDirtyGroups[t.id])&&(r.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,r,e))}syncUniforms(t,e,r){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,r)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Ng(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let r=this.getGlProgram();if(!t.static||t.dirtyId!==0||!r.uniformGroups[t.id]){t.dirtyId=0;let s=r.uniformGroups[t.id]||this.createSyncBufferGroup(t,r,e);t.buffer.update(),s(r.uniformData,t.uniforms,this.renderer,Wu,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,r.uniformBufferBindings[e])}createSyncBufferGroup(t,e,r){let{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);let o=this.gl.getUniformBlockIndex(e.program,r);e.uniformBufferBindings[r]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(t,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=qg(t,this.shader.program.uniformData)),t.autoManage){let h=new Float32Array(a.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){let e=this.gl,r=t.program,s=Yg(e,r);return r.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};Ii.extension={type:V.RendererSystem,name:"shader"};q.add(Ii);var ci=class{constructor(t){this.renderer=t}run(t){let{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.3 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}};ci.defaultOptions={hello:!1},ci.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"startup"};q.add(ci);function iR(i,t=[]){return t[Z.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.ADD]=[i.ONE,i.ONE],t[Z.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.NONE]=[0,0],t[Z.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t[Z.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SRC_IN]=[i.DST_ALPHA,i.ZERO],t[Z.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],t[Z.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[Z.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],t[Z.DST_IN]=[i.ZERO,i.SRC_ALPHA],t[Z.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],t[Z.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],t[Z.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[Z.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],t}var gU=0,xU=1,_U=2,yU=3,bU=4,vU=5,sR=class Kg{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=Z.NONE,this._blendEq=!1,this.map=[],this.map[gU]=this.setBlend,this.map[xU]=this.setOffset,this.map[_U]=this.setCullFace,this.map[yU]=this.setDepthTest,this.map[bU]=this.setFrontFace,this.map[vU]=this.setDepthMask,this.checks=[],this.defaultState=new Nr,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=iR(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e=e>>1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(Kg.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Kg.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;let e=this.blendModes[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}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(t,e){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};sR.extension={type:V.RendererSystem,name:"state"};var Zg=sR;q.add(Zg);var on=class extends ls.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);let e=(t.priority??[]).filter(s=>t.systems[s]),r=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(let s of r)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new Yt(e)})}addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}emitWithCustomOptions(t,e){let r=Object.keys(this._systemsHash);t.items.forEach(s=>{let o=r.find(n=>this._systemsHash[n]===s);s[t.name](e[o])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}};var Dh=class zu{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=zu.defaultMaxIdle,this.checkCountMax=zu.defaultCheckCountMax,this.mode=zu.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==iu.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,r=!1;for(let s=0;s<e.length;s++){let o=e[s];o.resource&&this.count-o.touched>this.maxIdle&&(t.destroyTexture(o,!0),e[s]=null,r=!0)}if(r){let s=0;for(let o=0;o<e.length;o++)e[o]!==null&&(e[s++]=e[o]);e.length=s}}unload(t){let e=this.renderer.texture,r=t._texture;r&&!r.framebuffer&&e.destroyTexture(r);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};Dh.defaultMode=iu.AUTO,Dh.defaultMaxIdle=60*60,Dh.defaultCheckCountMax=60*10,Dh.extension={type:V.RendererSystem,name:"textureGC"};var Wr=Dh;q.add(Wr);var Ts=class{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=rt.UNSIGNED_BYTE,this.internalFormat=U.RGBA,this.samplerType=0}};function oR(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[i.RGB]:L.FLOAT,[i.RGBA]:L.FLOAT,[i.ALPHA]:L.FLOAT,[i.LUMINANCE]:L.FLOAT,[i.LUMINANCE_ALPHA]:L.FLOAT,[i.R8]:L.FLOAT,[i.R8_SNORM]:L.FLOAT,[i.RG8]:L.FLOAT,[i.RG8_SNORM]:L.FLOAT,[i.RGB8]:L.FLOAT,[i.RGB8_SNORM]:L.FLOAT,[i.RGB565]:L.FLOAT,[i.RGBA4]:L.FLOAT,[i.RGB5_A1]:L.FLOAT,[i.RGBA8]:L.FLOAT,[i.RGBA8_SNORM]:L.FLOAT,[i.RGB10_A2]:L.FLOAT,[i.RGB10_A2UI]:L.FLOAT,[i.SRGB8]:L.FLOAT,[i.SRGB8_ALPHA8]:L.FLOAT,[i.R16F]:L.FLOAT,[i.RG16F]:L.FLOAT,[i.RGB16F]:L.FLOAT,[i.RGBA16F]:L.FLOAT,[i.R32F]:L.FLOAT,[i.RG32F]:L.FLOAT,[i.RGB32F]:L.FLOAT,[i.RGBA32F]:L.FLOAT,[i.R11F_G11F_B10F]:L.FLOAT,[i.RGB9_E5]:L.FLOAT,[i.R8I]:L.INT,[i.R8UI]:L.UINT,[i.R16I]:L.INT,[i.R16UI]:L.UINT,[i.R32I]:L.INT,[i.R32UI]:L.UINT,[i.RG8I]:L.INT,[i.RG8UI]:L.UINT,[i.RG16I]:L.INT,[i.RG16UI]:L.UINT,[i.RG32I]:L.INT,[i.RG32UI]:L.UINT,[i.RGB8I]:L.INT,[i.RGB8UI]:L.UINT,[i.RGB16I]:L.INT,[i.RGB16UI]:L.UINT,[i.RGB32I]:L.INT,[i.RGB32UI]:L.UINT,[i.RGBA8I]:L.INT,[i.RGBA8UI]:L.UINT,[i.RGBA16I]:L.INT,[i.RGBA16UI]:L.UINT,[i.RGBA32I]:L.INT,[i.RGBA32UI]:L.UINT,[i.DEPTH_COMPONENT16]:L.FLOAT,[i.DEPTH_COMPONENT24]:L.FLOAT,[i.DEPTH_COMPONENT32F]:L.FLOAT,[i.DEPTH_STENCIL]:L.FLOAT,[i.DEPTH24_STENCIL8]:L.FLOAT,[i.DEPTH32F_STENCIL8]:L.FLOAT}:t={[i.RGB]:L.FLOAT,[i.RGBA]:L.FLOAT,[i.ALPHA]:L.FLOAT,[i.LUMINANCE]:L.FLOAT,[i.LUMINANCE_ALPHA]:L.FLOAT,[i.DEPTH_STENCIL]:L.FLOAT},t}function nR(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[rt.UNSIGNED_BYTE]:{[U.RGBA]:i.RGBA8,[U.RGB]:i.RGB8,[U.RG]:i.RG8,[U.RED]:i.R8,[U.RGBA_INTEGER]:i.RGBA8UI,[U.RGB_INTEGER]:i.RGB8UI,[U.RG_INTEGER]:i.RG8UI,[U.RED_INTEGER]:i.R8UI,[U.ALPHA]:i.ALPHA,[U.LUMINANCE]:i.LUMINANCE,[U.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[rt.BYTE]:{[U.RGBA]:i.RGBA8_SNORM,[U.RGB]:i.RGB8_SNORM,[U.RG]:i.RG8_SNORM,[U.RED]:i.R8_SNORM,[U.RGBA_INTEGER]:i.RGBA8I,[U.RGB_INTEGER]:i.RGB8I,[U.RG_INTEGER]:i.RG8I,[U.RED_INTEGER]:i.R8I},[rt.UNSIGNED_SHORT]:{[U.RGBA_INTEGER]:i.RGBA16UI,[U.RGB_INTEGER]:i.RGB16UI,[U.RG_INTEGER]:i.RG16UI,[U.RED_INTEGER]:i.R16UI,[U.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[rt.SHORT]:{[U.RGBA_INTEGER]:i.RGBA16I,[U.RGB_INTEGER]:i.RGB16I,[U.RG_INTEGER]:i.RG16I,[U.RED_INTEGER]:i.R16I},[rt.UNSIGNED_INT]:{[U.RGBA_INTEGER]:i.RGBA32UI,[U.RGB_INTEGER]:i.RGB32UI,[U.RG_INTEGER]:i.RG32UI,[U.RED_INTEGER]:i.R32UI,[U.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[rt.INT]:{[U.RGBA_INTEGER]:i.RGBA32I,[U.RGB_INTEGER]:i.RGB32I,[U.RG_INTEGER]:i.RG32I,[U.RED_INTEGER]:i.R32I},[rt.FLOAT]:{[U.RGBA]:i.RGBA32F,[U.RGB]:i.RGB32F,[U.RG]:i.RG32F,[U.RED]:i.R32F,[U.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[rt.HALF_FLOAT]:{[U.RGBA]:i.RGBA16F,[U.RGB]:i.RGB16F,[U.RG]:i.RG16F,[U.RED]:i.R16F},[rt.UNSIGNED_SHORT_5_6_5]:{[U.RGB]:i.RGB565},[rt.UNSIGNED_SHORT_4_4_4_4]:{[U.RGBA]:i.RGBA4},[rt.UNSIGNED_SHORT_5_5_5_1]:{[U.RGBA]:i.RGB5_A1},[rt.UNSIGNED_INT_2_10_10_10_REV]:{[U.RGBA]:i.RGB10_A2,[U.RGBA_INTEGER]:i.RGB10_A2UI},[rt.UNSIGNED_INT_10F_11F_11F_REV]:{[U.RGB]:i.R11F_G11F_B10F},[rt.UNSIGNED_INT_5_9_9_9_REV]:{[U.RGB]:i.RGB9_E5},[rt.UNSIGNED_INT_24_8]:{[U.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[rt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[U.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:t={[rt.UNSIGNED_BYTE]:{[U.RGBA]:i.RGBA,[U.RGB]:i.RGB,[U.ALPHA]:i.ALPHA,[U.LUMINANCE]:i.LUMINANCE,[U.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[rt.UNSIGNED_SHORT_5_6_5]:{[U.RGB]:i.RGB},[rt.UNSIGNED_SHORT_4_4_4_4]:{[U.RGBA]:i.RGBA},[rt.UNSIGNED_SHORT_5_5_5_1]:{[U.RGBA]:i.RGBA}},t}var nn=class{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new ut,this.hasIntegerTextures=!1}contextChange(){let t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=nR(t),this.samplerTypes=oR(t);let e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};let r=new Ts(t.createTexture());t.bindTexture(t.TEXTURE_2D,r.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]=r,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Ts(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,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 s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){let{gl:r}=this;if(t=t?.castToBaseTexture(),t?.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;let s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(r.TEXTURE_2D,this.emptyTextures[r.TEXTURE_2D].texture),this.boundTextures[e]=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){let{gl:e,boundTextures:r}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<r.length;s++)r[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<r.length;s++)r[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),r[s]=null)}ensureSamplerType(t){let{boundTextures:e,hasIntegerTextures:r,CONTEXT_UID:s}=this;if(r)for(let o=t-1;o>=0;--o){let n=e[o];n&&n._glTextures[s].samplerType!==L.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(t){let e=new Ts(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??L.FLOAT,this.webGLVersion===2&&t.type===rt.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){let e=t._glTextures[this.CONTEXT_UID];if(!e)return;let r=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(r,t,e))e.samplerType!==L.FLOAT&&(this.hasIntegerTextures=!0);else{let s=t.realWidth,o=t.realHeight,n=r.gl;(e.width!==s||e.height!==o||e.dirtyId<0)&&(e.width=s,e.height=o,n.texImage2D(t.target,0,e.internalFormat,s,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){let{gl:r}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),r.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){let s=this.managedTextures.indexOf(t);s!==-1&&wg(this.managedTextures,s,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===br.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=ih.CLAMP:e.wrapMode=t.wrapMode,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let r=this.gl;if(e.mipmap&&t.mipmap!==br.ON_MANUAL&&r.generateMipmap(t.target),r.texParameteri(t.target,r.TEXTURE_WRAP_S,e.wrapMode),r.texParameteri(t.target,r.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===nr.LINEAR?r.LINEAR_MIPMAP_LINEAR:r.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===nr.LINEAR){let o=Math.min(t.anisotropicLevel,r.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));r.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===nr.LINEAR?r.LINEAR:r.NEAREST);r.texParameteri(t.target,r.TEXTURE_MAG_FILTER,t.scaleMode===nr.LINEAR?r.LINEAR:r.NEAREST)}destroy(){this.renderer=null}};nn.extension={type:V.RendererSystem,name:"texture"};q.add(nn);var an=class{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glTransformFeedbacks[r]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){let{gl:r,renderer:s}=this;e&&s.shader.bind(e),r.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:r,CONTEXT_UID:s}=this,o=e.createTransformFeedback();t._glTransformFeedbacks[s]=o,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,o);for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];a&&(r.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),o}disposeTransformFeedback(t,e){let r=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);let o=this.renderer.buffer;if(o)for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];if(!a)continue;let h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&o.dispose(a,e))}r&&(e||s.deleteTransformFeedback(r),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};an.extension={type:V.RendererSystem,name:"transformFeedback"};q.add(an);var ui=class{constructor(t){this.renderer=t}init(t){this.screen=new gt(0,0,t.width,t.height),this.element=t.view||Y.ADAPTER.createCanvas(),this.resolution=t.resolution||Y.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);let r=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=r,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${r}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",r,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}};ui.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},ui.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"_view"};q.add(ui);Y.PREFER_ENV=ze.WEBGL2;Y.STRICT_TEXTURE_CACHE=!1;Y.RENDER_OPTIONS={...li.defaultOptions,...hi.defaultOptions,...ui.defaultOptions,...ci.defaultOptions};Object.defineProperties(Y,{WRAP_MODE:{get(){return ut.defaultOptions.wrapMode},set(i){lt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),ut.defaultOptions.wrapMode=i}},SCALE_MODE:{get(){return ut.defaultOptions.scaleMode},set(i){lt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),ut.defaultOptions.scaleMode=i}},MIPMAP_TEXTURES:{get(){return ut.defaultOptions.mipmap},set(i){lt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),ut.defaultOptions.mipmap=i}},ANISOTROPIC_LEVEL:{get(){return ut.defaultOptions.anisotropicLevel},set(i){lt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),ut.defaultOptions.anisotropicLevel=i}},FILTER_RESOLUTION:{get(){return lt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Vr.defaultResolution},set(i){Vr.defaultResolution=i}},FILTER_MULTISAMPLE:{get(){return lt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Vr.defaultMultisample},set(i){Vr.defaultMultisample=i}},SPRITE_MAX_TEXTURES:{get(){return ai.defaultMaxTextures},set(i){lt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),ai.defaultMaxTextures=i}},SPRITE_BATCH_SIZE:{get(){return ai.defaultBatchSize},set(i){lt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),ai.defaultBatchSize=i}},CAN_UPLOAD_SAME_BUFFER:{get(){return ai.canUploadSameBuffer},set(i){lt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),ai.canUploadSameBuffer=i}},GC_MODE:{get(){return Wr.defaultMode},set(i){lt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Wr.defaultMode=i}},GC_MAX_IDLE:{get(){return Wr.defaultMaxIdle},set(i){lt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Wr.defaultMaxIdle=i}},GC_MAX_CHECK_COUNT:{get(){return Wr.defaultCheckCountMax},set(i){lt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Wr.defaultCheckCountMax=i}},PRECISION_VERTEX:{get(){return lr.defaultVertexPrecision},set(i){lt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),lr.defaultVertexPrecision=i}},PRECISION_FRAGMENT:{get(){return lr.defaultFragmentPrecision},set(i){lt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),lr.defaultFragmentPrecision=i}}});var Ss=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(Ss||{});var hn=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=r,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));let e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}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);let e=this.next;return this.next=t?null:e,this.previous=null,e}};var aR=class qe{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 hn(null,null,1/0),this.deltaMS=1/qe.targetFPMS,this.elapsedMS=1/qe.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,r=Ss.NORMAL){return this._addListener(new hn(t,e,r))}addOnce(t,e,r=Ss.NORMAL){return this._addListener(new hn(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*qe.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this.deltaTime);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,qe.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!qe._shared){let t=qe._shared=new qe;t.autoStart=!0,t._protected=!0}return qe._shared}static get system(){if(!qe._system){let t=qe._system=new qe;t.autoStart=!0,t._protected=!0}return qe._system}};aR.targetFPMS=.06;var cr=aR;Object.defineProperties(Y,{TARGET_FPMS:{get(){return cr.targetFPMS},set(i){lt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),cr.targetFPMS=i}}});var Nh=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Ss.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?cr.shared:new cr,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};Nh.extension=V.Application;q.add(Nh);var TU=[];q.handleByList(V.Renderer,TU);var Hh=class{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){let r=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,r)}else{let r=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,r)}e>=Ct.HIGH?this.multisample=Ct.HIGH:e>=Ct.MEDIUM?this.multisample=Ct.MEDIUM:e>=Ct.LOW?this.multisample=Ct.LOW:this.multisample=Ct.NONE}destroy(){}};Hh.extension={type:V.RendererSystem,name:"_multisample"};q.add(Hh);var $u=class{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var Vh=class{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){let{gl:e,CONTEXT_UID:r}=this,s=t._glBuffers[r]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:r,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){let o=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,r.bindBufferBase(r.UNIFORM_BUFFER,e,o.buffer)}}bindBufferRange(t,e,r){let{gl:s,CONTEXT_UID:o}=this;r=r||0;let n=t._glBuffers[o]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,r*256,256)}update(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glBuffers[r]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{let o=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,o)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];let r=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),r&&(e||s.deleteBuffer(r.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let r=0;r<e.length;r++)this.dispose(this.managedBuffers[e[r]],t)}createGLBuffer(t){let{CONTEXT_UID:e,gl:r}=this;return t._glBuffers[e]=new $u(r.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}};Vh.extension={type:V.RendererSystem,name:"buffer"};q.add(Vh);var Wh=class{constructor(t){this.renderer=t}render(t,e){let r=this.renderer,s,o,n,a;if(e&&(s=e.renderTexture,o=e.clear,n=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,r.runners.prerender.emit(),r.emit("prerender"),r.projection.transform=n,!r.context.isLost){if(s||(this.lastObjectRendered=t),!a){let h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}r.renderTexture.bind(s),r.batch.currentRenderer.start(),(o??r.background.clearBeforeRender)&&r.renderTexture.clear(),t.render(r),r.batch.currentRenderer.flush(),s&&(e.blit&&r.framebuffer.blit(),s.baseTexture.update()),r.runners.postrender.emit(),r.projection.transform=null,r.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}};Wh.extension={type:V.RendererSystem,name:"objectRenderer"};q.add(Wh);var Xu=class Qg extends on{constructor(t){super(),this.type=Hm.WEBGL,t=Object.assign({},Y.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Ye({projectionMatrix:new It},!0);let e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Qg.__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(e),"useContextAlpha"in t&&(lt("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=Qg.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t?.forceCanvas?!1:Eg()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),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(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}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 lt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return lt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return lt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return lt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){lt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return lt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){lt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return lt("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};Xu.extension={type:V.Renderer,priority:1},Xu.__plugins={},Xu.__systems={};var ju=Xu;q.handleByMap(V.RendererPlugin,ju.__plugins);q.handleByMap(V.RendererSystem,ju.__systems);q.add(ju);var Fi=class extends je{constructor(t,e){let{width:r,height:s}=e||{};super(r,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<t;o++){let n=new ut;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let r=0;r<this.length;r++)t[r]&&(t[r].castToBaseTexture?this.addBaseTextureAt(t[r].castToBaseTexture(),r):t[r]instanceof je?this.addResourceAt(t[r],r):this.addResourceAt(Vo(t[r],e),r))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].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 e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;let t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{let{realWidth:e,realHeight:r}=this.items[0];return this.resize(e,r),this.update(),Promise.resolve(this)}),this._load}};var zh=class extends Fi{constructor(t,e){let{width:r,height:s}=e||{},o,n;Array.isArray(t)?(o=t,n=t.length):n=t,super(n,{width:r,height:s}),o&&this.initFromArray(o,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=ri.TEXTURE_2D_ARRAY}upload(t,e,r){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=t;r.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,r.internalFormat,this._width,this._height,s,0,e.format,r.type,null);for(let h=0;h<s;h++){let l=n[h];o[h]<l.dirtyId&&(o[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,r.type,l.resource.source))}return!0}};var $h=class extends ne{constructor(t){super(t)}static test(t){let{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}};var hR=class Xh extends Fi{constructor(t,e){let{width:r,height:s,autoLoad:o,linkBaseTexture:n}=e||{};if(t&&t.length!==Xh.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:r,height:s});for(let a=0;a<Xh.SIDES;a++)this.items[a].target=ri.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=n!==!1,t&&this.initFromArray(t,e),o!==!1&&this.load()}bind(t){super.bind(t),t.target=ri.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,r){if(r===void 0&&(r=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=ri.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,r){let s=this.itemDirtyIds;for(let o=0;o<Xh.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||r.dirtyId<e.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(t,n,r),s[o]=n.dirtyId):s[o]<-1&&(t.gl.texImage2D(n.target,0,r.internalFormat,e.realWidth,e.realHeight,0,e.format,r.type,null),s[o]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Xh.SIDES}};hR.SIDES=6;var Jg=hR;var jh=class i extends ne{constructor(t,e){e=e||{};let r,s,o;typeof t=="string"?(r=i.EMPTY,s=t,o=!0):(r=t,s=null,o=!1),super(r),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??o,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{let r=await Y.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await r.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===$e.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),t(this)}catch(r){if(this.destroyed)return;e(r),this.onError.emit(r)}}),this._load)}upload(t,e,r){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,r)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return i._EMPTY=i._EMPTY??Y.ADAPTER.createCanvas(0,0),i._EMPTY}};var tx=class Yu extends ne{constructor(t,e){e=e||{},super(Y.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},Yu.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(){let t=new Image;ne.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;let e=t.width,r=t.height;if(!e||!r)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,o=r*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/r*e,o=this._overrideHeight||this._overrideWidth/e*r),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${si()}`,n.getContext("2d").drawImage(t,0,0,e,r,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(t){let e=Yu.SVG_SIZE.exec(t),r={};return e&&(r[e[1]]=Math.round(parseFloat(e[3])),r[e[5]]=Math.round(parseFloat(e[7]))),r}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&Yu.SVG_XML.test(t)}};tx.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,tx.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var ex=tx;var qu=class extends ne{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}};var rx=class ix extends ne{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){let r=document.createElement("video");e.autoLoad!==!1&&r.setAttribute("preload","auto"),e.playsinline!==!1&&(r.setAttribute("webkit-playsinline",""),r.setAttribute("playsinline","")),e.muted===!0&&(r.setAttribute("muted",""),r.muted=!0),e.loop===!0&&r.setAttribute("loop",""),e.autoPlay!==!1&&r.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);let s=t[0].src||t[0];ne.crossOrigin(r,s,e.crossorigin);for(let o=0;o<t.length;++o){let n=document.createElement("source"),{src:a,mime:h}=t[o];if(a=a||t[o],a.startsWith("data:"))h=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){let l=a.split("?").shift().toLowerCase(),c=l.slice(l.lastIndexOf(".")+1);h=h||ix.MIME_TYPES[c]||`video/${c}`}n.src=a,h&&(n.type=h),r.appendChild(n)}t=r}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){let e=cr.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;let t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,r)=>{this.valid?e(this):(this._resolve=e,this._reject=r,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){let t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);let e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();let t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(cr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(cr.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(cr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||ix.TYPES.includes(e)}};rx.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],rx.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var sx=rx;_h.push(jh,_s,$h,sx,qu,ex,cs,Jg,zh);var SU={vec3(i,t,e,r){(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2])&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],i.uniform3f(t,r[0],r[1],r[2]))},int(i,t,e,r){i.uniform1i(t,r)},ivec2(i,t,e,r){i.uniform2i(t,r[0],r[1])},ivec3(i,t,e,r){i.uniform3i(t,r[0],r[1],r[2])},ivec4(i,t,e,r){i.uniform4i(t,r[0],r[1],r[2],r[3])},uint(i,t,e,r){i.uniform1ui(t,r)},uvec2(i,t,e,r){i.uniform2ui(t,r[0],r[1])},uvec3(i,t,e,r){i.uniform3ui(t,r[0],r[1],r[2])},uvec4(i,t,e,r){i.uniform4ui(t,r[0],r[1],r[2],r[3])},bvec2(i,t,e,r){i.uniform2i(t,r[0],r[1])},bvec3(i,t,e,r){i.uniform3i(t,r[0],r[1],r[2])},bvec4(i,t,e,r){i.uniform4i(t,r[0],r[1],r[2],r[3])},mat2(i,t,e,r){i.uniformMatrix2fv(t,!1,r)},mat4(i,t,e,r){i.uniformMatrix4fv(t,!1,r)}},EU={float(i,t,e,r){i.uniform1fv(t,r)},vec2(i,t,e,r){i.uniform2fv(t,r)},vec3(i,t,e,r){i.uniform3fv(t,r)},vec4(i,t,e,r){i.uniform4fv(t,r)},int(i,t,e,r){i.uniform1iv(t,r)},ivec2(i,t,e,r){i.uniform2iv(t,r)},ivec3(i,t,e,r){i.uniform3iv(t,r)},ivec4(i,t,e,r){i.uniform4iv(t,r)},uint(i,t,e,r){i.uniform1uiv(t,r)},uvec2(i,t,e,r){i.uniform2uiv(t,r)},uvec3(i,t,e,r){i.uniform3uiv(t,r)},uvec4(i,t,e,r){i.uniform4uiv(t,r)},bool(i,t,e,r){i.uniform1iv(t,r)},bvec2(i,t,e,r){i.uniform2iv(t,r)},bvec3(i,t,e,r){i.uniform3iv(t,r)},bvec4(i,t,e,r){i.uniform4iv(t,r)},sampler2D(i,t,e,r){i.uniform1iv(t,r)},samplerCube(i,t,e,r){i.uniform1iv(t,r)},sampler2DArray(i,t,e,r){i.uniform1iv(t,r)}};function lR(i,t,e,r,s){let o=0,n=null,a=null,h=s.gl;for(let l in i.uniforms){let c=t[l],u=r[l],d=e[l],f=i.uniforms[l];if(!c){f.group===!0&&s.shader.syncUniformGroup(u);continue}c.type==="float"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,h.uniform1f(d.location,u)):c.type==="bool"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,h.uniform1i(d.location,Number(u))):(c.type==="sampler2D"||c.type==="samplerCube"||c.type==="sampler2DArray")&&c.size===1&&!c.isArray?(s.texture.bind(u,o),d.value!==o&&(d.value=o,h.uniform1i(d.location,o)),o++):c.type==="mat3"&&c.size===1&&!c.isArray?f.a!==void 0?h.uniformMatrix3fv(d.location,!1,u.toArray(!0)):h.uniformMatrix3fv(d.location,!1,u):c.type==="vec2"&&c.size===1&&!c.isArray?f.x!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y)&&(a[0]=n.x,a[1]=n.y,h.uniform2f(d.location,n.x,n.y))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1])&&(a[0]=n[0],a[1]=n[1],h.uniform2f(d.location,n[0],n[1]))):c.type==="vec4"&&c.size===1&&!c.isArray?f.width!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y||a[2]!==n.width||a[3]!==n.height)&&(a[0]=n.x,a[1]=n.y,a[2]=n.width,a[3]=n.height,h.uniform4f(d.location,n.x,n.y,n.width,n.height))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])&&(a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],h.uniform4f(d.location,n[0],n[1],n[2],n[3]))):(c.size===1&&!c.isArray?SU:EU)[c.type].call(null,h,d.location,d.value,u)}}function AU(){Object.assign(Ii.prototype,{systemCheck(){},syncUniforms(i,t){let{shader:e,renderer:r}=this;lR(i,e.program.uniformData,t.uniformData,i.uniforms,r)}})}AU();var Yh=new(window.AudioContext||window.webkitAudioContext),wU=(i,t)=>{let e,r=Yh.createGain();r.gain.value=t.volume??1,r.connect(Yh.destination);let s={id:i,url:t.url,loop:t.loop||!1,volume:t.volume??1};return{play:()=>{let m=Co.getAsset(s.url);if(!m){console.warn("AudioPlayer.play: Asset not found",s.url);return}e=Yh.createBufferSource(),e.buffer=m,e.loop=s.loop,r.gain.setValueAtTime(s.volume,Yh.currentTime),e.connect(r),e.start(0)},stop:()=>{e&&(e.stop(),e.disconnect(),r.disconnect(),r.connect(Yh.destination))},update:m=>{s={...s,...m}},getId:()=>s.id,getUrl:()=>s.url,getLoop:()=>s.loop,getVolume:()=>s.volume,setUrl:m=>{s.url=m},setLoop:m=>{s.loop=m},setVolume:m=>{s.volume=m,r.gain.value=m},id:s.id,url:s.url,loop:s.loop,volume:s.volume,gainNode:r}},cR=()=>{let i=[],t=[];return{add:a=>{t.push(a)},remove:a=>{t=t.filter(h=>h.id!==a)},getById:a=>t.find(h=>h.id===a),tick:()=>{for(let h of t){let l=i.find(c=>c.id===h.id);if(!l){let c=wU(h.id,{url:h.url,loop:h.loop,volume:h.volume??1});i.push(c),c.play();return}(l.url!==h.url||l.loop!==h.loop)&&(l.stop(),l.setUrl(h.url),l.setLoop(h.loop??!1),l.play()),l.getVolume()!==(h.volume??1)&&l.setVolume(h.volume??1)}let a=[];for(let h of i)t.find(l=>l.id===h.id)||(h.stop(),a.push(h.id));i=i.filter(h=>!a.includes(h.id))},destroy:()=>{for(let a of i)a.stop();i=[],t=[]}}};var CU=i=>i.split("/").pop(),PU=i=>({name:"advancedBufferLoader",priority:2,bufferMap:i,load:async t=>{let e=t.startsWith("file:")?t:CU(t),r=i[e];if(!r)throw new Error(`Buffer not found for key: ${e}`);return{data:r.buffer,type:r.type,metadata:null}},testParse:async t=>!0,parse:async t=>{if(t instanceof E)return t;let e=new Blob([t.data],{type:t.type}),r=await createImageBitmap(e);return new E.from(r)},unload:async t=>t.destroy(!0)}),RU=()=>{let i,t=cR(),e={elements:[],animations:[],audio:[]},r,s={animations:[],elements:[],audios:[]},o,n,a=u=>u?u.startsWith("audio/")?"audio":u.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(u)?"font":"texture":"texture",h=(u,d,f)=>{u.renderer.events.cursorStyles||(u.renderer.events.cursorStyles={}),u.renderer.events.cursorStyles.default||(u.renderer.events.cursorStyles.default="default"),u.renderer.events.cursorStyles.hover||(u.renderer.events.cursorStyles.hover="pointer");let p=d?.cursorStyles,m=f?.cursorStyles;JSON.stringify(p)!==JSON.stringify(m)&&(m?(m.default&&(u.renderer.events.cursorStyles.default=m.default,u.canvas.style.cursor=m.default),m.hover&&(u.renderer.events.cursorStyles.hover=m.hover)):p&&(u.renderer.events.cursorStyles.default="default",u.renderer.events.cursorStyles.hover="pointer"))},l=async(u,d,f,p,m)=>{h(u,f.global,p.global),o&&o.abort(),o=new AbortController;let x=o.signal;await rh({app:u,parent:d,prevASTTree:f.elements,nextASTTree:p.elements,animations:p.animations,elementPlugins:s.elements,animationPlugins:s.animations,eventHandler:m,signal:x}),await Nm({app:u,prevAudioTree:f.audio,nextAudioTree:p.audio,audioPlugins:s.audios,signal:x})},c={rendererName:"pixi",get canvas(){return i.canvas},init:async u=>{let{eventHandler:d,plugins:f,width:p,height:m,backgroundColor:x}=u;s=f,r=d,i=new Ja,i.audioStage=t,await i.init({width:p,height:m,backgroundColor:x});let v=new _r;return v.rect(0,0,p,m),v.fill(x||0),i.stage.addChild(v),i.stage.width=p,i.stage.height=m,i.ticker.add(i.audioStage.tick),c},destroy:()=>{i.audioStage.destroy(),i.destroy()},loadAssets:async u=>{if(!u)throw new Error("assetBufferMap is required");let d={audio:{},font:{},texture:{}};for(let[p,m]of Object.entries(u)){let x=a(m.type);d[x][p]=m}await Promise.all(Object.entries(d.audio).map(([p,m])=>Co.load(p,m.buffer))),await Promise.all(Object.entries(d.font).map(async([p,m])=>{let x=new Blob([m.buffer],{type:m.type}),v=URL.createObjectURL(x),y=new FontFace(p,`url(${v})`);try{await y.load(),document.fonts.add(y)}catch(b){console.error(`Failed to load font ${p}:`,b)}finally{URL.revokeObjectURL(v)}})),n?Object.assign(n.bufferMap,d.texture):(n=PU(d.texture),or.loader.parsers.length=0,or.reset(),G.add({name:"advanced-buffer-loader",extension:_.Asset,priority:ce.High,loader:n}),typeof or.registerPlugin=="function"&&or.registerPlugin(n));let f=Object.keys(d.texture);return Promise.all(f.map(p=>or.load(p)))},loadAudioAssets:async u=>Promise.all(u.map(async d=>{let p=await(await fetch(d)).arrayBuffer();return Co.load(d,p)})),updatedBackgroundColor:u=>{i.renderer.background.color=u},getStageElementBounds:()=>{let u={},d=f=>{if(!(!f||f.length===0))for(let p of f)u[p.label]={x:p.groupTransform.tx,y:p.groupTransform.ty,width:p.width,height:p.height},d(p.children)};return d(i.stage.children),u},render:u=>{let d=Es(u.elements),f={...u,elements:d};l(i,i.stage,e,f,r),e=f}};return c},uR=RU;var abt=uR;export{Ja as Application,or as Assets,Co as AudioAsset,jI as containerPlugin,Lm as createAnimationPlugin,bR as createAssetBufferManager,Dm as createAudioPlugin,We as createElementPlugin,abt as default,Es as parse,Es as parseJSONToAST,VI as rectPlugin,Nm as renderAudio,rh as renderElements,zI as sliderPlugin,iF as soundPlugin,WI as spritePlugin,HI as textPlugin,YI as textRevealingPlugin,rF as tweenPlugin};
1628
+ `))}}var mU=0,Wu={textureCount:0,uboCount:0},Ii=class{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=mU++}systemCheck(){if(!Lu())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,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;let r=t.program,s=r.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==r&&(this.program=r,this.gl.useProgram(s.program)),e||(Wu.textureCount=0,Wu.uboCount=0,this.syncUniformGroup(t.uniformGroup,Wu)),s}setUniforms(t){let e=this.shader.program,r=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(r.uniformData,t,this.renderer)}syncUniformGroup(t,e){let r=this.getGlProgram();(!t.static||t.dirtyId!==r.uniformDirtyGroups[t.id])&&(r.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,r,e))}syncUniforms(t,e,r){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,r)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Ng(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let r=this.getGlProgram();if(!t.static||t.dirtyId!==0||!r.uniformGroups[t.id]){t.dirtyId=0;let s=r.uniformGroups[t.id]||this.createSyncBufferGroup(t,r,e);t.buffer.update(),s(r.uniformData,t.uniforms,this.renderer,Wu,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,r.uniformBufferBindings[e])}createSyncBufferGroup(t,e,r){let{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);let o=this.gl.getUniformBlockIndex(e.program,r);e.uniformBufferBindings[r]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(t,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=qg(t,this.shader.program.uniformData)),t.autoManage){let h=new Float32Array(a.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){let e=this.gl,r=t.program,s=Yg(e,r);return r.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};Ii.extension={type:V.RendererSystem,name:"shader"};q.add(Ii);var ci=class{constructor(t){this.renderer=t}run(t){let{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.3 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}};ci.defaultOptions={hello:!1},ci.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"startup"};q.add(ci);function iR(i,t=[]){return t[Z.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.ADD]=[i.ONE,i.ONE],t[Z.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.NONE]=[0,0],t[Z.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t[Z.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SRC_IN]=[i.DST_ALPHA,i.ZERO],t[Z.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],t[Z.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[Z.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],t[Z.DST_IN]=[i.ZERO,i.SRC_ALPHA],t[Z.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],t[Z.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],t[Z.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[Z.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],t}var gU=0,xU=1,_U=2,yU=3,bU=4,vU=5,sR=class Kg{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=Z.NONE,this._blendEq=!1,this.map=[],this.map[gU]=this.setBlend,this.map[xU]=this.setOffset,this.map[_U]=this.setCullFace,this.map[yU]=this.setDepthTest,this.map[bU]=this.setFrontFace,this.map[vU]=this.setDepthMask,this.checks=[],this.defaultState=new Nr,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=iR(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e=e>>1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(Kg.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Kg.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;let e=this.blendModes[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}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(t,e){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};sR.extension={type:V.RendererSystem,name:"state"};var Zg=sR;q.add(Zg);var on=class extends ls.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);let e=(t.priority??[]).filter(s=>t.systems[s]),r=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(let s of r)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new Yt(e)})}addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}emitWithCustomOptions(t,e){let r=Object.keys(this._systemsHash);t.items.forEach(s=>{let o=r.find(n=>this._systemsHash[n]===s);s[t.name](e[o])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}};var Dh=class zu{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=zu.defaultMaxIdle,this.checkCountMax=zu.defaultCheckCountMax,this.mode=zu.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==iu.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,r=!1;for(let s=0;s<e.length;s++){let o=e[s];o.resource&&this.count-o.touched>this.maxIdle&&(t.destroyTexture(o,!0),e[s]=null,r=!0)}if(r){let s=0;for(let o=0;o<e.length;o++)e[o]!==null&&(e[s++]=e[o]);e.length=s}}unload(t){let e=this.renderer.texture,r=t._texture;r&&!r.framebuffer&&e.destroyTexture(r);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};Dh.defaultMode=iu.AUTO,Dh.defaultMaxIdle=60*60,Dh.defaultCheckCountMax=60*10,Dh.extension={type:V.RendererSystem,name:"textureGC"};var Wr=Dh;q.add(Wr);var Ts=class{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=rt.UNSIGNED_BYTE,this.internalFormat=U.RGBA,this.samplerType=0}};function oR(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[i.RGB]:L.FLOAT,[i.RGBA]:L.FLOAT,[i.ALPHA]:L.FLOAT,[i.LUMINANCE]:L.FLOAT,[i.LUMINANCE_ALPHA]:L.FLOAT,[i.R8]:L.FLOAT,[i.R8_SNORM]:L.FLOAT,[i.RG8]:L.FLOAT,[i.RG8_SNORM]:L.FLOAT,[i.RGB8]:L.FLOAT,[i.RGB8_SNORM]:L.FLOAT,[i.RGB565]:L.FLOAT,[i.RGBA4]:L.FLOAT,[i.RGB5_A1]:L.FLOAT,[i.RGBA8]:L.FLOAT,[i.RGBA8_SNORM]:L.FLOAT,[i.RGB10_A2]:L.FLOAT,[i.RGB10_A2UI]:L.FLOAT,[i.SRGB8]:L.FLOAT,[i.SRGB8_ALPHA8]:L.FLOAT,[i.R16F]:L.FLOAT,[i.RG16F]:L.FLOAT,[i.RGB16F]:L.FLOAT,[i.RGBA16F]:L.FLOAT,[i.R32F]:L.FLOAT,[i.RG32F]:L.FLOAT,[i.RGB32F]:L.FLOAT,[i.RGBA32F]:L.FLOAT,[i.R11F_G11F_B10F]:L.FLOAT,[i.RGB9_E5]:L.FLOAT,[i.R8I]:L.INT,[i.R8UI]:L.UINT,[i.R16I]:L.INT,[i.R16UI]:L.UINT,[i.R32I]:L.INT,[i.R32UI]:L.UINT,[i.RG8I]:L.INT,[i.RG8UI]:L.UINT,[i.RG16I]:L.INT,[i.RG16UI]:L.UINT,[i.RG32I]:L.INT,[i.RG32UI]:L.UINT,[i.RGB8I]:L.INT,[i.RGB8UI]:L.UINT,[i.RGB16I]:L.INT,[i.RGB16UI]:L.UINT,[i.RGB32I]:L.INT,[i.RGB32UI]:L.UINT,[i.RGBA8I]:L.INT,[i.RGBA8UI]:L.UINT,[i.RGBA16I]:L.INT,[i.RGBA16UI]:L.UINT,[i.RGBA32I]:L.INT,[i.RGBA32UI]:L.UINT,[i.DEPTH_COMPONENT16]:L.FLOAT,[i.DEPTH_COMPONENT24]:L.FLOAT,[i.DEPTH_COMPONENT32F]:L.FLOAT,[i.DEPTH_STENCIL]:L.FLOAT,[i.DEPTH24_STENCIL8]:L.FLOAT,[i.DEPTH32F_STENCIL8]:L.FLOAT}:t={[i.RGB]:L.FLOAT,[i.RGBA]:L.FLOAT,[i.ALPHA]:L.FLOAT,[i.LUMINANCE]:L.FLOAT,[i.LUMINANCE_ALPHA]:L.FLOAT,[i.DEPTH_STENCIL]:L.FLOAT},t}function nR(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[rt.UNSIGNED_BYTE]:{[U.RGBA]:i.RGBA8,[U.RGB]:i.RGB8,[U.RG]:i.RG8,[U.RED]:i.R8,[U.RGBA_INTEGER]:i.RGBA8UI,[U.RGB_INTEGER]:i.RGB8UI,[U.RG_INTEGER]:i.RG8UI,[U.RED_INTEGER]:i.R8UI,[U.ALPHA]:i.ALPHA,[U.LUMINANCE]:i.LUMINANCE,[U.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[rt.BYTE]:{[U.RGBA]:i.RGBA8_SNORM,[U.RGB]:i.RGB8_SNORM,[U.RG]:i.RG8_SNORM,[U.RED]:i.R8_SNORM,[U.RGBA_INTEGER]:i.RGBA8I,[U.RGB_INTEGER]:i.RGB8I,[U.RG_INTEGER]:i.RG8I,[U.RED_INTEGER]:i.R8I},[rt.UNSIGNED_SHORT]:{[U.RGBA_INTEGER]:i.RGBA16UI,[U.RGB_INTEGER]:i.RGB16UI,[U.RG_INTEGER]:i.RG16UI,[U.RED_INTEGER]:i.R16UI,[U.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[rt.SHORT]:{[U.RGBA_INTEGER]:i.RGBA16I,[U.RGB_INTEGER]:i.RGB16I,[U.RG_INTEGER]:i.RG16I,[U.RED_INTEGER]:i.R16I},[rt.UNSIGNED_INT]:{[U.RGBA_INTEGER]:i.RGBA32UI,[U.RGB_INTEGER]:i.RGB32UI,[U.RG_INTEGER]:i.RG32UI,[U.RED_INTEGER]:i.R32UI,[U.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[rt.INT]:{[U.RGBA_INTEGER]:i.RGBA32I,[U.RGB_INTEGER]:i.RGB32I,[U.RG_INTEGER]:i.RG32I,[U.RED_INTEGER]:i.R32I},[rt.FLOAT]:{[U.RGBA]:i.RGBA32F,[U.RGB]:i.RGB32F,[U.RG]:i.RG32F,[U.RED]:i.R32F,[U.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[rt.HALF_FLOAT]:{[U.RGBA]:i.RGBA16F,[U.RGB]:i.RGB16F,[U.RG]:i.RG16F,[U.RED]:i.R16F},[rt.UNSIGNED_SHORT_5_6_5]:{[U.RGB]:i.RGB565},[rt.UNSIGNED_SHORT_4_4_4_4]:{[U.RGBA]:i.RGBA4},[rt.UNSIGNED_SHORT_5_5_5_1]:{[U.RGBA]:i.RGB5_A1},[rt.UNSIGNED_INT_2_10_10_10_REV]:{[U.RGBA]:i.RGB10_A2,[U.RGBA_INTEGER]:i.RGB10_A2UI},[rt.UNSIGNED_INT_10F_11F_11F_REV]:{[U.RGB]:i.R11F_G11F_B10F},[rt.UNSIGNED_INT_5_9_9_9_REV]:{[U.RGB]:i.RGB9_E5},[rt.UNSIGNED_INT_24_8]:{[U.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[rt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[U.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:t={[rt.UNSIGNED_BYTE]:{[U.RGBA]:i.RGBA,[U.RGB]:i.RGB,[U.ALPHA]:i.ALPHA,[U.LUMINANCE]:i.LUMINANCE,[U.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[rt.UNSIGNED_SHORT_5_6_5]:{[U.RGB]:i.RGB},[rt.UNSIGNED_SHORT_4_4_4_4]:{[U.RGBA]:i.RGBA},[rt.UNSIGNED_SHORT_5_5_5_1]:{[U.RGBA]:i.RGBA}},t}var nn=class{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new ut,this.hasIntegerTextures=!1}contextChange(){let t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=nR(t),this.samplerTypes=oR(t);let e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};let r=new Ts(t.createTexture());t.bindTexture(t.TEXTURE_2D,r.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]=r,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Ts(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,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 s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){let{gl:r}=this;if(t=t?.castToBaseTexture(),t?.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;let s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(r.TEXTURE_2D,this.emptyTextures[r.TEXTURE_2D].texture),this.boundTextures[e]=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){let{gl:e,boundTextures:r}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<r.length;s++)r[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<r.length;s++)r[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),r[s]=null)}ensureSamplerType(t){let{boundTextures:e,hasIntegerTextures:r,CONTEXT_UID:s}=this;if(r)for(let o=t-1;o>=0;--o){let n=e[o];n&&n._glTextures[s].samplerType!==L.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(t){let e=new Ts(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??L.FLOAT,this.webGLVersion===2&&t.type===rt.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){let e=t._glTextures[this.CONTEXT_UID];if(!e)return;let r=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(r,t,e))e.samplerType!==L.FLOAT&&(this.hasIntegerTextures=!0);else{let s=t.realWidth,o=t.realHeight,n=r.gl;(e.width!==s||e.height!==o||e.dirtyId<0)&&(e.width=s,e.height=o,n.texImage2D(t.target,0,e.internalFormat,s,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){let{gl:r}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),r.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){let s=this.managedTextures.indexOf(t);s!==-1&&wg(this.managedTextures,s,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===br.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=ih.CLAMP:e.wrapMode=t.wrapMode,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let r=this.gl;if(e.mipmap&&t.mipmap!==br.ON_MANUAL&&r.generateMipmap(t.target),r.texParameteri(t.target,r.TEXTURE_WRAP_S,e.wrapMode),r.texParameteri(t.target,r.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===nr.LINEAR?r.LINEAR_MIPMAP_LINEAR:r.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===nr.LINEAR){let o=Math.min(t.anisotropicLevel,r.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));r.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===nr.LINEAR?r.LINEAR:r.NEAREST);r.texParameteri(t.target,r.TEXTURE_MAG_FILTER,t.scaleMode===nr.LINEAR?r.LINEAR:r.NEAREST)}destroy(){this.renderer=null}};nn.extension={type:V.RendererSystem,name:"texture"};q.add(nn);var an=class{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glTransformFeedbacks[r]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){let{gl:r,renderer:s}=this;e&&s.shader.bind(e),r.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:r,CONTEXT_UID:s}=this,o=e.createTransformFeedback();t._glTransformFeedbacks[s]=o,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,o);for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];a&&(r.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),o}disposeTransformFeedback(t,e){let r=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);let o=this.renderer.buffer;if(o)for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];if(!a)continue;let h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&o.dispose(a,e))}r&&(e||s.deleteTransformFeedback(r),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};an.extension={type:V.RendererSystem,name:"transformFeedback"};q.add(an);var ui=class{constructor(t){this.renderer=t}init(t){this.screen=new gt(0,0,t.width,t.height),this.element=t.view||Y.ADAPTER.createCanvas(),this.resolution=t.resolution||Y.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);let r=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=r,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${r}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",r,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}};ui.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},ui.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"_view"};q.add(ui);Y.PREFER_ENV=ze.WEBGL2;Y.STRICT_TEXTURE_CACHE=!1;Y.RENDER_OPTIONS={...li.defaultOptions,...hi.defaultOptions,...ui.defaultOptions,...ci.defaultOptions};Object.defineProperties(Y,{WRAP_MODE:{get(){return ut.defaultOptions.wrapMode},set(i){lt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),ut.defaultOptions.wrapMode=i}},SCALE_MODE:{get(){return ut.defaultOptions.scaleMode},set(i){lt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),ut.defaultOptions.scaleMode=i}},MIPMAP_TEXTURES:{get(){return ut.defaultOptions.mipmap},set(i){lt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),ut.defaultOptions.mipmap=i}},ANISOTROPIC_LEVEL:{get(){return ut.defaultOptions.anisotropicLevel},set(i){lt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),ut.defaultOptions.anisotropicLevel=i}},FILTER_RESOLUTION:{get(){return lt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Vr.defaultResolution},set(i){Vr.defaultResolution=i}},FILTER_MULTISAMPLE:{get(){return lt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Vr.defaultMultisample},set(i){Vr.defaultMultisample=i}},SPRITE_MAX_TEXTURES:{get(){return ai.defaultMaxTextures},set(i){lt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),ai.defaultMaxTextures=i}},SPRITE_BATCH_SIZE:{get(){return ai.defaultBatchSize},set(i){lt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),ai.defaultBatchSize=i}},CAN_UPLOAD_SAME_BUFFER:{get(){return ai.canUploadSameBuffer},set(i){lt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),ai.canUploadSameBuffer=i}},GC_MODE:{get(){return Wr.defaultMode},set(i){lt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Wr.defaultMode=i}},GC_MAX_IDLE:{get(){return Wr.defaultMaxIdle},set(i){lt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Wr.defaultMaxIdle=i}},GC_MAX_CHECK_COUNT:{get(){return Wr.defaultCheckCountMax},set(i){lt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Wr.defaultCheckCountMax=i}},PRECISION_VERTEX:{get(){return lr.defaultVertexPrecision},set(i){lt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),lr.defaultVertexPrecision=i}},PRECISION_FRAGMENT:{get(){return lr.defaultFragmentPrecision},set(i){lt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),lr.defaultFragmentPrecision=i}}});var Ss=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(Ss||{});var hn=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=r,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));let e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}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);let e=this.next;return this.next=t?null:e,this.previous=null,e}};var aR=class qe{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 hn(null,null,1/0),this.deltaMS=1/qe.targetFPMS,this.elapsedMS=1/qe.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,r=Ss.NORMAL){return this._addListener(new hn(t,e,r))}addOnce(t,e,r=Ss.NORMAL){return this._addListener(new hn(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*qe.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this.deltaTime);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,qe.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!qe._shared){let t=qe._shared=new qe;t.autoStart=!0,t._protected=!0}return qe._shared}static get system(){if(!qe._system){let t=qe._system=new qe;t.autoStart=!0,t._protected=!0}return qe._system}};aR.targetFPMS=.06;var cr=aR;Object.defineProperties(Y,{TARGET_FPMS:{get(){return cr.targetFPMS},set(i){lt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),cr.targetFPMS=i}}});var Nh=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Ss.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?cr.shared:new cr,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};Nh.extension=V.Application;q.add(Nh);var TU=[];q.handleByList(V.Renderer,TU);var Hh=class{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){let r=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,r)}else{let r=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,r)}e>=Ct.HIGH?this.multisample=Ct.HIGH:e>=Ct.MEDIUM?this.multisample=Ct.MEDIUM:e>=Ct.LOW?this.multisample=Ct.LOW:this.multisample=Ct.NONE}destroy(){}};Hh.extension={type:V.RendererSystem,name:"_multisample"};q.add(Hh);var $u=class{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var Vh=class{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){let{gl:e,CONTEXT_UID:r}=this,s=t._glBuffers[r]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:r,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){let o=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,r.bindBufferBase(r.UNIFORM_BUFFER,e,o.buffer)}}bindBufferRange(t,e,r){let{gl:s,CONTEXT_UID:o}=this;r=r||0;let n=t._glBuffers[o]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,r*256,256)}update(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glBuffers[r]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{let o=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,o)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];let r=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),r&&(e||s.deleteBuffer(r.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let r=0;r<e.length;r++)this.dispose(this.managedBuffers[e[r]],t)}createGLBuffer(t){let{CONTEXT_UID:e,gl:r}=this;return t._glBuffers[e]=new $u(r.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}};Vh.extension={type:V.RendererSystem,name:"buffer"};q.add(Vh);var Wh=class{constructor(t){this.renderer=t}render(t,e){let r=this.renderer,s,o,n,a;if(e&&(s=e.renderTexture,o=e.clear,n=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,r.runners.prerender.emit(),r.emit("prerender"),r.projection.transform=n,!r.context.isLost){if(s||(this.lastObjectRendered=t),!a){let h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}r.renderTexture.bind(s),r.batch.currentRenderer.start(),(o??r.background.clearBeforeRender)&&r.renderTexture.clear(),t.render(r),r.batch.currentRenderer.flush(),s&&(e.blit&&r.framebuffer.blit(),s.baseTexture.update()),r.runners.postrender.emit(),r.projection.transform=null,r.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}};Wh.extension={type:V.RendererSystem,name:"objectRenderer"};q.add(Wh);var Xu=class Qg extends on{constructor(t){super(),this.type=Hm.WEBGL,t=Object.assign({},Y.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Ye({projectionMatrix:new It},!0);let e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Qg.__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(e),"useContextAlpha"in t&&(lt("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=Qg.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t?.forceCanvas?!1:Eg()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),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(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}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 lt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return lt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return lt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return lt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){lt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return lt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){lt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return lt("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};Xu.extension={type:V.Renderer,priority:1},Xu.__plugins={},Xu.__systems={};var ju=Xu;q.handleByMap(V.RendererPlugin,ju.__plugins);q.handleByMap(V.RendererSystem,ju.__systems);q.add(ju);var Fi=class extends je{constructor(t,e){let{width:r,height:s}=e||{};super(r,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<t;o++){let n=new ut;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let r=0;r<this.length;r++)t[r]&&(t[r].castToBaseTexture?this.addBaseTextureAt(t[r].castToBaseTexture(),r):t[r]instanceof je?this.addResourceAt(t[r],r):this.addResourceAt(Vo(t[r],e),r))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].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 e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;let t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{let{realWidth:e,realHeight:r}=this.items[0];return this.resize(e,r),this.update(),Promise.resolve(this)}),this._load}};var zh=class extends Fi{constructor(t,e){let{width:r,height:s}=e||{},o,n;Array.isArray(t)?(o=t,n=t.length):n=t,super(n,{width:r,height:s}),o&&this.initFromArray(o,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=ri.TEXTURE_2D_ARRAY}upload(t,e,r){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=t;r.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,r.internalFormat,this._width,this._height,s,0,e.format,r.type,null);for(let h=0;h<s;h++){let l=n[h];o[h]<l.dirtyId&&(o[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,r.type,l.resource.source))}return!0}};var $h=class extends ne{constructor(t){super(t)}static test(t){let{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}};var hR=class Xh extends Fi{constructor(t,e){let{width:r,height:s,autoLoad:o,linkBaseTexture:n}=e||{};if(t&&t.length!==Xh.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:r,height:s});for(let a=0;a<Xh.SIDES;a++)this.items[a].target=ri.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=n!==!1,t&&this.initFromArray(t,e),o!==!1&&this.load()}bind(t){super.bind(t),t.target=ri.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,r){if(r===void 0&&(r=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=ri.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,r){let s=this.itemDirtyIds;for(let o=0;o<Xh.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||r.dirtyId<e.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(t,n,r),s[o]=n.dirtyId):s[o]<-1&&(t.gl.texImage2D(n.target,0,r.internalFormat,e.realWidth,e.realHeight,0,e.format,r.type,null),s[o]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Xh.SIDES}};hR.SIDES=6;var Jg=hR;var jh=class i extends ne{constructor(t,e){e=e||{};let r,s,o;typeof t=="string"?(r=i.EMPTY,s=t,o=!0):(r=t,s=null,o=!1),super(r),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??o,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{let r=await Y.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await r.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===$e.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),t(this)}catch(r){if(this.destroyed)return;e(r),this.onError.emit(r)}}),this._load)}upload(t,e,r){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,r)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return i._EMPTY=i._EMPTY??Y.ADAPTER.createCanvas(0,0),i._EMPTY}};var tx=class Yu extends ne{constructor(t,e){e=e||{},super(Y.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},Yu.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(){let t=new Image;ne.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;let e=t.width,r=t.height;if(!e||!r)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,o=r*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/r*e,o=this._overrideHeight||this._overrideWidth/e*r),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${si()}`,n.getContext("2d").drawImage(t,0,0,e,r,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(t){let e=Yu.SVG_SIZE.exec(t),r={};return e&&(r[e[1]]=Math.round(parseFloat(e[3])),r[e[5]]=Math.round(parseFloat(e[7]))),r}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&Yu.SVG_XML.test(t)}};tx.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,tx.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var ex=tx;var qu=class extends ne{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}};var rx=class ix extends ne{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){let r=document.createElement("video");e.autoLoad!==!1&&r.setAttribute("preload","auto"),e.playsinline!==!1&&(r.setAttribute("webkit-playsinline",""),r.setAttribute("playsinline","")),e.muted===!0&&(r.setAttribute("muted",""),r.muted=!0),e.loop===!0&&r.setAttribute("loop",""),e.autoPlay!==!1&&r.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);let s=t[0].src||t[0];ne.crossOrigin(r,s,e.crossorigin);for(let o=0;o<t.length;++o){let n=document.createElement("source"),{src:a,mime:h}=t[o];if(a=a||t[o],a.startsWith("data:"))h=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){let l=a.split("?").shift().toLowerCase(),c=l.slice(l.lastIndexOf(".")+1);h=h||ix.MIME_TYPES[c]||`video/${c}`}n.src=a,h&&(n.type=h),r.appendChild(n)}t=r}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){let e=cr.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;let t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,r)=>{this.valid?e(this):(this._resolve=e,this._reject=r,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){let t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);let e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();let t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(cr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(cr.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(cr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||ix.TYPES.includes(e)}};rx.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],rx.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var sx=rx;_h.push(jh,_s,$h,sx,qu,ex,cs,Jg,zh);var SU={vec3(i,t,e,r){(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2])&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],i.uniform3f(t,r[0],r[1],r[2]))},int(i,t,e,r){i.uniform1i(t,r)},ivec2(i,t,e,r){i.uniform2i(t,r[0],r[1])},ivec3(i,t,e,r){i.uniform3i(t,r[0],r[1],r[2])},ivec4(i,t,e,r){i.uniform4i(t,r[0],r[1],r[2],r[3])},uint(i,t,e,r){i.uniform1ui(t,r)},uvec2(i,t,e,r){i.uniform2ui(t,r[0],r[1])},uvec3(i,t,e,r){i.uniform3ui(t,r[0],r[1],r[2])},uvec4(i,t,e,r){i.uniform4ui(t,r[0],r[1],r[2],r[3])},bvec2(i,t,e,r){i.uniform2i(t,r[0],r[1])},bvec3(i,t,e,r){i.uniform3i(t,r[0],r[1],r[2])},bvec4(i,t,e,r){i.uniform4i(t,r[0],r[1],r[2],r[3])},mat2(i,t,e,r){i.uniformMatrix2fv(t,!1,r)},mat4(i,t,e,r){i.uniformMatrix4fv(t,!1,r)}},EU={float(i,t,e,r){i.uniform1fv(t,r)},vec2(i,t,e,r){i.uniform2fv(t,r)},vec3(i,t,e,r){i.uniform3fv(t,r)},vec4(i,t,e,r){i.uniform4fv(t,r)},int(i,t,e,r){i.uniform1iv(t,r)},ivec2(i,t,e,r){i.uniform2iv(t,r)},ivec3(i,t,e,r){i.uniform3iv(t,r)},ivec4(i,t,e,r){i.uniform4iv(t,r)},uint(i,t,e,r){i.uniform1uiv(t,r)},uvec2(i,t,e,r){i.uniform2uiv(t,r)},uvec3(i,t,e,r){i.uniform3uiv(t,r)},uvec4(i,t,e,r){i.uniform4uiv(t,r)},bool(i,t,e,r){i.uniform1iv(t,r)},bvec2(i,t,e,r){i.uniform2iv(t,r)},bvec3(i,t,e,r){i.uniform3iv(t,r)},bvec4(i,t,e,r){i.uniform4iv(t,r)},sampler2D(i,t,e,r){i.uniform1iv(t,r)},samplerCube(i,t,e,r){i.uniform1iv(t,r)},sampler2DArray(i,t,e,r){i.uniform1iv(t,r)}};function lR(i,t,e,r,s){let o=0,n=null,a=null,h=s.gl;for(let l in i.uniforms){let c=t[l],u=r[l],d=e[l],f=i.uniforms[l];if(!c){f.group===!0&&s.shader.syncUniformGroup(u);continue}c.type==="float"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,h.uniform1f(d.location,u)):c.type==="bool"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,h.uniform1i(d.location,Number(u))):(c.type==="sampler2D"||c.type==="samplerCube"||c.type==="sampler2DArray")&&c.size===1&&!c.isArray?(s.texture.bind(u,o),d.value!==o&&(d.value=o,h.uniform1i(d.location,o)),o++):c.type==="mat3"&&c.size===1&&!c.isArray?f.a!==void 0?h.uniformMatrix3fv(d.location,!1,u.toArray(!0)):h.uniformMatrix3fv(d.location,!1,u):c.type==="vec2"&&c.size===1&&!c.isArray?f.x!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y)&&(a[0]=n.x,a[1]=n.y,h.uniform2f(d.location,n.x,n.y))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1])&&(a[0]=n[0],a[1]=n[1],h.uniform2f(d.location,n[0],n[1]))):c.type==="vec4"&&c.size===1&&!c.isArray?f.width!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y||a[2]!==n.width||a[3]!==n.height)&&(a[0]=n.x,a[1]=n.y,a[2]=n.width,a[3]=n.height,h.uniform4f(d.location,n.x,n.y,n.width,n.height))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])&&(a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],h.uniform4f(d.location,n[0],n[1],n[2],n[3]))):(c.size===1&&!c.isArray?SU:EU)[c.type].call(null,h,d.location,d.value,u)}}function AU(){Object.assign(Ii.prototype,{systemCheck(){},syncUniforms(i,t){let{shader:e,renderer:r}=this;lR(i,e.program.uniformData,t.uniformData,i.uniforms,r)}})}AU();var Yh=new(window.AudioContext||window.webkitAudioContext),wU=(i,t)=>{let e,r=Yh.createGain();r.gain.value=t.volume??1,r.connect(Yh.destination);let s={id:i,url:t.url,loop:t.loop||!1,volume:t.volume??1};return{play:()=>{let m=Co.getAsset(s.url);if(!m){console.warn("AudioPlayer.play: Asset not found",s.url);return}e=Yh.createBufferSource(),e.buffer=m,e.loop=s.loop,r.gain.setValueAtTime(s.volume,Yh.currentTime),e.connect(r),e.start(0)},stop:()=>{e&&(e.stop(),e.disconnect(),r.disconnect(),r.connect(Yh.destination))},update:m=>{s={...s,...m}},getId:()=>s.id,getUrl:()=>s.url,getLoop:()=>s.loop,getVolume:()=>s.volume,setUrl:m=>{s.url=m},setLoop:m=>{s.loop=m},setVolume:m=>{s.volume=m,r.gain.value=m},id:s.id,url:s.url,loop:s.loop,volume:s.volume,gainNode:r}},cR=()=>{let i=[],t=[];return{add:a=>{t.push(a)},remove:a=>{t=t.filter(h=>h.id!==a)},getById:a=>t.find(h=>h.id===a),tick:()=>{for(let h of t){let l=i.find(c=>c.id===h.id);if(!l){let c=wU(h.id,{url:h.url,loop:h.loop,volume:h.volume??1});i.push(c),c.play();return}(l.url!==h.url||l.loop!==h.loop)&&(l.stop(),l.setUrl(h.url),l.setLoop(h.loop??!1),l.play()),l.getVolume()!==(h.volume??1)&&l.setVolume(h.volume??1)}let a=[];for(let h of i)t.find(l=>l.id===h.id)||(h.stop(),a.push(h.id));i=i.filter(h=>!a.includes(h.id))},destroy:()=>{for(let a of i)a.stop();i=[],t=[]}}};var CU=i=>i.split("/").pop(),PU=i=>({name:"advancedBufferLoader",priority:2,bufferMap:i,load:async t=>{let e=t.startsWith("file:")?t:CU(t),r=i[e];if(!r)throw new Error(`Buffer not found for key: ${e}`);return{data:r.buffer,type:r.type,metadata:null}},test:async t=>!0,testParse:async t=>!0,parse:async t=>{if(t instanceof E)return t;let e=new Blob([t.data],{type:t.type}),r=await createImageBitmap(e);return new E.from(r)},unload:async t=>t.destroy(!0)}),RU=()=>{let i,t=cR(),e={elements:[],animations:[],audio:[]},r,s={animations:[],elements:[],audios:[]},o,n,a=u=>u?u.startsWith("audio/")?"audio":u.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(u)?"font":"texture":"texture",h=(u,d,f)=>{u.renderer.events.cursorStyles||(u.renderer.events.cursorStyles={}),u.renderer.events.cursorStyles.default||(u.renderer.events.cursorStyles.default="default"),u.renderer.events.cursorStyles.hover||(u.renderer.events.cursorStyles.hover="pointer");let p=d?.cursorStyles,m=f?.cursorStyles;JSON.stringify(p)!==JSON.stringify(m)&&(m?(m.default&&(u.renderer.events.cursorStyles.default=m.default,u.canvas.style.cursor=m.default),m.hover&&(u.renderer.events.cursorStyles.hover=m.hover)):p&&(u.renderer.events.cursorStyles.default="default",u.renderer.events.cursorStyles.hover="pointer"))},l=async(u,d,f,p,m)=>{h(u,f.global,p.global),o&&o.abort(),o=new AbortController;let x=o.signal;await rh({app:u,parent:d,prevASTTree:f.elements,nextASTTree:p.elements,animations:p.animations,elementPlugins:s.elements,animationPlugins:s.animations,eventHandler:m,signal:x}),await Nm({app:u,prevAudioTree:f.audio,nextAudioTree:p.audio,audioPlugins:s.audios,signal:x})},c={rendererName:"pixi",get canvas(){return i.canvas},get ticker(){return i.ticker},findElementByLabel:u=>{if(i.stage.children&&i.stage.children.length>0)for(let d of i.stage.children){let f=findElementByLabel(d,u);if(f)return f}return null},extractBase64:async u=>{await i.renderer.extract.base64(u)},assignStageEvent:(u,d)=>{i.stage.eventMode="static",i.stage.on(u,d)},init:async u=>{let{eventHandler:d,plugins:f,width:p,height:m,backgroundColor:x}=u;s=f,r=d,i=new Ja,i.audioStage=t,await i.init({width:p,height:m,backgroundColor:x,preference:"webgl"});let v=new _r;return v.rect(0,0,p,m),v.fill(x||0),i.stage.addChild(v),i.stage.width=p,i.stage.height=m,i.ticker.add(i.audioStage.tick),c},destroy:()=>{i.audioStage.destroy(),i.destroy()},loadAssets:async u=>{if(!u)throw new Error("assetBufferMap is required");let d={audio:{},font:{},texture:{}};for(let[p,m]of Object.entries(u)){let x=a(m.type);d[x][p]=m}await Promise.all(Object.entries(d.audio).map(([p,m])=>Co.load(p,m.buffer))),await Promise.all(Object.entries(d.font).map(async([p,m])=>{let x=new Blob([m.buffer],{type:m.type}),v=URL.createObjectURL(x),y=new FontFace(p,`url(${v})`);try{await y.load(),document.fonts.add(y)}catch(b){console.error(`Failed to load font ${p}:`,b)}finally{URL.revokeObjectURL(v)}})),n?Object.assign(n.bufferMap,d.texture):(n=PU(d.texture),or.loader.parsers.length=0,or.reset(),G.add({name:"advanced-buffer-loader",extension:_.Asset,priority:ce.High,loader:n}),typeof or.registerPlugin=="function"&&or.registerPlugin(n));let f=Object.keys(d.texture);return Promise.all(f.map(p=>or.load(p)))},loadAudioAssets:async u=>Promise.all(u.map(async d=>{let p=await(await fetch(d)).arrayBuffer();return Co.load(d,p)})),updatedBackgroundColor:u=>{i.renderer.background.color=u},getStageElementBounds:()=>{let u={},d=f=>{if(!(!f||f.length===0))for(let p of f)u[p.label]={x:p.groupTransform.tx,y:p.groupTransform.ty,width:p.width,height:p.height},d(p.children)};return d(i.stage.children),u},render:u=>{let d=Es(u.elements),f={...u,elements:d};l(i,i.stage,e,f,r),e=f}};return c},uR=RU;var hbt=uR;export{Ja as Application,or as Assets,Co as AudioAsset,jI as containerPlugin,Lm as createAnimationPlugin,bR as createAssetBufferManager,Dm as createAudioPlugin,We as createElementPlugin,hbt as default,Es as parse,Es as parseJSONToAST,VI as rectPlugin,Nm as renderAudio,rh as renderElements,zI as sliderPlugin,iF as soundPlugin,WI as spritePlugin,HI as textPlugin,YI as textRevealingPlugin,rF as tweenPlugin};
1629
1629
  /*! Bundled license information:
1630
1630
 
1631
1631
  punycode/punycode.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "route-graphics",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "A 2D graphics rendering interface that takes JSON input and renders pixels using PixiJS",
5
5
  "main": "dist/RouteGraphics.js",
6
6
  "type": "module",