vizor_2d 1.0.2 → 1.0.4

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.
@@ -1 +1 @@
1
- (self.webpackChunkvizor_2d=self.webpackChunkvizor_2d||[]).push([[468],{6554:(e,t,r)=>{r.d(t,{d:()=>d});var n=r(9113),s=r(3012),i=r(8475),a=r(7547);const o=class e extends i.M{constructor(t){super(t={...e.defaultOptions,...t}),this.enabled=!0,this._state=a.U.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,"boolean"==typeof t.antialias?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1),t.blendRequired&&this.addResource("uBackTexture",0,3)}apply(e,t,r,n){e.applyFilter(this,t,r,n)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(t){const{gpu:r,gl:i,...a}=t;let o,d;return r&&(o=s.B.from(r)),i&&(d=n.M.from(i)),new e({gpuProgram:o,glProgram:d,...a})}};o.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};let d=o},780:(e,t,r)=>{r.d(t,{s:()=>o});var n=r(8507),s=r(7547),i=r(2043);const a=class e{constructor(e,t){this.state=s.U.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=e,this._adaptor=t,this._adaptor.init?.(this)}static getBatcher(e){return new this._availableBatchers[e]}buildStart(e){let t=this._batchersByInstructionSet[e.uid];t||(t=this._batchersByInstructionSet[e.uid]=Object.create(null),t.default||(t.default=new i.J({maxTextures:this.renderer.limits.maxBatchableTextures}))),this._activeBatches=t,this._activeBatch=this._activeBatches.default;for(const e in this._activeBatches)this._activeBatches[e].begin()}addToBatch(t,r){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(r);let n=this._activeBatches[t.batcherName];n||(n=this._activeBatches[t.batcherName]=e.getBatcher(t.batcherName),n.begin()),this._activeBatch=n}this._activeBatch.add(t)}break(e){this._activeBatch.break(e)}buildEnd(e){this._activeBatch.break(e);const t=this._activeBatches;for(const e in t){const r=t[e],n=r.geometry;n.indexBuffer.setDataWithSize(r.indexBuffer,r.indexSize,!0),n.buffers[0].setDataWithSize(r.attributeBuffer.float32View,r.attributeSize,!1)}}upload(e){const t=this._batchersByInstructionSet[e.uid];for(const e in t){const r=t[e],n=r.geometry;r.dirty&&(r.dirty=!1,n.buffers[0].update(4*r.attributeSize))}}execute(e){if("startBatch"===e.action){const t=e.batcher,r=t.geometry,n=t.shader;this._adaptor.start(this,r,n)}this._adaptor.execute(this,e)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(const e in this._activeBatches)this._activeBatches[e].destroy();this._activeBatches=null}};a.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"batch"},a._availableBatchers=Object.create(null);let o=a;n.XO.handleByMap(n.Ag.Batcher,o._availableBatchers),n.XO.add(i.J)},9824:(e,t,r)=>{r.d(t,{z:()=>k});var n=r(8507),s=r(9049),i=r(9313),a=r(9113),o=r(3012),d=r(5811),l=r(1196),u=r(6554),c="struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n};\n\nstruct MaskUniforms {\n uFilterMatrix:mat3x3<f32>,\n uMaskClamp:vec4<f32>,\n uAlpha:f32,\n uInverse:f32,\n};\n\n@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n@group(0) @binding(1) var uTexture: texture_2d<f32>;\n@group(0) @binding(2) var uSampler : sampler;\n\n@group(1) @binding(0) var<uniform> filterUniforms : MaskUniforms;\n@group(1) @binding(1) var uMaskTexture: texture_2d<f32>;\n\nstruct VSOutput {\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>,\n @location(1) filterUv : vec2<f32>,\n};\n\nfn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n{\n var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\n position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nfn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n}\n\nfn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);\n}\n\nfn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>\n{\n return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;\n}\n\nfn getSize() -> vec2<f32>\n{\n return gfu.uGlobalFrame.zw;\n}\n\n@vertex\nfn mainVertex(\n @location(0) aPosition : vec2<f32>,\n) -> VSOutput {\n return VSOutput(\n filterVertexPosition(aPosition),\n filterTextureCoord(aPosition),\n getFilterCoord(aPosition)\n );\n}\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2<f32>,\n @location(1) filterUv: vec2<f32>,\n @builtin(position) position: vec4<f32>\n) -> @location(0) vec4<f32> {\n\n var maskClamp = filterUniforms.uMaskClamp;\n var uAlpha = filterUniforms.uAlpha;\n\n var clip = step(3.5,\n step(maskClamp.x, filterUv.x) +\n step(maskClamp.y, filterUv.y) +\n step(filterUv.x, maskClamp.z) +\n step(filterUv.y, maskClamp.w));\n\n var mask = textureSample(uMaskTexture, uSampler, filterUv);\n var source = textureSample(uTexture, uSampler, uv);\n var alphaMul = 1.0 - uAlpha * (1.0 - mask.a);\n\n var a: f32 = alphaMul * mask.r * uAlpha * clip;\n\n if (filterUniforms.uInverse == 1.0) {\n a = 1.0 - a;\n }\n\n return source * a;\n}\n";class h extends u.d{constructor(e){const{sprite:t,...r}=e,n=new l.N(t.texture),s=new d.k({uFilterMatrix:{value:new i.u,type:"mat3x3<f32>"},uMaskClamp:{value:n.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:e.inverse?1:0,type:"f32"}});super({...r,gpuProgram:o.B.from({vertex:{source:c,entryPoint:"mainVertex"},fragment:{source:c,entryPoint:"mainFragment"}}),glProgram:a.M.from({vertex:"in vec2 aPosition;\n\nout vec2 vTextureCoord;\nout vec2 vMaskCoord;\n\n\nuniform vec4 uInputSize;\nuniform vec4 uOutputFrame;\nuniform vec4 uOutputTexture;\nuniform mat3 uFilterMatrix;\n\nvec4 filterVertexPosition( vec2 aPosition )\n{\n vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n \n position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( vec2 aPosition )\n{\n return aPosition * (uOutputFrame.zw * uInputSize.zw);\n}\n\nvec2 getFilterCoord( vec2 aPosition )\n{\n return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;\n} \n\nvoid main(void)\n{\n gl_Position = filterVertexPosition(aPosition);\n vTextureCoord = filterTextureCoord(aPosition);\n vMaskCoord = getFilterCoord(aPosition);\n}\n",fragment:"in vec2 vMaskCoord;\nin vec2 vTextureCoord;\n\nuniform sampler2D uTexture;\nuniform sampler2D uMaskTexture;\n\nuniform float uAlpha;\nuniform vec4 uMaskClamp;\nuniform float uInverse;\n\nout vec4 finalColor;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(uMaskClamp.x, vMaskCoord.x) +\n step(uMaskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, uMaskClamp.z) +\n step(vMaskCoord.y, uMaskClamp.w));\n\n // TODO look into why this is needed\n float npmAlpha = uAlpha;\n vec4 original = texture(uTexture, vTextureCoord);\n vec4 masky = texture(uMaskTexture, vMaskCoord);\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n float a = alphaMul * masky.r * npmAlpha * clip;\n\n if (uInverse == 1.0) {\n a = 1.0 - a;\n }\n\n finalColor = original * a;\n}\n",name:"mask-filter"}),clipToViewport:!1,resources:{filterUniforms:s,uMaskTexture:t.texture.source}}),this.sprite=t,this._textureMatrix=n}set inverse(e){this.resources.filterUniforms.uniforms.uInverse=e?1:0}get inverse(){return 1===this.resources.filterUniforms.uniforms.uInverse}apply(e,t,r,n){this._textureMatrix.texture=this.sprite.texture,e.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,e.applyFilter(this,t,r,n)}}var p=r(9636),g=r(9443),f=r(0),m=r(8655),_=r(5589),x=r(2437),b=r(5099);const v=new p.c;class T extends s.a{constructor(){super(),this.filters=[new h({sprite:new f.k(_.g.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(e){this.filters[0].sprite=e}get inverse(){return this.filters[0].inverse}set inverse(e){this.filters[0].inverse=e}}class k{constructor(e){this._activeMaskStage=[],this._renderer=e}push(e,t,r){const n=this._renderer;if(n.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1,maskedContainer:t}),e.inverse=t._maskOptions.inverse,e.renderMaskToTexture){const t=e.mask;t.includeInBuild=!0,t.collectRenderables(r,n,null),t.includeInBuild=!1}n.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:e,maskedContainer:t,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){const t=this._renderer,r=e.mask.renderMaskToTexture;if("pushMaskBegin"===e.action){const n=m.Z.get(T);if(n.inverse=e.inverse,r){e.mask.mask.measurable=!0;const r=(0,g.f)(e.mask.mask,!0,v);e.mask.mask.measurable=!1,r.ceil();const s=t.renderTarget.renderTarget.colorTexture.source,i=x.W.getOptimalTexture(r.width,r.height,s._resolution,s.antialias);t.renderTarget.push(i,!0),t.globalUniforms.push({offset:r,worldColor:4294967295});const a=n.sprite;a.texture=i,a.worldTransform.tx=r.minX,a.worldTransform.ty=r.minY,this._activeMaskStage.push({filterEffect:n,maskedContainer:e.maskedContainer,filterTexture:i})}else n.sprite=e.mask.mask,this._activeMaskStage.push({filterEffect:n,maskedContainer:e.maskedContainer})}else if("pushMaskEnd"===e.action){const e=this._activeMaskStage[this._activeMaskStage.length-1];r&&(t.type===b.W.WEBGL&&t.renderTarget.finishRenderPass(),t.renderTarget.pop(),t.globalUniforms.pop()),t.filter.push({renderPipeId:"filter",action:"pushFilter",container:e.maskedContainer,filterEffect:e.filterEffect,canBundle:!1})}else if("popMaskEnd"===e.action){t.filter.pop();const e=this._activeMaskStage.pop();r&&x.W.returnTexture(e.filterTexture),m.Z.return(e.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}}k.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"alphaMask"}},360:(e,t,r)=>{r.d(t,{j:()=>d});var n=r(8507),s=r(9049),i=r(3284),a=r(268);const o={};n.XO.handle(n.Ag.BlendMode,(e=>{if(!e.name)throw new Error("BlendMode extension must have a name property");o[e.name]=e.ref}),(e=>{delete o[e.name]}));class d{constructor(e){this._blendModeStack=[],this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=e,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}pushBlendMode(e,t,r){this._blendModeStack.push(t),this.setBlendMode(e,t,r)}popBlendMode(e){this._blendModeStack.pop();const t=this._blendModeStack[this._activeBlendMode.length-1]??"normal";this.setBlendMode(null,t,e)}setBlendMode(e,t,r){const n=e instanceof i.m;this._activeBlendMode!==t?(this._isAdvanced&&this._endAdvancedBlendMode(r),this._activeBlendMode=t,e&&(this._isAdvanced=!!o[t],this._isAdvanced&&this._beginAdvancedBlendMode(e,r))):this._isAdvanced&&e&&!n&&this._renderableList?.push(e)}_beginAdvancedBlendMode(e,t){this._renderer.renderPipes.batch.break(t);const r=this._activeBlendMode;if(!o[r])return void(0,a.R)(`Unable to assign BlendMode: '${r}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);const n=this._ensureFilterEffect(r),s=e instanceof i.m,d={renderPipeId:"filter",action:"pushFilter",filterEffect:n,renderables:s?null:[e],container:s?e.root:null,canBundle:!1};this._renderableList=d.renderables,t.add(d)}_ensureFilterEffect(e){let t=this._filterHash[e];return t||(t=this._filterHash[e]=new s.a,t.filters=[new o[e]]),t}_endAdvancedBlendMode(e){this._isAdvanced=!1,this._renderableList=null,this._renderer.renderPipes.batch.break(e),e.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(e){this._isAdvanced&&this._endAdvancedBlendMode(e)}destroy(){this._renderer=null,this._renderableList=null;for(const e in this._filterHash)this._filterHash[e].destroy();this._filterHash=null}}d.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"blendMode"}},279:(e,t,r)=>{r.d(t,{O:()=>o});var n=r(133),s=r(583),i=r(5589);const a=class e{constructor(t={}){if(this.uid=(0,n.L)("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...e.defaultOptions,...t},this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,"number"==typeof t.colorTextures){this._managedColorTextures=!0;for(let e=0;e<t.colorTextures;e++)this.colorTextures.push(new s.v({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map((e=>e.source))];const e=this.colorTexture.source;this.resize(e.width,e.height,e._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof i.g||t.depthStencilTexture instanceof s.v?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){const e=this._size;return e[0]=this.pixelWidth,e[1]=this.pixelHeight,e}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(e){this.resize(e.width,e.height,e._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new s.v({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(e,t,r=this.resolution,n=!1){this.dirtyId++,this.colorTextures.forEach(((s,i)=>{n&&0===i||s.source.resize(e,t,r)})),this.depthStencilTexture&&this.depthStencilTexture.source.resize(e,t,r)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach((e=>{e.destroy()})),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};a.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};let o=a},7238:(e,t,r)=>{r.d(t,{l:()=>h});var n=r(9313),s=r(9252),i=r(1257);var a=r(7729),o=r(4884),d=r(583),l=r(5589),u=r(8725);var c=r(279);class h{constructor(e){this.rootViewPort=new s.M,this.viewport=new s.M,this.mipLevel=0,this.layer=0,this.onRenderTargetChange=new a.C("onRenderTargetChange"),this.projectionMatrix=new n.u,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=e,e.gc.addCollection(this,"_gpuRenderTargetHash","hash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:e,clear:t,clearColor:r,frame:n,mipLevel:s,layer:i}){this._renderTargetStack.length=0,this.push(e,t,r,n,s??0,i??0),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=function(e){const t=e.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(e,t=!0,r,n,s=0,i=0){const a=this.getRenderTarget(e),o=this.renderTarget!==a;this.renderTarget=a,this.renderSurface=e;const d=this.getGpuRenderTarget(a);a.pixelWidth===d.width&&a.pixelHeight===d.height||(this.adaptor.resizeGpuRenderTarget(a),d.width=a.pixelWidth,d.height=a.pixelHeight);const u=a.colorTexture,c=this.viewport,h=u.arrayLayerCount||1;if((0|i)!==i&&(i|=0),i<0||i>=h)throw new Error(`[RenderTargetSystem] layer ${i} is out of bounds (arrayLayerCount=${h}).`);this.mipLevel=0|s,this.layer=0|i;const p=Math.max(u.pixelWidth>>s,1),g=Math.max(u.pixelHeight>>s,1);if(!n&&e instanceof l.g&&(n=e.frame),n){const e=u._resolution,t=1<<Math.max(0|s,0),r=n.x*e+.5|0,i=n.y*e+.5|0,a=n.width*e+.5|0,o=n.height*e+.5|0;let d=Math.floor(r/t),l=Math.floor(i/t),h=Math.ceil(a/t),f=Math.ceil(o/t);d=Math.min(Math.max(d,0),p-1),l=Math.min(Math.max(l,0),g-1),h=Math.min(Math.max(h,1),p-d),f=Math.min(Math.max(f,1),g-l),c.x=d,c.y=l,c.width=h,c.height=f}else c.x=0,c.y=0,c.width=p,c.height=g;return function(e,t,r,n,s,i){const a=i?1:-1;e.identity(),e.a=1/n*2,e.d=a*(1/s*2),e.tx=-1-t*e.a,e.ty=-a-r*e.d}(this.projectionMatrix,0,0,c.width/u.resolution,c.height/u.resolution,!a.isRoot),this.adaptor.startRenderPass(a,t,r,c,s,i),o&&this.onRenderTargetChange.emit(a),a}clear(e,t=i.u.ALL,r,n=this.mipLevel,s=this.layer){t&&(e&&(e=this.getRenderTarget(e)),this.adaptor.clear(e||this.renderTarget,t,r,this.viewport,n,s))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(e,t=i.u.ALL,r,n,s=0,a=0){const o=this.bind(e,t,r,n,s,a);return this._renderTargetStack.push({renderTarget:o,frame:n,mipLevel:s,layer:a}),o}pop(){this._renderTargetStack.pop();const e=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(e.renderTarget,!1,null,e.frame,e.mipLevel,e.layer)}getRenderTarget(e){return e.isTexture&&(e=e.source),this._renderSurfaceToRenderTargetHash.get(e)??this._initRenderTarget(e)}copyToTexture(e,t,r,n,s){r.x<0&&(n.width+=r.x,s.x-=r.x,r.x=0),r.y<0&&(n.height+=r.y,s.y-=r.y,r.y=0);const{pixelWidth:i,pixelHeight:a}=e;return n.width=Math.min(n.width,i-r.x),n.height=Math.min(n.height,a-r.y),this.adaptor.copyToTexture(e,t,r,n,s)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport,0,this.layer))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach(((e,t)=>{e!==t&&e.destroy()})),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(e){let t=null;return o.q.test(e)&&(e=(0,u.c)(e).source),e instanceof c.O?t=e:e instanceof d.v&&(t=new c.O({colorTextures:[e]}),e.source instanceof o.q&&(t.isRoot=!0),e.once("destroy",(()=>{t.destroy(),this._renderSurfaceToRenderTargetHash.delete(e);const r=this._gpuRenderTargetHash[t.uid];r&&(this._gpuRenderTargetHash[t.uid]=null,this.adaptor.destroyGpuRenderTarget(r))}))),this._renderSurfaceToRenderTargetHash.set(e,t),t}getGpuRenderTarget(e){return this._gpuRenderTargetHash[e.uid]||(this._gpuRenderTargetHash[e.uid]=this.adaptor.initGpuRenderTarget(e))}resetState(){this.renderTarget=null,this.renderSurface=null}}},381:(e,t,r)=>{r.d(t,{f:()=>xe,i:()=>_e});var n=r(594),s=r(1160),i=r(8507),a=r(9313),o=r(2437),d=r(218),l=r(9636);function u(e,t){t||(t=0);for(let r=t;r<e.length&&e[r];r++)e[r]=null}var c=r(433),h=r(5559),p=r(753);const g=new h.mc,f=h.fR|h.ig|h.u;function m(e,t=!1){!function(e){const t=e.root;let r;if(e.renderGroupParent){const n=e.renderGroupParent;e.worldTransform.appendFrom(t.relativeGroupTransform,n.worldTransform),e.worldColor=(0,p.j)(t.groupColor,n.worldColor),r=t.groupAlpha*n.worldAlpha}else e.worldTransform.copyFrom(t.localTransform),e.worldColor=t.localColor,r=t.localAlpha;r=r<0?0:r>1?1:r,e.worldAlpha=r,e.worldColorAlpha=e.worldColor+(255*r<<24)}(e);const r=e.childrenToUpdate,n=e.updateTick++;for(const t in r){const s=Number(t),i=r[t],a=i.list,o=i.index;for(let t=0;t<o;t++){const r=a[t];r.parentRenderGroup===e&&r.relativeRenderGroupDepth===s&&_(r,n,0)}u(a,o),i.index=0}if(t)for(let r=0;r<e.renderGroupChildren.length;r++)m(e.renderGroupChildren[r],t)}function _(e,t,r){if(t===e.updateTick)return;e.updateTick=t,e.didChange=!1;const n=e.localTransform;e.updateLocalTransform();const s=e.parent;if(s&&!s.renderGroup?(r|=e._updateFlags,e.relativeGroupTransform.appendFrom(n,s.relativeGroupTransform),r&f&&x(e,s,r)):(r=e._updateFlags,e.relativeGroupTransform.copyFrom(n),r&f&&x(e,g,r)),!e.renderGroup){const n=e.children,s=n.length;for(let e=0;e<s;e++)_(n[e],t,r);const i=e.parentRenderGroup,a=e;a.renderPipeId&&!i.structureDidChange&&i.updateRenderable(a)}}function x(e,t,r){if(r&h.ig){e.groupColor=(0,p.j)(e.localColor,t.groupColor);let r=e.localAlpha*t.groupAlpha;r=r<0?0:r>1?1:r,e.groupAlpha=r,e.groupColorAlpha=e.groupColor+(255*r<<24)}r&h.u&&(e.groupBlendMode="inherit"===e.localBlendMode?t.groupBlendMode:e.localBlendMode),r&h.fR&&(e.globalDisplayStatus=e.localDisplayStatus&t.globalDisplayStatus),e._updateFlags=0}const b=new a.u;class v{constructor(e){this._renderer=e}render({container:e,transform:t}){const r=e.parent,n=e.renderGroup.renderGroupParent;e.parent=null,e.renderGroup.renderGroupParent=null;const s=this._renderer,i=b;t&&(i.copyFrom(e.renderGroup.localTransform),e.renderGroup.localTransform.copyFrom(t));const a=s.renderPipes;this._updateCachedRenderGroups(e.renderGroup,null),this._updateRenderGroups(e.renderGroup),s.globalUniforms.start({worldTransformMatrix:t?e.renderGroup.localTransform:e.renderGroup.worldTransform,worldColor:e.renderGroup.worldColorAlpha}),(0,c.j)(e.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),t&&e.renderGroup.localTransform.copyFrom(i),e.parent=r,e.renderGroup.renderGroupParent=n}destroy(){this._renderer=null}_updateCachedRenderGroups(e,t){if(e._parentCacheAsTextureRenderGroup=t,e.isCachedAsTexture){if(!e.textureNeedsUpdate)return;t=e}for(let r=e.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(e.renderGroupChildren[r],t);if(e.invalidateMatrices(),e.isCachedAsTexture){if(e.textureNeedsUpdate){const t=e.root.getLocalBounds(),r=this._renderer,n=e.textureOptions.resolution||r.view.resolution,s=e.textureOptions.antialias??r.view.antialias,i=e.textureOptions.scaleMode??"linear",a=e.texture;t.ceil(),e.texture&&o.W.returnTexture(e.texture,!0);const u=o.W.getOptimalTexture(t.width,t.height,n,s);u._source.style=new d.n({scaleMode:i}),e.texture=u,e._textureBounds||(e._textureBounds=new l.c),e._textureBounds.copyFrom(t),a!==e.texture&&e.renderGroupParent&&(e.renderGroupParent.structureDidChange=!0)}}else e.texture&&(o.W.returnTexture(e.texture,!0),e.texture=null)}_updateRenderGroups(e){const t=this._renderer,r=t.renderPipes;if(e.runOnRender(t),e.instructionSet.renderPipes=r,e.structureDidChange?u(e.childrenRenderablesToUpdate.list,0):function(e,t){const{list:r}=e.childrenRenderablesToUpdate;let n=!1;for(let s=0;s<e.childrenRenderablesToUpdate.index;s++){const e=r[s];if(n=t[e.renderPipeId].validateRenderable(e),n)break}e.structureDidChange=n}(e,r),m(e),e.structureDidChange?(e.structureDidChange=!1,this._buildInstructions(e,t)):this._updateRenderables(e),e.childrenRenderablesToUpdate.index=0,t.renderPipes.batch.upload(e.instructionSet),!e.isCachedAsTexture||e.textureNeedsUpdate)for(let t=0;t<e.renderGroupChildren.length;t++)this._updateRenderGroups(e.renderGroupChildren[t])}_updateRenderables(e){const{list:t,index:r}=e.childrenRenderablesToUpdate;for(let n=0;n<r;n++){const r=t[n];r.didViewUpdate&&e.updateRenderable(r)}u(t,r)}_buildInstructions(e,t){const r=e.root,n=e.instructionSet;n.reset();const s=t.renderPipes?t:t.batch.renderer,i=s.renderPipes;i.batch.buildStart(n),i.blendMode.buildStart(),i.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),r.collectRenderablesWithEffects(n,s,null),i.batch.buildEnd(n),i.blendMode.buildEnd(n)}}v.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"renderGroup"};var T=r(3136),k=r(7073),y=r(780),C=r(9824);class M{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,r){this._renderer.renderPipes.batch.break(r);const n=this._colorStack;n[this._colorStackIndex]=n[this._colorStackIndex-1]&e.mask;const s=this._colorStack[this._colorStackIndex];s!==this._currentColor&&(this._currentColor=s,r.add({renderPipeId:"colorMask",colorMask:s,canBundle:!1})),this._colorStackIndex++}pop(e,t,r){this._renderer.renderPipes.batch.break(r);const n=this._colorStack;this._colorStackIndex--;const s=n[this._colorStackIndex-1];s!==this._currentColor&&(this._currentColor=s,r.add({renderPipeId:"colorMask",colorMask:s,canBundle:!1}))}execute(e){this._renderer.colorMask.setMask(e.colorMask)}destroy(){this._renderer=null,this._colorStack=null}}M.extension={type:[i.Ag.WebGLPipes,i.Ag.WebGPUPipes],name:"colorMask"};var S=r(1257),G=r(1957);class w{constructor(e){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=e}push(e,t,r){var n;const s=e,i=this._renderer;i.renderPipes.batch.break(r),i.renderPipes.blendMode.setBlendMode(s.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});const a=s.mask;a.includeInBuild=!0,this._maskHash.has(s)||this._maskHash.set(s,{instructionsStart:0,instructionsLength:0});const o=this._maskHash.get(s);o.instructionsStart=r.instructionSize,a.collectRenderables(r,i,null),a.includeInBuild=!1,i.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});const d=r.instructionSize-o.instructionsStart-1;o.instructionsLength=d;const l=i.renderTarget.renderTarget.uid;(n=this._maskStackHash)[l]??(n[l]=0)}pop(e,t,r){const n=e,s=this._renderer;s.renderPipes.batch.break(r),s.renderPipes.blendMode.setBlendMode(n.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:t._maskOptions.inverse,canBundle:!1});const i=this._maskHash.get(e);for(let e=0;e<i.instructionsLength;e++)r.instructions[r.instructionSize++]=r.instructions[i.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(e){var t;const r=this._renderer,n=r,s=r.renderTarget.renderTarget.uid;let i=(t=this._maskStackHash)[s]??(t[s]=0);"pushMaskBegin"===e.action?(n.renderTarget.ensureDepthStencil(),n.stencil.setStencilMode(G.K.RENDERING_MASK_ADD,i),i++,n.colorMask.setMask(0)):"pushMaskEnd"===e.action?(e.inverse?n.stencil.setStencilMode(G.K.INVERSE_MASK_ACTIVE,i):n.stencil.setStencilMode(G.K.MASK_ACTIVE,i),n.colorMask.setMask(15)):"popMaskBegin"===e.action?(n.colorMask.setMask(0),0!==i?n.stencil.setStencilMode(G.K.RENDERING_MASK_REMOVE,i):(n.renderTarget.clear(null,S.u.STENCIL),n.stencil.setStencilMode(G.K.DISABLED,i)),i--):"popMaskEnd"===e.action&&(e.inverse?n.stencil.setStencilMode(G.K.INVERSE_MASK_ACTIVE,i):n.stencil.setStencilMode(G.K.MASK_ACTIVE,i),n.colorMask.setMask(15)),this._maskStackHash[s]=i}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}}w.extension={type:[i.Ag.WebGLPipes,i.Ag.WebGPUPipes],name:"stencilMask"};var R=r(2577),P=r(268);const A=class e{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new R.Q(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...e.defaultOptions,...t},this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(e){R.Q.shared.setValue(e).alpha<1&&1===this._backgroundColor.alpha&&(0,P.R)("Cannot set a transparent background on an opaque canvas. To enable transparency, set backgroundAlpha < 1 when initializing your Application."),this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};A.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"background",priority:0},A.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let B=A;var U=r(360),O=r(1761),I=r(5589);const L={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},D=class e{constructor(e){this._renderer=e}_normalizeOptions(e,t={}){return e instanceof h.mc||e instanceof I.g?{target:e,...t}:{...t,...e}}async image(e){const t=O.e.get().createImage();return t.src=await this.base64(e),t}async base64(t){t=this._normalizeOptions(t,e.defaultImageOptions);const{format:r,quality:n}=t,s=this.canvas(t);if(void 0!==s.toBlob)return new Promise(((e,t)=>{s.toBlob((r=>{if(!r)return void t(new Error("ICanvas.toBlob failed!"));const n=new FileReader;n.onload=()=>e(n.result),n.onerror=t,n.readAsDataURL(r)}),L[r],n)}));if(void 0!==s.toDataURL)return s.toDataURL(L[r],n);if(void 0!==s.convertToBlob){const e=await s.convertToBlob({type:L[r],quality:n});return new Promise(((t,r)=>{const n=new FileReader;n.onload=()=>t(n.result),n.onerror=r,n.readAsDataURL(e)}))}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e){const t=(e=this._normalizeOptions(e)).target,r=this._renderer;if(t instanceof I.g)return r.texture.generateCanvas(t);const n=r.textureGenerator.generateTexture(e),s=r.texture.generateCanvas(n);return n.destroy(!0),s}pixels(e){const t=(e=this._normalizeOptions(e)).target,r=this._renderer,n=t instanceof I.g?t:r.textureGenerator.generateTexture(e),s=r.texture.getPixels(n);return t instanceof h.mc&&n.destroy(!0),s}texture(e){return(e=this._normalizeOptions(e)).target instanceof I.g?e.target:this._renderer.textureGenerator.generateTexture(e)}download(e){e=this._normalizeOptions(e);const t=this.canvas(e),r=document.createElement("a");r.download=e.filename??"image.png",r.href=t.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(e){const t=e.width??200;e=this._normalizeOptions(e);const r=this.canvas(e),n=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.height}px`);const s=["font-size: 1px;",`padding: ${t}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",s)}destroy(){this._renderer=null}};D.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"extract"},D.defaultImageOptions={format:"png",quality:1};let F=D;var z=r(9252),W=r(7269),E=r(583);class H extends I.g{static create(e){const{dynamic:t,...r}=e;return new H({source:new E.v(r),dynamic:t??!1})}resize(e,t,r){return this.source.resize(e,t,r),this}}const j=new z.M,V=new l.c,N=[0,0,0,0];class q{constructor(e){this._renderer=e}generateTexture(e){e instanceof h.mc&&(e={target:e,frame:void 0,textureSourceOptions:{},resolution:void 0});const t=e.resolution||this._renderer.resolution,r=e.antialias||this._renderer.view.antialias,n=e.target;let s=e.clearColor;if(s){s=Array.isArray(s)&&4===s.length?s:R.Q.shared.setValue(s).toArray()}else s=N;const i=e.frame?.copyTo(j)||(0,W.n)(n,V).rectangle;i.width=0|Math.max(i.width,1/t),i.height=0|Math.max(i.height,1/t);const o=H.create({...e.textureSourceOptions,width:i.width,height:i.height,resolution:t,antialias:r}),d=a.u.shared.translate(-i.x,-i.y);return this._renderer.render({container:n,transform:d,target:o,clearColor:s}),o.source.updateMipmaps(),o}destroy(){this._renderer=null}}function K(e){let t=!1;for(const r in e)if(null==e[r]){t=!0;break}if(!t)return e;const r=Object.create(null);for(const t in e){const n=e[t];n&&(r[t]=n)}return r}function $(e){let t=0;for(let r=0;r<e.length;r++)null==e[r]?t++:e[r-t]=e[r];return e.length-=t,e}q.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"textureGenerator"};const J=class e{constructor(e){this._managedResources=[],this._managedResourceHashes=[],this._managedCollections=[],this._ready=!1,this._renderer=e}init(t){t={...e.defaultOptions,...t},this.maxUnusedTime=t.gcMaxUnusedTime,this._frequency=t.gcFrequency,this.enabled=t.gcActive,this.now=performance.now()}get enabled(){return!!this._handler}set enabled(e){this.enabled!==e&&(e?(this._handler=this._renderer.scheduler.repeat((()=>{this._ready=!0}),this._frequency,!1),this._collectionsHandler=this._renderer.scheduler.repeat((()=>{for(const e of this._managedCollections){const{context:t,collection:r,type:n}=e;t[r]="hash"===n?K(t[r]):$(t[r])}}),this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._collectionsHandler),this._handler=0,this._collectionsHandler=0))}prerender({container:e}){this.now=performance.now(),e.renderGroup.gcTick=this._renderer.tick++,this._updateInstructionGCTick(e.renderGroup,e.renderGroup.gcTick)}postrender(){this._ready&&this.enabled&&(this.run(),this._ready=!1)}_updateInstructionGCTick(e,t){e.instructionSet.gcTick=t,e.gcTick=t;for(const r of e.renderGroupChildren)this._updateInstructionGCTick(r,t)}addCollection(e,t,r){this._managedCollections.push({context:e,collection:t,type:r})}addResource(e,t){if(-1!==e._gcLastUsed)return e._gcLastUsed=this.now,void e._onTouch?.(this.now);const r=this._managedResources.length;e._gcData={index:r,type:t},e._gcLastUsed=this.now,e._onTouch?.(this.now),e.once("unload",this.removeResource,this),this._managedResources.push(e)}removeResource(e){const t=e._gcData;if(!t)return;const r=t.index,n=this._managedResources.length-1;if(r!==n){const e=this._managedResources[n];this._managedResources[r]=e,e._gcData.index=r}this._managedResources.length--,e._gcData=null,e._gcLastUsed=-1}addResourceHash(e,t,r,n=0){this._managedResourceHashes.push({context:e,hash:t,type:r,priority:n}),this._managedResourceHashes.sort(((e,t)=>e.priority-t.priority))}run(){const e=performance.now(),t=this._managedResourceHashes;for(const r of t)this.runOnHash(r,e);let r=0;for(let t=0;t<this._managedResources.length;t++){const n=this._managedResources[t];r=this.runOnResource(n,e,r)}this._managedResources.length=r}updateRenderableGCTick(e,t){const r=e.renderGroup??e.parentRenderGroup,n=r?.instructionSet?.gcTick??-1;(r?.gcTick??0)===n&&(e._gcLastUsed=t,e._onTouch?.(t))}runOnResource(e,t,r){const n=e._gcData;"renderable"===n.type&&this.updateRenderableGCTick(e,t);return t-e._gcLastUsed<this.maxUnusedTime||!e.autoGarbageCollect?(this._managedResources[r]=e,n.index=r,r++):(e.unload(),e._gcData=null,e._gcLastUsed=-1,e.off("unload",this.removeResource,this)),r}_createHashClone(e,t){const r=Object.create(null);for(const n in e){if(n===t)break;null!==e[n]&&(r[n]=e[n])}return r}runOnHash(e,t){const{context:r,hash:n,type:s}=e,i=r[n];let a=null,o=0;for(const e in i){const r=i[e];if(null===r){o++,1e4!==o||a||(a=this._createHashClone(i,e));continue}if(-1===r._gcLastUsed){r._gcLastUsed=t,r._onTouch?.(t),a&&(a[e]=r);continue}"renderable"===s&&this.updateRenderableGCTick(r,t);if(!(t-r._gcLastUsed<this.maxUnusedTime)&&r.autoGarbageCollect){if(a||(o+1!==1e4?(i[e]=null,o++):a=this._createHashClone(i,e)),"renderable"===s){const e=r,t=e.renderGroup??e.parentRenderGroup;t&&(t.structureDidChange=!0)}r.unload(),r._gcData=null,r._gcLastUsed=-1}else a&&(a[e]=r)}a&&(r[n]=a)}destroy(){this.enabled=!1,this._managedResources.forEach((e=>{e.off("unload",this.removeResource,this)})),this._managedResources.length=0,this._managedResourceHashes.length=0,this._managedCollections.length=0,this._renderer=null}};J.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"gc",priority:0},J.defaultOptions={gcActive:!0,gcMaxUnusedTime:6e4,gcFrequency:3e4};let Q=J;var X=r(5101),Z=r(2760),Y=r(3513),ee=r(5099),te=r(5811);class re{constructor(e){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=e}reset(){this._stackIndex=0;for(let e=0;e<this._activeUniforms.length;e++)this._uniformsPool.push(this._activeUniforms[e]);for(let e=0;e<this._activeBindGroups.length;e++)this._bindGroupPool.push(this._activeBindGroups[e]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(e){this.reset(),this.push(e)}bind({size:e,projectionMatrix:t,worldTransformMatrix:r,worldColor:n,offset:s}){const i=this._renderer.renderTarget.renderTarget,o=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:i,worldTransformMatrix:new a.u,worldColor:4294967295,offset:new X.b},d={projectionMatrix:t||this._renderer.renderTarget.projectionMatrix,resolution:e||i.size,worldTransformMatrix:r||o.worldTransformMatrix,worldColor:n||o.worldColor,offset:s||o.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);const u=l.uniforms;let c;u.uProjectionMatrix=d.projectionMatrix,u.uResolution=d.resolution,u.uWorldTransformMatrix.copyFrom(d.worldTransformMatrix),u.uWorldTransformMatrix.tx-=d.offset.x,u.uWorldTransformMatrix.ty-=d.offset.y,(0,Z.V)(d.worldColor,u.uWorldColorAlpha,0),l.update(),this._renderer.renderPipes.uniformBatch?c=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(c=this._bindGroupPool.pop()||new Y.T,this._activeBindGroups.push(c),c.setResource(l,0)),d.bindGroup=c,this._currentGlobalUniformData=d}push(e){this.bind(e),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===ee.W.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new te.k({uProjectionMatrix:{value:new a.u,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new a.u,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null,this._globalUniformDataStack.length=0,this._uniformsPool.length=0,this._activeUniforms.length=0,this._bindGroupPool.length=0,this._activeBindGroups.length=0,this._currentGlobalUniformData=null}}re.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"globalUniforms"};var ne=r(7309);let se=1;class ie{constructor(){this._tasks=[],this._offset=0}init(){ne.R.system.add(this._update,this)}repeat(e,t,r=!0){const n=se++;let s=0;return r&&(this._offset+=1e3,s=this._offset),this._tasks.push({func:e,duration:t,start:performance.now(),offset:s,last:performance.now(),repeat:!0,id:n}),n}cancel(e){for(let t=0;t<this._tasks.length;t++)if(this._tasks[t].id===e)return void this._tasks.splice(t,1)}_update(){const e=performance.now();for(let t=0;t<this._tasks.length;t++){const r=this._tasks[t];if(e-r.offset-r.last>=r.duration){const t=e-r.start;r.func(t),r.last=e}}}destroy(){ne.R.system.remove(this._update,this),this._tasks.length=0}}ie.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"scheduler",priority:0};var ae=r(2571);let oe=!1;class de{constructor(e){this._renderer=e}init(e){if(e.hello){let e=this._renderer.name;this._renderer.type===ee.W.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),function(e){if(!oe){if(O.e.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const t=[`%c %c %c %c %c PixiJS %c v${ae.xv} (${e}) http://www.pixijs.com/\n\n`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${ae.xv} - ${e} - http://www.pixijs.com/`);oe=!0}}(e)}}}de.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"hello",priority:-2},de.defaultOptions={hello:!1};var le=r(4670);const ue=class e{constructor(e){this._renderer=e}init(t){t={...e.defaultOptions,...t},this.maxUnusedTime=t.renderableGCMaxUnusedTime}get enabled(){return(0,le.t6)("8.15.0","RenderableGCSystem.enabled is deprecated, please use the GCSystem.enabled instead."),this._renderer.gc.enabled}set enabled(e){(0,le.t6)("8.15.0","RenderableGCSystem.enabled is deprecated, please use the GCSystem.enabled instead."),this._renderer.gc.enabled=e}addManagedHash(e,t){(0,le.t6)("8.15.0","RenderableGCSystem.addManagedHash is deprecated, please use the GCSystem.addCollection instead."),this._renderer.gc.addCollection(e,t,"hash")}addManagedArray(e,t){(0,le.t6)("8.15.0","RenderableGCSystem.addManagedArray is deprecated, please use the GCSystem.addCollection instead."),this._renderer.gc.addCollection(e,t,"array")}addRenderable(e){(0,le.t6)("8.15.0","RenderableGCSystem.addRenderable is deprecated, please use the GCSystem instead."),this._renderer.gc.addResource(e,"renderable")}run(){(0,le.t6)("8.15.0","RenderableGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.run()}destroy(){this._renderer=null}};ue.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"renderableGC",priority:0},ue.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};let ce=ue;const he=class e{get count(){return this._renderer.tick}get checkCount(){return this._checkCount}set checkCount(e){(0,le.t6)("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._checkCount=e}get maxIdle(){return this._renderer.gc.maxUnusedTime/1e3*60}set maxIdle(e){(0,le.t6)("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.maxUnusedTime=e/60*1e3}get checkCountMax(){return Math.floor(this._renderer.gc._frequency/1e3)}set checkCountMax(e){(0,le.t6)("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead.")}get active(){return this._renderer.gc.enabled}set active(e){(0,le.t6)("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.enabled=e}constructor(e){this._renderer=e,this._checkCount=0}init(t){t.textureGCActive!==e.defaultOptions.textureGCActive&&(this.active=t.textureGCActive),t.textureGCMaxIdle!==e.defaultOptions.textureGCMaxIdle&&(this.maxIdle=t.textureGCMaxIdle),t.textureGCCheckCountMax!==e.defaultOptions.textureGCCheckCountMax&&(this.checkCountMax=t.textureGCCheckCountMax)}run(){(0,le.t6)("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.run()}destroy(){this._renderer=null}};he.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem],name:"textureGC"},he.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:3600,textureGCCheckCountMax:600};let pe=he;var ge=r(279),fe=r(8725);const me=class e{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(e){this.texture.source.autoDensity=e}get resolution(){return this.texture.source._resolution}set resolution(e){this.texture.source.resize(this.texture.source.width,this.texture.source.height,e)}init(t){(t={...e.defaultOptions,...t}).view&&((0,le.t6)(le.lj,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new z.M(0,0,t.width,t.height),this.canvas=t.canvas||O.e.get().createCanvas(),this.antialias=!!t.antialias,this.texture=(0,fe.c)(this.canvas,t),this.renderTarget=new ge.O({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(e,t,r){this.texture.source.resize(e,t,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(e=!1){("boolean"==typeof e?e:!!e?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.texture.destroy()}};me.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"view",priority:0},me.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};const _e=[B,re,de,me,v,Q,pe,q,F,k.d,ce,ie],xe=[U.j,y.s,T.k,s.a,C.z,w,M,n._]},8725:(e,t,r)=>{r.d(t,{c:()=>o});var n=r(6083),s=r(4884),i=r(5589);const a=new Map;function o(e,t){if(!a.has(e)){const r=new i.g({source:new s.q({resource:e,...t})}),n=()=>{a.get(e)===r&&a.delete(e)};r.once("destroy",n),r.source.once("destroy",n),a.set(e,r)}return a.get(e)}n.L.register(a)},594:(e,t,r)=>{r.d(t,{_:()=>s});var n=r(8507);class s{constructor(e){this._renderer=e}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}execute(e){e.isRenderable&&e.render(this._renderer)}destroy(){this._renderer=null}}s.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"customRender"}},1160:(e,t,r)=>{r.d(t,{a:()=>d});var n=r(8507),s=r(9313),i=r(8655),a=r(8422),o=r(433);class d{constructor(e){this._renderer=e}addRenderGroup(e,t){e.isCachedAsTexture?this._addRenderableCacheAsTexture(e,t):this._addRenderableDirect(e,t)}execute(e){e.isRenderable&&(e.isCachedAsTexture?this._executeCacheAsTexture(e):this._executeDirect(e))}destroy(){this._renderer=null}_addRenderableDirect(e,t){this._renderer.renderPipes.batch.break(t),e._batchableRenderGroup&&(i.Z.return(e._batchableRenderGroup),e._batchableRenderGroup=null),t.add(e)}_addRenderableCacheAsTexture(e,t){const r=e._batchableRenderGroup??(e._batchableRenderGroup=i.Z.get(a.K));r.renderable=e.root,r.transform=e.root.relativeGroupTransform,r.texture=e.texture,r.bounds=e._textureBounds,t.add(e),this._renderer.renderPipes.blendMode.pushBlendMode(e,e.root.groupBlendMode,t),this._renderer.renderPipes.batch.addToBatch(r,t),this._renderer.renderPipes.blendMode.popBlendMode(t)}_executeCacheAsTexture(e){if(e.textureNeedsUpdate){e.textureNeedsUpdate=!1;const t=(new s.u).translate(-e._textureBounds.x,-e._textureBounds.y);this._renderer.renderTarget.push(e.texture,!0,null,e.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:t,worldColor:4294967295,offset:{x:0,y:0}}),(0,o.j)(e,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}e._batchableRenderGroup._batcher.updateElement(e._batchableRenderGroup),e._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(e){this._renderer.globalUniforms.push({worldTransformMatrix:e.inverseParentTextureTransform,worldColor:e.worldColorAlpha}),(0,o.j)(e,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}}d.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"renderGroup"}},433:(e,t,r)=>{function n(e,t){const r=e.instructionSet,n=r.instructions;for(let e=0;e<r.instructionSize;e++){const r=n[e];t[r.renderPipeId].execute(r)}}r.d(t,{j:()=>n})},8422:(e,t,r)=>{r.d(t,{K:()=>n});class n{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}destroy(){this.reset()}}},3136:(e,t,r)=>{r.d(t,{k:()=>i});var n=r(8507),s=r(8422);class i{constructor(e){this._renderer=e}addRenderable(e,t){const r=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,r),this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){const t=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){const t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}_updateBatchableSprite(e,t){t.bounds=e.visualBounds,t.texture=e._texture}_getGpuSprite(e){return e._gpuData[this._renderer.uid]||this._initGPUSprite(e)}_initGPUSprite(e){const t=new s.K;return t.renderable=e,t.transform=e.groupTransform,t.texture=e._texture,t.bounds=e.visualBounds,t.roundPixels=this._renderer._roundPixels|e._roundPixels,e._gpuData[this._renderer.uid]=t,t}destroy(){this._renderer=null}}i.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"sprite"}}}]);
1
+ (self.webpackChunkvizor_2d=self.webpackChunkvizor_2d||[]).push([[468],{6554:(e,t,r)=>{r.d(t,{d:()=>d});var n=r(9113),s=r(3012),i=r(8475),a=r(7547);const o=class e extends i.M{constructor(t){super(t={...e.defaultOptions,...t}),this.enabled=!0,this._state=a.U.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,"boolean"==typeof t.antialias?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1),t.blendRequired&&this.addResource("uBackTexture",0,3)}apply(e,t,r,n){e.applyFilter(this,t,r,n)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(t){const{gpu:r,gl:i,...a}=t;let o,d;return r&&(o=s.B.from(r)),i&&(d=n.M.from(i)),new e({gpuProgram:o,glProgram:d,...a})}};o.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};let d=o},780:(e,t,r)=>{r.d(t,{s:()=>o});var n=r(8507),s=r(7547),i=r(2043);const a=class e{constructor(e,t){this.state=s.U.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=e,this._adaptor=t,this._adaptor.init?.(this)}static getBatcher(e){return new this._availableBatchers[e]}buildStart(e){let t=this._batchersByInstructionSet[e.uid];t||(t=this._batchersByInstructionSet[e.uid]=Object.create(null),t.default||(t.default=new i.J({maxTextures:this.renderer.limits.maxBatchableTextures}))),this._activeBatches=t,this._activeBatch=this._activeBatches.default;for(const e in this._activeBatches)this._activeBatches[e].begin()}addToBatch(t,r){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(r);let n=this._activeBatches[t.batcherName];n||(n=this._activeBatches[t.batcherName]=e.getBatcher(t.batcherName),n.begin()),this._activeBatch=n}this._activeBatch.add(t)}break(e){this._activeBatch.break(e)}buildEnd(e){this._activeBatch.break(e);const t=this._activeBatches;for(const e in t){const r=t[e],n=r.geometry;n.indexBuffer.setDataWithSize(r.indexBuffer,r.indexSize,!0),n.buffers[0].setDataWithSize(r.attributeBuffer.float32View,r.attributeSize,!1)}}upload(e){const t=this._batchersByInstructionSet[e.uid];for(const e in t){const r=t[e],n=r.geometry;r.dirty&&(r.dirty=!1,n.buffers[0].update(4*r.attributeSize))}}execute(e){if("startBatch"===e.action){const t=e.batcher,r=t.geometry,n=t.shader;this._adaptor.start(this,r,n)}this._adaptor.execute(this,e)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(const e in this._activeBatches)this._activeBatches[e].destroy();this._activeBatches=null}};a.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"batch"},a._availableBatchers=Object.create(null);let o=a;n.XO.handleByMap(n.Ag.Batcher,o._availableBatchers),n.XO.add(i.J)},9824:(e,t,r)=>{r.d(t,{z:()=>k});var n=r(8507),s=r(9049),i=r(9313),a=r(9113),o=r(3012),d=r(5811),l=r(1196),u=r(6554),c="struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n};\n\nstruct MaskUniforms {\n uFilterMatrix:mat3x3<f32>,\n uMaskClamp:vec4<f32>,\n uAlpha:f32,\n uInverse:f32,\n};\n\n@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n@group(0) @binding(1) var uTexture: texture_2d<f32>;\n@group(0) @binding(2) var uSampler : sampler;\n\n@group(1) @binding(0) var<uniform> filterUniforms : MaskUniforms;\n@group(1) @binding(1) var uMaskTexture: texture_2d<f32>;\n\nstruct VSOutput {\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>,\n @location(1) filterUv : vec2<f32>,\n};\n\nfn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n{\n var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\n position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nfn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n}\n\nfn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);\n}\n\nfn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>\n{\n return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;\n}\n\nfn getSize() -> vec2<f32>\n{\n return gfu.uGlobalFrame.zw;\n}\n\n@vertex\nfn mainVertex(\n @location(0) aPosition : vec2<f32>,\n) -> VSOutput {\n return VSOutput(\n filterVertexPosition(aPosition),\n filterTextureCoord(aPosition),\n getFilterCoord(aPosition)\n );\n}\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2<f32>,\n @location(1) filterUv: vec2<f32>,\n @builtin(position) position: vec4<f32>\n) -> @location(0) vec4<f32> {\n\n var maskClamp = filterUniforms.uMaskClamp;\n var uAlpha = filterUniforms.uAlpha;\n\n var clip = step(3.5,\n step(maskClamp.x, filterUv.x) +\n step(maskClamp.y, filterUv.y) +\n step(filterUv.x, maskClamp.z) +\n step(filterUv.y, maskClamp.w));\n\n var mask = textureSample(uMaskTexture, uSampler, filterUv);\n var source = textureSample(uTexture, uSampler, uv);\n var alphaMul = 1.0 - uAlpha * (1.0 - mask.a);\n\n var a: f32 = alphaMul * mask.r * uAlpha * clip;\n\n if (filterUniforms.uInverse == 1.0) {\n a = 1.0 - a;\n }\n\n return source * a;\n}\n";class h extends u.d{constructor(e){const{sprite:t,...r}=e,n=new l.N(t.texture),s=new d.k({uFilterMatrix:{value:new i.u,type:"mat3x3<f32>"},uMaskClamp:{value:n.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:e.inverse?1:0,type:"f32"}});super({...r,gpuProgram:o.B.from({vertex:{source:c,entryPoint:"mainVertex"},fragment:{source:c,entryPoint:"mainFragment"}}),glProgram:a.M.from({vertex:"in vec2 aPosition;\n\nout vec2 vTextureCoord;\nout vec2 vMaskCoord;\n\n\nuniform vec4 uInputSize;\nuniform vec4 uOutputFrame;\nuniform vec4 uOutputTexture;\nuniform mat3 uFilterMatrix;\n\nvec4 filterVertexPosition( vec2 aPosition )\n{\n vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n \n position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( vec2 aPosition )\n{\n return aPosition * (uOutputFrame.zw * uInputSize.zw);\n}\n\nvec2 getFilterCoord( vec2 aPosition )\n{\n return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;\n} \n\nvoid main(void)\n{\n gl_Position = filterVertexPosition(aPosition);\n vTextureCoord = filterTextureCoord(aPosition);\n vMaskCoord = getFilterCoord(aPosition);\n}\n",fragment:"in vec2 vMaskCoord;\nin vec2 vTextureCoord;\n\nuniform sampler2D uTexture;\nuniform sampler2D uMaskTexture;\n\nuniform float uAlpha;\nuniform vec4 uMaskClamp;\nuniform float uInverse;\n\nout vec4 finalColor;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(uMaskClamp.x, vMaskCoord.x) +\n step(uMaskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, uMaskClamp.z) +\n step(vMaskCoord.y, uMaskClamp.w));\n\n // TODO look into why this is needed\n float npmAlpha = uAlpha;\n vec4 original = texture(uTexture, vTextureCoord);\n vec4 masky = texture(uMaskTexture, vMaskCoord);\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n float a = alphaMul * masky.r * npmAlpha * clip;\n\n if (uInverse == 1.0) {\n a = 1.0 - a;\n }\n\n finalColor = original * a;\n}\n",name:"mask-filter"}),clipToViewport:!1,resources:{filterUniforms:s,uMaskTexture:t.texture.source}}),this.sprite=t,this._textureMatrix=n}set inverse(e){this.resources.filterUniforms.uniforms.uInverse=e?1:0}get inverse(){return 1===this.resources.filterUniforms.uniforms.uInverse}apply(e,t,r,n){this._textureMatrix.texture=this.sprite.texture,e.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,e.applyFilter(this,t,r,n)}}var p=r(9636),g=r(9443),f=r(6844),m=r(8655),_=r(5589),x=r(2437),b=r(5099);const v=new p.c;class T extends s.a{constructor(){super(),this.filters=[new h({sprite:new f.k(_.g.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(e){this.filters[0].sprite=e}get inverse(){return this.filters[0].inverse}set inverse(e){this.filters[0].inverse=e}}class k{constructor(e){this._activeMaskStage=[],this._renderer=e}push(e,t,r){const n=this._renderer;if(n.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1,maskedContainer:t}),e.inverse=t._maskOptions.inverse,e.renderMaskToTexture){const t=e.mask;t.includeInBuild=!0,t.collectRenderables(r,n,null),t.includeInBuild=!1}n.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:e,maskedContainer:t,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){const t=this._renderer,r=e.mask.renderMaskToTexture;if("pushMaskBegin"===e.action){const n=m.Z.get(T);if(n.inverse=e.inverse,r){e.mask.mask.measurable=!0;const r=(0,g.f)(e.mask.mask,!0,v);e.mask.mask.measurable=!1,r.ceil();const s=t.renderTarget.renderTarget.colorTexture.source,i=x.W.getOptimalTexture(r.width,r.height,s._resolution,s.antialias);t.renderTarget.push(i,!0),t.globalUniforms.push({offset:r,worldColor:4294967295});const a=n.sprite;a.texture=i,a.worldTransform.tx=r.minX,a.worldTransform.ty=r.minY,this._activeMaskStage.push({filterEffect:n,maskedContainer:e.maskedContainer,filterTexture:i})}else n.sprite=e.mask.mask,this._activeMaskStage.push({filterEffect:n,maskedContainer:e.maskedContainer})}else if("pushMaskEnd"===e.action){const e=this._activeMaskStage[this._activeMaskStage.length-1];r&&(t.type===b.W.WEBGL&&t.renderTarget.finishRenderPass(),t.renderTarget.pop(),t.globalUniforms.pop()),t.filter.push({renderPipeId:"filter",action:"pushFilter",container:e.maskedContainer,filterEffect:e.filterEffect,canBundle:!1})}else if("popMaskEnd"===e.action){t.filter.pop();const e=this._activeMaskStage.pop();r&&x.W.returnTexture(e.filterTexture),m.Z.return(e.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}}k.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"alphaMask"}},360:(e,t,r)=>{r.d(t,{j:()=>d});var n=r(8507),s=r(9049),i=r(3284),a=r(268);const o={};n.XO.handle(n.Ag.BlendMode,(e=>{if(!e.name)throw new Error("BlendMode extension must have a name property");o[e.name]=e.ref}),(e=>{delete o[e.name]}));class d{constructor(e){this._blendModeStack=[],this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=e,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}pushBlendMode(e,t,r){this._blendModeStack.push(t),this.setBlendMode(e,t,r)}popBlendMode(e){this._blendModeStack.pop();const t=this._blendModeStack[this._activeBlendMode.length-1]??"normal";this.setBlendMode(null,t,e)}setBlendMode(e,t,r){const n=e instanceof i.m;this._activeBlendMode!==t?(this._isAdvanced&&this._endAdvancedBlendMode(r),this._activeBlendMode=t,e&&(this._isAdvanced=!!o[t],this._isAdvanced&&this._beginAdvancedBlendMode(e,r))):this._isAdvanced&&e&&!n&&this._renderableList?.push(e)}_beginAdvancedBlendMode(e,t){this._renderer.renderPipes.batch.break(t);const r=this._activeBlendMode;if(!o[r])return void(0,a.R)(`Unable to assign BlendMode: '${r}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);const n=this._ensureFilterEffect(r),s=e instanceof i.m,d={renderPipeId:"filter",action:"pushFilter",filterEffect:n,renderables:s?null:[e],container:s?e.root:null,canBundle:!1};this._renderableList=d.renderables,t.add(d)}_ensureFilterEffect(e){let t=this._filterHash[e];return t||(t=this._filterHash[e]=new s.a,t.filters=[new o[e]]),t}_endAdvancedBlendMode(e){this._isAdvanced=!1,this._renderableList=null,this._renderer.renderPipes.batch.break(e),e.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(e){this._isAdvanced&&this._endAdvancedBlendMode(e)}destroy(){this._renderer=null,this._renderableList=null;for(const e in this._filterHash)this._filterHash[e].destroy();this._filterHash=null}}d.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"blendMode"}},279:(e,t,r)=>{r.d(t,{O:()=>o});var n=r(133),s=r(583),i=r(5589);const a=class e{constructor(t={}){if(this.uid=(0,n.L)("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...e.defaultOptions,...t},this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,"number"==typeof t.colorTextures){this._managedColorTextures=!0;for(let e=0;e<t.colorTextures;e++)this.colorTextures.push(new s.v({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map((e=>e.source))];const e=this.colorTexture.source;this.resize(e.width,e.height,e._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof i.g||t.depthStencilTexture instanceof s.v?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){const e=this._size;return e[0]=this.pixelWidth,e[1]=this.pixelHeight,e}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(e){this.resize(e.width,e.height,e._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new s.v({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(e,t,r=this.resolution,n=!1){this.dirtyId++,this.colorTextures.forEach(((s,i)=>{n&&0===i||s.source.resize(e,t,r)})),this.depthStencilTexture&&this.depthStencilTexture.source.resize(e,t,r)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach((e=>{e.destroy()})),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};a.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};let o=a},7238:(e,t,r)=>{r.d(t,{l:()=>h});var n=r(9313),s=r(9252),i=r(1257);var a=r(7729),o=r(4884),d=r(583),l=r(5589),u=r(8725);var c=r(279);class h{constructor(e){this.rootViewPort=new s.M,this.viewport=new s.M,this.mipLevel=0,this.layer=0,this.onRenderTargetChange=new a.C("onRenderTargetChange"),this.projectionMatrix=new n.u,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=e,e.gc.addCollection(this,"_gpuRenderTargetHash","hash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:e,clear:t,clearColor:r,frame:n,mipLevel:s,layer:i}){this._renderTargetStack.length=0,this.push(e,t,r,n,s??0,i??0),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=function(e){const t=e.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(e,t=!0,r,n,s=0,i=0){const a=this.getRenderTarget(e),o=this.renderTarget!==a;this.renderTarget=a,this.renderSurface=e;const d=this.getGpuRenderTarget(a);a.pixelWidth===d.width&&a.pixelHeight===d.height||(this.adaptor.resizeGpuRenderTarget(a),d.width=a.pixelWidth,d.height=a.pixelHeight);const u=a.colorTexture,c=this.viewport,h=u.arrayLayerCount||1;if((0|i)!==i&&(i|=0),i<0||i>=h)throw new Error(`[RenderTargetSystem] layer ${i} is out of bounds (arrayLayerCount=${h}).`);this.mipLevel=0|s,this.layer=0|i;const p=Math.max(u.pixelWidth>>s,1),g=Math.max(u.pixelHeight>>s,1);if(!n&&e instanceof l.g&&(n=e.frame),n){const e=u._resolution,t=1<<Math.max(0|s,0),r=n.x*e+.5|0,i=n.y*e+.5|0,a=n.width*e+.5|0,o=n.height*e+.5|0;let d=Math.floor(r/t),l=Math.floor(i/t),h=Math.ceil(a/t),f=Math.ceil(o/t);d=Math.min(Math.max(d,0),p-1),l=Math.min(Math.max(l,0),g-1),h=Math.min(Math.max(h,1),p-d),f=Math.min(Math.max(f,1),g-l),c.x=d,c.y=l,c.width=h,c.height=f}else c.x=0,c.y=0,c.width=p,c.height=g;return function(e,t,r,n,s,i){const a=i?1:-1;e.identity(),e.a=1/n*2,e.d=a*(1/s*2),e.tx=-1-t*e.a,e.ty=-a-r*e.d}(this.projectionMatrix,0,0,c.width/u.resolution,c.height/u.resolution,!a.isRoot),this.adaptor.startRenderPass(a,t,r,c,s,i),o&&this.onRenderTargetChange.emit(a),a}clear(e,t=i.u.ALL,r,n=this.mipLevel,s=this.layer){t&&(e&&(e=this.getRenderTarget(e)),this.adaptor.clear(e||this.renderTarget,t,r,this.viewport,n,s))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(e,t=i.u.ALL,r,n,s=0,a=0){const o=this.bind(e,t,r,n,s,a);return this._renderTargetStack.push({renderTarget:o,frame:n,mipLevel:s,layer:a}),o}pop(){this._renderTargetStack.pop();const e=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(e.renderTarget,!1,null,e.frame,e.mipLevel,e.layer)}getRenderTarget(e){return e.isTexture&&(e=e.source),this._renderSurfaceToRenderTargetHash.get(e)??this._initRenderTarget(e)}copyToTexture(e,t,r,n,s){r.x<0&&(n.width+=r.x,s.x-=r.x,r.x=0),r.y<0&&(n.height+=r.y,s.y-=r.y,r.y=0);const{pixelWidth:i,pixelHeight:a}=e;return n.width=Math.min(n.width,i-r.x),n.height=Math.min(n.height,a-r.y),this.adaptor.copyToTexture(e,t,r,n,s)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport,0,this.layer))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach(((e,t)=>{e!==t&&e.destroy()})),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(e){let t=null;return o.q.test(e)&&(e=(0,u.c)(e).source),e instanceof c.O?t=e:e instanceof d.v&&(t=new c.O({colorTextures:[e]}),e.source instanceof o.q&&(t.isRoot=!0),e.once("destroy",(()=>{t.destroy(),this._renderSurfaceToRenderTargetHash.delete(e);const r=this._gpuRenderTargetHash[t.uid];r&&(this._gpuRenderTargetHash[t.uid]=null,this.adaptor.destroyGpuRenderTarget(r))}))),this._renderSurfaceToRenderTargetHash.set(e,t),t}getGpuRenderTarget(e){return this._gpuRenderTargetHash[e.uid]||(this._gpuRenderTargetHash[e.uid]=this.adaptor.initGpuRenderTarget(e))}resetState(){this.renderTarget=null,this.renderSurface=null}}},381:(e,t,r)=>{r.d(t,{f:()=>xe,i:()=>_e});var n=r(594),s=r(1160),i=r(8507),a=r(9313),o=r(2437),d=r(218),l=r(9636);function u(e,t){t||(t=0);for(let r=t;r<e.length&&e[r];r++)e[r]=null}var c=r(433),h=r(5559),p=r(753);const g=new h.mc,f=h.fR|h.ig|h.u;function m(e,t=!1){!function(e){const t=e.root;let r;if(e.renderGroupParent){const n=e.renderGroupParent;e.worldTransform.appendFrom(t.relativeGroupTransform,n.worldTransform),e.worldColor=(0,p.j)(t.groupColor,n.worldColor),r=t.groupAlpha*n.worldAlpha}else e.worldTransform.copyFrom(t.localTransform),e.worldColor=t.localColor,r=t.localAlpha;r=r<0?0:r>1?1:r,e.worldAlpha=r,e.worldColorAlpha=e.worldColor+(255*r<<24)}(e);const r=e.childrenToUpdate,n=e.updateTick++;for(const t in r){const s=Number(t),i=r[t],a=i.list,o=i.index;for(let t=0;t<o;t++){const r=a[t];r.parentRenderGroup===e&&r.relativeRenderGroupDepth===s&&_(r,n,0)}u(a,o),i.index=0}if(t)for(let r=0;r<e.renderGroupChildren.length;r++)m(e.renderGroupChildren[r],t)}function _(e,t,r){if(t===e.updateTick)return;e.updateTick=t,e.didChange=!1;const n=e.localTransform;e.updateLocalTransform();const s=e.parent;if(s&&!s.renderGroup?(r|=e._updateFlags,e.relativeGroupTransform.appendFrom(n,s.relativeGroupTransform),r&f&&x(e,s,r)):(r=e._updateFlags,e.relativeGroupTransform.copyFrom(n),r&f&&x(e,g,r)),!e.renderGroup){const n=e.children,s=n.length;for(let e=0;e<s;e++)_(n[e],t,r);const i=e.parentRenderGroup,a=e;a.renderPipeId&&!i.structureDidChange&&i.updateRenderable(a)}}function x(e,t,r){if(r&h.ig){e.groupColor=(0,p.j)(e.localColor,t.groupColor);let r=e.localAlpha*t.groupAlpha;r=r<0?0:r>1?1:r,e.groupAlpha=r,e.groupColorAlpha=e.groupColor+(255*r<<24)}r&h.u&&(e.groupBlendMode="inherit"===e.localBlendMode?t.groupBlendMode:e.localBlendMode),r&h.fR&&(e.globalDisplayStatus=e.localDisplayStatus&t.globalDisplayStatus),e._updateFlags=0}const b=new a.u;class v{constructor(e){this._renderer=e}render({container:e,transform:t}){const r=e.parent,n=e.renderGroup.renderGroupParent;e.parent=null,e.renderGroup.renderGroupParent=null;const s=this._renderer,i=b;t&&(i.copyFrom(e.renderGroup.localTransform),e.renderGroup.localTransform.copyFrom(t));const a=s.renderPipes;this._updateCachedRenderGroups(e.renderGroup,null),this._updateRenderGroups(e.renderGroup),s.globalUniforms.start({worldTransformMatrix:t?e.renderGroup.localTransform:e.renderGroup.worldTransform,worldColor:e.renderGroup.worldColorAlpha}),(0,c.j)(e.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),t&&e.renderGroup.localTransform.copyFrom(i),e.parent=r,e.renderGroup.renderGroupParent=n}destroy(){this._renderer=null}_updateCachedRenderGroups(e,t){if(e._parentCacheAsTextureRenderGroup=t,e.isCachedAsTexture){if(!e.textureNeedsUpdate)return;t=e}for(let r=e.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(e.renderGroupChildren[r],t);if(e.invalidateMatrices(),e.isCachedAsTexture){if(e.textureNeedsUpdate){const t=e.root.getLocalBounds(),r=this._renderer,n=e.textureOptions.resolution||r.view.resolution,s=e.textureOptions.antialias??r.view.antialias,i=e.textureOptions.scaleMode??"linear",a=e.texture;t.ceil(),e.texture&&o.W.returnTexture(e.texture,!0);const u=o.W.getOptimalTexture(t.width,t.height,n,s);u._source.style=new d.n({scaleMode:i}),e.texture=u,e._textureBounds||(e._textureBounds=new l.c),e._textureBounds.copyFrom(t),a!==e.texture&&e.renderGroupParent&&(e.renderGroupParent.structureDidChange=!0)}}else e.texture&&(o.W.returnTexture(e.texture,!0),e.texture=null)}_updateRenderGroups(e){const t=this._renderer,r=t.renderPipes;if(e.runOnRender(t),e.instructionSet.renderPipes=r,e.structureDidChange?u(e.childrenRenderablesToUpdate.list,0):function(e,t){const{list:r}=e.childrenRenderablesToUpdate;let n=!1;for(let s=0;s<e.childrenRenderablesToUpdate.index;s++){const e=r[s];if(n=t[e.renderPipeId].validateRenderable(e),n)break}e.structureDidChange=n}(e,r),m(e),e.structureDidChange?(e.structureDidChange=!1,this._buildInstructions(e,t)):this._updateRenderables(e),e.childrenRenderablesToUpdate.index=0,t.renderPipes.batch.upload(e.instructionSet),!e.isCachedAsTexture||e.textureNeedsUpdate)for(let t=0;t<e.renderGroupChildren.length;t++)this._updateRenderGroups(e.renderGroupChildren[t])}_updateRenderables(e){const{list:t,index:r}=e.childrenRenderablesToUpdate;for(let n=0;n<r;n++){const r=t[n];r.didViewUpdate&&e.updateRenderable(r)}u(t,r)}_buildInstructions(e,t){const r=e.root,n=e.instructionSet;n.reset();const s=t.renderPipes?t:t.batch.renderer,i=s.renderPipes;i.batch.buildStart(n),i.blendMode.buildStart(),i.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),r.collectRenderablesWithEffects(n,s,null),i.batch.buildEnd(n),i.blendMode.buildEnd(n)}}v.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"renderGroup"};var T=r(3136),k=r(7073),y=r(780),C=r(9824);class M{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,r){this._renderer.renderPipes.batch.break(r);const n=this._colorStack;n[this._colorStackIndex]=n[this._colorStackIndex-1]&e.mask;const s=this._colorStack[this._colorStackIndex];s!==this._currentColor&&(this._currentColor=s,r.add({renderPipeId:"colorMask",colorMask:s,canBundle:!1})),this._colorStackIndex++}pop(e,t,r){this._renderer.renderPipes.batch.break(r);const n=this._colorStack;this._colorStackIndex--;const s=n[this._colorStackIndex-1];s!==this._currentColor&&(this._currentColor=s,r.add({renderPipeId:"colorMask",colorMask:s,canBundle:!1}))}execute(e){this._renderer.colorMask.setMask(e.colorMask)}destroy(){this._renderer=null,this._colorStack=null}}M.extension={type:[i.Ag.WebGLPipes,i.Ag.WebGPUPipes],name:"colorMask"};var S=r(1257),G=r(1957);class w{constructor(e){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=e}push(e,t,r){var n;const s=e,i=this._renderer;i.renderPipes.batch.break(r),i.renderPipes.blendMode.setBlendMode(s.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});const a=s.mask;a.includeInBuild=!0,this._maskHash.has(s)||this._maskHash.set(s,{instructionsStart:0,instructionsLength:0});const o=this._maskHash.get(s);o.instructionsStart=r.instructionSize,a.collectRenderables(r,i,null),a.includeInBuild=!1,i.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});const d=r.instructionSize-o.instructionsStart-1;o.instructionsLength=d;const l=i.renderTarget.renderTarget.uid;(n=this._maskStackHash)[l]??(n[l]=0)}pop(e,t,r){const n=e,s=this._renderer;s.renderPipes.batch.break(r),s.renderPipes.blendMode.setBlendMode(n.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:t._maskOptions.inverse,canBundle:!1});const i=this._maskHash.get(e);for(let e=0;e<i.instructionsLength;e++)r.instructions[r.instructionSize++]=r.instructions[i.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(e){var t;const r=this._renderer,n=r,s=r.renderTarget.renderTarget.uid;let i=(t=this._maskStackHash)[s]??(t[s]=0);"pushMaskBegin"===e.action?(n.renderTarget.ensureDepthStencil(),n.stencil.setStencilMode(G.K.RENDERING_MASK_ADD,i),i++,n.colorMask.setMask(0)):"pushMaskEnd"===e.action?(e.inverse?n.stencil.setStencilMode(G.K.INVERSE_MASK_ACTIVE,i):n.stencil.setStencilMode(G.K.MASK_ACTIVE,i),n.colorMask.setMask(15)):"popMaskBegin"===e.action?(n.colorMask.setMask(0),0!==i?n.stencil.setStencilMode(G.K.RENDERING_MASK_REMOVE,i):(n.renderTarget.clear(null,S.u.STENCIL),n.stencil.setStencilMode(G.K.DISABLED,i)),i--):"popMaskEnd"===e.action&&(e.inverse?n.stencil.setStencilMode(G.K.INVERSE_MASK_ACTIVE,i):n.stencil.setStencilMode(G.K.MASK_ACTIVE,i),n.colorMask.setMask(15)),this._maskStackHash[s]=i}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}}w.extension={type:[i.Ag.WebGLPipes,i.Ag.WebGPUPipes],name:"stencilMask"};var R=r(2577),P=r(268);const A=class e{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new R.Q(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...e.defaultOptions,...t},this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(e){R.Q.shared.setValue(e).alpha<1&&1===this._backgroundColor.alpha&&(0,P.R)("Cannot set a transparent background on an opaque canvas. To enable transparency, set backgroundAlpha < 1 when initializing your Application."),this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};A.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"background",priority:0},A.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let B=A;var U=r(360),O=r(1761),I=r(5589);const L={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},D=class e{constructor(e){this._renderer=e}_normalizeOptions(e,t={}){return e instanceof h.mc||e instanceof I.g?{target:e,...t}:{...t,...e}}async image(e){const t=O.e.get().createImage();return t.src=await this.base64(e),t}async base64(t){t=this._normalizeOptions(t,e.defaultImageOptions);const{format:r,quality:n}=t,s=this.canvas(t);if(void 0!==s.toBlob)return new Promise(((e,t)=>{s.toBlob((r=>{if(!r)return void t(new Error("ICanvas.toBlob failed!"));const n=new FileReader;n.onload=()=>e(n.result),n.onerror=t,n.readAsDataURL(r)}),L[r],n)}));if(void 0!==s.toDataURL)return s.toDataURL(L[r],n);if(void 0!==s.convertToBlob){const e=await s.convertToBlob({type:L[r],quality:n});return new Promise(((t,r)=>{const n=new FileReader;n.onload=()=>t(n.result),n.onerror=r,n.readAsDataURL(e)}))}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e){const t=(e=this._normalizeOptions(e)).target,r=this._renderer;if(t instanceof I.g)return r.texture.generateCanvas(t);const n=r.textureGenerator.generateTexture(e),s=r.texture.generateCanvas(n);return n.destroy(!0),s}pixels(e){const t=(e=this._normalizeOptions(e)).target,r=this._renderer,n=t instanceof I.g?t:r.textureGenerator.generateTexture(e),s=r.texture.getPixels(n);return t instanceof h.mc&&n.destroy(!0),s}texture(e){return(e=this._normalizeOptions(e)).target instanceof I.g?e.target:this._renderer.textureGenerator.generateTexture(e)}download(e){e=this._normalizeOptions(e);const t=this.canvas(e),r=document.createElement("a");r.download=e.filename??"image.png",r.href=t.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(e){const t=e.width??200;e=this._normalizeOptions(e);const r=this.canvas(e),n=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.height}px`);const s=["font-size: 1px;",`padding: ${t}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",s)}destroy(){this._renderer=null}};D.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"extract"},D.defaultImageOptions={format:"png",quality:1};let F=D;var W=r(9252),z=r(7269),E=r(583);class H extends I.g{static create(e){const{dynamic:t,...r}=e;return new H({source:new E.v(r),dynamic:t??!1})}resize(e,t,r){return this.source.resize(e,t,r),this}}const j=new W.M,V=new l.c,N=[0,0,0,0];class q{constructor(e){this._renderer=e}generateTexture(e){e instanceof h.mc&&(e={target:e,frame:void 0,textureSourceOptions:{},resolution:void 0});const t=e.resolution||this._renderer.resolution,r=e.antialias||this._renderer.view.antialias,n=e.target;let s=e.clearColor;if(s){s=Array.isArray(s)&&4===s.length?s:R.Q.shared.setValue(s).toArray()}else s=N;const i=e.frame?.copyTo(j)||(0,z.n)(n,V).rectangle;i.width=0|Math.max(i.width,1/t),i.height=0|Math.max(i.height,1/t);const o=H.create({...e.textureSourceOptions,width:i.width,height:i.height,resolution:t,antialias:r}),d=a.u.shared.translate(-i.x,-i.y);return this._renderer.render({container:n,transform:d,target:o,clearColor:s}),o.source.updateMipmaps(),o}destroy(){this._renderer=null}}function K(e){let t=!1;for(const r in e)if(null==e[r]){t=!0;break}if(!t)return e;const r=Object.create(null);for(const t in e){const n=e[t];n&&(r[t]=n)}return r}function $(e){let t=0;for(let r=0;r<e.length;r++)null==e[r]?t++:e[r-t]=e[r];return e.length-=t,e}q.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"textureGenerator"};const J=class e{constructor(e){this._managedResources=[],this._managedResourceHashes=[],this._managedCollections=[],this._ready=!1,this._renderer=e}init(t){t={...e.defaultOptions,...t},this.maxUnusedTime=t.gcMaxUnusedTime,this._frequency=t.gcFrequency,this.enabled=t.gcActive,this.now=performance.now()}get enabled(){return!!this._handler}set enabled(e){this.enabled!==e&&(e?(this._handler=this._renderer.scheduler.repeat((()=>{this._ready=!0}),this._frequency,!1),this._collectionsHandler=this._renderer.scheduler.repeat((()=>{for(const e of this._managedCollections){const{context:t,collection:r,type:n}=e;t[r]="hash"===n?K(t[r]):$(t[r])}}),this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._collectionsHandler),this._handler=0,this._collectionsHandler=0))}prerender({container:e}){this.now=performance.now(),e.renderGroup.gcTick=this._renderer.tick++,this._updateInstructionGCTick(e.renderGroup,e.renderGroup.gcTick)}postrender(){this._ready&&this.enabled&&(this.run(),this._ready=!1)}_updateInstructionGCTick(e,t){e.instructionSet.gcTick=t,e.gcTick=t;for(const r of e.renderGroupChildren)this._updateInstructionGCTick(r,t)}addCollection(e,t,r){this._managedCollections.push({context:e,collection:t,type:r})}addResource(e,t){if(-1!==e._gcLastUsed)return e._gcLastUsed=this.now,void e._onTouch?.(this.now);const r=this._managedResources.length;e._gcData={index:r,type:t},e._gcLastUsed=this.now,e._onTouch?.(this.now),e.once("unload",this.removeResource,this),this._managedResources.push(e)}removeResource(e){const t=e._gcData;if(!t)return;const r=t.index,n=this._managedResources.length-1;if(r!==n){const e=this._managedResources[n];this._managedResources[r]=e,e._gcData.index=r}this._managedResources.length--,e._gcData=null,e._gcLastUsed=-1}addResourceHash(e,t,r,n=0){this._managedResourceHashes.push({context:e,hash:t,type:r,priority:n}),this._managedResourceHashes.sort(((e,t)=>e.priority-t.priority))}run(){const e=performance.now(),t=this._managedResourceHashes;for(const r of t)this.runOnHash(r,e);let r=0;for(let t=0;t<this._managedResources.length;t++){const n=this._managedResources[t];r=this.runOnResource(n,e,r)}this._managedResources.length=r}updateRenderableGCTick(e,t){const r=e.renderGroup??e.parentRenderGroup,n=r?.instructionSet?.gcTick??-1;(r?.gcTick??0)===n&&(e._gcLastUsed=t,e._onTouch?.(t))}runOnResource(e,t,r){const n=e._gcData;"renderable"===n.type&&this.updateRenderableGCTick(e,t);return t-e._gcLastUsed<this.maxUnusedTime||!e.autoGarbageCollect?(this._managedResources[r]=e,n.index=r,r++):(e.unload(),e._gcData=null,e._gcLastUsed=-1,e.off("unload",this.removeResource,this)),r}_createHashClone(e,t){const r=Object.create(null);for(const n in e){if(n===t)break;null!==e[n]&&(r[n]=e[n])}return r}runOnHash(e,t){const{context:r,hash:n,type:s}=e,i=r[n];let a=null,o=0;for(const e in i){const r=i[e];if(null===r){o++,1e4!==o||a||(a=this._createHashClone(i,e));continue}if(-1===r._gcLastUsed){r._gcLastUsed=t,r._onTouch?.(t),a&&(a[e]=r);continue}"renderable"===s&&this.updateRenderableGCTick(r,t);if(!(t-r._gcLastUsed<this.maxUnusedTime)&&r.autoGarbageCollect){if(a||(o+1!==1e4?(i[e]=null,o++):a=this._createHashClone(i,e)),"renderable"===s){const e=r,t=e.renderGroup??e.parentRenderGroup;t&&(t.structureDidChange=!0)}r.unload(),r._gcData=null,r._gcLastUsed=-1}else a&&(a[e]=r)}a&&(r[n]=a)}destroy(){this.enabled=!1,this._managedResources.forEach((e=>{e.off("unload",this.removeResource,this)})),this._managedResources.length=0,this._managedResourceHashes.length=0,this._managedCollections.length=0,this._renderer=null}};J.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"gc",priority:0},J.defaultOptions={gcActive:!0,gcMaxUnusedTime:6e4,gcFrequency:3e4};let X=J;var Z=r(5101),Q=r(2760),Y=r(3513),ee=r(5099),te=r(5811);class re{constructor(e){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=e}reset(){this._stackIndex=0;for(let e=0;e<this._activeUniforms.length;e++)this._uniformsPool.push(this._activeUniforms[e]);for(let e=0;e<this._activeBindGroups.length;e++)this._bindGroupPool.push(this._activeBindGroups[e]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(e){this.reset(),this.push(e)}bind({size:e,projectionMatrix:t,worldTransformMatrix:r,worldColor:n,offset:s}){const i=this._renderer.renderTarget.renderTarget,o=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:i,worldTransformMatrix:new a.u,worldColor:4294967295,offset:new Z.b},d={projectionMatrix:t||this._renderer.renderTarget.projectionMatrix,resolution:e||i.size,worldTransformMatrix:r||o.worldTransformMatrix,worldColor:n||o.worldColor,offset:s||o.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);const u=l.uniforms;let c;u.uProjectionMatrix=d.projectionMatrix,u.uResolution=d.resolution,u.uWorldTransformMatrix.copyFrom(d.worldTransformMatrix),u.uWorldTransformMatrix.tx-=d.offset.x,u.uWorldTransformMatrix.ty-=d.offset.y,(0,Q.V)(d.worldColor,u.uWorldColorAlpha,0),l.update(),this._renderer.renderPipes.uniformBatch?c=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(c=this._bindGroupPool.pop()||new Y.T,this._activeBindGroups.push(c),c.setResource(l,0)),d.bindGroup=c,this._currentGlobalUniformData=d}push(e){this.bind(e),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===ee.W.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new te.k({uProjectionMatrix:{value:new a.u,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new a.u,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null,this._globalUniformDataStack.length=0,this._uniformsPool.length=0,this._activeUniforms.length=0,this._bindGroupPool.length=0,this._activeBindGroups.length=0,this._currentGlobalUniformData=null}}re.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"globalUniforms"};var ne=r(7309);let se=1;class ie{constructor(){this._tasks=[],this._offset=0}init(){ne.R.system.add(this._update,this)}repeat(e,t,r=!0){const n=se++;let s=0;return r&&(this._offset+=1e3,s=this._offset),this._tasks.push({func:e,duration:t,start:performance.now(),offset:s,last:performance.now(),repeat:!0,id:n}),n}cancel(e){for(let t=0;t<this._tasks.length;t++)if(this._tasks[t].id===e)return void this._tasks.splice(t,1)}_update(){const e=performance.now();for(let t=0;t<this._tasks.length;t++){const r=this._tasks[t];if(e-r.offset-r.last>=r.duration){const t=e-r.start;r.func(t),r.last=e}}}destroy(){ne.R.system.remove(this._update,this),this._tasks.length=0}}ie.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"scheduler",priority:0};var ae=r(2571);let oe=!1;class de{constructor(e){this._renderer=e}init(e){if(e.hello){let e=this._renderer.name;this._renderer.type===ee.W.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),function(e){if(!oe){if(O.e.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const t=[`%c %c %c %c %c PixiJS %c v${ae.xv} (${e}) http://www.pixijs.com/\n\n`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${ae.xv} - ${e} - http://www.pixijs.com/`);oe=!0}}(e)}}}de.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"hello",priority:-2},de.defaultOptions={hello:!1};var le=r(4670);const ue=class e{constructor(e){this._renderer=e}init(t){t={...e.defaultOptions,...t},this.maxUnusedTime=t.renderableGCMaxUnusedTime}get enabled(){return(0,le.t6)("8.15.0","RenderableGCSystem.enabled is deprecated, please use the GCSystem.enabled instead."),this._renderer.gc.enabled}set enabled(e){(0,le.t6)("8.15.0","RenderableGCSystem.enabled is deprecated, please use the GCSystem.enabled instead."),this._renderer.gc.enabled=e}addManagedHash(e,t){(0,le.t6)("8.15.0","RenderableGCSystem.addManagedHash is deprecated, please use the GCSystem.addCollection instead."),this._renderer.gc.addCollection(e,t,"hash")}addManagedArray(e,t){(0,le.t6)("8.15.0","RenderableGCSystem.addManagedArray is deprecated, please use the GCSystem.addCollection instead."),this._renderer.gc.addCollection(e,t,"array")}addRenderable(e){(0,le.t6)("8.15.0","RenderableGCSystem.addRenderable is deprecated, please use the GCSystem instead."),this._renderer.gc.addResource(e,"renderable")}run(){(0,le.t6)("8.15.0","RenderableGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.run()}destroy(){this._renderer=null}};ue.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"renderableGC",priority:0},ue.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};let ce=ue;const he=class e{get count(){return this._renderer.tick}get checkCount(){return this._checkCount}set checkCount(e){(0,le.t6)("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._checkCount=e}get maxIdle(){return this._renderer.gc.maxUnusedTime/1e3*60}set maxIdle(e){(0,le.t6)("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.maxUnusedTime=e/60*1e3}get checkCountMax(){return Math.floor(this._renderer.gc._frequency/1e3)}set checkCountMax(e){(0,le.t6)("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead.")}get active(){return this._renderer.gc.enabled}set active(e){(0,le.t6)("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.enabled=e}constructor(e){this._renderer=e,this._checkCount=0}init(t){t.textureGCActive!==e.defaultOptions.textureGCActive&&(this.active=t.textureGCActive),t.textureGCMaxIdle!==e.defaultOptions.textureGCMaxIdle&&(this.maxIdle=t.textureGCMaxIdle),t.textureGCCheckCountMax!==e.defaultOptions.textureGCCheckCountMax&&(this.checkCountMax=t.textureGCCheckCountMax)}run(){(0,le.t6)("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.run()}destroy(){this._renderer=null}};he.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem],name:"textureGC"},he.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:3600,textureGCCheckCountMax:600};let pe=he;var ge=r(279),fe=r(8725);const me=class e{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(e){this.texture.source.autoDensity=e}get resolution(){return this.texture.source._resolution}set resolution(e){this.texture.source.resize(this.texture.source.width,this.texture.source.height,e)}init(t){(t={...e.defaultOptions,...t}).view&&((0,le.t6)(le.lj,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new W.M(0,0,t.width,t.height),this.canvas=t.canvas||O.e.get().createCanvas(),this.antialias=!!t.antialias,this.texture=(0,fe.c)(this.canvas,t),this.renderTarget=new ge.O({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(e,t,r){this.texture.source.resize(e,t,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(e=!1){("boolean"==typeof e?e:!!e?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.texture.destroy()}};me.extension={type:[i.Ag.WebGLSystem,i.Ag.WebGPUSystem,i.Ag.CanvasSystem],name:"view",priority:0},me.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};const _e=[B,re,de,me,v,X,pe,q,F,k.d,ce,ie],xe=[U.j,y.s,T.k,s.a,C.z,w,M,n._]},8725:(e,t,r)=>{r.d(t,{c:()=>o});var n=r(6083),s=r(4884),i=r(5589);const a=new Map;function o(e,t){if(!a.has(e)){const r=new i.g({source:new s.q({resource:e,...t})}),n=()=>{a.get(e)===r&&a.delete(e)};r.once("destroy",n),r.source.once("destroy",n),a.set(e,r)}return a.get(e)}n.L.register(a)},594:(e,t,r)=>{r.d(t,{_:()=>s});var n=r(8507);class s{constructor(e){this._renderer=e}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}execute(e){e.isRenderable&&e.render(this._renderer)}destroy(){this._renderer=null}}s.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"customRender"}},1160:(e,t,r)=>{r.d(t,{a:()=>d});var n=r(8507),s=r(9313),i=r(8655),a=r(8422),o=r(433);class d{constructor(e){this._renderer=e}addRenderGroup(e,t){e.isCachedAsTexture?this._addRenderableCacheAsTexture(e,t):this._addRenderableDirect(e,t)}execute(e){e.isRenderable&&(e.isCachedAsTexture?this._executeCacheAsTexture(e):this._executeDirect(e))}destroy(){this._renderer=null}_addRenderableDirect(e,t){this._renderer.renderPipes.batch.break(t),e._batchableRenderGroup&&(i.Z.return(e._batchableRenderGroup),e._batchableRenderGroup=null),t.add(e)}_addRenderableCacheAsTexture(e,t){const r=e._batchableRenderGroup??(e._batchableRenderGroup=i.Z.get(a.K));r.renderable=e.root,r.transform=e.root.relativeGroupTransform,r.texture=e.texture,r.bounds=e._textureBounds,t.add(e),this._renderer.renderPipes.blendMode.pushBlendMode(e,e.root.groupBlendMode,t),this._renderer.renderPipes.batch.addToBatch(r,t),this._renderer.renderPipes.blendMode.popBlendMode(t)}_executeCacheAsTexture(e){if(e.textureNeedsUpdate){e.textureNeedsUpdate=!1;const t=(new s.u).translate(-e._textureBounds.x,-e._textureBounds.y);this._renderer.renderTarget.push(e.texture,!0,null,e.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:t,worldColor:4294967295,offset:{x:0,y:0}}),(0,o.j)(e,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}e._batchableRenderGroup._batcher.updateElement(e._batchableRenderGroup),e._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(e){this._renderer.globalUniforms.push({worldTransformMatrix:e.inverseParentTextureTransform,worldColor:e.worldColorAlpha}),(0,o.j)(e,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}}d.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"renderGroup"}},433:(e,t,r)=>{function n(e,t){const r=e.instructionSet,n=r.instructions;for(let e=0;e<r.instructionSize;e++){const r=n[e];t[r.renderPipeId].execute(r)}}r.d(t,{j:()=>n})},3136:(e,t,r)=>{r.d(t,{k:()=>i});var n=r(8507),s=r(8422);class i{constructor(e){this._renderer=e}addRenderable(e,t){const r=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,r),this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){const t=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){const t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}_updateBatchableSprite(e,t){t.bounds=e.visualBounds,t.texture=e._texture}_getGpuSprite(e){return e._gpuData[this._renderer.uid]||this._initGPUSprite(e)}_initGPUSprite(e){const t=new s.K;return t.renderable=e,t.transform=e.groupTransform,t.texture=e._texture,t.bounds=e.visualBounds,t.roundPixels=this._renderer._roundPixels|e._roundPixels,e._gpuData[this._renderer.uid]=t,t}destroy(){this._renderer=null}}i.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"sprite"}}}]);
@@ -1 +1 @@
1
- (self.webpackChunkvizor_2d=self.webpackChunkvizor_2d||[]).push([[851],{6851:(e,t,n)=>{n.d(t,{CanvasRenderer:()=>se});var a=n(8507),r=n(594),o=n(1160),i=n(2079),s=n(9313),c=n(2577),l=n(1761);let h;function d(e){const t=l.e.get().createCanvas(6,1),n=t.getContext("2d");return n.fillStyle=e,n.fillRect(0,0,6,1),t}function u(){if(void 0!==h)return h;try{const e=d("#ff00ff"),t=d("#ffff00"),n=l.e.get().createCanvas(6,1).getContext("2d");n.globalCompositeOperation="multiply",n.drawImage(e,0,0),n.drawImage(t,2,0);const a=n.getImageData(2,0,1,1);if(a){const e=a.data;h=255===e[0]&&0===e[1]&&0===e[2]}else h=!1}catch(e){h=!1}return h}const p={canvas:null,convertTintToImage:!1,cacheStepsPerColorChannel:8,canUseMultiply:u(),tintMethod:null,_canvasSourceCache:new WeakMap,_unpremultipliedCache:new WeakMap,getCanvasSource:e=>{const t=e.source,n=t?.resource;if(!n)return null;const a="premultiplied-alpha"===t.alphaMode,r=t.resourceWidth??t.pixelWidth,o=t.resourceHeight??t.pixelHeight,i=r!==t.pixelWidth||o!==t.pixelHeight;if(a){if((n instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&n instanceof OffscreenCanvas)&&!i)return n;const e=p._unpremultipliedCache.get(t);if(e?.resourceId===t._resourceId)return e.canvas}if(n instanceof Uint8Array||n instanceof Uint8ClampedArray||n instanceof Int8Array||n instanceof Uint16Array||n instanceof Int16Array||n instanceof Uint32Array||n instanceof Int32Array||n instanceof Float32Array||n instanceof ArrayBuffer){const e=p._canvasSourceCache.get(t);if(e?.resourceId===t._resourceId)return e.canvas;const a=l.e.get().createCanvas(t.pixelWidth,t.pixelHeight),r=a.getContext("2d"),o=r.createImageData(t.pixelWidth,t.pixelHeight),i=o.data,s=n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength);if("bgra8unorm"===t.format)for(let e=0;e<i.length&&e+3<s.length;e+=4)i[e]=s[e+2],i[e+1]=s[e+1],i[e+2]=s[e],i[e+3]=s[e+3];else i.set(s.subarray(0,i.length));return r.putImageData(o,0,0),p._canvasSourceCache.set(t,{canvas:a,resourceId:t._resourceId}),a}if(a){const e=l.e.get().createCanvas(t.pixelWidth,t.pixelHeight),a=e.getContext("2d",{willReadFrequently:!0});e.width=t.pixelWidth,e.height=t.pixelHeight,a.drawImage(n,0,0);const r=a.getImageData(0,0,e.width,e.height),o=r.data;for(let e=0;e<o.length;e+=4){const t=o[e+3];if(t>0){const n=255/t;o[e]=Math.min(255,o[e]*n+.5),o[e+1]=Math.min(255,o[e+1]*n+.5),o[e+2]=Math.min(255,o[e+2]*n+.5)}}return a.putImageData(r,0,0),p._unpremultipliedCache.set(t,{canvas:e,resourceId:t._resourceId}),e}if(i){const e=p._canvasSourceCache.get(t);if(e?.resourceId===t._resourceId)return e.canvas;const a=l.e.get().createCanvas(t.pixelWidth,t.pixelHeight),r=a.getContext("2d");return a.width=t.pixelWidth,a.height=t.pixelHeight,r.drawImage(n,0,0),p._canvasSourceCache.set(t,{canvas:a,resourceId:t._resourceId}),a}return n},getTintedCanvas:(e,t)=>{const n=e.texture,a=c.Q.shared.setValue(t).toHex(),r=n.tintCache||(n.tintCache={}),o=r[a],i=n.source._resourceId;if(o?.tintId===i)return o;const s=o&&"getContext"in o?o:l.e.get().createCanvas();if(p.tintMethod(n,t,s),s.tintId=i,p.convertTintToImage&&void 0!==s.toDataURL){const e=l.e.get().createImage();e.src=s.toDataURL(),e.tintId=i,r[a]=e}else r[a]=s;return r[a]},getTintedPattern:(e,t)=>{const n=c.Q.shared.setValue(t).toHex(),a=e.patternCache||(e.patternCache={}),r=e.source._resourceId;let o=a[n];if(o?.tintId===r)return o;p.canvas||(p.canvas=l.e.get().createCanvas()),p.tintMethod(e,t,p.canvas);return o=p.canvas.getContext("2d").createPattern(p.canvas,"repeat"),o.tintId=r,a[n]=o,o},applyPatternTransform:(e,t,n=!0)=>{if(!t)return;const a=e;if(!a.setTransform)return;const r=globalThis.DOMMatrix;if(!r)return;const o=new r([t.a,t.b,t.c,t.d,t.tx,t.ty]);a.setTransform(n?o.inverse():o)},tintWithMultiply:(e,t,n)=>{const a=n.getContext("2d"),r=e.frame.clone(),o=e.source._resolution??e.source.resolution??1,s=e.rotate;r.x*=o,r.y*=o,r.width*=o,r.height*=o;const l=i.E.isVertical(s),h=l?r.height:r.width,d=l?r.width:r.height;n.width=Math.ceil(h),n.height=Math.ceil(d),a.save(),a.fillStyle=c.Q.shared.setValue(t).toHex(),a.fillRect(0,0,h,d),a.globalCompositeOperation="multiply";const u=p.getCanvasSource(e);u?(s&&p._applyInverseRotation(a,s,r.width,r.height),a.drawImage(u,r.x,r.y,r.width,r.height,0,0,r.width,r.height),a.globalCompositeOperation="destination-atop",a.drawImage(u,r.x,r.y,r.width,r.height,0,0,r.width,r.height),a.restore()):a.restore()},tintWithOverlay:(e,t,n)=>{const a=n.getContext("2d"),r=e.frame.clone(),o=e.source._resolution??e.source.resolution??1,s=e.rotate;r.x*=o,r.y*=o,r.width*=o,r.height*=o;const l=i.E.isVertical(s),h=l?r.height:r.width,d=l?r.width:r.height;n.width=Math.ceil(h),n.height=Math.ceil(d),a.save(),a.globalCompositeOperation="copy",a.fillStyle=c.Q.shared.setValue(t).toHex(),a.fillRect(0,0,h,d),a.globalCompositeOperation="destination-atop";const u=p.getCanvasSource(e);u?(s&&p._applyInverseRotation(a,s,r.width,r.height),a.drawImage(u,r.x,r.y,r.width,r.height,0,0,r.width,r.height),a.restore()):a.restore()},tintWithPerPixel:(e,t,n)=>{const a=n.getContext("2d"),r=e.frame.clone(),o=e.source._resolution??e.source.resolution??1,s=e.rotate;r.x*=o,r.y*=o,r.width*=o,r.height*=o;const c=i.E.isVertical(s),l=c?r.height:r.width,h=c?r.width:r.height;n.width=Math.ceil(l),n.height=Math.ceil(h),a.save(),a.globalCompositeOperation="copy";const d=p.getCanvasSource(e);if(!d)return void a.restore();s&&p._applyInverseRotation(a,s,r.width,r.height),a.drawImage(d,r.x,r.y,r.width,r.height,0,0,r.width,r.height),a.restore();const u=t>>16&255,g=t>>8&255,m=255&t,f=a.getImageData(0,0,l,h),x=f.data;for(let e=0;e<x.length;e+=4)x[e]=x[e]*u/255,x[e+1]=x[e+1]*g/255,x[e+2]=x[e+2]*m/255;a.putImageData(f,0,0)},_applyInverseRotation:(e,t,n,a)=>{const r=i.E.inv(t),o=i.E.uX(r),s=i.E.uY(r),c=i.E.vX(r),l=i.E.vY(r),h=-Math.min(0,o*n,c*a,o*n+c*a),d=-Math.min(0,s*n,l*a,s*n+l*a);e.transform(o,s,c,l,h,d)}};p.tintMethod=p.canUseMultiply?p.tintWithMultiply:p.tintWithPerPixel;var g=n(5589),m=n(198),f=n(4676),x=n(115),v=n(7276),y=n(2806),C=n(2801),_=n(2413);const w=new s.u,T=new s.u,b=new s.u,k=new s.u;function M(e,t,n){e.beginPath();for(let a=0;a<n.length;a+=3){const r=2*n[a],o=2*n[a+1],i=2*n[a+2];e.moveTo(t[r],t[r+1]),e.lineTo(t[o],t[o+1]),e.lineTo(t[i],t[i+1]),e.closePath()}e.fill()}function I(e,t){switch(t.type){case"rectangle":{const n=t;e.rect(n.x,n.y,n.width,n.height);break}case"roundedRectangle":{const n=t;!function(e,t,n,a,r,o){o=Math.max(0,Math.min(o,Math.min(a,r)/2)),e.moveTo(t+o,n),e.lineTo(t+a-o,n),e.quadraticCurveTo(t+a,n,t+a,n+o),e.lineTo(t+a,n+r-o),e.quadraticCurveTo(t+a,n+r,t+a-o,n+r),e.lineTo(t+o,n+r),e.quadraticCurveTo(t,n+r,t,n+r-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n)}(e,n.x,n.y,n.width,n.height,n.radius);break}case"circle":{const n=t;e.arc(n.x,n.y,n.radius,0,2*Math.PI);break}case"ellipse":{const n=t;e.ellipse?e.ellipse(n.x,n.y,n.halfWidth,n.halfHeight,0,0,2*Math.PI):(e.save(),e.translate(n.x,n.y),e.scale(n.halfWidth,n.halfHeight),e.arc(0,0,1,0,2*Math.PI),e.restore());break}case"triangle":{const n=t;e.moveTo(n.x,n.y),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3),e.closePath();break}default:{const n=t,a=n.points;if(!a?.length)break;e.moveTo(a[0],a[1]);for(let t=2;t<a.length;t+=2)e.lineTo(a[t],a[t+1]);n.closePath&&e.closePath();break}}}function P(e,t){if(!t?.length)return!1;for(let n=0;n<t.length;n++){const a=t[n];if(!a?.shape)continue;const r=a.transform,o=r&&!r.isIdentity();o&&(e.save(),e.transform(r.a,r.b,r.c,r.d,r.tx,r.ty)),I(e,a.shape),o&&e.restore()}return!0}function S(e,t,n,a){const r=e.fill;if(r instanceof v._){r.buildGradient();const o=r.texture;if(o){const i=p.getTintedPattern(o,t),s=n?k.copyFrom(n).scale(o.source.pixelWidth,o.source.pixelHeight):k.copyFrom(r.transform);return a&&!e.textureSpace&&s.append(a),p.applyPatternTransform(i,s),i}}if(r instanceof y.m){const e=p.getTintedPattern(r.texture,t);return p.applyPatternTransform(e,r.transform),e}const o=e.texture;if(o&&o!==g.g.WHITE){if(!o.source.resource)return"#808080";const a=p.getTintedPattern(o,t),r=n?k.copyFrom(n).scale(o.source.pixelWidth,o.source.pixelHeight):e.matrix;return p.applyPatternTransform(a,r),a}return`#${(16777215&t).toString(16).padStart(6,"0")}`}class A{constructor(){this.shader=null}contextChange(e){}execute(e,t){const n=e.renderer,a=n.canvasContext,r=a.activeContext,o=t.groupTransform,s=n.globalUniforms.globalUniformData?.worldColor??4294967295,c=t.groupColorAlpha,l=(s>>>24&255)/255*((c>>>24&255)/255)*(n.filter?.alphaMultiplier??1);if(l<=0)return;const h=16777215&s,d=16777215&c,u=(0,m.D)((0,f.u)(d,h)),v=n._roundPixels|t._roundPixels;r.save(),a.setContextTransform(o,1===v),a.setBlendMode(t.groupBlendMode);const y=t.context.instructions;for(let e=0;e<y.length;e++){const t=y[e];if("texture"===t.action){const e=t.data,n=e.image,s=n?p.getCanvasSource(n):null;if(!s)continue;const c=e.alpha*l;if(c<=0)continue;const h=(0,f.u)(e.style,u);r.globalAlpha=c;let d=s;16777215!==h&&(d=p.getTintedCanvas({texture:n},h));const g=n.frame,m=n.source._resolution??n.source.resolution??1;let x=g.x*m,y=g.y*m;const C=g.width*m,_=g.height*m;d!==s&&(x=0,y=0);const T=e.transform,b=T&&!T.isIdentity(),k=n.rotate;b||k?(w.copyFrom(o),b&&w.append(T),k&&i.E.matrixAppendRotationInv(w,k,e.dx,e.dy,e.dw,e.dh),a.setContextTransform(w,1===v)):a.setContextTransform(o,1===v),r.drawImage(d,x,y,d===s?C:d.width,d===s?_:d.height,k?0:e.dx,k?0:e.dy,e.dw,e.dh),(b||k)&&a.setContextTransform(o,1===v);continue}const n=t.data,s=n?.path?.shapePath;if(!s?.shapePrimitives?.length)continue;const c=n.style,h=(0,f.u)(c.color,u),d=c.alpha*l;if(d<=0)continue;const m="stroke"===t.action;if(r.globalAlpha=d,m){const e=c;r.lineWidth=e.width,r.lineCap=e.cap,r.lineJoin=e.join,r.miterLimit=e.miterLimit}const k=s.shapePrimitives;if(!m&&n.hole?.shapePath?.shapePrimitives?.length){k[k.length-1].holes=n.hole.shapePath.shapePrimitives}for(let e=0;e<k.length;e++){const t=k[e];if(!t?.shape)continue;const n=t.transform,a=n&&!n.isIdentity(),i=c.texture&&c.texture!==g.g.WHITE,s="global"===c.textureSpace?n:null,l=S(c,h,i?(0,_.Y)(T,c,t.shape,s):null,a?b.copyFrom(o).append(n):o);if(a&&(r.save(),r.transform(n.a,n.b,n.c,n.d,n.tx,n.ty)),m){const e=c;if(.5!==e.alignment&&!e.pixelLine){const n=[],a=[],o=[],i=C.y[t.shape.type];if(i?.build(t.shape,n)){const i=t.shape.closePath??!0;(0,x.h)(n,e,!1,i,a,o),r.fillStyle=l,M(r,a,o)}else r.strokeStyle=l,r.beginPath(),I(r,t.shape),r.stroke()}else r.strokeStyle=l,r.beginPath(),I(r,t.shape),r.stroke()}else{r.fillStyle=l,r.beginPath(),I(r,t.shape);P(r,t.holes)?r.fill("evenodd"):r.fill()}a&&r.restore()}}r.restore()}destroy(){this.shader=null}}A.extension={type:[a.Ag.CanvasPipesAdaptor],name:"graphics"};var R=n(3136);const W=class e{static _getPatternRepeat(e,t){const n=e&&"clamp-to-edge"!==e,a=t&&"clamp-to-edge"!==t;return n&&a?"repeat":n?"repeat-x":a?"repeat-y":"no-repeat"}start(e,t,n){}execute(t,n){const a=n.elements;if(!a||!a.length)return;const r=t.renderer,o=r.canvasContext,s=o.activeContext;for(let t=0;t<a.length;t++){const c=a[t];if(!c.packAsQuad)continue;const l=c,h=l.texture,d=h?p.getCanvasSource(h):null;if(!d)continue;const u=h.source.style,g=o.smoothProperty,x="nearest"!==u.scaleMode;s[g]!==x&&(s[g]=x),o.setBlendMode(n.blendMode);const v=r.globalUniforms.globalUniformData?.worldColor??4294967295,y=l.color,C=(v>>>24&255)/255*((y>>>24&255)/255)*(r.filter?.alphaMultiplier??1);if(C<=0)continue;s.globalAlpha=C;const _=16777215&v,w=16777215&y,T=(0,m.D)((0,f.u)(w,_)),b=h.frame,k=u.addressModeU??u.addressMode,M=u.addressModeV??u.addressMode,I=e._getPatternRepeat(k,M),P=h.source._resolution??h.source.resolution??1,S=l.renderable?.renderGroup?.isCachedAsTexture,A=b.x*P,R=b.y*P,W=b.width*P,H=b.height*P,E=l.bounds,B=r.renderTarget.renderTarget.isRoot,O=E.minX,D=E.minY,U=E.maxX-E.minX,q=E.maxY-E.minY,F=h.rotate,V=h.uvs,G=Math.min(V.x0,V.x1,V.x2,V.x3,V.y0,V.y1,V.y2,V.y3),L=Math.max(V.x0,V.x1,V.x2,V.x3,V.y0,V.y1,V.y2,V.y3),X="no-repeat"!==I&&(G<0||L>1),Y=F&&!(!X&&(16777215!==T||F));Y?(e._tempPatternMatrix.copyFrom(l.transform),i.E.matrixAppendRotationInv(e._tempPatternMatrix,F,O,D,U,q),o.setContextTransform(e._tempPatternMatrix,1===l.roundPixels,void 0,S&&B)):o.setContextTransform(l.transform,1===l.roundPixels,void 0,S&&B);const Q=Y?0:O,z=Y?0:D,N=U,j=q;if(X){let t=d;const n=16777215!==T&&!F,a=b.width<=h.source.width&&b.height<=h.source.height;n&&a&&(t=p.getTintedCanvas({texture:h},T));const r=s.createPattern(t,I);if(!r)continue;const o=N,i=j;if(0===o||0===i)continue;const c=1/o,l=1/i,u=(V.x1-V.x0)*c,g=(V.y1-V.y0)*c,m=(V.x3-V.x0)*l,f=(V.y3-V.y0)*l,x=V.x0-u*Q-m*z,v=V.y0-g*Q-f*z,y=h.source.pixelWidth,C=h.source.pixelHeight;e._tempPatternMatrix.set(u*y,g*C,m*y,f*C,x*y,v*C),p.applyPatternTransform(r,e._tempPatternMatrix),s.fillStyle=r,s.fillRect(Q,z,N,j)}else{const e=16777215!==T||F?p.getTintedCanvas({texture:h},T):d,t=e!==d;s.drawImage(e,t?0:A,t?0:R,t?e.width:W,t?e.height:H,Q,z,N,j)}}}};W._tempPatternMatrix=new s.u,W.extension={type:[a.Ag.CanvasPipesAdaptor],name:"batch"};let H=W;var E=n(780),B=n(9824);class O{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,n){this._renderer.renderPipes.batch.break(n);const a=this._colorStack;a[this._colorStackIndex]=a[this._colorStackIndex-1]&e.mask;const r=this._colorStack[this._colorStackIndex];r!==this._currentColor&&(this._currentColor=r,n.add({renderPipeId:"colorMask",colorMask:r,canBundle:!1})),this._colorStackIndex++}pop(e,t,n){this._renderer.renderPipes.batch.break(n);const a=this._colorStack;this._colorStackIndex--;const r=a[this._colorStackIndex-1];r!==this._currentColor&&(this._currentColor=r,n.add({renderPipeId:"colorMask",colorMask:r,canBundle:!1}))}execute(e){}destroy(){this._renderer=null,this._colorStack=null}}O.extension={type:[a.Ag.CanvasPipes],name:"colorMask"};var D=n(9501),U=n(268);function q(e,t){switch(t.type){case"rectangle":{const n=t;e.rect(n.x,n.y,n.width,n.height);break}case"roundedRectangle":{const n=t;!function(e,t,n,a,r,o){o=Math.max(0,Math.min(o,Math.min(a,r)/2)),e.moveTo(t+o,n),e.lineTo(t+a-o,n),e.quadraticCurveTo(t+a,n,t+a,n+o),e.lineTo(t+a,n+r-o),e.quadraticCurveTo(t+a,n+r,t+a-o,n+r),e.lineTo(t+o,n+r),e.quadraticCurveTo(t,n+r,t,n+r-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n)}(e,n.x,n.y,n.width,n.height,n.radius);break}case"circle":{const n=t;e.moveTo(n.x+n.radius,n.y),e.arc(n.x,n.y,n.radius,0,2*Math.PI);break}case"ellipse":{const n=t;e.ellipse?(e.moveTo(n.x+n.halfWidth,n.y),e.ellipse(n.x,n.y,n.halfWidth,n.halfHeight,0,0,2*Math.PI)):(e.save(),e.translate(n.x,n.y),e.scale(n.halfWidth,n.halfHeight),e.moveTo(1,0),e.arc(0,0,1,0,2*Math.PI),e.restore());break}case"triangle":{const n=t;e.moveTo(n.x,n.y),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3),e.closePath();break}default:{const n=t,a=n.points;if(!a?.length)break;e.moveTo(a[0],a[1]);for(let t=2;t<a.length;t+=2)e.lineTo(a[t],a[t+1]);n.closePath&&e.closePath();break}}}function F(e,t){if(!t?.length)return!1;for(let n=0;n<t.length;n++){const a=t[n];if(!a?.shape)continue;const r=a.transform,o=r&&!r.isIdentity();o&&(e.save(),e.transform(r.a,r.b,r.c,r.d,r.tx,r.ty)),q(e,a.shape),o&&e.restore()}return!0}class V{constructor(e){this._warnedMaskTypes=new Set,this._canvasMaskStack=[],this._renderer=e}push(e,t,n){this._renderer.renderPipes.batch.break(n),n.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,n){this._renderer.renderPipes.batch.break(n),n.add({renderPipeId:"stencilMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){if("pushMaskBegin"!==e.action&&"popMaskEnd"!==e.action)return;const t=this._renderer,n=t.canvasContext,a=n?.activeContext;if(!a)return;if("popMaskEnd"===e.action){return void(this._canvasMaskStack.pop()&&a.restore())}e.inverse&&this._warnOnce("inverse","CanvasRenderer: inverse masks are not supported on Canvas2D; ignoring inverse flag.");const r=e.mask.mask;if(!(r instanceof D.A))return this._warnOnce("nonGraphics","CanvasRenderer: only Graphics masks are supported in Canvas2D; skipping mask."),void this._canvasMaskStack.push(!1);const o=r,i=o.context?.instructions;if(!i?.length)return void this._canvasMaskStack.push(!1);a.save(),n.setContextTransform(o.groupTransform,1==(t._roundPixels|o._roundPixels)),a.beginPath();let s=!1,c=!1;for(let e=0;e<i.length;e++){const t=i[e],n=t.action;if("fill"!==n&&"stroke"!==n)continue;const r=t.data,o=r?.path?.shapePath;if(!o?.shapePrimitives?.length)continue;const l=o.shapePrimitives;for(let e=0;e<l.length;e++){const t=l[e];if(!t?.shape)continue;const n=t.transform,r=n&&!n.isIdentity();r&&(a.save(),a.transform(n.a,n.b,n.c,n.d,n.tx,n.ty)),q(a,t.shape),c=F(a,t.holes)||c,s=!0,r&&a.restore()}}if(!s)return a.restore(),void this._canvasMaskStack.push(!1);c?a.clip("evenodd"):a.clip(),this._canvasMaskStack.push(!0)}destroy(){this._renderer=null,this._warnedMaskTypes=null,this._canvasMaskStack=null}_warnOnce(e,t){this._warnedMaskTypes.has(e)||(this._warnedMaskTypes.add(e),(0,U.R)(t))}}V.extension={type:[a.Ag.CanvasPipes],name:"stencilMask"};var G=n(360),L=n(800),X=n(381),Y=n(5099);const Q="source-over";const z=new s.u;class N{constructor(e){this.activeResolution=1,this.smoothProperty="imageSmoothingEnabled",this.blendModes=function(){const e=u(),t=Object.create(null);return t.inherit=Q,t.none=Q,t.normal="source-over",t.add="lighter",t.multiply=e?"multiply":Q,t.screen=e?"screen":Q,t.overlay=e?"overlay":Q,t.darken=e?"darken":Q,t.lighten=e?"lighten":Q,t["color-dodge"]=e?"color-dodge":Q,t["color-burn"]=e?"color-burn":Q,t["hard-light"]=e?"hard-light":Q,t["soft-light"]=e?"soft-light":Q,t.difference=e?"difference":Q,t.exclusion=e?"exclusion":Q,t.saturation=e?"saturation":Q,t.color=e?"color":Q,t.luminosity=e?"luminosity":Q,t["linear-burn"]=e?"color-burn":Q,t["linear-dodge"]=e?"color-dodge":Q,t["linear-light"]=e?"hard-light":Q,t["pin-light"]=e?"hard-light":Q,t["vivid-light"]=e?"hard-light":Q,t["hard-mix"]=Q,t.negation=e?"difference":Q,t["normal-npm"]=t.normal,t["add-npm"]=t.add,t["screen-npm"]=t.screen,t.erase="destination-out",t.subtract=Q,t.divide=Q,t.min=Q,t.max=Q,t}(),this._activeBlendMode="normal",this._projTransform=null,this._outerBlend=!1,this._warnedBlendModes=new Set,this._renderer=e}resolutionChange(e){this.activeResolution=e}init(){const e=this._renderer.background.alpha<1;if(this.rootContext=this._renderer.canvas.getContext("2d",{alpha:e}),this.activeContext=this.rootContext,this.activeResolution=this._renderer.resolution,!this.rootContext.imageSmoothingEnabled){const e=this.rootContext;e.webkitImageSmoothingEnabled?this.smoothProperty="webkitImageSmoothingEnabled":e.mozImageSmoothingEnabled?this.smoothProperty="mozImageSmoothingEnabled":e.oImageSmoothingEnabled?this.smoothProperty="oImageSmoothingEnabled":e.msImageSmoothingEnabled&&(this.smoothProperty="msImageSmoothingEnabled")}}setContextTransform(e,t,n,a){const r=a?s.u.IDENTITY:this._renderer.globalUniforms.globalUniformData?.worldTransformMatrix||s.u.IDENTITY;let o=z;o.copyFrom(r),o.append(e);const i=this._projTransform,c=this.activeResolution;if(n=n||c,i){const e=s.u.shared;e.copyFrom(o),e.prepend(i),o=e}t?this.activeContext.setTransform(o.a*n,o.b*n,o.c*n,o.d*n,o.tx*c|0,o.ty*c|0):this.activeContext.setTransform(o.a*n,o.b*n,o.c*n,o.d*n,o.tx*c,o.ty*c)}clear(e,t){const n=this.activeContext,a=this._renderer;if(n.clearRect(0,0,a.width,a.height),e){const r=c.Q.shared.setValue(e);n.globalAlpha=t??r.alpha,n.fillStyle=r.toHex(),n.fillRect(0,0,a.width,a.height),n.globalAlpha=1}}setBlendMode(e){if(this._activeBlendMode===e)return;this._activeBlendMode=e,this._outerBlend=!1;const t=this.blendModes[e];if(!t)return this._warnedBlendModes.has(e)||(console.warn(`CanvasRenderer: blend mode "${e}" is not supported in Canvas2D; falling back to "source-over".`),this._warnedBlendModes.add(e)),void(this.activeContext.globalCompositeOperation="source-over");this.activeContext.globalCompositeOperation=t}destroy(){this.rootContext=null,this.activeContext=null,this._warnedBlendModes.clear()}}N.extension={type:[a.Ag.CanvasSystem],name:"canvasContext"};class j{constructor(){this.maxTextures=16,this.maxBatchableTextures=16,this.maxUniformBindings=0}init(){}}j.extension={type:[a.Ag.CanvasSystem],name:"limits"};var $=n(7238),J=n(4884);class K{init(e,t){this._renderer=e,this._renderTargetSystem=t}initGpuRenderTarget(e){const t=e.colorTexture,{canvas:n,context:a}=this._ensureCanvas(t);return{canvas:n,context:a,width:n.width,height:n.height}}resizeGpuRenderTarget(e){const t=e.colorTexture,{canvas:n}=this._ensureCanvas(t);n.width=e.pixelWidth,n.height=e.pixelHeight}startRenderPass(e,t,n,a){const r=this._renderTargetSystem.getGpuRenderTarget(e);this._renderer.canvasContext.activeContext=r.context,this._renderer.canvasContext.activeResolution=e.resolution,t&&this.clear(e,t,n,a)}clear(e,t,n,a){const r=this._renderTargetSystem.getGpuRenderTarget(e).context,o=a||{x:0,y:0,width:e.pixelWidth,height:e.pixelHeight};if(r.setTransform(1,0,0,1,0,0),r.clearRect(o.x,o.y,o.width,o.height),n){const e=c.Q.shared.setValue(n);e.alpha>0&&(r.globalAlpha=e.alpha,r.fillStyle=e.toHex(),r.fillRect(o.x,o.y,o.width,o.height),r.globalAlpha=1)}}finishRenderPass(){}copyToTexture(e,t,n,a,r){const o=this._renderTargetSystem.getGpuRenderTarget(e).canvas,i=t.source,{context:s}=this._ensureCanvas(i),c=r?.x??0,l=r?.y??0;return s.drawImage(o,n.x,n.y,a.width,a.height,c,l,a.width,a.height),i.update(),t}destroyGpuRenderTarget(e){}_ensureCanvas(e){let t=e.resource;t&&J.q.test(t)||(t=l.e.get().createCanvas(e.pixelWidth,e.pixelHeight),e.resource=t),t.width===e.pixelWidth&&t.height===e.pixelHeight||(t.width=e.pixelWidth,t.height=e.pixelHeight);const n=t.getContext("2d");return{canvas:t,context:n}}}class Z extends $.l{constructor(e){super(e),this.adaptor=new K,this.adaptor.init(e,this)}}Z.extension={type:[a.Ag.CanvasSystem],name:"renderTarget"};class ee{constructor(e){}init(){}initSource(e){}generateCanvas(e){const t=l.e.get().createCanvas(),n=t.getContext("2d"),a=p.getCanvasSource(e);if(!a)return t;const r=e.frame,o=e.source._resolution??e.source.resolution??1,i=r.x*o,s=r.y*o,c=r.width*o,h=r.height*o;return t.width=Math.ceil(c),t.height=Math.ceil(h),n.drawImage(a,i,s,c,h,0,0,c,h),t}getPixels(e){const t=this.generateCanvas(e);return{pixels:t.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,t.width,t.height).data,width:t.width,height:t.height}}destroy(){}}ee.extension={type:[a.Ag.CanvasSystem],name:"texture"};const te=[...X.i,N,j,ee,Z],ne=[G.j,E.s,R.k,o.a,B.z,V,O,r._],ae=[H,A],re=[],oe=[],ie=[];a.XO.handleByNamedList(a.Ag.CanvasSystem,re),a.XO.handleByNamedList(a.Ag.CanvasPipes,oe),a.XO.handleByNamedList(a.Ag.CanvasPipesAdaptor,ie),a.XO.add(...te,...ne,...ae);class se extends L.k{constructor(){super({name:"canvas",type:Y.W.CANVAS,systems:re,renderPipes:oe,renderPipeAdaptors:ie})}}}}]);
1
+ (self.webpackChunkvizor_2d=self.webpackChunkvizor_2d||[]).push([[851],{6851:(e,t,n)=>{n.d(t,{CanvasRenderer:()=>se});var a=n(8507),r=n(594),o=n(1160),i=n(2079),s=n(9313),c=n(2577),l=n(1761);let h;function d(e){const t=l.e.get().createCanvas(6,1),n=t.getContext("2d");return n.fillStyle=e,n.fillRect(0,0,6,1),t}function u(){if(void 0!==h)return h;try{const e=d("#ff00ff"),t=d("#ffff00"),n=l.e.get().createCanvas(6,1).getContext("2d");n.globalCompositeOperation="multiply",n.drawImage(e,0,0),n.drawImage(t,2,0);const a=n.getImageData(2,0,1,1);if(a){const e=a.data;h=255===e[0]&&0===e[1]&&0===e[2]}else h=!1}catch(e){h=!1}return h}const p={canvas:null,convertTintToImage:!1,cacheStepsPerColorChannel:8,canUseMultiply:u(),tintMethod:null,_canvasSourceCache:new WeakMap,_unpremultipliedCache:new WeakMap,getCanvasSource:e=>{const t=e.source,n=t?.resource;if(!n)return null;const a="premultiplied-alpha"===t.alphaMode,r=t.resourceWidth??t.pixelWidth,o=t.resourceHeight??t.pixelHeight,i=r!==t.pixelWidth||o!==t.pixelHeight;if(a){if((n instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&n instanceof OffscreenCanvas)&&!i)return n;const e=p._unpremultipliedCache.get(t);if(e?.resourceId===t._resourceId)return e.canvas}if(n instanceof Uint8Array||n instanceof Uint8ClampedArray||n instanceof Int8Array||n instanceof Uint16Array||n instanceof Int16Array||n instanceof Uint32Array||n instanceof Int32Array||n instanceof Float32Array||n instanceof ArrayBuffer){const e=p._canvasSourceCache.get(t);if(e?.resourceId===t._resourceId)return e.canvas;const a=l.e.get().createCanvas(t.pixelWidth,t.pixelHeight),r=a.getContext("2d"),o=r.createImageData(t.pixelWidth,t.pixelHeight),i=o.data,s=n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength);if("bgra8unorm"===t.format)for(let e=0;e<i.length&&e+3<s.length;e+=4)i[e]=s[e+2],i[e+1]=s[e+1],i[e+2]=s[e],i[e+3]=s[e+3];else i.set(s.subarray(0,i.length));return r.putImageData(o,0,0),p._canvasSourceCache.set(t,{canvas:a,resourceId:t._resourceId}),a}if(a){const e=l.e.get().createCanvas(t.pixelWidth,t.pixelHeight),a=e.getContext("2d",{willReadFrequently:!0});e.width=t.pixelWidth,e.height=t.pixelHeight,a.drawImage(n,0,0);const r=a.getImageData(0,0,e.width,e.height),o=r.data;for(let e=0;e<o.length;e+=4){const t=o[e+3];if(t>0){const n=255/t;o[e]=Math.min(255,o[e]*n+.5),o[e+1]=Math.min(255,o[e+1]*n+.5),o[e+2]=Math.min(255,o[e+2]*n+.5)}}return a.putImageData(r,0,0),p._unpremultipliedCache.set(t,{canvas:e,resourceId:t._resourceId}),e}if(i){const e=p._canvasSourceCache.get(t);if(e?.resourceId===t._resourceId)return e.canvas;const a=l.e.get().createCanvas(t.pixelWidth,t.pixelHeight),r=a.getContext("2d");return a.width=t.pixelWidth,a.height=t.pixelHeight,r.drawImage(n,0,0),p._canvasSourceCache.set(t,{canvas:a,resourceId:t._resourceId}),a}return n},getTintedCanvas:(e,t)=>{const n=e.texture,a=c.Q.shared.setValue(t).toHex(),r=n.tintCache||(n.tintCache={}),o=r[a],i=n.source._resourceId;if(o?.tintId===i)return o;const s=o&&"getContext"in o?o:l.e.get().createCanvas();if(p.tintMethod(n,t,s),s.tintId=i,p.convertTintToImage&&void 0!==s.toDataURL){const e=l.e.get().createImage();e.src=s.toDataURL(),e.tintId=i,r[a]=e}else r[a]=s;return r[a]},getTintedPattern:(e,t)=>{const n=c.Q.shared.setValue(t).toHex(),a=e.patternCache||(e.patternCache={}),r=e.source._resourceId;let o=a[n];if(o?.tintId===r)return o;p.canvas||(p.canvas=l.e.get().createCanvas()),p.tintMethod(e,t,p.canvas);return o=p.canvas.getContext("2d").createPattern(p.canvas,"repeat"),o.tintId=r,a[n]=o,o},applyPatternTransform:(e,t,n=!0)=>{if(!t)return;const a=e;if(!a.setTransform)return;const r=globalThis.DOMMatrix;if(!r)return;const o=new r([t.a,t.b,t.c,t.d,t.tx,t.ty]);a.setTransform(n?o.inverse():o)},tintWithMultiply:(e,t,n)=>{const a=n.getContext("2d"),r=e.frame.clone(),o=e.source._resolution??e.source.resolution??1,s=e.rotate;r.x*=o,r.y*=o,r.width*=o,r.height*=o;const l=i.E.isVertical(s),h=l?r.height:r.width,d=l?r.width:r.height;n.width=Math.ceil(h),n.height=Math.ceil(d),a.save(),a.fillStyle=c.Q.shared.setValue(t).toHex(),a.fillRect(0,0,h,d),a.globalCompositeOperation="multiply";const u=p.getCanvasSource(e);u?(s&&p._applyInverseRotation(a,s,r.width,r.height),a.drawImage(u,r.x,r.y,r.width,r.height,0,0,r.width,r.height),a.globalCompositeOperation="destination-atop",a.drawImage(u,r.x,r.y,r.width,r.height,0,0,r.width,r.height),a.restore()):a.restore()},tintWithOverlay:(e,t,n)=>{const a=n.getContext("2d"),r=e.frame.clone(),o=e.source._resolution??e.source.resolution??1,s=e.rotate;r.x*=o,r.y*=o,r.width*=o,r.height*=o;const l=i.E.isVertical(s),h=l?r.height:r.width,d=l?r.width:r.height;n.width=Math.ceil(h),n.height=Math.ceil(d),a.save(),a.globalCompositeOperation="copy",a.fillStyle=c.Q.shared.setValue(t).toHex(),a.fillRect(0,0,h,d),a.globalCompositeOperation="destination-atop";const u=p.getCanvasSource(e);u?(s&&p._applyInverseRotation(a,s,r.width,r.height),a.drawImage(u,r.x,r.y,r.width,r.height,0,0,r.width,r.height),a.restore()):a.restore()},tintWithPerPixel:(e,t,n)=>{const a=n.getContext("2d"),r=e.frame.clone(),o=e.source._resolution??e.source.resolution??1,s=e.rotate;r.x*=o,r.y*=o,r.width*=o,r.height*=o;const c=i.E.isVertical(s),l=c?r.height:r.width,h=c?r.width:r.height;n.width=Math.ceil(l),n.height=Math.ceil(h),a.save(),a.globalCompositeOperation="copy";const d=p.getCanvasSource(e);if(!d)return void a.restore();s&&p._applyInverseRotation(a,s,r.width,r.height),a.drawImage(d,r.x,r.y,r.width,r.height,0,0,r.width,r.height),a.restore();const u=t>>16&255,g=t>>8&255,m=255&t,f=a.getImageData(0,0,l,h),x=f.data;for(let e=0;e<x.length;e+=4)x[e]=x[e]*u/255,x[e+1]=x[e+1]*g/255,x[e+2]=x[e+2]*m/255;a.putImageData(f,0,0)},_applyInverseRotation:(e,t,n,a)=>{const r=i.E.inv(t),o=i.E.uX(r),s=i.E.uY(r),c=i.E.vX(r),l=i.E.vY(r),h=-Math.min(0,o*n,c*a,o*n+c*a),d=-Math.min(0,s*n,l*a,s*n+l*a);e.transform(o,s,c,l,h,d)}};p.tintMethod=p.canUseMultiply?p.tintWithMultiply:p.tintWithPerPixel;var g=n(5589),m=n(198),f=n(4676),x=n(115),v=n(7276),y=n(2806),C=n(2801),_=n(2413);const w=new s.u,T=new s.u,b=new s.u,k=new s.u;function M(e,t,n){e.beginPath();for(let a=0;a<n.length;a+=3){const r=2*n[a],o=2*n[a+1],i=2*n[a+2];e.moveTo(t[r],t[r+1]),e.lineTo(t[o],t[o+1]),e.lineTo(t[i],t[i+1]),e.closePath()}e.fill()}function I(e,t){switch(t.type){case"rectangle":{const n=t;e.rect(n.x,n.y,n.width,n.height);break}case"roundedRectangle":{const n=t;!function(e,t,n,a,r,o){o=Math.max(0,Math.min(o,Math.min(a,r)/2)),e.moveTo(t+o,n),e.lineTo(t+a-o,n),e.quadraticCurveTo(t+a,n,t+a,n+o),e.lineTo(t+a,n+r-o),e.quadraticCurveTo(t+a,n+r,t+a-o,n+r),e.lineTo(t+o,n+r),e.quadraticCurveTo(t,n+r,t,n+r-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n)}(e,n.x,n.y,n.width,n.height,n.radius);break}case"circle":{const n=t;e.arc(n.x,n.y,n.radius,0,2*Math.PI);break}case"ellipse":{const n=t;e.ellipse?e.ellipse(n.x,n.y,n.halfWidth,n.halfHeight,0,0,2*Math.PI):(e.save(),e.translate(n.x,n.y),e.scale(n.halfWidth,n.halfHeight),e.arc(0,0,1,0,2*Math.PI),e.restore());break}case"triangle":{const n=t;e.moveTo(n.x,n.y),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3),e.closePath();break}default:{const n=t,a=n.points;if(!a?.length)break;e.moveTo(a[0],a[1]);for(let t=2;t<a.length;t+=2)e.lineTo(a[t],a[t+1]);n.closePath&&e.closePath();break}}}function P(e,t){if(!t?.length)return!1;for(let n=0;n<t.length;n++){const a=t[n];if(!a?.shape)continue;const r=a.transform,o=r&&!r.isIdentity();o&&(e.save(),e.transform(r.a,r.b,r.c,r.d,r.tx,r.ty)),I(e,a.shape),o&&e.restore()}return!0}function S(e,t,n,a){const r=e.fill;if(r instanceof v._){r.buildGradient();const o=r.texture;if(o){const i=p.getTintedPattern(o,t),s=n?k.copyFrom(n).scale(o.source.pixelWidth,o.source.pixelHeight):k.copyFrom(r.transform);return a&&!e.textureSpace&&s.append(a),p.applyPatternTransform(i,s),i}}if(r instanceof y.m){const e=p.getTintedPattern(r.texture,t);return p.applyPatternTransform(e,r.transform),e}const o=e.texture;if(o&&o!==g.g.WHITE){if(!o.source.resource)return"#808080";const a=p.getTintedPattern(o,t),r=n?k.copyFrom(n).scale(o.source.pixelWidth,o.source.pixelHeight):e.matrix;return p.applyPatternTransform(a,r),a}return`#${(16777215&t).toString(16).padStart(6,"0")}`}class A{constructor(){this.shader=null}contextChange(e){}execute(e,t){const n=e.renderer,a=n.canvasContext,r=a.activeContext,o=t.groupTransform,s=n.globalUniforms.globalUniformData?.worldColor??4294967295,c=t.groupColorAlpha,l=(s>>>24&255)/255*((c>>>24&255)/255)*(n.filter?.alphaMultiplier??1);if(l<=0)return;const h=16777215&s,d=16777215&c,u=(0,m.D)((0,f.u)(d,h)),v=n._roundPixels|t._roundPixels;r.save(),a.setContextTransform(o,1===v),a.setBlendMode(t.groupBlendMode);const y=t.context.instructions;for(let e=0;e<y.length;e++){const t=y[e];if("texture"===t.action){const e=t.data,n=e.image,s=n?p.getCanvasSource(n):null;if(!s)continue;const c=e.alpha*l;if(c<=0)continue;const h=(0,f.u)(e.style,u);r.globalAlpha=c;let d=s;16777215!==h&&(d=p.getTintedCanvas({texture:n},h));const g=n.frame,m=n.source._resolution??n.source.resolution??1;let x=g.x*m,y=g.y*m;const C=g.width*m,_=g.height*m;d!==s&&(x=0,y=0);const T=e.transform,b=T&&!T.isIdentity(),k=n.rotate;b||k?(w.copyFrom(o),b&&w.append(T),k&&i.E.matrixAppendRotationInv(w,k,e.dx,e.dy,e.dw,e.dh),a.setContextTransform(w,1===v)):a.setContextTransform(o,1===v),r.drawImage(d,x,y,d===s?C:d.width,d===s?_:d.height,k?0:e.dx,k?0:e.dy,e.dw,e.dh),(b||k)&&a.setContextTransform(o,1===v);continue}const n=t.data,s=n?.path?.shapePath;if(!s?.shapePrimitives?.length)continue;const c=n.style,h=(0,f.u)(c.color,u),d=c.alpha*l;if(d<=0)continue;const m="stroke"===t.action;if(r.globalAlpha=d,m){const e=c;r.lineWidth=e.width,r.lineCap=e.cap,r.lineJoin=e.join,r.miterLimit=e.miterLimit}const k=s.shapePrimitives;if(!m&&n.hole?.shapePath?.shapePrimitives?.length){k[k.length-1].holes=n.hole.shapePath.shapePrimitives}for(let e=0;e<k.length;e++){const t=k[e];if(!t?.shape)continue;const n=t.transform,a=n&&!n.isIdentity(),i=c.texture&&c.texture!==g.g.WHITE,s="global"===c.textureSpace?n:null,l=S(c,h,i?(0,_.Y)(T,c,t.shape,s):null,a?b.copyFrom(o).append(n):o);if(a&&(r.save(),r.transform(n.a,n.b,n.c,n.d,n.tx,n.ty)),m){const e=c;if(.5!==e.alignment&&!e.pixelLine){const n=[],a=[],o=[],i=C.y[t.shape.type];if(i?.build(t.shape,n)){const i=t.shape.closePath??!0;(0,x.h)(n,e,!1,i,a,o),r.fillStyle=l,M(r,a,o)}else r.strokeStyle=l,r.beginPath(),I(r,t.shape),r.stroke()}else r.strokeStyle=l,r.beginPath(),I(r,t.shape),r.stroke()}else{r.fillStyle=l,r.beginPath(),I(r,t.shape);P(r,t.holes)?r.fill("evenodd"):r.fill()}a&&r.restore()}}r.restore()}destroy(){this.shader=null}}A.extension={type:[a.Ag.CanvasPipesAdaptor],name:"graphics"};var R=n(3136);const W=class e{static _getPatternRepeat(e,t){const n=e&&"clamp-to-edge"!==e,a=t&&"clamp-to-edge"!==t;return n&&a?"repeat":n?"repeat-x":a?"repeat-y":"no-repeat"}start(e,t,n){}execute(t,n){const a=n.elements;if(!a||!a.length)return;const r=t.renderer,o=r.canvasContext,s=o.activeContext;for(let t=0;t<a.length;t++){const c=a[t];if(!c.packAsQuad)continue;const l=c,h=l.texture,d=h?p.getCanvasSource(h):null;if(!d)continue;const u=h.source.style,g=o.smoothProperty,x="nearest"!==u.scaleMode;s[g]!==x&&(s[g]=x),o.setBlendMode(n.blendMode);const v=r.globalUniforms.globalUniformData?.worldColor??4294967295,y=l.color,C=(v>>>24&255)/255*((y>>>24&255)/255)*(r.filter?.alphaMultiplier??1);if(C<=0)continue;s.globalAlpha=C;const _=16777215&v,w=16777215&y,T=(0,m.D)((0,f.u)(w,_)),b=h.frame,k=u.addressModeU??u.addressMode,M=u.addressModeV??u.addressMode,I=e._getPatternRepeat(k,M),P=h.source._resolution??h.source.resolution??1,S=l.renderable?.renderGroup?.isCachedAsTexture,A=b.x*P,R=b.y*P,W=b.width*P,H=b.height*P,E=l.bounds,B=r.renderTarget.renderTarget.isRoot,O=E.minX,D=E.minY,U=E.maxX-E.minX,q=E.maxY-E.minY,F=h.rotate,V=h.uvs,G=Math.min(V.x0,V.x1,V.x2,V.x3,V.y0,V.y1,V.y2,V.y3),L=Math.max(V.x0,V.x1,V.x2,V.x3,V.y0,V.y1,V.y2,V.y3),X="no-repeat"!==I&&(G<0||L>1),Y=F&&!(!X&&(16777215!==T||F));Y?(e._tempPatternMatrix.copyFrom(l.transform),i.E.matrixAppendRotationInv(e._tempPatternMatrix,F,O,D,U,q),o.setContextTransform(e._tempPatternMatrix,1===l.roundPixels,void 0,S&&B)):o.setContextTransform(l.transform,1===l.roundPixels,void 0,S&&B);const Q=Y?0:O,z=Y?0:D,N=U,j=q;if(X){let t=d;const n=16777215!==T&&!F,a=b.width<=h.source.width&&b.height<=h.source.height;n&&a&&(t=p.getTintedCanvas({texture:h},T));const r=s.createPattern(t,I);if(!r)continue;const o=N,i=j;if(0===o||0===i)continue;const c=1/o,l=1/i,u=(V.x1-V.x0)*c,g=(V.y1-V.y0)*c,m=(V.x3-V.x0)*l,f=(V.y3-V.y0)*l,x=V.x0-u*Q-m*z,v=V.y0-g*Q-f*z,y=h.source.pixelWidth,C=h.source.pixelHeight;e._tempPatternMatrix.set(u*y,g*C,m*y,f*C,x*y,v*C),p.applyPatternTransform(r,e._tempPatternMatrix),s.fillStyle=r,s.fillRect(Q,z,N,j)}else{const e=16777215!==T||F?p.getTintedCanvas({texture:h},T):d,t=e!==d;s.drawImage(e,t?0:A,t?0:R,t?e.width:W,t?e.height:H,Q,z,N,j)}}}};W._tempPatternMatrix=new s.u,W.extension={type:[a.Ag.CanvasPipesAdaptor],name:"batch"};let H=W;var E=n(780),B=n(9824);class O{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,n){this._renderer.renderPipes.batch.break(n);const a=this._colorStack;a[this._colorStackIndex]=a[this._colorStackIndex-1]&e.mask;const r=this._colorStack[this._colorStackIndex];r!==this._currentColor&&(this._currentColor=r,n.add({renderPipeId:"colorMask",colorMask:r,canBundle:!1})),this._colorStackIndex++}pop(e,t,n){this._renderer.renderPipes.batch.break(n);const a=this._colorStack;this._colorStackIndex--;const r=a[this._colorStackIndex-1];r!==this._currentColor&&(this._currentColor=r,n.add({renderPipeId:"colorMask",colorMask:r,canBundle:!1}))}execute(e){}destroy(){this._renderer=null,this._colorStack=null}}O.extension={type:[a.Ag.CanvasPipes],name:"colorMask"};var D=n(4663),U=n(268);function q(e,t){switch(t.type){case"rectangle":{const n=t;e.rect(n.x,n.y,n.width,n.height);break}case"roundedRectangle":{const n=t;!function(e,t,n,a,r,o){o=Math.max(0,Math.min(o,Math.min(a,r)/2)),e.moveTo(t+o,n),e.lineTo(t+a-o,n),e.quadraticCurveTo(t+a,n,t+a,n+o),e.lineTo(t+a,n+r-o),e.quadraticCurveTo(t+a,n+r,t+a-o,n+r),e.lineTo(t+o,n+r),e.quadraticCurveTo(t,n+r,t,n+r-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n)}(e,n.x,n.y,n.width,n.height,n.radius);break}case"circle":{const n=t;e.moveTo(n.x+n.radius,n.y),e.arc(n.x,n.y,n.radius,0,2*Math.PI);break}case"ellipse":{const n=t;e.ellipse?(e.moveTo(n.x+n.halfWidth,n.y),e.ellipse(n.x,n.y,n.halfWidth,n.halfHeight,0,0,2*Math.PI)):(e.save(),e.translate(n.x,n.y),e.scale(n.halfWidth,n.halfHeight),e.moveTo(1,0),e.arc(0,0,1,0,2*Math.PI),e.restore());break}case"triangle":{const n=t;e.moveTo(n.x,n.y),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3),e.closePath();break}default:{const n=t,a=n.points;if(!a?.length)break;e.moveTo(a[0],a[1]);for(let t=2;t<a.length;t+=2)e.lineTo(a[t],a[t+1]);n.closePath&&e.closePath();break}}}function F(e,t){if(!t?.length)return!1;for(let n=0;n<t.length;n++){const a=t[n];if(!a?.shape)continue;const r=a.transform,o=r&&!r.isIdentity();o&&(e.save(),e.transform(r.a,r.b,r.c,r.d,r.tx,r.ty)),q(e,a.shape),o&&e.restore()}return!0}class V{constructor(e){this._warnedMaskTypes=new Set,this._canvasMaskStack=[],this._renderer=e}push(e,t,n){this._renderer.renderPipes.batch.break(n),n.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,n){this._renderer.renderPipes.batch.break(n),n.add({renderPipeId:"stencilMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){if("pushMaskBegin"!==e.action&&"popMaskEnd"!==e.action)return;const t=this._renderer,n=t.canvasContext,a=n?.activeContext;if(!a)return;if("popMaskEnd"===e.action){return void(this._canvasMaskStack.pop()&&a.restore())}e.inverse&&this._warnOnce("inverse","CanvasRenderer: inverse masks are not supported on Canvas2D; ignoring inverse flag.");const r=e.mask.mask;if(!(r instanceof D.A))return this._warnOnce("nonGraphics","CanvasRenderer: only Graphics masks are supported in Canvas2D; skipping mask."),void this._canvasMaskStack.push(!1);const o=r,i=o.context?.instructions;if(!i?.length)return void this._canvasMaskStack.push(!1);a.save(),n.setContextTransform(o.groupTransform,1==(t._roundPixels|o._roundPixels)),a.beginPath();let s=!1,c=!1;for(let e=0;e<i.length;e++){const t=i[e],n=t.action;if("fill"!==n&&"stroke"!==n)continue;const r=t.data,o=r?.path?.shapePath;if(!o?.shapePrimitives?.length)continue;const l=o.shapePrimitives;for(let e=0;e<l.length;e++){const t=l[e];if(!t?.shape)continue;const n=t.transform,r=n&&!n.isIdentity();r&&(a.save(),a.transform(n.a,n.b,n.c,n.d,n.tx,n.ty)),q(a,t.shape),c=F(a,t.holes)||c,s=!0,r&&a.restore()}}if(!s)return a.restore(),void this._canvasMaskStack.push(!1);c?a.clip("evenodd"):a.clip(),this._canvasMaskStack.push(!0)}destroy(){this._renderer=null,this._warnedMaskTypes=null,this._canvasMaskStack=null}_warnOnce(e,t){this._warnedMaskTypes.has(e)||(this._warnedMaskTypes.add(e),(0,U.R)(t))}}V.extension={type:[a.Ag.CanvasPipes],name:"stencilMask"};var G=n(360),L=n(800),X=n(381),Y=n(5099);const Q="source-over";const z=new s.u;class N{constructor(e){this.activeResolution=1,this.smoothProperty="imageSmoothingEnabled",this.blendModes=function(){const e=u(),t=Object.create(null);return t.inherit=Q,t.none=Q,t.normal="source-over",t.add="lighter",t.multiply=e?"multiply":Q,t.screen=e?"screen":Q,t.overlay=e?"overlay":Q,t.darken=e?"darken":Q,t.lighten=e?"lighten":Q,t["color-dodge"]=e?"color-dodge":Q,t["color-burn"]=e?"color-burn":Q,t["hard-light"]=e?"hard-light":Q,t["soft-light"]=e?"soft-light":Q,t.difference=e?"difference":Q,t.exclusion=e?"exclusion":Q,t.saturation=e?"saturation":Q,t.color=e?"color":Q,t.luminosity=e?"luminosity":Q,t["linear-burn"]=e?"color-burn":Q,t["linear-dodge"]=e?"color-dodge":Q,t["linear-light"]=e?"hard-light":Q,t["pin-light"]=e?"hard-light":Q,t["vivid-light"]=e?"hard-light":Q,t["hard-mix"]=Q,t.negation=e?"difference":Q,t["normal-npm"]=t.normal,t["add-npm"]=t.add,t["screen-npm"]=t.screen,t.erase="destination-out",t.subtract=Q,t.divide=Q,t.min=Q,t.max=Q,t}(),this._activeBlendMode="normal",this._projTransform=null,this._outerBlend=!1,this._warnedBlendModes=new Set,this._renderer=e}resolutionChange(e){this.activeResolution=e}init(){const e=this._renderer.background.alpha<1;if(this.rootContext=this._renderer.canvas.getContext("2d",{alpha:e}),this.activeContext=this.rootContext,this.activeResolution=this._renderer.resolution,!this.rootContext.imageSmoothingEnabled){const e=this.rootContext;e.webkitImageSmoothingEnabled?this.smoothProperty="webkitImageSmoothingEnabled":e.mozImageSmoothingEnabled?this.smoothProperty="mozImageSmoothingEnabled":e.oImageSmoothingEnabled?this.smoothProperty="oImageSmoothingEnabled":e.msImageSmoothingEnabled&&(this.smoothProperty="msImageSmoothingEnabled")}}setContextTransform(e,t,n,a){const r=a?s.u.IDENTITY:this._renderer.globalUniforms.globalUniformData?.worldTransformMatrix||s.u.IDENTITY;let o=z;o.copyFrom(r),o.append(e);const i=this._projTransform,c=this.activeResolution;if(n=n||c,i){const e=s.u.shared;e.copyFrom(o),e.prepend(i),o=e}t?this.activeContext.setTransform(o.a*n,o.b*n,o.c*n,o.d*n,o.tx*c|0,o.ty*c|0):this.activeContext.setTransform(o.a*n,o.b*n,o.c*n,o.d*n,o.tx*c,o.ty*c)}clear(e,t){const n=this.activeContext,a=this._renderer;if(n.clearRect(0,0,a.width,a.height),e){const r=c.Q.shared.setValue(e);n.globalAlpha=t??r.alpha,n.fillStyle=r.toHex(),n.fillRect(0,0,a.width,a.height),n.globalAlpha=1}}setBlendMode(e){if(this._activeBlendMode===e)return;this._activeBlendMode=e,this._outerBlend=!1;const t=this.blendModes[e];if(!t)return this._warnedBlendModes.has(e)||(console.warn(`CanvasRenderer: blend mode "${e}" is not supported in Canvas2D; falling back to "source-over".`),this._warnedBlendModes.add(e)),void(this.activeContext.globalCompositeOperation="source-over");this.activeContext.globalCompositeOperation=t}destroy(){this.rootContext=null,this.activeContext=null,this._warnedBlendModes.clear()}}N.extension={type:[a.Ag.CanvasSystem],name:"canvasContext"};class j{constructor(){this.maxTextures=16,this.maxBatchableTextures=16,this.maxUniformBindings=0}init(){}}j.extension={type:[a.Ag.CanvasSystem],name:"limits"};var $=n(7238),J=n(4884);class K{init(e,t){this._renderer=e,this._renderTargetSystem=t}initGpuRenderTarget(e){const t=e.colorTexture,{canvas:n,context:a}=this._ensureCanvas(t);return{canvas:n,context:a,width:n.width,height:n.height}}resizeGpuRenderTarget(e){const t=e.colorTexture,{canvas:n}=this._ensureCanvas(t);n.width=e.pixelWidth,n.height=e.pixelHeight}startRenderPass(e,t,n,a){const r=this._renderTargetSystem.getGpuRenderTarget(e);this._renderer.canvasContext.activeContext=r.context,this._renderer.canvasContext.activeResolution=e.resolution,t&&this.clear(e,t,n,a)}clear(e,t,n,a){const r=this._renderTargetSystem.getGpuRenderTarget(e).context,o=a||{x:0,y:0,width:e.pixelWidth,height:e.pixelHeight};if(r.setTransform(1,0,0,1,0,0),r.clearRect(o.x,o.y,o.width,o.height),n){const e=c.Q.shared.setValue(n);e.alpha>0&&(r.globalAlpha=e.alpha,r.fillStyle=e.toHex(),r.fillRect(o.x,o.y,o.width,o.height),r.globalAlpha=1)}}finishRenderPass(){}copyToTexture(e,t,n,a,r){const o=this._renderTargetSystem.getGpuRenderTarget(e).canvas,i=t.source,{context:s}=this._ensureCanvas(i),c=r?.x??0,l=r?.y??0;return s.drawImage(o,n.x,n.y,a.width,a.height,c,l,a.width,a.height),i.update(),t}destroyGpuRenderTarget(e){}_ensureCanvas(e){let t=e.resource;t&&J.q.test(t)||(t=l.e.get().createCanvas(e.pixelWidth,e.pixelHeight),e.resource=t),t.width===e.pixelWidth&&t.height===e.pixelHeight||(t.width=e.pixelWidth,t.height=e.pixelHeight);const n=t.getContext("2d");return{canvas:t,context:n}}}class Z extends $.l{constructor(e){super(e),this.adaptor=new K,this.adaptor.init(e,this)}}Z.extension={type:[a.Ag.CanvasSystem],name:"renderTarget"};class ee{constructor(e){}init(){}initSource(e){}generateCanvas(e){const t=l.e.get().createCanvas(),n=t.getContext("2d"),a=p.getCanvasSource(e);if(!a)return t;const r=e.frame,o=e.source._resolution??e.source.resolution??1,i=r.x*o,s=r.y*o,c=r.width*o,h=r.height*o;return t.width=Math.ceil(c),t.height=Math.ceil(h),n.drawImage(a,i,s,c,h,0,0,c,h),t}getPixels(e){const t=this.generateCanvas(e);return{pixels:t.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,t.width,t.height).data,width:t.width,height:t.height}}destroy(){}}ee.extension={type:[a.Ag.CanvasSystem],name:"texture"};const te=[...X.i,N,j,ee,Z],ne=[G.j,E.s,R.k,o.a,B.z,V,O,r._],ae=[H,A],re=[],oe=[],ie=[];a.XO.handleByNamedList(a.Ag.CanvasSystem,re),a.XO.handleByNamedList(a.Ag.CanvasPipes,oe),a.XO.handleByNamedList(a.Ag.CanvasPipesAdaptor,ie),a.XO.add(...te,...ne,...ae);class se extends L.k{constructor(){super({name:"canvas",type:Y.W.CANVAS,systems:re,renderPipes:oe,renderPipeAdaptors:ie})}}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunkvizor_2d=self.webpackChunkvizor_2d||[]).push([[866],{2067:(e,t,r)=>{r.d(t,{Ls:()=>n,_Q:()=>s,mA:()=>i});const n={name:"local-uniform-bit",vertex:{header:"\n\n struct LocalUniforms {\n uTransformMatrix:mat3x3<f32>,\n uColor:vec4<f32>,\n uRound:f32,\n }\n\n @group(1) @binding(0) var<uniform> localUniforms : LocalUniforms;\n ",main:"\n vColor *= localUniforms.uColor;\n modelMatrix *= localUniforms.uTransformMatrix;\n ",end:"\n if(localUniforms.uRound == 1)\n {\n vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);\n }\n "}},s={...n,vertex:{...n.vertex,header:n.vertex.header.replace("group(1)","group(2)")}},i={name:"local-uniform-bit",vertex:{header:"\n\n uniform mat3 uTransformMatrix;\n uniform vec4 uColor;\n uniform float uRound;\n ",main:"\n vColor *= uColor;\n modelMatrix = uTransformMatrix;\n ",end:"\n if(uRound == 1.)\n {\n gl_Position.xy = roundPixels(gl_Position.xy, uResolution);\n }\n "}}},3391:(e,t,r)=>{r.d(t,{R:()=>n,m:()=>s});const n={name:"texture-bit",vertex:{header:"\n\n struct TextureUniforms {\n uTextureMatrix:mat3x3<f32>,\n }\n\n @group(2) @binding(2) var<uniform> textureUniforms : TextureUniforms;\n ",main:"\n uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy;\n "},fragment:{header:"\n @group(2) @binding(0) var uTexture: texture_2d<f32>;\n @group(2) @binding(1) var uSampler: sampler;\n\n\n ",main:"\n outColor = textureSample(uTexture, uSampler, vUV);\n "}},s={name:"texture-bit",vertex:{header:"\n uniform mat3 uTextureMatrix;\n ",main:"\n uv = (uTextureMatrix * vec3(uv, 1.0)).xy;\n "},fragment:{header:"\n uniform sampler2D uTexture;\n\n\n ",main:"\n outColor = texture(uTexture, vUV);\n "}}},7084:(e,t,r)=>{r.d(t,{q:()=>i});var n=r(268),s=r(8306);function i(e,t){for(const r in e.attributes){const s=e.attributes[r],i=t[r];i?(s.format??(s.format=i.format),s.offset??(s.offset=i.offset),s.instance??(s.instance=i.instance)):(0,n.R)(`Attribute ${r} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}!function(e){const{buffers:t,attributes:r}=e,n={},i={};for(const e in t){const r=t[e];n[r.uid]=0,i[r.uid]=0}for(const e in r){const t=r[e];n[t.buffer.uid]+=(0,s.m)(t.format).stride}for(const e in r){const t=r[e];t.stride??(t.stride=n[t.buffer.uid]),t.start??(t.start=i[t.buffer.uid]),i[t.buffer.uid]+=(0,s.m)(t.format).stride}}(e)}},9866:(e,t,r)=>{r.d(t,{WebGPURenderer:()=>Me});var n=r(8507),s=r(9313),i=r(341),a=r(5611),o=r(4459),u=r(4e3),d=r(2067),c=r(6665),h=r(8475),l=r(5811);class f{constructor(){this._maxTextures=0}contextChange(e){const t=new l.k({uTransformMatrix:{value:new s.u,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}});this._maxTextures=e.limits.maxBatchableTextures;const r=(0,a.v)({name:"graphics",bits:[o.F,(0,u._)(this._maxTextures),d._Q,c.b]});this.shader=new h.M({gpuProgram:r,resources:{localUniforms:t}})}execute(e,t){const r=t.context,n=r.customShader||this.shader,s=e.renderer,a=s.graphicsContext,{batcher:o,instructions:u}=a.getContextRenderData(r),d=s.encoder;d.setGeometry(o.geometry,n.gpuProgram);const c=s.globalUniforms.bindGroup;d.setBindGroup(0,c,n.gpuProgram);const h=s.renderPipes.uniformBatch.getUniformBindGroup(n.resources.localUniforms,!0);d.setBindGroup(2,h,n.gpuProgram);const l=u.instructions;let f=null;for(let t=0;t<u.instructionSize;t++){const r=l[t];if(r.topology!==f&&(f=r.topology,d.setPipelineFromGeometryProgramAndState(o.geometry,n.gpuProgram,e.state,r.topology)),n.groups[1]=r.bindGroup,!r.gpuBindGroup){const e=r.textures;r.bindGroup=(0,i.w)(e.textures,e.count,this._maxTextures),r.gpuBindGroup=s.bindGroup.getBindGroup(r.bindGroup,n.gpuProgram,1)}d.setBindGroup(1,r.bindGroup,n.gpuProgram),d.renderPassEncoder.drawIndexed(r.size,1,r.start)}}destroy(){this.shader.destroy(!0),this.shader=null}}f.extension={type:[n.Ag.WebGPUPipesAdaptor],name:"graphics"};var p=r(3391),m=r(5589),g=r(268);class _{init(){const e=(0,a.v)({name:"mesh",bits:[d.Ls,p.R,c.b]});this._shader=new h.M({gpuProgram:e,resources:{uTexture:m.g.EMPTY._source,uSampler:m.g.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new s.u}}}})}execute(e,t){const r=e.renderer;let n=t._shader;if(n){if(!n.gpuProgram)return void(0,g.R)("Mesh shader has no gpuProgram",t.shader)}else n=this._shader,n.groups[2]=r.texture.getTextureBindGroup(t.texture);const s=n.gpuProgram;if(s.autoAssignGlobalUniforms&&(n.groups[0]=r.globalUniforms.bindGroup),s.autoAssignLocalUniforms){const t=e.localUniforms;n.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(t,!0)}r.encoder.draw({geometry:t._geometry,shader:n,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}}_.extension={type:[n.Ag.WebGPUPipesAdaptor],name:"mesh"};var b=r(7547);const v=b.U.for2d();class x{start(e,t,r){const n=e.renderer,s=n.encoder,i=r.gpuProgram;this._shader=r,this._geometry=t,s.setGeometry(t,i),v.blendMode="normal",n.pipeline.getPipeline(t,i,v);const a=n.globalUniforms.bindGroup;s.resetBindGroup(1),s.setBindGroup(0,a,i)}execute(e,t){const r=this._shader.gpuProgram,n=e.renderer,s=n.encoder;if(!t.bindGroup){const e=t.textures;t.bindGroup=(0,i.w)(e.textures,e.count,n.limits.maxBatchableTextures)}v.blendMode=t.blendMode;const a=n.bindGroup.getBindGroup(t.bindGroup,r,1),o=n.pipeline.getPipeline(this._geometry,r,v,t.topology);t.bindGroup._touch(n.gc.now,n.tick),s.setPipeline(o),s.renderPassEncoder.setBindGroup(1,a),s.renderPassEncoder.drawIndexed(t.size,1,t.start)}}x.extension={type:[n.Ag.WebGPUPipesAdaptor],name:"batch"};var y=r(800),G=r(381),T=r(5099);class P{constructor(e){this._hash=Object.create(null),this._renderer=e}contextChange(e){this._gpu=e}getBindGroup(e,t,r){e._updateKey();return this._hash[e._key]||this._createBindGroup(e,t,r)}_createBindGroup(e,t,r){const n=this._gpu.device,s=t.layout[r],i=[],a=this._renderer;for(const t in s){const r=e.resources[t]??e.resources[s[t]];let n;if("uniformGroup"===r._resourceType){const e=r;a.ubo.updateUniformGroup(e);const t=e.buffer;n={buffer:a.buffer.getGPUBuffer(t),offset:0,size:t.descriptor.size}}else if("buffer"===r._resourceType){const e=r;n={buffer:a.buffer.getGPUBuffer(e),offset:0,size:e.descriptor.size}}else if("bufferResource"===r._resourceType){const e=r;n={buffer:a.buffer.getGPUBuffer(e.buffer),offset:e.offset,size:e.size}}else if("textureSampler"===r._resourceType){const e=r;n=a.texture.getGpuSampler(e)}else if("textureSource"===r._resourceType){const e=r;n=a.texture.getTextureView(e)}i.push({binding:s[t],resource:n})}const o=a.shader.getProgramData(t).bindGroups[r],u=n.createBindGroup({layout:o,entries:i});return this._hash[e._key]=u,u}destroy(){this._hash=null,this._renderer=null}}P.extension={type:[n.Ag.WebGPUSystem],name:"bindGroup"};var S=r(4334),B=r(133),C=r(6736);class U{constructor(e){this.gpuBuffer=e}destroy(){this.gpuBuffer.destroy(),this.gpuBuffer=null}}class w{constructor(e){this._renderer=e,this._managedBuffers=new S.s({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"gpuBuffer"})}contextChange(e){this._gpu=e}getGPUBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]?.gpuBuffer||this.createGPUBuffer(e)}updateBuffer(e){const t=this.getGPUBuffer(e),r=e.data;return e._updateID&&r&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,0,r.buffer,0,(e._updateSize||r.byteLength)+3&-4)),t}destroyAll(){this._managedBuffers.removeAll()}onBufferUnload(e){e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this)}createGPUBuffer(e){const t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e._resourceId=(0,B.L)("resource"),e.data&&((0,C.W)(e.data.buffer,t.getMappedRange(),e.data.byteOffset,e.data.byteLength),t.unmap()),e._gpuData[this._renderer.uid]=new U(t),this._managedBuffers.add(e)&&(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this)),t}onBufferChange(e){this._managedBuffers.remove(e),e._updateID=0,this.createGPUBuffer(e)}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gpu=null}}w.extension={type:[n.Ag.WebGPUSystem],name:"buffer"};class M{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.pipeline.setColorMask(e))}destroy(){this._renderer=null,this._colorMaskCache=null}}M.extension={type:[n.Ag.WebGPUSystem],name:"colorMask"};var R=r(1761);class A{constructor(e){this._renderer=e}async init(e){return this._initPromise||(this._initPromise=(e.gpu?Promise.resolve(e.gpu):this._createDeviceAndAdaptor(e)).then((e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}))),this._initPromise}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){const t=await R.e.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter((e=>t.features.has(e))),n=await t.requestDevice({requiredFeatures:r});return{adapter:t,device:n}}destroy(){this.gpu=null,this._renderer=null}}A.extension={type:[n.Ag.WebGPUSystem],name:"device"},A.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};class E{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e}renderStart(){this.commandFinished=new Promise((e=>{this._resolveCommandFinished=e})),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(e){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(e.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(e){this.renderPassEncoder.setViewport(e.x,e.y,e.width,e.height,0,1)}setPipelineFromGeometryProgramAndState(e,t,r,n){const s=this._renderer.pipeline.getPipeline(e,t,r,n);this.setPipeline(s)}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e))}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)))}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;const t=2===e.data.BYTES_PER_ELEMENT?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t)}resetBindGroup(e){this._boundBindGroup[e]=null}setBindGroup(e,t,r){if(this._boundBindGroup[e]===t)return;this._boundBindGroup[e]=t,t._touch(this._renderer.gc.now,this._renderer.tick);const n=this._renderer.bindGroup.getBindGroup(t,r,e);this.renderPassEncoder.setBindGroup(e,n)}setGeometry(e,t){const r=this._renderer.pipeline.getBufferNamesToBind(e,t);for(const t in r)this._setVertexBuffer(parseInt(t,10),e.attributes[r[t]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(const r in e.groups){const n=e.groups[r];t||this._syncBindGroup(n),this.setBindGroup(r,n,e.gpuProgram)}}_syncBindGroup(e){for(const t in e.resources){const r=e.resources[t];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(e){const{geometry:t,shader:r,state:n,topology:s,size:i,start:a,instanceCount:o,skipSync:u}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,n,s),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,u),t.indexBuffer?this.renderPassEncoder.drawIndexed(i||t.indexBuffer.data.length,o??t.instanceCount,a||0):this.renderPassEncoder.draw(i||t.getSize(),o??t.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const e=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1],this._renderer.renderTarget.mipLevel,this._renderer.renderTarget.layer);this.renderPassEncoder=this.commandEncoder.beginRenderPass(e);const t=this._boundPipeline,r={...this._boundVertexBuffer},n=this._boundIndexBuffer,s={...this._boundBindGroup};this._clearCache();const i=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(i.x,i.y,i.width,i.height,0,1),this.setPipeline(t);for(const e in r)this._setVertexBuffer(e,r[e]);for(const e in s)this.setBindGroup(e,s[e],null);this._setIndexBuffer(n)}_clearCache(){for(let e=0;e<16;e++)this._boundBindGroup[e]=null,this._boundVertexBuffer[e]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(e){this._gpu=e}}E.extension={type:[n.Ag.WebGPUSystem],name:"encoder",priority:1};class L{constructor(e){this._renderer=e}contextChange(){this.maxTextures=this._renderer.device.gpu.device.limits.maxSampledTexturesPerShaderStage,this.maxBatchableTextures=this.maxTextures}destroy(){}}L.extension={type:[n.Ag.WebGPUSystem],name:"limits"};var k=r(1957);class O{constructor(e){this._renderTargetStencilState=Object.create(null),this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:k.K.DISABLED,stencilReference:0}),this._activeRenderTarget=e,this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){const r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=e,r.stencilReference=t;const n=this._renderer;n.pipeline.setStencilMode(e),n.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}O.extension={type:[n.Ag.WebGPUSystem],name:"stencil"};var z=r(7047);const I={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}};function F(e){const t=e.map((e=>({data:e,offset:0,size:0})));let r=0;for(let e=0;e<t.length;e++){const n=t[e];let s=I[n.data.type].size;const i=I[n.data.type].align;if(!I[n.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${n.data.type}`);n.data.size>1&&(s=Math.max(s,i)*n.data.size),r=Math.ceil(r/i)*i,n.size=s,n.offset=r,r+=s}return r=16*Math.ceil(r/16),{uboElements:t,size:r}}var D=r(6423),H=r(1266);function W(e,t){const{size:r,align:n}=I[e.data.type],s=(n-r)/4,i=e.data.type.indexOf("i32")>=0?"dataInt32":"data";return`\n v = uv.${e.data.name};\n ${0!==t?`offset += ${t};`:""}\n\n arrayOffset = offset;\n\n t = 0;\n\n for(var i=0; i < ${e.data.size*(r/4)}; i++)\n {\n for(var j = 0; j < ${r/4}; j++)\n {\n ${i}[arrayOffset++] = v[t++];\n }\n ${0!==s?`arrayOffset += ${s};`:""}\n }\n `}function N(e){return(0,D.E)(e,"uboWgsl",W,H._)}class V extends z.W{constructor(){super({createUboElements:F,generateUboSync:N})}}V.extension={type:[n.Ag.WebGPUSystem],name:"ubo"};var K=r(949),j=r(581),$=r(1132);class q{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error("UniformBufferBatch: array is too large: "+4*e);const t=this.byteIndex;let r=t+4*e;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>4*this.data.length)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,t}addGroup(e){const t=this.addEmptyGroup(e.length);for(let r=0;r<e.length;r++)this.data[t/4+r]=e[r];return t}destroy(){this.data=null}}var Y=r(3513);const X=128;class Q{constructor(e){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=e,this._batchBuffer=new q({minUniformOffsetAlignment:X});for(let e=0;e<2;e++){let t=$.S.UNIFORM|$.S.COPY_DST;0===e&&(t|=$.S.COPY_SRC),this._buffers.push(new K.h({data:this._batchBuffer.data,usage:t}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){this._bindGroupHash=Object.create(null),this._batchBuffer.clear()}getUniformBindGroup(e,t){if(!t&&this._bindGroupHash[e.uid])return this._bindGroupHash[e.uid];this._renderer.ubo.ensureUniformGroup(e);const r=e.buffer.data,n=this._batchBuffer.addEmptyGroup(r.length);return this._renderer.ubo.syncUniformGroup(e,this._batchBuffer.data,n/4),this._bindGroupHash[e.uid]=this._getBindGroup(n/X),this._bindGroupHash[e.uid]}getUboResource(e){this._renderer.ubo.updateUniformGroup(e);const t=e.buffer.data,r=this._batchBuffer.addGroup(t);return this._getBufferResource(r/X)}getArrayBindGroup(e){const t=this._batchBuffer.addGroup(e);return this._getBindGroup(t/X)}getArrayBufferResource(e){const t=this._batchBuffer.addGroup(e)/X;return this._getBufferResource(t)}_getBufferResource(e){if(!this._bufferResources[e]){const t=this._buffers[e%2];this._bufferResources[e]=new j.d({buffer:t,offset:256*(e/2|0),size:X})}return this._bufferResources[e]}_getBindGroup(e){if(!this._bindGroups[e]){const t=new Y.T({0:this._getBufferResource(e)});this._bindGroups[e]=t}return this._bindGroups[e]}_uploadBindGroups(){const e=this._renderer.buffer,t=this._buffers[0];t.update(this._batchBuffer.byteIndex),e.updateBuffer(t);const r=this._renderer.gpu.device.createCommandEncoder();for(let n=1;n<this._buffers.length;n++){const s=this._buffers[n];r.copyBufferToBuffer(e.getGPUBuffer(t),X,e.getGPUBuffer(s),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([r.finish()])}destroy(){for(let e=0;e<this._bindGroups.length;e++)this._bindGroups[e]?.destroy();this._bindGroups=null,this._bindGroupHash=null;for(let e=0;e<this._buffers.length;e++)this._buffers[e].destroy();this._buffers=null;for(let e=0;e<this._bufferResources.length;e++)this._bufferResources[e].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._renderer=null}}Q.extension={type:[n.Ag.WebGPUPipes],name:"uniformBatch"};var J=r(7084),Z=r(7952),ee=r(1172);const te={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};class re{constructor(e){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._colorTargetCount=1,this._renderer=e}contextChange(e){this._gpu=e,this.setStencilMode(k.K.DISABLED),this._updatePipeHash()}setMultisampleCount(e){this._multisampleCount!==e&&(this._multisampleCount=e,this._updatePipeHash())}setRenderTarget(e){this._multisampleCount=e.msaaSamples,this._depthStencilAttachment=e.descriptor.depthStencilAttachment?1:0,this._colorTargetCount=e.colorTargetCount,this._updatePipeHash()}setColorMask(e){this._colorMask!==e&&(this._colorMask=e,this._updatePipeHash())}setStencilMode(e){this._stencilMode!==e&&(this._stencilMode=e,this._stencilState=ee.g[e],this._updatePipeHash())}setPipeline(e,t,r,n){const s=this.getPipeline(e,t,r);n.setPipeline(s)}getPipeline(e,t,r,n){e._layoutKey||((0,J.q)(e,t.attributeData),this._generateBufferKey(e)),n||(n=e.topology);const s=function(e,t,r,n,s){return e<<24|t<<16|r<<10|n<<5|s}(e._layoutKey,t._layoutKey,r.data,r._blendModeId,te[n]);return this._pipeCache[s]||(this._pipeCache[s]=this._createPipeline(e,t,r,n)),this._pipeCache[s]}_createPipeline(e,t,r,n){const s=this._gpu.device,i=this._createVertexBufferLayouts(e,t),a=this._renderer.state.getColorTargets(r,this._colorTargetCount),o=this._stencilMode===k.K.RENDERING_MASK_ADD?0:this._colorMask;for(let e=0;e<a.length;e++)a[e].writeMask=o;const u=this._renderer.shader.getProgramData(t).pipeline,d={vertex:{module:this._getModule(t.vertex.source),entryPoint:t.vertex.entryPoint,buffers:i},fragment:{module:this._getModule(t.fragment.source),entryPoint:t.fragment.entryPoint,targets:a},primitive:{topology:n,cullMode:r.cullMode},layout:u,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};this._depthStencilAttachment&&(d.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:r.depthTest,depthCompare:r.depthTest?"less":"always"});return s.createRenderPipeline(d)}_getModule(e){return this._moduleCache[e]||this._createModule(e)}_createModule(e){const t=this._gpu.device;return this._moduleCache[e]=t.createShaderModule({code:e}),this._moduleCache[e]}_generateBufferKey(e){const t=[];let r=0;const n=Object.keys(e.attributes).sort();for(let s=0;s<n.length;s++){const i=e.attributes[n[s]];t[r++]=i.offset,t[r++]=i.format,t[r++]=i.stride,t[r++]=i.instance}const s=t.join("|");return e._layoutKey=(0,Z.X)(s,"geometry"),e._layoutKey}_generateAttributeLocationsKey(e){const t=[];let r=0;const n=Object.keys(e.attributeData).sort();for(let s=0;s<n.length;s++){const i=e.attributeData[n[s]];t[r++]=i.location}const s=t.join("|");return e._attributeLocationsKey=(0,Z.X)(s,"programAttributes"),e._attributeLocationsKey}getBufferNamesToBind(e,t){const r=e._layoutKey<<16|t._attributeLocationsKey;if(this._bindingNamesCache[r])return this._bindingNamesCache[r];const n=this._createVertexBufferLayouts(e,t),s=Object.create(null),i=t.attributeData;for(let e=0;e<n.length;e++){const t=Object.values(n[e].attributes)[0].shaderLocation;for(const r in i)if(i[r].location===t){s[e]=r;break}}return this._bindingNamesCache[r]=s,s}_createVertexBufferLayouts(e,t){t._attributeLocationsKey||this._generateAttributeLocationsKey(t);const r=e._layoutKey<<16|t._attributeLocationsKey;if(this._bufferLayoutsCache[r])return this._bufferLayoutsCache[r];const n=[];return e.buffers.forEach((r=>{const s={arrayStride:0,stepMode:"vertex",attributes:[]},i=s.attributes;for(const n in t.attributeData){const a=e.attributes[n];1!==(a.divisor??1)&&(0,g.R)(`Attribute ${n} has an invalid divisor value of '${a.divisor}'. WebGPU only supports a divisor value of 1`),a.buffer===r&&(s.arrayStride=a.stride,s.stepMode=a.instance?"instance":"vertex",i.push({shaderLocation:t.attributeData[n].location,offset:a.offset,format:a.format}))}i.length&&n.push(s)})),this._bufferLayoutsCache[r]=n,n}_updatePipeHash(){const e=(t=this._stencilMode,r=this._multisampleCount,n=this._colorMask,s=this._depthStencilAttachment,i=this._colorTargetCount,n<<8|t<<5|s<<3|i<<1|r);var t,r,n,s,i;this._pipeStateCaches[e]||(this._pipeStateCaches[e]=Object.create(null)),this._pipeCache=this._pipeStateCaches[e]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}}re.extension={type:[n.Ag.WebGPUSystem],name:"pipeline"};var ne=r(7238),se=r(1257),ie=r(4884),ae=r(583);class oe{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}class ue{init(e,t){this._renderer=e,this._renderTargetSystem=t}copyToTexture(e,t,r,n,s){const i=this._renderer,a=this._getGpuColorTexture(e),o=i.texture.getGpuSource(t.source);return i.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:r},{texture:o,origin:s},n),t}startRenderPass(e,t=!0,r,n,s=0,i=0){const a=this._renderTargetSystem.getGpuRenderTarget(e);if(0!==i&&a.msaaTextures?.length)throw new Error("[RenderTargetSystem] Rendering to array layers is not supported with MSAA render targets.");if(s>0&&a.msaaTextures?.length)throw new Error("[RenderTargetSystem] Rendering to mip levels is not supported with MSAA render targets.");const o=this.getDescriptor(e,t,r,s,i);a.descriptor=o,this._renderer.pipeline.setRenderTarget(a),this._renderer.encoder.beginRenderPass(a),this._renderer.encoder.setViewport(n)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(e){const t=this._renderTargetSystem.getGpuRenderTarget(e);return t.contexts[0]?t.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(e.colorTextures[0].source)}getDescriptor(e,t,r,n=0,s=0){"boolean"==typeof t&&(t=t?se.u.ALL:se.u.NONE);const i=this._renderTargetSystem,a=i.getGpuRenderTarget(e),o=e.colorTextures.map(((e,o)=>{const u=a.contexts[o];let d,c;if(u){if(0!==s)throw new Error("[RenderTargetSystem] Rendering to array layers is not supported for canvas targets.");d=u.getCurrentTexture().createView()}else d=this._renderer.texture.getGpuSource(e).createView({dimension:"2d",baseMipLevel:n,mipLevelCount:1,baseArrayLayer:s,arrayLayerCount:1});a.msaaTextures[o]&&(c=d,d=this._renderer.texture.getTextureView(a.msaaTextures[o]));const h=t&se.u.COLOR?"clear":"load";return r??(r=i.defaultClearColor),{view:d,resolveTarget:c,clearValue:r,storeOp:"store",loadOp:h}}));let u;if(!e.stencil&&!e.depth||e.depthStencilTexture||(e.ensureDepthStencilTexture(),e.depthStencilTexture.source.sampleCount=a.msaa?4:1),e.depthStencilTexture){const r=t&se.u.STENCIL?"clear":"load",i=t&se.u.DEPTH?"clear":"load";u={view:this._renderer.texture.getGpuSource(e.depthStencilTexture.source).createView({dimension:"2d",baseMipLevel:n,mipLevelCount:1,baseArrayLayer:s,arrayLayerCount:1}),stencilStoreOp:"store",stencilLoadOp:r,depthClearValue:1,depthLoadOp:i,depthStoreOp:"store"}}return{colorAttachments:o,depthStencilAttachment:u}}clear(e,t=!0,r,n,s=0,i=0){if(!t)return;const{gpu:a,encoder:o}=this._renderer,u=a.device;if(null===o.commandEncoder){const a=u.createCommandEncoder(),o=this.getDescriptor(e,t,r,s,i),d=a.beginRenderPass(o);d.setViewport(n.x,n.y,n.width,n.height,0,1),d.end();const c=a.finish();u.queue.submit([c])}else this.startRenderPass(e,t,r,n,s,i)}initGpuRenderTarget(e){e.isRoot=!0;const t=new oe;return t.colorTargetCount=e.colorTextures.length,e.colorTextures.forEach(((e,r)=>{if(e instanceof ie.q){const n=e.resource.getContext("webgpu"),s=e.transparent?"premultiplied":"opaque";try{n.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:s})}catch(e){console.error(e)}t.contexts[r]=n}if(t.msaa=e.source.antialias,e.source.antialias){const n=new ae.v({width:0,height:0,sampleCount:4,arrayLayerCount:e.source.arrayLayerCount});t.msaaTextures[r]=n}})),t.msaa&&(t.msaaSamples=4,e.depthStencilTexture&&(e.depthStencilTexture.source.sampleCount=4)),t}destroyGpuRenderTarget(e){e.contexts.forEach((e=>{e.unconfigure()})),e.msaaTextures.forEach((e=>{e.destroy()})),e.msaaTextures.length=0,e.contexts.length=0}ensureDepthStencilTexture(e){const t=this._renderTargetSystem.getGpuRenderTarget(e);e.depthStencilTexture&&t.msaa&&(e.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(e){const t=this._renderTargetSystem.getGpuRenderTarget(e);t.width=e.width,t.height=e.height,t.msaa&&e.colorTextures.forEach(((e,r)=>{const n=t.msaaTextures[r];n?.resize(e.source.width,e.source.height,e.source._resolution)}))}}class de extends ne.l{constructor(e){super(e),this.adaptor=new ue,this.adaptor.init(e,this)}}de.extension={type:[n.Ag.WebGPUSystem],name:"renderTarget"};class ce{constructor(){this._gpuProgramData=Object.create(null)}contextChange(e){this._gpu=e}getProgramData(e){return this._gpuProgramData[e._layoutKey]||this._createGPUProgramData(e)}_createGPUProgramData(e){const t=this._gpu.device,r=e.gpuLayout.map((e=>t.createBindGroupLayout({entries:e}))),n={bindGroupLayouts:r};return this._gpuProgramData[e._layoutKey]={bindGroups:r,pipeline:t.createPipelineLayout(n)},this._gpuProgramData[e._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}}ce.extension={type:[n.Ag.WebGPUSystem],name:"shader"};const he={normal:{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},add:{alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}},multiply:{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}},screen:{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},overlay:{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},none:{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}},"normal-npm":{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}},"add-npm":{alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}},"screen-npm":{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}},erase:{alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}},min:{alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}},max:{alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}};class le{constructor(){this.defaultState=new b.U,this.defaultState.blend=!0}contextChange(e){this.gpu=e}getColorTargets(e,t){const r=[],n={format:"bgra8unorm",writeMask:0,blend:he[e.blendMode]||he.normal};for(let e=0;e<t;e++)r[e]=n;return r}destroy(){this.gpu=null}}le.extension={type:[n.Ag.WebGPUSystem],name:"state"};var fe=r(7608);const pe={type:"image",upload(e,t,r,n=0){const s=e.resource,i=(0|e.pixelWidth)*(0|e.pixelHeight),a=s.byteLength/i;r.device.queue.writeTexture({texture:t,origin:{x:0,y:0,z:n}},s,{offset:0,rowsPerImage:e.pixelHeight,bytesPerRow:e.pixelWidth*a},{width:e.pixelWidth,height:e.pixelHeight,depthOrArrayLayers:1})}},me={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},ge={blockBytes:4,blockWidth:1,blockHeight:1},_e={type:"compressed",upload(e,t,r,n=0){let s=e.pixelWidth,i=e.pixelHeight;const a=me[e.format]||ge;for(let o=0;o<e.resource.length;o++){const u=e.resource[o],d=Math.ceil(s/a.blockWidth)*a.blockBytes;r.device.queue.writeTexture({texture:t,mipLevel:o,origin:{x:0,y:0,z:n}},u,{offset:0,bytesPerRow:d},{width:Math.ceil(s/a.blockWidth)*a.blockWidth,height:Math.ceil(i/a.blockHeight)*a.blockHeight,depthOrArrayLayers:1}),s=Math.max(s>>1,1),i=Math.max(i>>1,1)}}},be=["right","left","top","bottom","front","back"];const ve={type:"image",upload(e,t,r,n=0){const s=e.resource;if(!s)return;if(globalThis.HTMLImageElement&&s instanceof HTMLImageElement){const t=R.e.get().createCanvas(s.width,s.height);t.getContext("2d").drawImage(s,0,0,s.width,s.height),e.resource=t,(0,g.R)("ImageSource: Image element passed, converting to canvas and replacing resource.")}const i=Math.min(t.width,e.resourceWidth||e.pixelWidth),a=Math.min(t.height,e.resourceHeight||e.pixelHeight),o="premultiply-alpha-on-upload"===e.alphaMode;r.device.queue.copyExternalImageToTexture({source:s},{texture:t,origin:{x:0,y:0,z:n},premultipliedAlpha:o},{width:i,height:a})}},xe={type:"video",upload(e,t,r,n){ve.upload(e,t,r,n)}};class ye{constructor(e){this.device=e,this.sampler=e.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(e){let t=this.pipelines[e];return t||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:"\n var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(\n vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));\n\n struct VertexOutput {\n @builtin(position) position : vec4<f32>,\n @location(0) texCoord : vec2<f32>,\n };\n\n @vertex\n fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {\n var output : VertexOutput;\n output.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);\n output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);\n return output;\n }\n\n @group(0) @binding(0) var imgSampler : sampler;\n @group(0) @binding(1) var img : texture_2d<f32>;\n\n @fragment\n fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {\n return textureSample(img, imgSampler, texCoord);\n }\n "})),t=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:e}]}}),this.pipelines[e]=t),t}generateMipmap(e){const t=this._getMipmapPipeline(e.format);if("3d"===e.dimension||"1d"===e.dimension)throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=e;const n=e.depthOrArrayLayers||1,s=e.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!s){const t={size:{width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:n},format:e.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:e.mipLevelCount-1};r=this.device.createTexture(t)}const i=this.device.createCommandEncoder({}),a=t.getBindGroupLayout(0);for(let o=0;o<n;++o){let n=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:o,arrayLayerCount:1}),u=s?1:0;for(let s=1;s<e.mipLevelCount;++s){const e=r.createView({baseMipLevel:u++,mipLevelCount:1,dimension:"2d",baseArrayLayer:o,arrayLayerCount:1}),s=i.beginRenderPass({colorAttachments:[{view:e,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),d=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:n}]});s.setPipeline(t),s.setBindGroup(0,d),s.draw(3,1,0,0),s.end(),n=e}}if(!s){const t={width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:n};for(let n=1;n<e.mipLevelCount;++n)i.copyTextureToTexture({texture:r,mipLevel:n-1},{texture:e,mipLevel:n},t),t.width=Math.ceil(t.width/2),t.height=Math.ceil(t.height/2)}return this.device.queue.submit([i.finish()]),s||r.destroy(),e}}class Ge{constructor(e){this.textureView=null,this.gpuTexture=e}destroy(){this.gpuTexture.destroy(),this.textureView=null,this.gpuTexture=null}}class Te{constructor(e){this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._renderer=e,e.gc.addCollection(this,"_bindGroupHash","hash"),this._managedTextures=new S.s({renderer:e,type:"resource",onUnload:this.onSourceUnload.bind(this),name:"gpuTextureSource"});const t={image:ve,buffer:pe,video:xe,compressed:_e};var r;this._uploads={...t,cube:(r=t,{type:"cube",upload(e,t,n){const s=e.faces;for(let e=0;e<be.length;e++){const i=s[be[e]];(r[i.uploadMethodId]||r.image).upload(i,t,n,e)}}})}}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(e){this._gpu=e}initSource(e){return e._gpuData[this._renderer.uid]?.gpuTexture||this._initSource(e)}_initSource(e){if(e.autoGenerateMipmaps){const t=Math.max(e.pixelWidth,e.pixelHeight);e.mipLevelCount=Math.floor(Math.log2(t))+1}let t=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;"compressed"!==e.uploadMethodId&&(t|=GPUTextureUsage.RENDER_ATTACHMENT,t|=GPUTextureUsage.COPY_SRC);const r=me[e.format]||{blockBytes:4,blockWidth:1,blockHeight:1},n=Math.ceil(e.pixelWidth/r.blockWidth)*r.blockWidth,s=Math.ceil(e.pixelHeight/r.blockHeight)*r.blockHeight,i={label:e.label,size:{width:n,height:s,depthOrArrayLayers:e.arrayLayerCount},format:e.format,sampleCount:e.sampleCount,mipLevelCount:e.mipLevelCount,dimension:e.dimension,usage:t},a=this._gpu.device.createTexture(i);e._gpuData[this._renderer.uid]=new Ge(a);return this._managedTextures.add(e)&&(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceResize,this),e.on("updateMipmaps",this.onUpdateMipmaps,this)),this.onSourceUpdate(e),a}onSourceUpdate(e){const t=this.getGpuSource(e);t&&(this._uploads[e.uploadMethodId]&&this._uploads[e.uploadMethodId].upload(e,t,this._gpu),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e))}onUpdateMipmaps(e){this._mipmapGenerator||(this._mipmapGenerator=new ye(this._gpu.device));const t=this.getGpuSource(e);this._mipmapGenerator.generateMipmap(t)}onSourceUnload(e){e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceResize,this),e.off("updateMipmaps",this.onUpdateMipmaps,this)}onSourceResize(e){e._gcLastUsed=this._renderer.gc.now;const t=e._gpuData[this._renderer.uid],r=t?.gpuTexture;r?r.width===e.pixelWidth&&r.height===e.pixelHeight||(t.destroy(),this._bindGroupHash[e.uid]=null,e._gpuData[this._renderer.uid]=null,this.initSource(e)):this.initSource(e)}_initSampler(e){return this._gpuSamplers[e._resourceId]=this._gpu.device.createSampler(e),this._gpuSamplers[e._resourceId]}getGpuSampler(e){return this._gpuSamplers[e._resourceId]||this._initSampler(e)}getGpuSource(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]?.gpuTexture||this.initSource(e)}getTextureBindGroup(e){return this._bindGroupHash[e.uid]||this._createTextureBindGroup(e)}_createTextureBindGroup(e){const t=e.source;return this._bindGroupHash[e.uid]=new Y.T({0:t,1:t.style,2:new l.k({uTextureMatrix:{type:"mat3x3<f32>",value:e.textureMatrix.mapCoord}})}),this._bindGroupHash[e.uid]}getTextureView(e){const t=e.source;t._gcLastUsed=this._renderer.gc.now;let r=t._gpuData[this._renderer.uid];return r||(this.initSource(t),r=t._gpuData[this._renderer.uid]),r.textureView||(r.textureView=r.gpuTexture.createView({dimension:t.viewDimension})),r.textureView}generateCanvas(e){const t=this._renderer,r=t.gpu.device.createCommandEncoder(),n=R.e.get().createCanvas();n.width=e.source.pixelWidth,n.height=e.source.pixelHeight;const s=n.getContext("webgpu");return s.configure({device:t.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:R.e.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:t.texture.getGpuSource(e.source),origin:{x:0,y:0}},{texture:s.getCurrentTexture()},{width:n.width,height:n.height}),t.gpu.device.queue.submit([r.finish()]),n}getPixels(e){const t=this.generateCanvas(e),r=fe.N.getOptimalCanvasAndContext(t.width,t.height),n=r.context;n.drawImage(t,0,0);const{width:s,height:i}=t,a=n.getImageData(0,0,s,i),o=new Uint8ClampedArray(a.data.buffer);return fe.N.returnCanvasAndContext(r),{pixels:o,width:s,height:i}}destroy(){this._managedTextures.destroy();for(const e of Object.keys(this._bindGroupHash)){const t=Number(e),r=this._bindGroupHash[t];r?.destroy()}this._renderer=null,this._gpu=null,this._mipmapGenerator=null,this._gpuSamplers=null,this._bindGroupHash=null}}Te.extension={type:[n.Ag.WebGPUSystem],name:"texture"};const Pe=[...G.i,V,E,A,L,w,Te,de,ce,le,re,M,O,P],Se=[...G.f,Q],Be=[x,_,f],Ce=[],Ue=[],we=[];n.XO.handleByNamedList(n.Ag.WebGPUSystem,Ce),n.XO.handleByNamedList(n.Ag.WebGPUPipes,Ue),n.XO.handleByNamedList(n.Ag.WebGPUPipesAdaptor,we),n.XO.add(...Pe,...Se,...Be);class Me extends y.k{constructor(){super({name:"webgpu",type:T.W.WEBGPU,systems:Ce,renderPipes:Ue,renderPipeAdaptors:we})}}},1172:(e,t,r)=>{r.d(t,{g:()=>s});var n=r(1957);const s=[];s[n.K.NONE]=void 0,s[n.K.DISABLED]={stencilWriteMask:0,stencilReadMask:0},s[n.K.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}},s[n.K.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}},s[n.K.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}},s[n.K.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"keep"},stencilBack:{compare:"not-equal",passOp:"keep"}}},581:(e,t,r)=>{r.d(t,{d:()=>i});var n=r(8875),s=r(133);class i extends n.A{constructor({buffer:e,offset:t,size:r}){super(),this.uid=(0,s.L)("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=(0,s.L)("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=e,this.offset=0|t,this.size=r,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=(0,s.L)("resource"),this.emit("change",this)}destroy(e=!1){this.destroyed=!0,e&&this.buffer.destroy(),this.emit("change",this),this.buffer=null,this.removeAllListeners()}}},7047:(e,t,r)=>{r.d(t,{W:()=>a});var n=r(4577),s=r(949),i=r(1132);class a{constructor(e){this._syncFunctionHash=Object.create(null),this._adaptor=e,this._systemCheck()}_systemCheck(){if(!(0,n.f)())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(e){const t=this.getUniformGroupData(e);e.buffer||(e.buffer=new s.h({data:new Float32Array(t.layout.size/4),usage:i.S.UNIFORM|i.S.COPY_DST}))}getUniformGroupData(e){return this._syncFunctionHash[e._signature]||this._initUniformGroup(e)}_initUniformGroup(e){const t=e._signature;let r=this._syncFunctionHash[t];if(!r){const n=Object.keys(e.uniformStructures).map((t=>e.uniformStructures[t])),s=this._adaptor.createUboElements(n),i=this._generateUboSync(s.uboElements);r=this._syncFunctionHash[t]={layout:s,syncFunction:i}}return this._syncFunctionHash[t]}_generateUboSync(e){return this._adaptor.generateUboSync(e)}syncUniformGroup(e,t,r){const n=this.getUniformGroupData(e);e.buffer||(e.buffer=new s.h({data:new Float32Array(n.layout.size/4),usage:i.S.UNIFORM|i.S.COPY_DST}));let a=null;return t||(t=e.buffer.data,a=e.buffer.dataInt32),r||(r=0),n.syncFunction(e.uniforms,t,a,r),!0}updateUniformGroup(e){if(e.isStatic&&!e._dirtyId)return!1;e._dirtyId=0;const t=this.syncUniformGroup(e);return e.buffer.update(),t}destroy(){this._syncFunctionHash=null}}},6423:(e,t,r)=>{r.d(t,{E:()=>s});var n=r(8166);function s(e,t,r,s){const i=["\n var v = null;\n var v2 = null;\n var t = 0;\n var index = 0;\n var name = null;\n var arrayOffset = null;\n "];let a=0;for(let o=0;o<e.length;o++){const u=e[o],d=u.data.name;let c=!1,h=0;for(let e=0;e<n.$.length;e++){if(n.$[e].test(u.data)){h=u.offset/4,i.push(`name = "${d}";`,`offset += ${h-a};`,n.$[e][t]||n.$[e].ubo),c=!0;break}}if(!c)if(u.data.size>1)h=u.offset/4,i.push(r(u,h-a));else{const e=s[u.data.type];h=u.offset/4,i.push(`\n v = uv.${d};\n offset += ${h-a};\n ${e};\n `)}a=h}const o=i.join("\n");return new Function("uv","data","dataInt32","offset",o)}},1266:(e,t,r)=>{function n(e,t){return`\n for (let i = 0; i < ${e*t}; i++) {\n data[offset + (((i / ${e})|0) * 4) + (i % ${e})] = v[i];\n }\n `}r.d(t,{_:()=>i,g:()=>s});const s={f32:"\n data[offset] = v;",i32:"\n dataInt32[offset] = v;","vec2<f32>":"\n data[offset] = v[0];\n data[offset + 1] = v[1];","vec3<f32>":"\n data[offset] = v[0];\n data[offset + 1] = v[1];\n data[offset + 2] = v[2];","vec4<f32>":"\n data[offset] = v[0];\n data[offset + 1] = v[1];\n data[offset + 2] = v[2];\n data[offset + 3] = v[3];","vec2<i32>":"\n dataInt32[offset] = v[0];\n dataInt32[offset + 1] = v[1];","vec3<i32>":"\n dataInt32[offset] = v[0];\n dataInt32[offset + 1] = v[1];\n dataInt32[offset + 2] = v[2];","vec4<i32>":"\n dataInt32[offset] = v[0];\n dataInt32[offset + 1] = v[1];\n dataInt32[offset + 2] = v[2];\n dataInt32[offset + 3] = v[3];","mat2x2<f32>":"\n data[offset] = v[0];\n data[offset + 1] = v[1];\n data[offset + 4] = v[2];\n data[offset + 5] = v[3];","mat3x3<f32>":"\n data[offset] = v[0];\n data[offset + 1] = v[1];\n data[offset + 2] = v[2];\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];","mat4x4<f32>":"\n for (let i = 0; i < 16; i++) {\n data[offset + i] = v[i];\n }","mat3x2<f32>":n(3,2),"mat4x2<f32>":n(4,2),"mat2x3<f32>":n(2,3),"mat4x3<f32>":n(4,3),"mat2x4<f32>":n(2,4),"mat3x4<f32>":n(3,4)},i={...s,"mat2x2<f32>":"\n data[offset] = v[0];\n data[offset + 1] = v[1];\n data[offset + 2] = v[2];\n data[offset + 3] = v[3];\n "}},8166:(e,t,r)=>{r.d(t,{$:()=>n});const n=[{type:"mat3x3<f32>",test:e=>void 0!==e.value.a,ubo:"\n var matrix = uv[name].toArray(true);\n data[offset] = matrix[0];\n data[offset + 1] = matrix[1];\n data[offset + 2] = matrix[2];\n data[offset + 4] = matrix[3];\n data[offset + 5] = matrix[4];\n data[offset + 6] = matrix[5];\n data[offset + 8] = matrix[6];\n data[offset + 9] = matrix[7];\n data[offset + 10] = matrix[8];\n ",uniform:"\n gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true));\n "},{type:"vec4<f32>",test:e=>"vec4<f32>"===e.type&&1===e.size&&void 0!==e.value.width,ubo:"\n v = uv[name];\n data[offset] = v.x;\n data[offset + 1] = v.y;\n data[offset + 2] = v.width;\n data[offset + 3] = v.height;\n ",uniform:"\n cv = ud[name].value;\n v = uv[name];\n if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height);\n }\n "},{type:"vec2<f32>",test:e=>"vec2<f32>"===e.type&&1===e.size&&void 0!==e.value.x,ubo:"\n v = uv[name];\n data[offset] = v.x;\n data[offset + 1] = v.y;\n ",uniform:"\n cv = ud[name].value;\n v = uv[name];\n if (cv[0] !== v.x || cv[1] !== v.y) {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[name].location, v.x, v.y);\n }\n "},{type:"vec4<f32>",test:e=>"vec4<f32>"===e.type&&1===e.size&&void 0!==e.value.red,ubo:"\n v = uv[name];\n data[offset] = v.red;\n data[offset + 1] = v.green;\n data[offset + 2] = v.blue;\n data[offset + 3] = v.alpha;\n ",uniform:"\n cv = ud[name].value;\n v = uv[name];\n if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) {\n cv[0] = v.red;\n cv[1] = v.green;\n cv[2] = v.blue;\n cv[3] = v.alpha;\n gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha);\n }\n "},{type:"vec3<f32>",test:e=>"vec3<f32>"===e.type&&1===e.size&&void 0!==e.value.red,ubo:"\n v = uv[name];\n data[offset] = v.red;\n data[offset + 1] = v.green;\n data[offset + 2] = v.blue;\n ",uniform:"\n cv = ud[name].value;\n v = uv[name];\n if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) {\n cv[0] = v.red;\n cv[1] = v.green;\n cv[2] = v.blue;\n gl.uniform3f(ud[name].location, v.red, v.green, v.blue);\n }\n "}]}}]);