@ray-js/robot-map-sdk 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/bin/docs-server.js +195 -0
  2. package/dist-docs/404.html +2 -2
  3. package/dist-docs/assets/{app.Dqj628zE.js → app.3-ianRvb.js} +1 -1
  4. package/dist-docs/assets/chunks/@localSearchIndexroot.l5uunL9n.js +1 -0
  5. package/dist-docs/assets/chunks/{BitmapFont.BXsyt1Ko.js → BitmapFont.C8awBCd1.js} +1 -1
  6. package/dist-docs/assets/chunks/{BufferResource.8pzc1eMm.js → BufferResource.C5TLxka4.js} +1 -1
  7. package/dist-docs/assets/chunks/{CanvasRenderer.DpOhlsYI.js → CanvasRenderer.DyglCOE2.js} +1 -1
  8. package/dist-docs/assets/chunks/{RenderTargetSystem.CWKFKvEe.js → RenderTargetSystem._cMCUdmu.js} +1 -1
  9. package/dist-docs/assets/chunks/{VPLocalSearchBox.D1fbUxUi.js → VPLocalSearchBox.DYzATQt_.js} +1 -1
  10. package/dist-docs/assets/chunks/{WebGLRenderer.BlPSqrND.js → WebGLRenderer.C_pauwH4.js} +1 -1
  11. package/dist-docs/assets/chunks/{WebGPURenderer.szL5hbKh.js → WebGPURenderer.DuRPdsh5.js} +1 -1
  12. package/dist-docs/assets/chunks/{browserAll.BxwMP9Gg.js → browserAll.BebatlLr.js} +1 -1
  13. package/dist-docs/assets/chunks/{index.nS-neZH_.js → index.DR0yN-kU.js} +4 -4
  14. package/dist-docs/assets/chunks/{theme.B9FcKggM.js → theme.Dn4kNa0x.js} +3 -3
  15. package/dist-docs/assets/chunks/{webworkerAll.BXgPGAoF.js → webworkerAll.BAL0vGum.js} +1 -1
  16. package/dist-docs/assets/{guide_getting-started.md.B8rkVqGP.js → guide_getting-started.md.DzTPTYGC.js} +2 -2
  17. package/dist-docs/assets/guide_getting-started.md.DzTPTYGC.lean.js +1 -0
  18. package/dist-docs/assets/records_bugs_2026-03-11-docs-server-bin-clean-bugfix.md.GGWCjkok.js +1 -0
  19. package/dist-docs/assets/records_bugs_2026-03-11-docs-server-bin-clean-bugfix.md.GGWCjkok.lean.js +1 -0
  20. package/dist-docs/guide/advanced-usage.html +3 -3
  21. package/dist-docs/guide/concepts.html +3 -3
  22. package/dist-docs/guide/getting-started.html +5 -5
  23. package/dist-docs/guide/mcp.html +3 -3
  24. package/dist-docs/hashmap.json +1 -1
  25. package/dist-docs/index.html +3 -3
  26. package/dist-docs/plans/2026-03-04-detected-objects-visibility-design.html +3 -3
  27. package/dist-docs/plans/2026-03-04-show-detected-objects-implementation-plan.html +3 -3
  28. package/dist-docs/plans/2026-03-10-simulator-debug-design.html +3 -3
  29. package/dist-docs/plans/2026-03-10-simulator-events-console-design.html +3 -3
  30. package/dist-docs/plans/2026-03-10-simulator-events-console-implementation-plan.html +3 -3
  31. package/dist-docs/plans/2026-03-10-simulator-runtime-controls-design.html +3 -3
  32. package/dist-docs/plans/2026-03-10-simulator-runtime-controls-implementation-plan.html +3 -3
  33. package/dist-docs/records/bugs/2026-02-28-fix-pixi-bindgroup-webgpu-snapshot-whitescreen-bugfix.html +3 -3
  34. package/dist-docs/records/bugs/2026-03-10-events-drawer-toolbar-scroll-bugfix.html +3 -3
  35. package/dist-docs/records/bugs/2026-03-10-simulator-initial-render-layout-bugfix.html +3 -3
  36. package/dist-docs/records/bugs/2026-03-10-simulator-wheel-scroll-leak-bugfix.html +3 -3
  37. package/dist-docs/records/bugs/2026-03-11-docs-server-bin-clean-bugfix.html +25 -0
  38. package/dist-docs/records/plans/2026-03-02-furniture-feature-plan.html +3 -3
  39. package/dist-docs/records/plans/2026-03-10-simulator-events-console-plan.html +3 -3
  40. package/dist-docs/records/plans/2026-03-10-simulator-last-successful-combo-cache-plan.html +3 -3
  41. package/dist-docs/records/plans/2026-03-10-simulator-map-parsed-view-plan.html +3 -3
  42. package/dist-docs/records/plans/2026-03-10-simulator-map-playground-refactor-plan.html +3 -3
  43. package/dist-docs/records/plans/2026-03-10-simulator-playground-plan.html +3 -3
  44. package/dist-docs/records/plans/2026-03-10-simulator-runtime-controls-plan.html +3 -3
  45. package/dist-docs/records/plans/2026-03-11-simulator-src-migration-implementation.html +3 -3
  46. package/dist-docs/records/plans/2026-03-11-simulator-src-migration-plan.html +3 -3
  47. package/dist-docs/reference/callbacks.html +3 -3
  48. package/dist-docs/reference/config.html +3 -3
  49. package/dist-docs/reference/data.html +3 -3
  50. package/dist-docs/reference/methods.html +3 -3
  51. package/dist-docs/reference/runtime.html +3 -3
  52. package/dist-docs/reference/types.html +3 -3
  53. package/dist-docs/reference/utils.html +3 -3
  54. package/dist-docs/simulator/index.html +3 -3
  55. package/package.json +1 -1
  56. package/dist-docs/assets/chunks/@localSearchIndexroot.5wY6DA9h.js +0 -1
  57. package/dist-docs/assets/guide_getting-started.md.B8rkVqGP.lean.js +0 -1
@@ -1,4 +1,4 @@
1
- import{E as U,d as C,v as z,T,f as H,a as L,C as M,R as A,b as j,I as G,g as R,c as q,e as W,l as J,h as _,w as Z,i as V}from"./index.nS-neZH_.js";import"./framework.CBLqO2Q1.js";import"./mapValues.D2X8cRgC.js";import"./theme.B9FcKggM.js";class $ extends U{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return C(z,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return C(z,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return C(z,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return C(z,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return C(z,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=!1){var e;this.emit("destroy",this),this.removeAllListeners();for(const i in this.chars)(e=this.chars[i].texture)==null||e.destroy();this.chars=null,t&&(this.pages.forEach(i=>i.texture.destroy(!0)),this.pages=null)}}const Y=class X extends ${constructor(t){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentMaxCharHeight=0,this._currentPageIndex=-1,this._skipKerning=!1;const e={...X.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;const i=e.style.clone();e.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=T.WHITE,i._fill.fill=null),this.applyFillAsTint=e.overrideFill;const s=i.fontSize;i.fontSize=this.baseMeasurementFontSize;const n=H(i);e.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/s):i.fontSize=this.baseRenderedFontSize=s,this._style=i,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,e.textureStyle&&(this._textureStyle=e.textureStyle instanceof L?e.textureStyle:new L(e.textureStyle)),this.fontMetrics=M.measureFont(n),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(t){var F,f;const e=M.graphemeSegmenter(t).filter(c=>!this._currentChars.includes(c)).filter((c,p,g)=>g.indexOf(c)===p);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:s,context:n}=i.canvasAndContext,a=i.texture.source;const r=this._style;let o=this._currentX,h=this._currentY,l=this._currentMaxCharHeight;const u=this.baseRenderedFontSize/this.baseMeasurementFontSize,m=this._padding*u;let S=!1;const y=s.width/this.resolution,w=s.height/this.resolution;for(let c=0;c<e.length;c++){const p=e[c],g=M.measureText(p,r,s,!1);g.lineHeight=g.height;const O=g.width*u,P=Math.ceil((r.fontStyle==="italic"?2:1)*O),b=g.height*u,x=P+m*2,B=b+m*2;if(S=!1,p!==`
1
+ import{E as U,d as C,v as z,T,f as H,a as L,C as M,R as A,b as j,I as G,g as R,c as q,e as W,l as J,h as _,w as Z,i as V}from"./index.DR0yN-kU.js";import"./framework.CBLqO2Q1.js";import"./mapValues.D2X8cRgC.js";import"./theme.Dn4kNa0x.js";class $ extends U{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return C(z,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return C(z,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return C(z,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return C(z,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return C(z,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=!1){var e;this.emit("destroy",this),this.removeAllListeners();for(const i in this.chars)(e=this.chars[i].texture)==null||e.destroy();this.chars=null,t&&(this.pages.forEach(i=>i.texture.destroy(!0)),this.pages=null)}}const Y=class X extends ${constructor(t){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentMaxCharHeight=0,this._currentPageIndex=-1,this._skipKerning=!1;const e={...X.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;const i=e.style.clone();e.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=T.WHITE,i._fill.fill=null),this.applyFillAsTint=e.overrideFill;const s=i.fontSize;i.fontSize=this.baseMeasurementFontSize;const n=H(i);e.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/s):i.fontSize=this.baseRenderedFontSize=s,this._style=i,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,e.textureStyle&&(this._textureStyle=e.textureStyle instanceof L?e.textureStyle:new L(e.textureStyle)),this.fontMetrics=M.measureFont(n),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(t){var F,f;const e=M.graphemeSegmenter(t).filter(c=>!this._currentChars.includes(c)).filter((c,p,g)=>g.indexOf(c)===p);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:s,context:n}=i.canvasAndContext,a=i.texture.source;const r=this._style;let o=this._currentX,h=this._currentY,l=this._currentMaxCharHeight;const u=this.baseRenderedFontSize/this.baseMeasurementFontSize,m=this._padding*u;let S=!1;const y=s.width/this.resolution,w=s.height/this.resolution;for(let c=0;c<e.length;c++){const p=e[c],g=M.measureText(p,r,s,!1);g.lineHeight=g.height;const O=g.width*u,P=Math.ceil((r.fontStyle==="italic"?2:1)*O),b=g.height*u,x=P+m*2,B=b+m*2;if(S=!1,p!==`
2
2
  `&&p!=="\r"&&p!==" "&&p!==" "&&(S=!0,l=Math.ceil(Math.max(B,l))),o+x>y&&(h+=l,l=B,o=0,h+l>w)){a.update();const v=this._nextPage();s=v.canvasAndContext.canvas,n=v.canvasAndContext.context,a=v.texture.source,o=0,h=0,l=0}const D=O/u-(((F=r.dropShadow)==null?void 0:F.distance)??0)-(((f=r._stroke)==null?void 0:f.width)??0);if(this.chars[p]={id:p.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:D,kerning:{}},S){this._drawGlyph(n,g,o+m,h+m,u,r);const v=a.width*u,I=a.height*u,N=new A(o/v*a.width,h/I*a.height,x/v*a.width,B/I*a.height);this.chars[p].texture=new T({source:a,frame:N}),o+=Math.ceil(x)}}a.update(),this._currentX=o,this._currentY=h,this._currentMaxCharHeight=l,this._skipKerning&&this._applyKerning(e,n)}get pageTextures(){return C(z,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){const i=this._measureCache;for(let s=0;s<t.length;s++){const n=t[s];for(let a=0;a<this._currentChars.length;a++){const r=this._currentChars[a];let o=i[n];o||(o=i[n]=e.measureText(n).width);let h=i[r];h||(h=i[r]=e.measureText(r).width);let l=e.measureText(n+r).width,u=l-(o+h);u&&(this.chars[n].kerning[r]=u),l=e.measureText(n+r).width,u=l-(o+h),u&&(this.chars[r].kerning[n]=u)}}}_nextPage(){this._currentPageIndex++;const t=this.resolution,e=j.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);const i=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new T({source:new G({resource:e.canvas,resolution:i,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})});this._textureStyle&&(s.source.style=this._textureStyle);const n={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=n,n}_setupContext(t,e,i){e.fontSize=this.baseRenderedFontSize,t.scale(i,i),t.font=H(e),e.fontSize=this.baseMeasurementFontSize,t.textBaseline=e.textBaseline;const s=e._stroke,n=(s==null?void 0:s.width)??0;if(s&&(t.lineWidth=n,t.lineJoin=s.join,t.miterLimit=s.miterLimit,t.strokeStyle=R(s,t)),e._fill&&(t.fillStyle=R(e._fill,t)),e.dropShadow){const a=e.dropShadow,r=q.shared.setValue(a.color).toArray(),o=a.blur*i,h=a.distance*i;t.shadowColor=`rgba(${r[0]*255},${r[1]*255},${r[2]*255},${a.alpha})`,t.shadowBlur=o,t.shadowOffsetX=Math.cos(a.angle)*h,t.shadowOffsetY=Math.sin(a.angle)*h}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0}_drawGlyph(t,e,i,s,n,a){const r=e.text,o=e.fontProperties,h=a._stroke,l=((h==null?void 0:h.width)??0)*n,u=i+l/2,m=s-l/2,S=o.descent*n,y=e.lineHeight*n;let w=!1;a.stroke&&l&&(w=!0,t.strokeText(r,u,m+y-S));const{shadowBlur:F,shadowOffsetX:f,shadowOffsetY:c}=t;a._fill&&(w&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.fillText(r,u,m+y-S)),w&&(t.shadowBlur=F,t.shadowOffsetX=f,t.shadowOffsetY=c)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){const{canvasAndContext:e,texture:i}=this.pages[t];j.returnCanvasAndContext(e),i.destroy(!0)}this.pages=null}};Y.defaultOptions={textureSize:512,style:new W,mipmap:!0};let E=Y;function Q(d,t,e,i){const s={width:0,height:0,offsetY:0,scale:t.fontSize/e.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=e.baseLineOffset;let n=s.lines[0],a=null,r=!0;const o={width:0,start:0,index:0,positions:[],chars:[]},h=e.baseMeasurementFontSize/t.fontSize,l=t.letterSpacing*h,u=t.wordWrapWidth*h,m=t.lineHeight?t.lineHeight*h:e.lineHeight,S=t.wordWrap&&t.breakWords,y=f=>{const c=n.width;for(let p=0;p<o.index;p++){const g=f.positions[p];n.chars.push(f.chars[p]),n.charPositions.push(g+c)}n.width+=f.width,r=!1,o.width=0,o.index=0,o.chars.length=0},w=()=>{let f=n.chars.length-1;if(i){let c=n.chars[f];for(;c===" ";)n.width-=e.chars[c].xAdvance,c=n.chars[--f]}s.width=Math.max(s.width,n.width),n={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},r=!0,s.lines.push(n),s.height+=m},F=f=>f-l>u;for(let f=0;f<d.length+1;f++){let c;const p=f===d.length;p||(c=d[f]);const g=e.chars[c]||e.chars[" "];if(/(?:\s)/.test(c)||c==="\r"||c===`
3
3
  `||p){if(!r&&t.wordWrap&&F(n.width+o.width)?(w(),y(o),p||n.charPositions.push(0)):(o.start=n.width,y(o),p||n.charPositions.push(0)),c==="\r"||c===`
4
4
  `)w();else if(!p){const x=g.xAdvance+(g.kerning[a]||0)+l;n.width+=x,n.spaceWidth=x,n.spacesIndex.push(n.charPositions.length),n.chars.push(c)}}else{const b=g.kerning[a]||0,x=g.xAdvance+b+l;S&&F(n.width+o.width+x)&&(y(o),w()),o.positions[o.index++]=o.width+b,o.chars.push(c),o.width+=x}a=c}return w(),t.align==="center"?ee(s):t.align==="right"?te(s):t.align==="justify"&&se(s),s}function ee(d){for(let t=0;t<d.lines.length;t++){const e=d.lines[t],i=d.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function te(d){for(let t=0;t<d.lines.length;t++){const e=d.lines[t],i=d.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function se(d){const t=d.width;for(let e=0;e<d.lines.length;e++){const i=d.lines[e];let s=0,n=i.spacesIndex[s++],a=0;const r=i.spacesIndex.length,h=(t-i.width)/r;for(let l=0;l<i.charPositions.length;l++)l===n&&(n=i.spacesIndex[s++],a+=h),i.charPositions[l]+=a}}function ie(d){if(d==="")return[];typeof d=="string"&&(d=[d]);const t=[];for(let e=0,i=d.length;e<i;e++){const s=d[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);if(s[0].length===0||s[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");const n=s[0].charCodeAt(0),a=s[1].charCodeAt(0);if(a<n)throw new Error("[BitmapFont]: Invalid character range.");for(let r=n,o=a;r<=o;r++)t.push(String.fromCharCode(r))}else t.push(...Array.from(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}let k=0;class ne{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1,textureStyle:null},this.measureCache=J(1e3)}getFont(t,e){var a;let i=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke?(i+=e._fill.fill.styleKey,s=!1):(e._stroke||e.dropShadow)&&(i=`${e.styleKey}-bitmap`,s=!1),!_.has(i)){const r=Object.create(e);r._lineHeight=0;const o=new E({style:r,overrideFill:s,overrideSize:!0,...this.defaultOptions});k++,k>50&&Z("BitmapText",`You have dynamically created ${k} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),o.once("destroy",()=>{k--,_.remove(i)}),_.set(i,o)}const n=_.get(i);return(a=n.ensureCharacters)==null||a.call(n,t),n}getLayout(t,e,i=!0){const s=this.getFont(t,e),n=`${t}-${e.styleKey}-${i}`;if(this.measureCache.has(n))return this.measureCache.get(n);const a=M.graphemeSegmenter(t),r=Q(a,e,s,i);return this.measureCache.set(n,r),r}measureText(t,e,i=!0){return this.getLayout(t,e,i)}install(...t){var h,l,u,m;let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:(h=t[2])==null?void 0:h.chars,resolution:(l=t[2])==null?void 0:l.resolution,padding:(u=t[2])==null?void 0:u.padding,skipKerning:(m=t[2])==null?void 0:m.skipKerning},C(z,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));const i=e==null?void 0:e.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};const s=e.style,n=s instanceof W?s:new W(s),a=e.dynamicFill??this._canUseTintForStyle(n),r=new E({style:n,overrideFill:a,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1,textureStyle:e.textureStyle}),o=ie(e.chars);return r.ensureCharacters(o.join("")),_.set(`${i}-bitmap`,r),r.once("destroy",()=>_.remove(`${i}-bitmap`)),r}uninstall(t){const e=`${t}-bitmap`,i=_.get(e);i&&i.destroy()}_canUseTintForStyle(t){return!t._stroke&&(!t.dropShadow||t.dropShadow.color===0)&&!t._fill.fill&&t._fill.color===16777215}}const K=new ne;class le extends ${constructor(t,e){super();const{textures:i,data:s}=t;Object.keys(s.pages).forEach(n=>{const a=s.pages[parseInt(n,10)],r=i[a.id];this.pages.push({texture:r})}),Object.keys(s.chars).forEach(n=>{const a=s.chars[n],{frame:r,source:o,rotate:h}=i[a.page],l=V.transformRectCoords(a,r,h,new A),u=new T({frame:l,orig:new A(0,0,a.width,a.height),source:o,rotate:h});this.chars[n]={id:n.codePointAt(0),xOffset:a.xOffset,yOffset:a.yOffset,xAdvance:a.xAdvance,kerning:a.kerning??{},texture:u}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){const{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){K.install(t)}static uninstall(t){K.uninstall(t)}}export{le as BitmapFont};
@@ -1,4 +1,4 @@
1
- import{w as _,j as y,S as c,u as S,B as g,k as m,E as I,m as p}from"./index.nS-neZH_.js";const D={name:"texture-bit",vertex:{header:`
1
+ import{w as _,j as y,S as c,u as S,B as g,k as m,E as I,m as p}from"./index.DR0yN-kU.js";const D={name:"texture-bit",vertex:{header:`
2
2
 
3
3
  struct TextureUniforms {
4
4
  uTextureMatrix:mat3x3<f32>,
@@ -1 +1 @@
1
- import{z as T,i as Se,A as Me,D as ae,M as U,p as w,G as je,w as Ve,H as Ye,c as we,T as Ie,J as Xe,K as $e,L as Je,N as Ke,O as Qe,Q as ze,V as Re,W as Ze,X as et,x as oe}from"./index.nS-neZH_.js";import{R as tt,S as st,B as nt,a as at,b as rt,c as ot,A as it,C as ct}from"./RenderTargetSystem.CWKFKvEe.js";import"./framework.CBLqO2Q1.js";import"./mapValues.D2X8cRgC.js";import"./theme.B9FcKggM.js";const ge=class X{static _getPatternRepeat(e,t){const s=e&&e!=="clamp-to-edge",a=t&&t!=="clamp-to-edge";return s&&a?"repeat":s?"repeat-x":a?"repeat-y":"no-repeat"}start(e,t,s){}execute(e,t){var i,h,f,g;const s=t.elements;if(!s||!s.length)return;const a=e.renderer,r=a.canvasContext,o=r.activeContext;for(let I=0;I<s.length;I++){const G=s[I];if(!G.packAsQuad)continue;const v=G,u=v.texture,R=u?T.getCanvasSource(u):null;if(!R)continue;const x=u.source.style,A=r.smoothProperty,q=x.scaleMode!=="nearest";o[A]!==q&&(o[A]=q),r.setBlendMode(t.blendMode);const E=((i=a.globalUniforms.globalUniformData)==null?void 0:i.worldColor)??4294967295,P=v.color,y=(E>>>24&255)/255,V=(P>>>24&255)/255,ee=((h=a.filter)==null?void 0:h.alphaMultiplier)??1,Q=y*V*ee;if(Q<=0)continue;o.globalAlpha=Q;const z=E&16777215,$=P&16777215,k=Me(ae($,z)),_=u.frame,S=x.addressModeU??x.addressMode,ie=x.addressModeV??x.addressMode,Z=X._getPatternRepeat(S,ie),D=u.source._resolution??u.source.resolution??1,Y=(g=(f=v.renderable)==null?void 0:f.renderGroup)==null?void 0:g.isCachedAsTexture,d=_.x*D,p=_.y*D,m=_.width*D,L=_.height*D,M=v.bounds,b=a.renderTarget.renderTarget.isRoot,W=M.minX,F=M.minY,B=M.maxX-M.minX,H=M.maxY-M.minY,O=u.rotate,c=u.uvs,N=Math.min(c.x0,c.x1,c.x2,c.x3,c.y0,c.y1,c.y2,c.y3),j=Math.max(c.x0,c.x1,c.x2,c.x3,c.y0,c.y1,c.y2,c.y3),C=Z!=="no-repeat"&&(N<0||j>1),ce=O&&!(!C&&(k!==16777215||O));ce?(X._tempPatternMatrix.copyFrom(v.transform),Se.matrixAppendRotationInv(X._tempPatternMatrix,O,W,F,B,H),r.setContextTransform(X._tempPatternMatrix,v.roundPixels===1,void 0,Y&&b)):r.setContextTransform(v.transform,v.roundPixels===1,void 0,Y&&b);const te=ce?0:W,se=ce?0:F,le=B,he=H;if(C){let de=R;const J=k!==16777215&&!O,K=_.width<=u.source.width&&_.height<=u.source.height;J&&K&&(de=T.getTintedCanvas({texture:u},k));const pe=o.createPattern(de,Z);if(!pe)continue;const xe=le,ye=he;if(xe===0||ye===0)continue;const Ce=1/xe,Te=1/ye,Pe=(c.x1-c.x0)*Ce,ke=(c.y1-c.y0)*Ce,be=(c.x3-c.x0)*Te,_e=(c.y3-c.y0)*Te,Oe=c.x0-Pe*te-be*se,Ne=c.y0-ke*te-_e*se,ue=u.source.pixelWidth,me=u.source.pixelHeight;X._tempPatternMatrix.set(Pe*ue,ke*me,be*ue,_e*me,Oe*ue,Ne*me),T.applyPatternTransform(pe,X._tempPatternMatrix),o.fillStyle=pe,o.fillRect(te,se,le,he)}else{const J=k!==16777215||O?T.getTintedCanvas({texture:u},k):R,K=J!==R;o.drawImage(J,K?0:d,K?0:p,K?J.width:m,K?J.height:L,te,se,le,he)}}}};ge._tempPatternMatrix=new U;ge.extension={type:[w.CanvasPipesAdaptor],name:"batch"};let lt=ge;class Ae{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,s){this._renderer.renderPipes.batch.break(s);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,s.add({renderPipeId:"colorMask",colorMask:r,canBundle:!1})),this._colorStackIndex++}pop(e,t,s){this._renderer.renderPipes.batch.break(s);const a=this._colorStack;this._colorStackIndex--;const r=a[this._colorStackIndex-1];r!==this._currentColor&&(this._currentColor=r,s.add({renderPipeId:"colorMask",colorMask:r,canBundle:!1}))}execute(e){}destroy(){this._renderer=null,this._colorStack=null}}Ae.extension={type:[w.CanvasPipes],name:"colorMask"};function ht(n,e,t,s,a,r){r=Math.max(0,Math.min(r,Math.min(s,a)/2)),n.moveTo(e+r,t),n.lineTo(e+s-r,t),n.quadraticCurveTo(e+s,t,e+s,t+r),n.lineTo(e+s,t+a-r),n.quadraticCurveTo(e+s,t+a,e+s-r,t+a),n.lineTo(e+r,t+a),n.quadraticCurveTo(e,t+a,e,t+a-r),n.lineTo(e,t+r),n.quadraticCurveTo(e,t,e+r,t)}function Be(n,e){switch(e.type){case"rectangle":{const t=e;n.rect(t.x,t.y,t.width,t.height);break}case"roundedRectangle":{const t=e;ht(n,t.x,t.y,t.width,t.height,t.radius);break}case"circle":{const t=e;n.moveTo(t.x+t.radius,t.y),n.arc(t.x,t.y,t.radius,0,Math.PI*2);break}case"ellipse":{const t=e;n.ellipse?(n.moveTo(t.x+t.halfWidth,t.y),n.ellipse(t.x,t.y,t.halfWidth,t.halfHeight,0,0,Math.PI*2)):(n.save(),n.translate(t.x,t.y),n.scale(t.halfWidth,t.halfHeight),n.moveTo(1,0),n.arc(0,0,1,0,Math.PI*2),n.restore());break}case"triangle":{const t=e;n.moveTo(t.x,t.y),n.lineTo(t.x2,t.y2),n.lineTo(t.x3,t.y3),n.closePath();break}case"polygon":default:{const t=e,s=t.points;if(!(s!=null&&s.length))break;n.moveTo(s[0],s[1]);for(let a=2;a<s.length;a+=2)n.lineTo(s[a],s[a+1]);t.closePath&&n.closePath();break}}}function dt(n,e){if(!(e!=null&&e.length))return!1;for(let t=0;t<e.length;t++){const s=e[t];if(!(s!=null&&s.shape))continue;const a=s.transform,r=a&&!a.isIdentity();r&&(n.save(),n.transform(a.a,a.b,a.c,a.d,a.tx,a.ty)),Be(n,s.shape),r&&n.restore()}return!0}class He{constructor(e){this._warnedMaskTypes=new Set,this._canvasMaskStack=[],this._renderer=e}push(e,t,s){this._renderer.renderPipes.batch.break(s),s.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,s){this._renderer.renderPipes.batch.break(s),s.add({renderPipeId:"stencilMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){var g,I,G;if(e.action!=="pushMaskBegin"&&e.action!=="popMaskEnd")return;const t=this._renderer,s=t.canvasContext,a=s==null?void 0:s.activeContext;if(!a)return;if(e.action==="popMaskEnd"){this._canvasMaskStack.pop()&&a.restore();return}e.inverse&&this._warnOnce("inverse","CanvasRenderer: inverse masks are not supported on Canvas2D; ignoring inverse flag.");const r=e.mask.mask;if(!(r instanceof je)){this._warnOnce("nonGraphics","CanvasRenderer: only Graphics masks are supported in Canvas2D; skipping mask."),this._canvasMaskStack.push(!1);return}const o=r,i=(g=o.context)==null?void 0:g.instructions;if(!(i!=null&&i.length)){this._canvasMaskStack.push(!1);return}a.save(),s.setContextTransform(o.groupTransform,(t._roundPixels|o._roundPixels)===1),a.beginPath();let h=!1,f=!1;for(let v=0;v<i.length;v++){const u=i[v],R=u.action;if(R!=="fill"&&R!=="stroke")continue;const x=u.data,A=(I=x==null?void 0:x.path)==null?void 0:I.shapePath;if(!((G=A==null?void 0:A.shapePrimitives)!=null&&G.length))continue;const q=A.shapePrimitives;for(let E=0;E<q.length;E++){const P=q[E];if(!(P!=null&&P.shape))continue;const y=P.transform,V=y&&!y.isIdentity();V&&(a.save(),a.transform(y.a,y.b,y.c,y.d,y.tx,y.ty)),Be(a,P.shape),f=dt(a,P.holes)||f,h=!0,V&&a.restore()}}if(!h){a.restore(),this._canvasMaskStack.push(!1);return}f?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),Ve(t))}}He.extension={type:[w.CanvasPipes],name:"stencilMask"};const l="source-over";function pt(){const n=Ye(),e=Object.create(null);return e.inherit=l,e.none=l,e.normal="source-over",e.add="lighter",e.multiply=n?"multiply":l,e.screen=n?"screen":l,e.overlay=n?"overlay":l,e.darken=n?"darken":l,e.lighten=n?"lighten":l,e["color-dodge"]=n?"color-dodge":l,e["color-burn"]=n?"color-burn":l,e["hard-light"]=n?"hard-light":l,e["soft-light"]=n?"soft-light":l,e.difference=n?"difference":l,e.exclusion=n?"exclusion":l,e.saturation=n?"saturation":l,e.color=n?"color":l,e.luminosity=n?"luminosity":l,e["linear-burn"]=n?"color-burn":l,e["linear-dodge"]=n?"color-dodge":l,e["linear-light"]=n?"hard-light":l,e["pin-light"]=n?"hard-light":l,e["vivid-light"]=n?"hard-light":l,e["hard-mix"]=l,e.negation=n?"difference":l,e["normal-npm"]=e.normal,e["add-npm"]=e.add,e["screen-npm"]=e.screen,e.erase="destination-out",e.subtract=l,e.divide=l,e.min=l,e.max=l,e}const ut=new U;class Ge{constructor(e){this.activeResolution=1,this.smoothProperty="imageSmoothingEnabled",this.blendModes=pt(),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 t=this.rootContext;t.webkitImageSmoothingEnabled?this.smoothProperty="webkitImageSmoothingEnabled":t.mozImageSmoothingEnabled?this.smoothProperty="mozImageSmoothingEnabled":t.oImageSmoothingEnabled?this.smoothProperty="oImageSmoothingEnabled":t.msImageSmoothingEnabled&&(this.smoothProperty="msImageSmoothingEnabled")}}setContextTransform(e,t,s,a){var f;const r=a?U.IDENTITY:((f=this._renderer.globalUniforms.globalUniformData)==null?void 0:f.worldTransformMatrix)||U.IDENTITY;let o=ut;o.copyFrom(r),o.append(e);const i=this._projTransform,h=this.activeResolution;if(s=s||h,i){const g=U.shared;g.copyFrom(o),g.prepend(i),o=g}t?this.activeContext.setTransform(o.a*s,o.b*s,o.c*s,o.d*s,o.tx*h|0,o.ty*h|0):this.activeContext.setTransform(o.a*s,o.b*s,o.c*s,o.d*s,o.tx*h,o.ty*h)}clear(e,t){const s=this.activeContext,a=this._renderer;if(s.clearRect(0,0,a.width,a.height),e){const r=we.shared.setValue(e);s.globalAlpha=t??r.alpha,s.fillStyle=r.toHex(),s.fillRect(0,0,a.width,a.height),s.globalAlpha=1}}setBlendMode(e){if(this._activeBlendMode===e)return;this._activeBlendMode=e,this._outerBlend=!1;const t=this.blendModes[e];if(!t){this._warnedBlendModes.has(e)||(console.warn(`CanvasRenderer: blend mode "${e}" is not supported in Canvas2D; falling back to "source-over".`),this._warnedBlendModes.add(e)),this.activeContext.globalCompositeOperation="source-over";return}this.activeContext.globalCompositeOperation=t}destroy(){this.rootContext=null,this.activeContext=null,this._warnedBlendModes.clear()}}Ge.extension={type:[w.CanvasSystem],name:"canvasContext"};class Ee{constructor(){this.maxTextures=16,this.maxBatchableTextures=16,this.maxUniformBindings=0}init(){}}Ee.extension={type:[w.CanvasSystem],name:"limits"};const mt="#808080",ne=new U,ft=new U,gt=new U,fe=new U;function vt(n,e,t){n.beginPath();for(let s=0;s<t.length;s+=3){const a=t[s]*2,r=t[s+1]*2,o=t[s+2]*2;n.moveTo(e[a],e[a+1]),n.lineTo(e[r],e[r+1]),n.lineTo(e[o],e[o+1]),n.closePath()}n.fill()}function xt(n){return`#${(n&16777215).toString(16).padStart(6,"0")}`}function yt(n,e,t,s,a,r){r=Math.max(0,Math.min(r,Math.min(s,a)/2)),n.moveTo(e+r,t),n.lineTo(e+s-r,t),n.quadraticCurveTo(e+s,t,e+s,t+r),n.lineTo(e+s,t+a-r),n.quadraticCurveTo(e+s,t+a,e+s-r,t+a),n.lineTo(e+r,t+a),n.quadraticCurveTo(e,t+a,e,t+a-r),n.lineTo(e,t+r),n.quadraticCurveTo(e,t,e+r,t)}function re(n,e){switch(e.type){case"rectangle":{const t=e;n.rect(t.x,t.y,t.width,t.height);break}case"roundedRectangle":{const t=e;yt(n,t.x,t.y,t.width,t.height,t.radius);break}case"circle":{const t=e;n.arc(t.x,t.y,t.radius,0,Math.PI*2);break}case"ellipse":{const t=e;n.ellipse?n.ellipse(t.x,t.y,t.halfWidth,t.halfHeight,0,0,Math.PI*2):(n.save(),n.translate(t.x,t.y),n.scale(t.halfWidth,t.halfHeight),n.arc(0,0,1,0,Math.PI*2),n.restore());break}case"triangle":{const t=e;n.moveTo(t.x,t.y),n.lineTo(t.x2,t.y2),n.lineTo(t.x3,t.y3),n.closePath();break}case"polygon":default:{const t=e,s=t.points;if(!(s!=null&&s.length))break;n.moveTo(s[0],s[1]);for(let a=2;a<s.length;a+=2)n.lineTo(s[a],s[a+1]);t.closePath&&n.closePath();break}}}function Ct(n,e){if(!(e!=null&&e.length))return!1;for(let t=0;t<e.length;t++){const s=e[t];if(!(s!=null&&s.shape))continue;const a=s.transform,r=a&&!a.isIdentity();r&&(n.save(),n.transform(a.a,a.b,a.c,a.d,a.tx,a.ty)),re(n,s.shape),r&&n.restore()}return!0}function Tt(n,e,t,s){const a=n.fill;if(a instanceof Ke){a.buildGradient();const o=a.texture;if(o){const i=T.getTintedPattern(o,e),h=t?fe.copyFrom(t).scale(o.source.pixelWidth,o.source.pixelHeight):fe.copyFrom(a.transform);return s&&!n.textureSpace&&h.append(s),T.applyPatternTransform(i,h),i}}if(a instanceof Qe){const o=T.getTintedPattern(a.texture,e);return T.applyPatternTransform(o,a.transform),o}const r=n.texture;if(r&&r!==Ie.WHITE){if(!r.source.resource)return mt;const o=T.getTintedPattern(r,e),i=t?fe.copyFrom(t).scale(r.source.pixelWidth,r.source.pixelHeight):n.matrix;return T.applyPatternTransform(o,i),o}return xt(e)}class We{constructor(){this.shader=null}contextChange(e){}execute(e,t){var q,E,P,y,V,ee,Q;const s=e.renderer,a=s.canvasContext,r=a.activeContext,o=t.groupTransform,i=((q=s.globalUniforms.globalUniformData)==null?void 0:q.worldColor)??4294967295,h=t.groupColorAlpha,f=(i>>>24&255)/255,g=(h>>>24&255)/255,I=((E=s.filter)==null?void 0:E.alphaMultiplier)??1,G=f*g*I;if(G<=0)return;const v=i&16777215,u=h&16777215,R=Me(ae(u,v)),x=s._roundPixels|t._roundPixels;r.save(),a.setContextTransform(o,x===1),a.setBlendMode(t.groupBlendMode);const A=t.context.instructions;for(let z=0;z<A.length;z++){const $=A[z];if($.action==="texture"){const d=$.data,p=d.image,m=p?T.getCanvasSource(p):null;if(!m)continue;const L=d.alpha*G;if(L<=0)continue;const M=ae(d.style,R);r.globalAlpha=L;let b=m;M!==16777215&&(b=T.getTintedCanvas({texture:p},M));const W=p.frame,F=p.source._resolution??p.source.resolution??1;let B=W.x*F,H=W.y*F;const O=W.width*F,c=W.height*F;b!==m&&(B=0,H=0);const N=d.transform,j=N&&!N.isIdentity(),C=p.rotate;j||C?(ne.copyFrom(o),j&&ne.append(N),C&&Se.matrixAppendRotationInv(ne,C,d.dx,d.dy,d.dw,d.dh),a.setContextTransform(ne,x===1)):a.setContextTransform(o,x===1),r.drawImage(b,B,H,b===m?O:b.width,b===m?c:b.height,C?0:d.dx,C?0:d.dy,d.dw,d.dh),(j||C)&&a.setContextTransform(o,x===1);continue}const k=$.data,_=(P=k==null?void 0:k.path)==null?void 0:P.shapePath;if(!((y=_==null?void 0:_.shapePrimitives)!=null&&y.length))continue;const S=k.style,ie=ae(S.color,R),Z=S.alpha*G;if(Z<=0)continue;const D=$.action==="stroke";if(r.globalAlpha=Z,D){const d=S;r.lineWidth=d.width,r.lineCap=d.cap,r.lineJoin=d.join,r.miterLimit=d.miterLimit}const Y=_.shapePrimitives;if(!D&&((Q=(ee=(V=k.hole)==null?void 0:V.shapePath)==null?void 0:ee.shapePrimitives)!=null&&Q.length)){const d=Y[Y.length-1];d.holes=k.hole.shapePath.shapePrimitives}for(let d=0;d<Y.length;d++){const p=Y[d];if(!(p!=null&&p.shape))continue;const m=p.transform,L=m&&!m.isIdentity(),M=S.texture&&S.texture!==Ie.WHITE,b=S.textureSpace==="global"?m:null,W=M?Xe(ft,S,p.shape,b):null,F=L?gt.copyFrom(o).append(m):o,B=Tt(S,ie,W,F);if(L&&(r.save(),r.transform(m.a,m.b,m.c,m.d,m.tx,m.ty)),D){const H=S;if(H.alignment!==.5&&!H.pixelLine){const c=[],N=[],j=[],C=$e[p.shape.type];if(C!=null&&C.build(p.shape,c)){const ve=p.shape.closePath??!0;Je(c,H,!1,ve,N,j),r.fillStyle=B,vt(r,N,j)}else r.strokeStyle=B,r.beginPath(),re(r,p.shape),r.stroke()}else r.strokeStyle=B,r.beginPath(),re(r,p.shape),r.stroke()}else r.fillStyle=B,r.beginPath(),re(r,p.shape),Ct(r,p.holes)?r.fill("evenodd"):r.fill();L&&r.restore()}}r.restore()}destroy(){this.shader=null}}We.extension={type:[w.CanvasPipesAdaptor],name:"graphics"};class Pt{init(e,t){this._renderer=e,this._renderTargetSystem=t}initGpuRenderTarget(e){const t=e.colorTexture,{canvas:s,context:a}=this._ensureCanvas(t);return{canvas:s,context:a,width:s.width,height:s.height}}resizeGpuRenderTarget(e){const t=e.colorTexture,{canvas:s}=this._ensureCanvas(t);s.width=e.pixelWidth,s.height=e.pixelHeight}startRenderPass(e,t,s,a){const r=this._renderTargetSystem.getGpuRenderTarget(e);this._renderer.canvasContext.activeContext=r.context,this._renderer.canvasContext.activeResolution=e.resolution,t&&this.clear(e,t,s,a)}clear(e,t,s,a){const o=this._renderTargetSystem.getGpuRenderTarget(e).context,i=a||{x:0,y:0,width:e.pixelWidth,height:e.pixelHeight};if(o.setTransform(1,0,0,1,0,0),o.clearRect(i.x,i.y,i.width,i.height),s){const h=we.shared.setValue(s);h.alpha>0&&(o.globalAlpha=h.alpha,o.fillStyle=h.toHex(),o.fillRect(i.x,i.y,i.width,i.height),o.globalAlpha=1)}}finishRenderPass(){}copyToTexture(e,t,s,a,r){const i=this._renderTargetSystem.getGpuRenderTarget(e).canvas,h=t.source,{context:f}=this._ensureCanvas(h),g=(r==null?void 0:r.x)??0,I=(r==null?void 0:r.y)??0;return f.drawImage(i,s.x,s.y,a.width,a.height,g,I,a.width,a.height),h.update(),t}destroyGpuRenderTarget(e){}_ensureCanvas(e){let t=e.resource;(!t||!ze.test(t))&&(t=Re.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 s=t.getContext("2d");return{canvas:t,context:s}}}class Fe extends tt{constructor(e){super(e),this.adaptor=new Pt,this.adaptor.init(e,this)}}Fe.extension={type:[w.CanvasSystem],name:"renderTarget"};class Ue{constructor(e){}init(){}initSource(e){}generateCanvas(e){const t=Re.get().createCanvas(),s=t.getContext("2d"),a=T.getCanvasSource(e);if(!a)return t;const r=e.frame,o=e.source._resolution??e.source.resolution??1,i=r.x*o,h=r.y*o,f=r.width*o,g=r.height*o;return t.width=Math.ceil(f),t.height=Math.ceil(g),s.drawImage(a,i,h,f,g,0,0,f,g),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(){}}Ue.extension={type:[w.CanvasSystem],name:"texture"};const kt=[...st,Ge,Ee,Ue,Fe],bt=[nt,at,rt,ot,it,He,Ae,ct],_t=[lt,We],qe=[],De=[],Le=[];oe.handleByNamedList(w.CanvasSystem,qe);oe.handleByNamedList(w.CanvasPipes,De);oe.handleByNamedList(w.CanvasPipesAdaptor,Le);oe.add(...kt,...bt,..._t);class At extends Ze{constructor(){const e={name:"canvas",type:et.CANVAS,systems:qe,renderPipes:De,renderPipeAdaptors:Le};super(e)}}export{At as CanvasRenderer};
1
+ import{z as T,i as Se,A as Me,D as ae,M as U,p as w,G as je,w as Ve,H as Ye,c as we,T as Ie,J as Xe,K as $e,L as Je,N as Ke,O as Qe,Q as ze,V as Re,W as Ze,X as et,x as oe}from"./index.DR0yN-kU.js";import{R as tt,S as st,B as nt,a as at,b as rt,c as ot,A as it,C as ct}from"./RenderTargetSystem._cMCUdmu.js";import"./framework.CBLqO2Q1.js";import"./mapValues.D2X8cRgC.js";import"./theme.Dn4kNa0x.js";const ge=class X{static _getPatternRepeat(e,t){const s=e&&e!=="clamp-to-edge",a=t&&t!=="clamp-to-edge";return s&&a?"repeat":s?"repeat-x":a?"repeat-y":"no-repeat"}start(e,t,s){}execute(e,t){var i,h,f,g;const s=t.elements;if(!s||!s.length)return;const a=e.renderer,r=a.canvasContext,o=r.activeContext;for(let I=0;I<s.length;I++){const G=s[I];if(!G.packAsQuad)continue;const v=G,u=v.texture,R=u?T.getCanvasSource(u):null;if(!R)continue;const x=u.source.style,A=r.smoothProperty,q=x.scaleMode!=="nearest";o[A]!==q&&(o[A]=q),r.setBlendMode(t.blendMode);const E=((i=a.globalUniforms.globalUniformData)==null?void 0:i.worldColor)??4294967295,P=v.color,y=(E>>>24&255)/255,V=(P>>>24&255)/255,ee=((h=a.filter)==null?void 0:h.alphaMultiplier)??1,Q=y*V*ee;if(Q<=0)continue;o.globalAlpha=Q;const z=E&16777215,$=P&16777215,k=Me(ae($,z)),_=u.frame,S=x.addressModeU??x.addressMode,ie=x.addressModeV??x.addressMode,Z=X._getPatternRepeat(S,ie),D=u.source._resolution??u.source.resolution??1,Y=(g=(f=v.renderable)==null?void 0:f.renderGroup)==null?void 0:g.isCachedAsTexture,d=_.x*D,p=_.y*D,m=_.width*D,L=_.height*D,M=v.bounds,b=a.renderTarget.renderTarget.isRoot,W=M.minX,F=M.minY,B=M.maxX-M.minX,H=M.maxY-M.minY,O=u.rotate,c=u.uvs,N=Math.min(c.x0,c.x1,c.x2,c.x3,c.y0,c.y1,c.y2,c.y3),j=Math.max(c.x0,c.x1,c.x2,c.x3,c.y0,c.y1,c.y2,c.y3),C=Z!=="no-repeat"&&(N<0||j>1),ce=O&&!(!C&&(k!==16777215||O));ce?(X._tempPatternMatrix.copyFrom(v.transform),Se.matrixAppendRotationInv(X._tempPatternMatrix,O,W,F,B,H),r.setContextTransform(X._tempPatternMatrix,v.roundPixels===1,void 0,Y&&b)):r.setContextTransform(v.transform,v.roundPixels===1,void 0,Y&&b);const te=ce?0:W,se=ce?0:F,le=B,he=H;if(C){let de=R;const J=k!==16777215&&!O,K=_.width<=u.source.width&&_.height<=u.source.height;J&&K&&(de=T.getTintedCanvas({texture:u},k));const pe=o.createPattern(de,Z);if(!pe)continue;const xe=le,ye=he;if(xe===0||ye===0)continue;const Ce=1/xe,Te=1/ye,Pe=(c.x1-c.x0)*Ce,ke=(c.y1-c.y0)*Ce,be=(c.x3-c.x0)*Te,_e=(c.y3-c.y0)*Te,Oe=c.x0-Pe*te-be*se,Ne=c.y0-ke*te-_e*se,ue=u.source.pixelWidth,me=u.source.pixelHeight;X._tempPatternMatrix.set(Pe*ue,ke*me,be*ue,_e*me,Oe*ue,Ne*me),T.applyPatternTransform(pe,X._tempPatternMatrix),o.fillStyle=pe,o.fillRect(te,se,le,he)}else{const J=k!==16777215||O?T.getTintedCanvas({texture:u},k):R,K=J!==R;o.drawImage(J,K?0:d,K?0:p,K?J.width:m,K?J.height:L,te,se,le,he)}}}};ge._tempPatternMatrix=new U;ge.extension={type:[w.CanvasPipesAdaptor],name:"batch"};let lt=ge;class Ae{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,s){this._renderer.renderPipes.batch.break(s);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,s.add({renderPipeId:"colorMask",colorMask:r,canBundle:!1})),this._colorStackIndex++}pop(e,t,s){this._renderer.renderPipes.batch.break(s);const a=this._colorStack;this._colorStackIndex--;const r=a[this._colorStackIndex-1];r!==this._currentColor&&(this._currentColor=r,s.add({renderPipeId:"colorMask",colorMask:r,canBundle:!1}))}execute(e){}destroy(){this._renderer=null,this._colorStack=null}}Ae.extension={type:[w.CanvasPipes],name:"colorMask"};function ht(n,e,t,s,a,r){r=Math.max(0,Math.min(r,Math.min(s,a)/2)),n.moveTo(e+r,t),n.lineTo(e+s-r,t),n.quadraticCurveTo(e+s,t,e+s,t+r),n.lineTo(e+s,t+a-r),n.quadraticCurveTo(e+s,t+a,e+s-r,t+a),n.lineTo(e+r,t+a),n.quadraticCurveTo(e,t+a,e,t+a-r),n.lineTo(e,t+r),n.quadraticCurveTo(e,t,e+r,t)}function Be(n,e){switch(e.type){case"rectangle":{const t=e;n.rect(t.x,t.y,t.width,t.height);break}case"roundedRectangle":{const t=e;ht(n,t.x,t.y,t.width,t.height,t.radius);break}case"circle":{const t=e;n.moveTo(t.x+t.radius,t.y),n.arc(t.x,t.y,t.radius,0,Math.PI*2);break}case"ellipse":{const t=e;n.ellipse?(n.moveTo(t.x+t.halfWidth,t.y),n.ellipse(t.x,t.y,t.halfWidth,t.halfHeight,0,0,Math.PI*2)):(n.save(),n.translate(t.x,t.y),n.scale(t.halfWidth,t.halfHeight),n.moveTo(1,0),n.arc(0,0,1,0,Math.PI*2),n.restore());break}case"triangle":{const t=e;n.moveTo(t.x,t.y),n.lineTo(t.x2,t.y2),n.lineTo(t.x3,t.y3),n.closePath();break}case"polygon":default:{const t=e,s=t.points;if(!(s!=null&&s.length))break;n.moveTo(s[0],s[1]);for(let a=2;a<s.length;a+=2)n.lineTo(s[a],s[a+1]);t.closePath&&n.closePath();break}}}function dt(n,e){if(!(e!=null&&e.length))return!1;for(let t=0;t<e.length;t++){const s=e[t];if(!(s!=null&&s.shape))continue;const a=s.transform,r=a&&!a.isIdentity();r&&(n.save(),n.transform(a.a,a.b,a.c,a.d,a.tx,a.ty)),Be(n,s.shape),r&&n.restore()}return!0}class He{constructor(e){this._warnedMaskTypes=new Set,this._canvasMaskStack=[],this._renderer=e}push(e,t,s){this._renderer.renderPipes.batch.break(s),s.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,s){this._renderer.renderPipes.batch.break(s),s.add({renderPipeId:"stencilMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){var g,I,G;if(e.action!=="pushMaskBegin"&&e.action!=="popMaskEnd")return;const t=this._renderer,s=t.canvasContext,a=s==null?void 0:s.activeContext;if(!a)return;if(e.action==="popMaskEnd"){this._canvasMaskStack.pop()&&a.restore();return}e.inverse&&this._warnOnce("inverse","CanvasRenderer: inverse masks are not supported on Canvas2D; ignoring inverse flag.");const r=e.mask.mask;if(!(r instanceof je)){this._warnOnce("nonGraphics","CanvasRenderer: only Graphics masks are supported in Canvas2D; skipping mask."),this._canvasMaskStack.push(!1);return}const o=r,i=(g=o.context)==null?void 0:g.instructions;if(!(i!=null&&i.length)){this._canvasMaskStack.push(!1);return}a.save(),s.setContextTransform(o.groupTransform,(t._roundPixels|o._roundPixels)===1),a.beginPath();let h=!1,f=!1;for(let v=0;v<i.length;v++){const u=i[v],R=u.action;if(R!=="fill"&&R!=="stroke")continue;const x=u.data,A=(I=x==null?void 0:x.path)==null?void 0:I.shapePath;if(!((G=A==null?void 0:A.shapePrimitives)!=null&&G.length))continue;const q=A.shapePrimitives;for(let E=0;E<q.length;E++){const P=q[E];if(!(P!=null&&P.shape))continue;const y=P.transform,V=y&&!y.isIdentity();V&&(a.save(),a.transform(y.a,y.b,y.c,y.d,y.tx,y.ty)),Be(a,P.shape),f=dt(a,P.holes)||f,h=!0,V&&a.restore()}}if(!h){a.restore(),this._canvasMaskStack.push(!1);return}f?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),Ve(t))}}He.extension={type:[w.CanvasPipes],name:"stencilMask"};const l="source-over";function pt(){const n=Ye(),e=Object.create(null);return e.inherit=l,e.none=l,e.normal="source-over",e.add="lighter",e.multiply=n?"multiply":l,e.screen=n?"screen":l,e.overlay=n?"overlay":l,e.darken=n?"darken":l,e.lighten=n?"lighten":l,e["color-dodge"]=n?"color-dodge":l,e["color-burn"]=n?"color-burn":l,e["hard-light"]=n?"hard-light":l,e["soft-light"]=n?"soft-light":l,e.difference=n?"difference":l,e.exclusion=n?"exclusion":l,e.saturation=n?"saturation":l,e.color=n?"color":l,e.luminosity=n?"luminosity":l,e["linear-burn"]=n?"color-burn":l,e["linear-dodge"]=n?"color-dodge":l,e["linear-light"]=n?"hard-light":l,e["pin-light"]=n?"hard-light":l,e["vivid-light"]=n?"hard-light":l,e["hard-mix"]=l,e.negation=n?"difference":l,e["normal-npm"]=e.normal,e["add-npm"]=e.add,e["screen-npm"]=e.screen,e.erase="destination-out",e.subtract=l,e.divide=l,e.min=l,e.max=l,e}const ut=new U;class Ge{constructor(e){this.activeResolution=1,this.smoothProperty="imageSmoothingEnabled",this.blendModes=pt(),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 t=this.rootContext;t.webkitImageSmoothingEnabled?this.smoothProperty="webkitImageSmoothingEnabled":t.mozImageSmoothingEnabled?this.smoothProperty="mozImageSmoothingEnabled":t.oImageSmoothingEnabled?this.smoothProperty="oImageSmoothingEnabled":t.msImageSmoothingEnabled&&(this.smoothProperty="msImageSmoothingEnabled")}}setContextTransform(e,t,s,a){var f;const r=a?U.IDENTITY:((f=this._renderer.globalUniforms.globalUniformData)==null?void 0:f.worldTransformMatrix)||U.IDENTITY;let o=ut;o.copyFrom(r),o.append(e);const i=this._projTransform,h=this.activeResolution;if(s=s||h,i){const g=U.shared;g.copyFrom(o),g.prepend(i),o=g}t?this.activeContext.setTransform(o.a*s,o.b*s,o.c*s,o.d*s,o.tx*h|0,o.ty*h|0):this.activeContext.setTransform(o.a*s,o.b*s,o.c*s,o.d*s,o.tx*h,o.ty*h)}clear(e,t){const s=this.activeContext,a=this._renderer;if(s.clearRect(0,0,a.width,a.height),e){const r=we.shared.setValue(e);s.globalAlpha=t??r.alpha,s.fillStyle=r.toHex(),s.fillRect(0,0,a.width,a.height),s.globalAlpha=1}}setBlendMode(e){if(this._activeBlendMode===e)return;this._activeBlendMode=e,this._outerBlend=!1;const t=this.blendModes[e];if(!t){this._warnedBlendModes.has(e)||(console.warn(`CanvasRenderer: blend mode "${e}" is not supported in Canvas2D; falling back to "source-over".`),this._warnedBlendModes.add(e)),this.activeContext.globalCompositeOperation="source-over";return}this.activeContext.globalCompositeOperation=t}destroy(){this.rootContext=null,this.activeContext=null,this._warnedBlendModes.clear()}}Ge.extension={type:[w.CanvasSystem],name:"canvasContext"};class Ee{constructor(){this.maxTextures=16,this.maxBatchableTextures=16,this.maxUniformBindings=0}init(){}}Ee.extension={type:[w.CanvasSystem],name:"limits"};const mt="#808080",ne=new U,ft=new U,gt=new U,fe=new U;function vt(n,e,t){n.beginPath();for(let s=0;s<t.length;s+=3){const a=t[s]*2,r=t[s+1]*2,o=t[s+2]*2;n.moveTo(e[a],e[a+1]),n.lineTo(e[r],e[r+1]),n.lineTo(e[o],e[o+1]),n.closePath()}n.fill()}function xt(n){return`#${(n&16777215).toString(16).padStart(6,"0")}`}function yt(n,e,t,s,a,r){r=Math.max(0,Math.min(r,Math.min(s,a)/2)),n.moveTo(e+r,t),n.lineTo(e+s-r,t),n.quadraticCurveTo(e+s,t,e+s,t+r),n.lineTo(e+s,t+a-r),n.quadraticCurveTo(e+s,t+a,e+s-r,t+a),n.lineTo(e+r,t+a),n.quadraticCurveTo(e,t+a,e,t+a-r),n.lineTo(e,t+r),n.quadraticCurveTo(e,t,e+r,t)}function re(n,e){switch(e.type){case"rectangle":{const t=e;n.rect(t.x,t.y,t.width,t.height);break}case"roundedRectangle":{const t=e;yt(n,t.x,t.y,t.width,t.height,t.radius);break}case"circle":{const t=e;n.arc(t.x,t.y,t.radius,0,Math.PI*2);break}case"ellipse":{const t=e;n.ellipse?n.ellipse(t.x,t.y,t.halfWidth,t.halfHeight,0,0,Math.PI*2):(n.save(),n.translate(t.x,t.y),n.scale(t.halfWidth,t.halfHeight),n.arc(0,0,1,0,Math.PI*2),n.restore());break}case"triangle":{const t=e;n.moveTo(t.x,t.y),n.lineTo(t.x2,t.y2),n.lineTo(t.x3,t.y3),n.closePath();break}case"polygon":default:{const t=e,s=t.points;if(!(s!=null&&s.length))break;n.moveTo(s[0],s[1]);for(let a=2;a<s.length;a+=2)n.lineTo(s[a],s[a+1]);t.closePath&&n.closePath();break}}}function Ct(n,e){if(!(e!=null&&e.length))return!1;for(let t=0;t<e.length;t++){const s=e[t];if(!(s!=null&&s.shape))continue;const a=s.transform,r=a&&!a.isIdentity();r&&(n.save(),n.transform(a.a,a.b,a.c,a.d,a.tx,a.ty)),re(n,s.shape),r&&n.restore()}return!0}function Tt(n,e,t,s){const a=n.fill;if(a instanceof Ke){a.buildGradient();const o=a.texture;if(o){const i=T.getTintedPattern(o,e),h=t?fe.copyFrom(t).scale(o.source.pixelWidth,o.source.pixelHeight):fe.copyFrom(a.transform);return s&&!n.textureSpace&&h.append(s),T.applyPatternTransform(i,h),i}}if(a instanceof Qe){const o=T.getTintedPattern(a.texture,e);return T.applyPatternTransform(o,a.transform),o}const r=n.texture;if(r&&r!==Ie.WHITE){if(!r.source.resource)return mt;const o=T.getTintedPattern(r,e),i=t?fe.copyFrom(t).scale(r.source.pixelWidth,r.source.pixelHeight):n.matrix;return T.applyPatternTransform(o,i),o}return xt(e)}class We{constructor(){this.shader=null}contextChange(e){}execute(e,t){var q,E,P,y,V,ee,Q;const s=e.renderer,a=s.canvasContext,r=a.activeContext,o=t.groupTransform,i=((q=s.globalUniforms.globalUniformData)==null?void 0:q.worldColor)??4294967295,h=t.groupColorAlpha,f=(i>>>24&255)/255,g=(h>>>24&255)/255,I=((E=s.filter)==null?void 0:E.alphaMultiplier)??1,G=f*g*I;if(G<=0)return;const v=i&16777215,u=h&16777215,R=Me(ae(u,v)),x=s._roundPixels|t._roundPixels;r.save(),a.setContextTransform(o,x===1),a.setBlendMode(t.groupBlendMode);const A=t.context.instructions;for(let z=0;z<A.length;z++){const $=A[z];if($.action==="texture"){const d=$.data,p=d.image,m=p?T.getCanvasSource(p):null;if(!m)continue;const L=d.alpha*G;if(L<=0)continue;const M=ae(d.style,R);r.globalAlpha=L;let b=m;M!==16777215&&(b=T.getTintedCanvas({texture:p},M));const W=p.frame,F=p.source._resolution??p.source.resolution??1;let B=W.x*F,H=W.y*F;const O=W.width*F,c=W.height*F;b!==m&&(B=0,H=0);const N=d.transform,j=N&&!N.isIdentity(),C=p.rotate;j||C?(ne.copyFrom(o),j&&ne.append(N),C&&Se.matrixAppendRotationInv(ne,C,d.dx,d.dy,d.dw,d.dh),a.setContextTransform(ne,x===1)):a.setContextTransform(o,x===1),r.drawImage(b,B,H,b===m?O:b.width,b===m?c:b.height,C?0:d.dx,C?0:d.dy,d.dw,d.dh),(j||C)&&a.setContextTransform(o,x===1);continue}const k=$.data,_=(P=k==null?void 0:k.path)==null?void 0:P.shapePath;if(!((y=_==null?void 0:_.shapePrimitives)!=null&&y.length))continue;const S=k.style,ie=ae(S.color,R),Z=S.alpha*G;if(Z<=0)continue;const D=$.action==="stroke";if(r.globalAlpha=Z,D){const d=S;r.lineWidth=d.width,r.lineCap=d.cap,r.lineJoin=d.join,r.miterLimit=d.miterLimit}const Y=_.shapePrimitives;if(!D&&((Q=(ee=(V=k.hole)==null?void 0:V.shapePath)==null?void 0:ee.shapePrimitives)!=null&&Q.length)){const d=Y[Y.length-1];d.holes=k.hole.shapePath.shapePrimitives}for(let d=0;d<Y.length;d++){const p=Y[d];if(!(p!=null&&p.shape))continue;const m=p.transform,L=m&&!m.isIdentity(),M=S.texture&&S.texture!==Ie.WHITE,b=S.textureSpace==="global"?m:null,W=M?Xe(ft,S,p.shape,b):null,F=L?gt.copyFrom(o).append(m):o,B=Tt(S,ie,W,F);if(L&&(r.save(),r.transform(m.a,m.b,m.c,m.d,m.tx,m.ty)),D){const H=S;if(H.alignment!==.5&&!H.pixelLine){const c=[],N=[],j=[],C=$e[p.shape.type];if(C!=null&&C.build(p.shape,c)){const ve=p.shape.closePath??!0;Je(c,H,!1,ve,N,j),r.fillStyle=B,vt(r,N,j)}else r.strokeStyle=B,r.beginPath(),re(r,p.shape),r.stroke()}else r.strokeStyle=B,r.beginPath(),re(r,p.shape),r.stroke()}else r.fillStyle=B,r.beginPath(),re(r,p.shape),Ct(r,p.holes)?r.fill("evenodd"):r.fill();L&&r.restore()}}r.restore()}destroy(){this.shader=null}}We.extension={type:[w.CanvasPipesAdaptor],name:"graphics"};class Pt{init(e,t){this._renderer=e,this._renderTargetSystem=t}initGpuRenderTarget(e){const t=e.colorTexture,{canvas:s,context:a}=this._ensureCanvas(t);return{canvas:s,context:a,width:s.width,height:s.height}}resizeGpuRenderTarget(e){const t=e.colorTexture,{canvas:s}=this._ensureCanvas(t);s.width=e.pixelWidth,s.height=e.pixelHeight}startRenderPass(e,t,s,a){const r=this._renderTargetSystem.getGpuRenderTarget(e);this._renderer.canvasContext.activeContext=r.context,this._renderer.canvasContext.activeResolution=e.resolution,t&&this.clear(e,t,s,a)}clear(e,t,s,a){const o=this._renderTargetSystem.getGpuRenderTarget(e).context,i=a||{x:0,y:0,width:e.pixelWidth,height:e.pixelHeight};if(o.setTransform(1,0,0,1,0,0),o.clearRect(i.x,i.y,i.width,i.height),s){const h=we.shared.setValue(s);h.alpha>0&&(o.globalAlpha=h.alpha,o.fillStyle=h.toHex(),o.fillRect(i.x,i.y,i.width,i.height),o.globalAlpha=1)}}finishRenderPass(){}copyToTexture(e,t,s,a,r){const i=this._renderTargetSystem.getGpuRenderTarget(e).canvas,h=t.source,{context:f}=this._ensureCanvas(h),g=(r==null?void 0:r.x)??0,I=(r==null?void 0:r.y)??0;return f.drawImage(i,s.x,s.y,a.width,a.height,g,I,a.width,a.height),h.update(),t}destroyGpuRenderTarget(e){}_ensureCanvas(e){let t=e.resource;(!t||!ze.test(t))&&(t=Re.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 s=t.getContext("2d");return{canvas:t,context:s}}}class Fe extends tt{constructor(e){super(e),this.adaptor=new Pt,this.adaptor.init(e,this)}}Fe.extension={type:[w.CanvasSystem],name:"renderTarget"};class Ue{constructor(e){}init(){}initSource(e){}generateCanvas(e){const t=Re.get().createCanvas(),s=t.getContext("2d"),a=T.getCanvasSource(e);if(!a)return t;const r=e.frame,o=e.source._resolution??e.source.resolution??1,i=r.x*o,h=r.y*o,f=r.width*o,g=r.height*o;return t.width=Math.ceil(f),t.height=Math.ceil(g),s.drawImage(a,i,h,f,g,0,0,f,g),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(){}}Ue.extension={type:[w.CanvasSystem],name:"texture"};const kt=[...st,Ge,Ee,Ue,Fe],bt=[nt,at,rt,ot,it,He,Ae,ct],_t=[lt,We],qe=[],De=[],Le=[];oe.handleByNamedList(w.CanvasSystem,qe);oe.handleByNamedList(w.CanvasPipes,De);oe.handleByNamedList(w.CanvasPipesAdaptor,Le);oe.add(...kt,...bt,..._t);class At extends Ze{constructor(){const e={name:"canvas",type:et.CANVAS,systems:qe,renderPipes:De,renderPipeAdaptors:Le};super(e)}}export{At as CanvasRenderer};
@@ -1,4 +1,4 @@
1
- import{ac as ze,ad as Ve,a4 as ie,M as m,ae as Ne,af as je,Y as $e,ag as oe,p as l,x as W,ah as w,ai as qe,aj as z,ak as T,X as V,al as le,am as Ke,T as f,S as g,a2 as D,an as de,w as ue,ao as Z,ap as ce,aq as he,ar as pe,as as fe,y as P,a as Ye,c as E,V as N,R as B,at as Xe,au as Je,P as Qe,av as Ze,a0 as et,q as ee,aw as te,d as p,m as tt,a3 as R,Q as O,ax as rt,v as st,ay as nt,az as at}from"./index.nS-neZH_.js";var it=`in vec2 vMaskCoord;
1
+ import{ac as ze,ad as Ve,a4 as ie,M as m,ae as Ne,af as je,Y as $e,ag as oe,p as l,x as W,ah as w,ai as qe,aj as z,ak as T,X as V,al as le,am as Ke,T as f,S as g,a2 as D,an as de,w as ue,ao as Z,ap as ce,aq as he,ar as pe,as as fe,y as P,a as Ye,c as E,V as N,R as B,at as Xe,au as Je,P as Qe,av as Ze,a0 as et,q as ee,aw as te,d as p,m as tt,a3 as R,Q as O,ax as rt,v as st,ay as nt,az as at}from"./index.DR0yN-kU.js";var it=`in vec2 vMaskCoord;
2
2
  in vec2 vTextureCoord;
3
3
 
4
4
  uniform sampler2D uTexture;
@@ -1,4 +1,4 @@
1
- var Nt=Object.defineProperty;var Ft=(a,e,t)=>e in a?Nt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var Re=(a,e,t)=>Ft(a,typeof e!="symbol"?e+"":e,t);import{V as Ot,D as le,h as ge,a3 as et,ar as Ct,as as Rt,at as At,q as $e,au as Mt,d as Lt,av as tt,p as he,aw as Dt,ax as zt,s as Pt,ay as Vt,v as Ae,P as fe,O as _e,az as $t,aA as jt,W as Bt,R as Wt,$ as Kt,b as Jt,o as H,j as _,a0 as Ut,aa as qt,k as L,aB as Gt,ac as Ht,c as Z,e as Se,n as st,B as nt,F as it,a as pe,t as ve,aC as Qt,aD as rt,aE as Yt,ag as Zt,al as Xt,aF as es,_ as ts}from"./framework.CBLqO2Q1.js";import{u as ss,c as ns}from"./theme.B9FcKggM.js";const is={root:()=>Ot(()=>import("./@localSearchIndexroot.5wY6DA9h.js"),[])};/*!
1
+ var Nt=Object.defineProperty;var Ft=(a,e,t)=>e in a?Nt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var Re=(a,e,t)=>Ft(a,typeof e!="symbol"?e+"":e,t);import{V as Ot,D as le,h as ge,a3 as et,ar as Ct,as as Rt,at as At,q as $e,au as Mt,d as Lt,av as tt,p as he,aw as Dt,ax as zt,s as Pt,ay as Vt,v as Ae,P as fe,O as _e,az as $t,aA as jt,W as Bt,R as Wt,$ as Kt,b as Jt,o as H,j as _,a0 as Ut,aa as qt,k as L,aB as Gt,ac as Ht,c as Z,e as Se,n as st,B as nt,F as it,a as pe,t as ve,aC as Qt,aD as rt,aE as Yt,ag as Zt,al as Xt,aF as es,_ as ts}from"./framework.CBLqO2Q1.js";import{u as ss,c as ns}from"./theme.Dn4kNa0x.js";const is={root:()=>Ot(()=>import("./@localSearchIndexroot.l5uunL9n.js"),[])};/*!
2
2
  * tabbable 6.2.0
3
3
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
4
4
  */var vt=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],ke=vt.join(","),mt=typeof Element>"u",re=mt?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ne=!mt&&Element.prototype.getRootNode?function(a){var e;return a==null||(e=a.getRootNode)===null||e===void 0?void 0:e.call(a)}:function(a){return a==null?void 0:a.ownerDocument},Fe=function a(e,t){var s;t===void 0&&(t=!0);var n=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"inert"),r=n===""||n==="true",i=r||t&&e&&a(e.parentNode);return i},rs=function(e){var t,s=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return s===""||s==="true"},gt=function(e,t,s){if(Fe(e))return[];var n=Array.prototype.slice.apply(e.querySelectorAll(ke));return t&&re.call(e,ke)&&n.unshift(e),n=n.filter(s),n},bt=function a(e,t,s){for(var n=[],r=Array.from(e);r.length;){var i=r.shift();if(!Fe(i,!1))if(i.tagName==="SLOT"){var o=i.assignedElements(),l=o.length?o:i.children,c=a(l,!0,s);s.flatten?n.push.apply(n,c):n.push({scopeParent:i,candidates:c})}else{var h=re.call(i,ke);h&&s.filter(i)&&(t||!e.includes(i))&&n.push(i);var m=i.shadowRoot||typeof s.getShadowRoot=="function"&&s.getShadowRoot(i),f=!Fe(m,!1)&&(!s.shadowRootFilter||s.shadowRootFilter(i));if(m&&f){var b=a(m===!0?i.children:m.children,!0,s);s.flatten?n.push.apply(n,b):n.push({scopeParent:i,candidates:b})}else r.unshift.apply(r,i.children)}}return n},yt=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},ie=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||rs(e))&&!yt(e)?0:e.tabIndex},as=function(e,t){var s=ie(e);return s<0&&t&&!yt(e)?0:s},os=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},wt=function(e){return e.tagName==="INPUT"},ls=function(e){return wt(e)&&e.type==="hidden"},cs=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(s){return s.tagName==="SUMMARY"});return t},us=function(e,t){for(var s=0;s<e.length;s++)if(e[s].checked&&e[s].form===t)return e[s]},ds=function(e){if(!e.name)return!0;var t=e.form||Ne(e),s=function(o){return t.querySelectorAll('input[type="radio"][name="'+o+'"]')},n;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")n=s(window.CSS.escape(e.name));else try{n=s(e.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var r=us(n,e.form);return!r||r===e},hs=function(e){return wt(e)&&e.type==="radio"},fs=function(e){return hs(e)&&!ds(e)},ps=function(e){var t,s=e&&Ne(e),n=(t=s)===null||t===void 0?void 0:t.host,r=!1;if(s&&s!==e){var i,o,l;for(r=!!((i=n)!==null&&i!==void 0&&(o=i.ownerDocument)!==null&&o!==void 0&&o.contains(n)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!r&&n;){var c,h,m;s=Ne(n),n=(c=s)===null||c===void 0?void 0:c.host,r=!!((h=n)!==null&&h!==void 0&&(m=h.ownerDocument)!==null&&m!==void 0&&m.contains(n))}}return r},at=function(e){var t=e.getBoundingClientRect(),s=t.width,n=t.height;return s===0&&n===0},vs=function(e,t){var s=t.displayCheck,n=t.getShadowRoot;if(getComputedStyle(e).visibility==="hidden")return!0;var r=re.call(e,"details>summary:first-of-type"),i=r?e.parentElement:e;if(re.call(i,"details:not([open]) *"))return!0;if(!s||s==="full"||s==="legacy-full"){if(typeof n=="function"){for(var o=e;e;){var l=e.parentElement,c=Ne(e);if(l&&!l.shadowRoot&&n(l)===!0)return at(e);e.assignedSlot?e=e.assignedSlot:!l&&c!==e.ownerDocument?e=c.host:e=l}e=o}if(ps(e))return!e.getClientRects().length;if(s!=="legacy-full")return!0}else if(s==="non-zero-area")return at(e);return!1},ms=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var s=0;s<t.children.length;s++){var n=t.children.item(s);if(n.tagName==="LEGEND")return re.call(t,"fieldset[disabled] *")?!0:!n.contains(e)}return!0}t=t.parentElement}return!1},Oe=function(e,t){return!(t.disabled||Fe(t)||ls(t)||vs(t,e)||cs(t)||ms(t))},je=function(e,t){return!(fs(t)||ie(t)<0||!Oe(e,t))},gs=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},bs=function a(e){var t=[],s=[];return e.forEach(function(n,r){var i=!!n.scopeParent,o=i?n.scopeParent:n,l=as(o,i),c=i?a(n.candidates):o;l===0?i?t.push.apply(t,c):t.push(o):s.push({documentOrder:r,tabIndex:l,item:n,isScope:i,content:c})}),s.sort(os).reduce(function(n,r){return r.isScope?n.push.apply(n,r.content):n.push(r.content),n},[]).concat(t)},ys=function(e,t){t=t||{};var s;return t.getShadowRoot?s=bt([e],t.includeContainer,{filter:je.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:gs}):s=gt(e,t.includeContainer,je.bind(null,t)),bs(s)},ws=function(e,t){t=t||{};var s;return t.getShadowRoot?s=bt([e],t.includeContainer,{filter:Oe.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):s=gt(e,t.includeContainer,Oe.bind(null,t)),s},ae=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return re.call(e,ke)===!1?!1:je(t,e)},xs=vt.concat("iframe").join(","),Me=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return re.call(e,xs)===!1?!1:Oe(t,e)};/*!
@@ -1,4 +1,4 @@
1
- import{V as R,Y as F,p as d,_ as P,k as B,w as p,j as z,af as ye,aa as O,T as S,aA as Ce,a3 as q,aB as Ne,S as g,R as V,Q as y,a2 as C,a4 as M,M as Z,aC as Q,aD as De,aE as Ie,aF as J,aG as ee,aH as Ge,W as Ue,X as Fe,x as A}from"./index.nS-neZH_.js";import{e as Pe,G as Oe,c as Me,a as Le,U as we,B as te,b as N,d as He}from"./BufferResource.8pzc1eMm.js";import{R as Ve,S as Xe,d as ke}from"./RenderTargetSystem.CWKFKvEe.js";import"./framework.CBLqO2Q1.js";import"./mapValues.D2X8cRgC.js";import"./theme.B9FcKggM.js";function We(){const{userAgent:t}=R.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}class re{constructor(){this._tempState=F.for2d(),this._didUploadHash={}}init(e){e.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(e,r,n){const s=e.renderer,i=this._didUploadHash[n.uid];s.shader.bind(n,i),i||(this._didUploadHash[n.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(r,n.glProgram)}execute(e,r){const n=e.renderer;this._tempState.blendMode=r.blendMode,n.state.set(this._tempState);const s=r.textures.textures;for(let i=0;i<r.textures.count;i++)n.texture.bind(s[i],i);n.geometry.draw(r.topology,r.size,r.start)}}re.extension={type:[d.WebGLPipesAdaptor],name:"batch"};var v=(t=>(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(v||{});class je{constructor(e,r){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=r}destroy(){this.buffer=null,this.updateID=-1,this.byteLength=-1,this.type=-1,this._lastBindBaseLocation=-1,this._lastBindCallId=-1}}class ne{constructor(e){this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=e,this._managedBuffers=new P({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"glBuffer"})}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gl=null,this._boundBufferBases={}}contextChange(){this._gl=this._renderer.gl,this.destroyAll(!0),this._maxBindings=this._renderer.limits.maxUniformBindings}getGlBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]||this.createGLBuffer(e)}bind(e){const{_gl:r}=this,n=this.getGlBuffer(e);r.bindBuffer(n.type,n.buffer)}bindBufferBase(e,r){const{_gl:n}=this;this._boundBufferBases[r]!==e&&(this._boundBufferBases[r]=e,e._lastBindBaseLocation=r,n.bindBufferBase(n.UNIFORM_BUFFER,r,e.buffer))}nextBindBase(e){this._bindCallId++,this._minBaseLocation=0,e&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(e){let r=this.getLastBindBaseLocation(e);if(r>=this._minBaseLocation)return e._lastBindCallId=this._bindCallId,r;let n=0,s=this._nextBindBaseIndex;for(;n<2;){s>=this._maxBindings&&(s=this._minBaseLocation,n++);const i=this._boundBufferBases[s];if(i&&i._lastBindCallId===this._bindCallId){s++;continue}break}return r=s,this._nextBindBaseIndex=s+1,n>=2?-1:(e._lastBindCallId=this._bindCallId,this._boundBufferBases[r]=null,r)}getLastBindBaseLocation(e){const r=e._lastBindBaseLocation;return this._boundBufferBases[r]===e?r:-1}bindBufferRange(e,r,n,s){const{_gl:i}=this;n||(n=0),r||(r=0),this._boundBufferBases[r]=null,i.bindBufferRange(i.UNIFORM_BUFFER,r||0,e.buffer,n*256,s||256)}updateBuffer(e){const{_gl:r}=this,n=this.getGlBuffer(e);if(e._updateID===n.updateID)return n;n.updateID=e._updateID,r.bindBuffer(n.type,n.buffer);const s=e.data,i=e.descriptor.usage&B.STATIC?r.STATIC_DRAW:r.DYNAMIC_DRAW;return s?n.byteLength>=s.byteLength?r.bufferSubData(n.type,0,s,0,e._updateSize/s.BYTES_PER_ELEMENT):(n.byteLength=s.byteLength,r.bufferData(n.type,s,i)):(n.byteLength=e.descriptor.size,r.bufferData(n.type,n.byteLength,i)),n}destroyAll(e=!1){this._managedBuffers.removeAll(e)}onBufferUnload(e,r=!1){const n=e._gpuData[this._renderer.uid];n&&(r||this._gl.deleteBuffer(n.buffer))}createGLBuffer(e){const{_gl:r}=this;let n=v.ARRAY_BUFFER;e.descriptor.usage&B.INDEX?n=v.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&B.UNIFORM&&(n=v.UNIFORM_BUFFER);const s=new je(r.createBuffer(),n);return e._gpuData[this._renderer.uid]=s,this._managedBuffers.add(e),s}resetState(){this._boundBufferBases=Object.create(null)}}ne.extension={type:[d.WebGLSystem],name:"buffer"};const L=class se{constructor(e){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=e,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this._renderer.gl=e}init(e){e={...se.defaultOptions,...e};let r=this.multiView=e.multiView;if(e.context&&r&&(p("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),r=!1),r?this.canvas=R.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,e.context)this.initFromContext(e.context);else{const n=this._renderer.background.alpha<1,s=e.premultipliedAlpha??!0,i=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:n,premultipliedAlpha:s,antialias:i,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&p("multiView is disabled, but targetCanvas is not the main canvas");return}const{canvas:r}=this;(r.width<e.width||r.height<e.height)&&(r.width=Math.max(e.width,e.width),r.height=Math.max(e.height,e.height))}initFromContext(e){this.gl=e,this.webGLVersion=e instanceof R.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(e),this._renderer.runners.contextChange.emit(e);const r=this._renderer.view.canvas;r.addEventListener("webglcontextlost",this.handleContextLost,!1),r.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(e,r){let n;const s=this.canvas;if(e===2&&(n=s.getContext("webgl2",r)),!n&&(n=s.getContext("webgl",r),!n))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=n,this.initFromContext(this.gl)}getExtensions(){const{gl:e}=this,r={anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc"),rgtc:e.getExtension("EXT_texture_compression_rgtc"),loseContext:e.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...r,drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:e.getExtension("ANGLE_instanced_arrays"),srgb:e.getExtension("EXT_sRGB")};else{this.extensions={...r,colorBufferFloat:e.getExtension("EXT_color_buffer_float")};const n=e.getExtension("WEBGL_provoking_vertex");n&&n.provokingVertexWEBGL(n.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(e){e.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{var r;this.gl.isContextLost()&&((r=this.extensions.loseContext)==null||r.restoreContext())},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){var r;const e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),(r=this.extensions.loseContext)==null||r.loseContext()}forceContextLoss(){var e;(e=this.extensions.loseContext)==null||e.loseContext(),this._contextLossForced=!0}validateContext(e){const r=e.getContextAttributes();r&&!r.stencil&&p("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const n=this.supports,s=this.webGLVersion===2,i=this.extensions;n.uint32Indices=s||!!i.uint32ElementIndex,n.uniformBufferObject=s,n.vertexArrayObject=s||!!i.vertexArrayObject,n.srgbTextures=s||!!i.srgb,n.nonPowOf2wrapping=s,n.nonPowOf2mipmaps=s,n.msaa=s,n.uint32Indices||p("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};L.extension={type:[d.WebGLSystem],name:"context"};L.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};let Ke=L;var G=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(G||{}),w=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(w||{}),l=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(l||{});const X={uint8x2:l.UNSIGNED_BYTE,uint8x4:l.UNSIGNED_BYTE,sint8x2:l.BYTE,sint8x4:l.BYTE,unorm8x2:l.UNSIGNED_BYTE,unorm8x4:l.UNSIGNED_BYTE,snorm8x2:l.BYTE,snorm8x4:l.BYTE,uint16x2:l.UNSIGNED_SHORT,uint16x4:l.UNSIGNED_SHORT,sint16x2:l.SHORT,sint16x4:l.SHORT,unorm16x2:l.UNSIGNED_SHORT,unorm16x4:l.UNSIGNED_SHORT,snorm16x2:l.SHORT,snorm16x4:l.SHORT,float16x2:l.HALF_FLOAT,float16x4:l.HALF_FLOAT,float32:l.FLOAT,float32x2:l.FLOAT,float32x3:l.FLOAT,float32x4:l.FLOAT,uint32:l.UNSIGNED_INT,uint32x2:l.UNSIGNED_INT,uint32x3:l.UNSIGNED_INT,uint32x4:l.UNSIGNED_INT,sint32:l.INT,sint32x2:l.INT,sint32x3:l.INT,sint32x4:l.INT};function $e(t){return X[t]??X.float32}const Ye={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class ze{constructor(){this.vaoCache=Object.create(null)}destroy(){this.vaoCache=Object.create(null)}}class ie{constructor(e){this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._managedGeometries=new P({renderer:e,type:"resource",onUnload:this.onGeometryUnload.bind(this),name:"glGeometry"})}contextChange(){const e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");this.destroyAll(!0);const r=this._renderer.context.extensions.vertexArrayObject;r&&(e.createVertexArray=()=>r.createVertexArrayOES(),e.bindVertexArray=s=>r.bindVertexArrayOES(s),e.deleteVertexArray=s=>r.deleteVertexArrayOES(s));const n=this._renderer.context.extensions.vertexAttribDivisorANGLE;n&&(e.drawArraysInstanced=(s,i,a,o)=>{n.drawArraysInstancedANGLE(s,i,a,o)},e.drawElementsInstanced=(s,i,a,o,u)=>{n.drawElementsInstancedANGLE(s,i,a,o,u)},e.vertexAttribDivisor=(s,i)=>n.vertexAttribDivisorANGLE(s,i)),this._activeGeometry=null,this._activeVao=null}bind(e,r){const n=this.gl;this._activeGeometry=e;const s=this.getVao(e,r);this._activeVao!==s&&(this._activeVao=s,n.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){const e=this._activeGeometry,r=this._renderer.buffer;for(let n=0;n<e.buffers.length;n++){const s=e.buffers[n];r.updateBuffer(s)}e._gcLastUsed=this._renderer.gc.now}checkCompatibility(e,r){const n=e.attributes,s=r._attributeData;for(const i in s)if(!n[i])throw new Error(`shader and geometry incompatible, geometry missing the "${i}" attribute`)}getSignature(e,r){const n=e.attributes,s=r._attributeData,i=["g",e.uid];for(const a in n)s[a]&&i.push(a,s[a].location);return i.join("-")}getVao(e,r){var n;return((n=e._gpuData[this._renderer.uid])==null?void 0:n.vaoCache[r._key])||this.initGeometryVao(e,r)}initGeometryVao(e,r,n=!0){const s=this._renderer.gl,i=this._renderer.buffer;this._renderer.shader._getProgramData(r),this.checkCompatibility(e,r);const a=this.getSignature(e,r);let o=e._gpuData[this._renderer.uid];o||(o=new ze,e._gpuData[this._renderer.uid]=o,this._managedGeometries.add(e));const u=o.vaoCache;let c=u[a];if(c)return u[r._key]=c,c;Pe(e,r._attributeData);const _=e.buffers;c=s.createVertexArray(),s.bindVertexArray(c);for(let f=0;f<_.length;f++){const h=_[f];i.bind(h)}return this.activateVao(e,r),u[r._key]=c,u[a]=c,s.bindVertexArray(null),c}onGeometryUnload(e,r=!1){const n=e._gpuData[this._renderer.uid];if(!n)return;const s=n.vaoCache;if(!r)for(const i in s)this._activeVao!==s[i]&&this.resetState(),this.gl.deleteVertexArray(s[i])}destroyAll(e=!1){this._managedGeometries.removeAll(e)}activateVao(e,r){var o;const n=this._renderer.gl,s=this._renderer.buffer,i=e.attributes;e.indexBuffer&&s.bind(e.indexBuffer);let a=null;for(const u in i){const c=i[u],_=c.buffer,f=s.getGlBuffer(_),h=r._attributeData[u];if(h){a!==f&&(s.bind(_),a=f);const m=h.location;n.enableVertexAttribArray(m);const b=z(c.format),E=$e(c.format);if(((o=h.format)==null?void 0:o.substring(1,4))==="int"?n.vertexAttribIPointer(m,b.size,E,c.stride,c.offset):n.vertexAttribPointer(m,b.size,E,b.normalised,c.stride,c.offset),c.instance)if(this.hasInstance){const Be=c.divisor??1;n.vertexAttribDivisor(m,Be)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(e,r,n,s){const{gl:i}=this._renderer,a=this._activeGeometry,o=Ye[e||a.topology];if(s??(s=a.instanceCount),a.indexBuffer){const u=a.indexBuffer.data.BYTES_PER_ELEMENT,c=u===2?i.UNSIGNED_SHORT:i.UNSIGNED_INT;s!==1?i.drawElementsInstanced(o,r||a.indexBuffer.data.length,c,(n||0)*u,s):i.drawElements(o,r||a.indexBuffer.data.length,c,(n||0)*u)}else s!==1?i.drawArraysInstanced(o,n||0,r||a.getSize(),s):i.drawArrays(o,n||0,r||a.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._managedGeometries.destroy(),this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}}ie.extension={type:[d.WebGLSystem],name:"geometry"};const qe=new Ce({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),H=class ae{constructor(e){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=e}init(e={}){const{useBackBuffer:r,antialias:n}={...ae.defaultOptions,...e};this.useBackBuffer=r,this._antialias=n,this._renderer.context.supports.msaa||(p("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=F.for2d();const s=new ye({vertex:`
1
+ import{V as R,Y as F,p as d,_ as P,k as B,w as p,j as z,af as ye,aa as O,T as S,aA as Ce,a3 as q,aB as Ne,S as g,R as V,Q as y,a2 as C,a4 as M,M as Z,aC as Q,aD as De,aE as Ie,aF as J,aG as ee,aH as Ge,W as Ue,X as Fe,x as A}from"./index.DR0yN-kU.js";import{e as Pe,G as Oe,c as Me,a as Le,U as we,B as te,b as N,d as He}from"./BufferResource.C5TLxka4.js";import{R as Ve,S as Xe,d as ke}from"./RenderTargetSystem._cMCUdmu.js";import"./framework.CBLqO2Q1.js";import"./mapValues.D2X8cRgC.js";import"./theme.Dn4kNa0x.js";function We(){const{userAgent:t}=R.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}class re{constructor(){this._tempState=F.for2d(),this._didUploadHash={}}init(e){e.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(e,r,n){const s=e.renderer,i=this._didUploadHash[n.uid];s.shader.bind(n,i),i||(this._didUploadHash[n.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(r,n.glProgram)}execute(e,r){const n=e.renderer;this._tempState.blendMode=r.blendMode,n.state.set(this._tempState);const s=r.textures.textures;for(let i=0;i<r.textures.count;i++)n.texture.bind(s[i],i);n.geometry.draw(r.topology,r.size,r.start)}}re.extension={type:[d.WebGLPipesAdaptor],name:"batch"};var v=(t=>(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(v||{});class je{constructor(e,r){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=r}destroy(){this.buffer=null,this.updateID=-1,this.byteLength=-1,this.type=-1,this._lastBindBaseLocation=-1,this._lastBindCallId=-1}}class ne{constructor(e){this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=e,this._managedBuffers=new P({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"glBuffer"})}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gl=null,this._boundBufferBases={}}contextChange(){this._gl=this._renderer.gl,this.destroyAll(!0),this._maxBindings=this._renderer.limits.maxUniformBindings}getGlBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]||this.createGLBuffer(e)}bind(e){const{_gl:r}=this,n=this.getGlBuffer(e);r.bindBuffer(n.type,n.buffer)}bindBufferBase(e,r){const{_gl:n}=this;this._boundBufferBases[r]!==e&&(this._boundBufferBases[r]=e,e._lastBindBaseLocation=r,n.bindBufferBase(n.UNIFORM_BUFFER,r,e.buffer))}nextBindBase(e){this._bindCallId++,this._minBaseLocation=0,e&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(e){let r=this.getLastBindBaseLocation(e);if(r>=this._minBaseLocation)return e._lastBindCallId=this._bindCallId,r;let n=0,s=this._nextBindBaseIndex;for(;n<2;){s>=this._maxBindings&&(s=this._minBaseLocation,n++);const i=this._boundBufferBases[s];if(i&&i._lastBindCallId===this._bindCallId){s++;continue}break}return r=s,this._nextBindBaseIndex=s+1,n>=2?-1:(e._lastBindCallId=this._bindCallId,this._boundBufferBases[r]=null,r)}getLastBindBaseLocation(e){const r=e._lastBindBaseLocation;return this._boundBufferBases[r]===e?r:-1}bindBufferRange(e,r,n,s){const{_gl:i}=this;n||(n=0),r||(r=0),this._boundBufferBases[r]=null,i.bindBufferRange(i.UNIFORM_BUFFER,r||0,e.buffer,n*256,s||256)}updateBuffer(e){const{_gl:r}=this,n=this.getGlBuffer(e);if(e._updateID===n.updateID)return n;n.updateID=e._updateID,r.bindBuffer(n.type,n.buffer);const s=e.data,i=e.descriptor.usage&B.STATIC?r.STATIC_DRAW:r.DYNAMIC_DRAW;return s?n.byteLength>=s.byteLength?r.bufferSubData(n.type,0,s,0,e._updateSize/s.BYTES_PER_ELEMENT):(n.byteLength=s.byteLength,r.bufferData(n.type,s,i)):(n.byteLength=e.descriptor.size,r.bufferData(n.type,n.byteLength,i)),n}destroyAll(e=!1){this._managedBuffers.removeAll(e)}onBufferUnload(e,r=!1){const n=e._gpuData[this._renderer.uid];n&&(r||this._gl.deleteBuffer(n.buffer))}createGLBuffer(e){const{_gl:r}=this;let n=v.ARRAY_BUFFER;e.descriptor.usage&B.INDEX?n=v.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&B.UNIFORM&&(n=v.UNIFORM_BUFFER);const s=new je(r.createBuffer(),n);return e._gpuData[this._renderer.uid]=s,this._managedBuffers.add(e),s}resetState(){this._boundBufferBases=Object.create(null)}}ne.extension={type:[d.WebGLSystem],name:"buffer"};const L=class se{constructor(e){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=e,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this._renderer.gl=e}init(e){e={...se.defaultOptions,...e};let r=this.multiView=e.multiView;if(e.context&&r&&(p("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),r=!1),r?this.canvas=R.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,e.context)this.initFromContext(e.context);else{const n=this._renderer.background.alpha<1,s=e.premultipliedAlpha??!0,i=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:n,premultipliedAlpha:s,antialias:i,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&p("multiView is disabled, but targetCanvas is not the main canvas");return}const{canvas:r}=this;(r.width<e.width||r.height<e.height)&&(r.width=Math.max(e.width,e.width),r.height=Math.max(e.height,e.height))}initFromContext(e){this.gl=e,this.webGLVersion=e instanceof R.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(e),this._renderer.runners.contextChange.emit(e);const r=this._renderer.view.canvas;r.addEventListener("webglcontextlost",this.handleContextLost,!1),r.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(e,r){let n;const s=this.canvas;if(e===2&&(n=s.getContext("webgl2",r)),!n&&(n=s.getContext("webgl",r),!n))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=n,this.initFromContext(this.gl)}getExtensions(){const{gl:e}=this,r={anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc"),rgtc:e.getExtension("EXT_texture_compression_rgtc"),loseContext:e.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...r,drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:e.getExtension("ANGLE_instanced_arrays"),srgb:e.getExtension("EXT_sRGB")};else{this.extensions={...r,colorBufferFloat:e.getExtension("EXT_color_buffer_float")};const n=e.getExtension("WEBGL_provoking_vertex");n&&n.provokingVertexWEBGL(n.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(e){e.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{var r;this.gl.isContextLost()&&((r=this.extensions.loseContext)==null||r.restoreContext())},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){var r;const e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),(r=this.extensions.loseContext)==null||r.loseContext()}forceContextLoss(){var e;(e=this.extensions.loseContext)==null||e.loseContext(),this._contextLossForced=!0}validateContext(e){const r=e.getContextAttributes();r&&!r.stencil&&p("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const n=this.supports,s=this.webGLVersion===2,i=this.extensions;n.uint32Indices=s||!!i.uint32ElementIndex,n.uniformBufferObject=s,n.vertexArrayObject=s||!!i.vertexArrayObject,n.srgbTextures=s||!!i.srgb,n.nonPowOf2wrapping=s,n.nonPowOf2mipmaps=s,n.msaa=s,n.uint32Indices||p("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};L.extension={type:[d.WebGLSystem],name:"context"};L.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};let Ke=L;var G=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(G||{}),w=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(w||{}),l=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(l||{});const X={uint8x2:l.UNSIGNED_BYTE,uint8x4:l.UNSIGNED_BYTE,sint8x2:l.BYTE,sint8x4:l.BYTE,unorm8x2:l.UNSIGNED_BYTE,unorm8x4:l.UNSIGNED_BYTE,snorm8x2:l.BYTE,snorm8x4:l.BYTE,uint16x2:l.UNSIGNED_SHORT,uint16x4:l.UNSIGNED_SHORT,sint16x2:l.SHORT,sint16x4:l.SHORT,unorm16x2:l.UNSIGNED_SHORT,unorm16x4:l.UNSIGNED_SHORT,snorm16x2:l.SHORT,snorm16x4:l.SHORT,float16x2:l.HALF_FLOAT,float16x4:l.HALF_FLOAT,float32:l.FLOAT,float32x2:l.FLOAT,float32x3:l.FLOAT,float32x4:l.FLOAT,uint32:l.UNSIGNED_INT,uint32x2:l.UNSIGNED_INT,uint32x3:l.UNSIGNED_INT,uint32x4:l.UNSIGNED_INT,sint32:l.INT,sint32x2:l.INT,sint32x3:l.INT,sint32x4:l.INT};function $e(t){return X[t]??X.float32}const Ye={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class ze{constructor(){this.vaoCache=Object.create(null)}destroy(){this.vaoCache=Object.create(null)}}class ie{constructor(e){this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._managedGeometries=new P({renderer:e,type:"resource",onUnload:this.onGeometryUnload.bind(this),name:"glGeometry"})}contextChange(){const e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");this.destroyAll(!0);const r=this._renderer.context.extensions.vertexArrayObject;r&&(e.createVertexArray=()=>r.createVertexArrayOES(),e.bindVertexArray=s=>r.bindVertexArrayOES(s),e.deleteVertexArray=s=>r.deleteVertexArrayOES(s));const n=this._renderer.context.extensions.vertexAttribDivisorANGLE;n&&(e.drawArraysInstanced=(s,i,a,o)=>{n.drawArraysInstancedANGLE(s,i,a,o)},e.drawElementsInstanced=(s,i,a,o,u)=>{n.drawElementsInstancedANGLE(s,i,a,o,u)},e.vertexAttribDivisor=(s,i)=>n.vertexAttribDivisorANGLE(s,i)),this._activeGeometry=null,this._activeVao=null}bind(e,r){const n=this.gl;this._activeGeometry=e;const s=this.getVao(e,r);this._activeVao!==s&&(this._activeVao=s,n.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){const e=this._activeGeometry,r=this._renderer.buffer;for(let n=0;n<e.buffers.length;n++){const s=e.buffers[n];r.updateBuffer(s)}e._gcLastUsed=this._renderer.gc.now}checkCompatibility(e,r){const n=e.attributes,s=r._attributeData;for(const i in s)if(!n[i])throw new Error(`shader and geometry incompatible, geometry missing the "${i}" attribute`)}getSignature(e,r){const n=e.attributes,s=r._attributeData,i=["g",e.uid];for(const a in n)s[a]&&i.push(a,s[a].location);return i.join("-")}getVao(e,r){var n;return((n=e._gpuData[this._renderer.uid])==null?void 0:n.vaoCache[r._key])||this.initGeometryVao(e,r)}initGeometryVao(e,r,n=!0){const s=this._renderer.gl,i=this._renderer.buffer;this._renderer.shader._getProgramData(r),this.checkCompatibility(e,r);const a=this.getSignature(e,r);let o=e._gpuData[this._renderer.uid];o||(o=new ze,e._gpuData[this._renderer.uid]=o,this._managedGeometries.add(e));const u=o.vaoCache;let c=u[a];if(c)return u[r._key]=c,c;Pe(e,r._attributeData);const _=e.buffers;c=s.createVertexArray(),s.bindVertexArray(c);for(let f=0;f<_.length;f++){const h=_[f];i.bind(h)}return this.activateVao(e,r),u[r._key]=c,u[a]=c,s.bindVertexArray(null),c}onGeometryUnload(e,r=!1){const n=e._gpuData[this._renderer.uid];if(!n)return;const s=n.vaoCache;if(!r)for(const i in s)this._activeVao!==s[i]&&this.resetState(),this.gl.deleteVertexArray(s[i])}destroyAll(e=!1){this._managedGeometries.removeAll(e)}activateVao(e,r){var o;const n=this._renderer.gl,s=this._renderer.buffer,i=e.attributes;e.indexBuffer&&s.bind(e.indexBuffer);let a=null;for(const u in i){const c=i[u],_=c.buffer,f=s.getGlBuffer(_),h=r._attributeData[u];if(h){a!==f&&(s.bind(_),a=f);const m=h.location;n.enableVertexAttribArray(m);const b=z(c.format),E=$e(c.format);if(((o=h.format)==null?void 0:o.substring(1,4))==="int"?n.vertexAttribIPointer(m,b.size,E,c.stride,c.offset):n.vertexAttribPointer(m,b.size,E,b.normalised,c.stride,c.offset),c.instance)if(this.hasInstance){const Be=c.divisor??1;n.vertexAttribDivisor(m,Be)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(e,r,n,s){const{gl:i}=this._renderer,a=this._activeGeometry,o=Ye[e||a.topology];if(s??(s=a.instanceCount),a.indexBuffer){const u=a.indexBuffer.data.BYTES_PER_ELEMENT,c=u===2?i.UNSIGNED_SHORT:i.UNSIGNED_INT;s!==1?i.drawElementsInstanced(o,r||a.indexBuffer.data.length,c,(n||0)*u,s):i.drawElements(o,r||a.indexBuffer.data.length,c,(n||0)*u)}else s!==1?i.drawArraysInstanced(o,n||0,r||a.getSize(),s):i.drawArrays(o,n||0,r||a.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._managedGeometries.destroy(),this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}}ie.extension={type:[d.WebGLSystem],name:"geometry"};const qe=new Ce({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),H=class ae{constructor(e){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=e}init(e={}){const{useBackBuffer:r,antialias:n}={...ae.defaultOptions,...e};this.useBackBuffer=r,this._antialias=n,this._renderer.context.supports.msaa||(p("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=F.for2d();const s=new ye({vertex:`
2
2
  attribute vec2 aPosition;
3
3
  out vec2 vUv;
4
4
 
@@ -1,4 +1,4 @@
1
- import{Y as L,Z as A,p as l,_ as D,m as ce,$ as de,V as B,S as C,k as T,B as he,a0 as k,a1 as w,w as v,a2 as y,Q as pe,a3 as le,a4 as z,b as M,M as F,a5 as O,a6 as fe,a7 as ge,a8 as me,a9 as I,aa as W,ab as _e,T as R,W as be,X as ye,x as S}from"./index.nS-neZH_.js";import{c as xe,u as Ge,U as Pe,B as Be,G as Se,e as Te,t as Ce}from"./BufferResource.8pzc1eMm.js";import{R as ve,S as Ue,d as we}from"./RenderTargetSystem.CWKFKvEe.js";import"./framework.CBLqO2Q1.js";import"./mapValues.D2X8cRgC.js";import"./theme.B9FcKggM.js";const G=L.for2d();class H{start(e,t,r){const s=e.renderer,i=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=t,i.setGeometry(t,n),G.blendMode="normal",s.pipeline.getPipeline(t,n,G);const o=s.globalUniforms.bindGroup;i.resetBindGroup(1),i.setBindGroup(0,o,n)}execute(e,t){const r=this._shader.gpuProgram,s=e.renderer,i=s.encoder;if(!t.bindGroup){const u=t.textures;t.bindGroup=A(u.textures,u.count,s.limits.maxBatchableTextures)}G.blendMode=t.blendMode;const n=s.bindGroup.getBindGroup(t.bindGroup,r,1),o=s.pipeline.getPipeline(this._geometry,r,G,t.topology);t.bindGroup._touch(s.gc.now,s.tick),i.setPipeline(o),i.renderPassEncoder.setBindGroup(1,n),i.renderPassEncoder.drawIndexed(t.size,1,t.start)}}H.extension={type:[l.WebGPUPipesAdaptor],name:"batch"};class V{constructor(e){this._hash=Object.create(null),this._renderer=e}contextChange(e){this._gpu=e}getBindGroup(e,t,r){return e._updateKey(),this._hash[e._key]||this._createBindGroup(e,t,r)}_createBindGroup(e,t,r){const s=this._gpu.device,i=t.layout[r],n=[],o=this._renderer;for(const f in i){const h=e.resources[f]??e.resources[i[f]];let p;if(h._resourceType==="uniformGroup"){const d=h;o.ubo.updateUniformGroup(d);const g=d.buffer;p={buffer:o.buffer.getGPUBuffer(g),offset:0,size:g.descriptor.size}}else if(h._resourceType==="buffer"){const d=h;p={buffer:o.buffer.getGPUBuffer(d),offset:0,size:d.descriptor.size}}else if(h._resourceType==="bufferResource"){const d=h;p={buffer:o.buffer.getGPUBuffer(d.buffer),offset:d.offset,size:d.size}}else if(h._resourceType==="textureSampler"){const d=h;p=o.texture.getGpuSampler(d)}else if(h._resourceType==="textureSource"){const d=h;p=o.texture.getTextureView(d)}n.push({binding:i[f],resource:p})}const u=o.shader.getProgramData(t).bindGroups[r],c=s.createBindGroup({layout:u,entries:n});return this._hash[e._key]=c,c}destroy(){this._hash=null,this._renderer=null}}V.extension={type:[l.WebGPUSystem],name:"bindGroup"};class Me{constructor(e){this.gpuBuffer=e}destroy(){this.gpuBuffer.destroy(),this.gpuBuffer=null}}class N{constructor(e){this._renderer=e,this._managedBuffers=new D({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"gpuBuffer"})}contextChange(e){this._gpu=e}getGPUBuffer(e){var t;return e._gcLastUsed=this._renderer.gc.now,((t=e._gpuData[this._renderer.uid])==null?void 0:t.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=ce("resource"),e.data&&(de(e.data.buffer,t.getMappedRange(),e.data.byteOffset,e.data.byteLength),t.unmap()),e._gpuData[this._renderer.uid]=new Me(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}}N.extension={type:[l.WebGPUSystem],name:"buffer"};class Re{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: ${e*4}`);const t=this.byteIndex;let r=t+e*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)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}}class j{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}}j.extension={type:[l.WebGPUSystem],name:"colorMask"};class U{constructor(e){this._renderer=e}async init(e){return this._initPromise?this._initPromise:(this._initPromise=(e.gpu?Promise.resolve(e.gpu):this._createDeviceAndAdaptor(e)).then(t=>{this.gpu=t,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){const t=await B.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(i=>t.features.has(i)),s=await t.requestDevice({requiredFeatures:r});return{adapter:t,device:s}}destroy(){this.gpu=null,this._renderer=null}}U.extension={type:[l.WebGPUSystem],name:"device"};U.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};class K{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,s){const i=this._renderer.pipeline.getPipeline(e,t,r,s);this.setPipeline(i)}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=e.data.BYTES_PER_ELEMENT===2?"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 s=this._renderer.bindGroup.getBindGroup(t,r,e);this.renderPassEncoder.setBindGroup(e,s)}setGeometry(e,t){const r=this._renderer.pipeline.getBufferNamesToBind(e,t);for(const s in r)this._setVertexBuffer(parseInt(s,10),e.attributes[r[s]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(const r in e.groups){const s=e.groups[r];t||this._syncBindGroup(s),this.setBindGroup(r,s,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:s,topology:i,size:n,start:o,instanceCount:u,skipSync:c}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,s,i),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,c),t.indexBuffer?this.renderPassEncoder.drawIndexed(n||t.indexBuffer.data.length,u??t.instanceCount,o||0):this.renderPassEncoder.draw(n||t.getSize(),u??t.instanceCount,o||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},s=this._boundIndexBuffer,i={...this._boundBindGroup};this._clearCache();const n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(t);for(const o in r)this._setVertexBuffer(o,r[o]);for(const o in i)this.setBindGroup(o,i[o],null);this._setIndexBuffer(s)}_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}}K.extension={type:[l.WebGPUSystem],name:"encoder",priority:1};class q{constructor(e){this._renderer=e}contextChange(){this.maxTextures=this._renderer.device.gpu.device.limits.maxSampledTexturesPerShaderStage,this.maxBatchableTextures=this.maxTextures}destroy(){}}q.extension={type:[l.WebGPUSystem],name:"limits"};class Y{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:C.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 s=this._renderer;s.pipeline.setStencilMode(e),s.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}Y.extension={type:[l.WebGPUSystem],name:"stencil"};const P={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 Ee(a){const e=a.map(r=>({data:r,offset:0,size:0}));let t=0;for(let r=0;r<e.length;r++){const s=e[r];let i=P[s.data.type].size;const n=P[s.data.type].align;if(!P[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(i=Math.max(i,n)*s.data.size),t=Math.ceil(t/n)*n,s.size=i,s.offset=t,t+=i}return t=Math.ceil(t/16)*16,{uboElements:e,size:t}}function Le(a,e){const{size:t,align:r}=P[a.data.type],s=(r-t)/4,i=a.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
1
+ import{Y as L,Z as A,p as l,_ as D,m as ce,$ as de,V as B,S as C,k as T,B as he,a0 as k,a1 as w,w as v,a2 as y,Q as pe,a3 as le,a4 as z,b as M,M as F,a5 as O,a6 as fe,a7 as ge,a8 as me,a9 as I,aa as W,ab as _e,T as R,W as be,X as ye,x as S}from"./index.DR0yN-kU.js";import{c as xe,u as Ge,U as Pe,B as Be,G as Se,e as Te,t as Ce}from"./BufferResource.C5TLxka4.js";import{R as ve,S as Ue,d as we}from"./RenderTargetSystem._cMCUdmu.js";import"./framework.CBLqO2Q1.js";import"./mapValues.D2X8cRgC.js";import"./theme.Dn4kNa0x.js";const G=L.for2d();class H{start(e,t,r){const s=e.renderer,i=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=t,i.setGeometry(t,n),G.blendMode="normal",s.pipeline.getPipeline(t,n,G);const o=s.globalUniforms.bindGroup;i.resetBindGroup(1),i.setBindGroup(0,o,n)}execute(e,t){const r=this._shader.gpuProgram,s=e.renderer,i=s.encoder;if(!t.bindGroup){const u=t.textures;t.bindGroup=A(u.textures,u.count,s.limits.maxBatchableTextures)}G.blendMode=t.blendMode;const n=s.bindGroup.getBindGroup(t.bindGroup,r,1),o=s.pipeline.getPipeline(this._geometry,r,G,t.topology);t.bindGroup._touch(s.gc.now,s.tick),i.setPipeline(o),i.renderPassEncoder.setBindGroup(1,n),i.renderPassEncoder.drawIndexed(t.size,1,t.start)}}H.extension={type:[l.WebGPUPipesAdaptor],name:"batch"};class V{constructor(e){this._hash=Object.create(null),this._renderer=e}contextChange(e){this._gpu=e}getBindGroup(e,t,r){return e._updateKey(),this._hash[e._key]||this._createBindGroup(e,t,r)}_createBindGroup(e,t,r){const s=this._gpu.device,i=t.layout[r],n=[],o=this._renderer;for(const f in i){const h=e.resources[f]??e.resources[i[f]];let p;if(h._resourceType==="uniformGroup"){const d=h;o.ubo.updateUniformGroup(d);const g=d.buffer;p={buffer:o.buffer.getGPUBuffer(g),offset:0,size:g.descriptor.size}}else if(h._resourceType==="buffer"){const d=h;p={buffer:o.buffer.getGPUBuffer(d),offset:0,size:d.descriptor.size}}else if(h._resourceType==="bufferResource"){const d=h;p={buffer:o.buffer.getGPUBuffer(d.buffer),offset:d.offset,size:d.size}}else if(h._resourceType==="textureSampler"){const d=h;p=o.texture.getGpuSampler(d)}else if(h._resourceType==="textureSource"){const d=h;p=o.texture.getTextureView(d)}n.push({binding:i[f],resource:p})}const u=o.shader.getProgramData(t).bindGroups[r],c=s.createBindGroup({layout:u,entries:n});return this._hash[e._key]=c,c}destroy(){this._hash=null,this._renderer=null}}V.extension={type:[l.WebGPUSystem],name:"bindGroup"};class Me{constructor(e){this.gpuBuffer=e}destroy(){this.gpuBuffer.destroy(),this.gpuBuffer=null}}class N{constructor(e){this._renderer=e,this._managedBuffers=new D({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"gpuBuffer"})}contextChange(e){this._gpu=e}getGPUBuffer(e){var t;return e._gcLastUsed=this._renderer.gc.now,((t=e._gpuData[this._renderer.uid])==null?void 0:t.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=ce("resource"),e.data&&(de(e.data.buffer,t.getMappedRange(),e.data.byteOffset,e.data.byteLength),t.unmap()),e._gpuData[this._renderer.uid]=new Me(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}}N.extension={type:[l.WebGPUSystem],name:"buffer"};class Re{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: ${e*4}`);const t=this.byteIndex;let r=t+e*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)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}}class j{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}}j.extension={type:[l.WebGPUSystem],name:"colorMask"};class U{constructor(e){this._renderer=e}async init(e){return this._initPromise?this._initPromise:(this._initPromise=(e.gpu?Promise.resolve(e.gpu):this._createDeviceAndAdaptor(e)).then(t=>{this.gpu=t,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){const t=await B.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(i=>t.features.has(i)),s=await t.requestDevice({requiredFeatures:r});return{adapter:t,device:s}}destroy(){this.gpu=null,this._renderer=null}}U.extension={type:[l.WebGPUSystem],name:"device"};U.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};class K{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,s){const i=this._renderer.pipeline.getPipeline(e,t,r,s);this.setPipeline(i)}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=e.data.BYTES_PER_ELEMENT===2?"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 s=this._renderer.bindGroup.getBindGroup(t,r,e);this.renderPassEncoder.setBindGroup(e,s)}setGeometry(e,t){const r=this._renderer.pipeline.getBufferNamesToBind(e,t);for(const s in r)this._setVertexBuffer(parseInt(s,10),e.attributes[r[s]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(const r in e.groups){const s=e.groups[r];t||this._syncBindGroup(s),this.setBindGroup(r,s,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:s,topology:i,size:n,start:o,instanceCount:u,skipSync:c}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,s,i),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,c),t.indexBuffer?this.renderPassEncoder.drawIndexed(n||t.indexBuffer.data.length,u??t.instanceCount,o||0):this.renderPassEncoder.draw(n||t.getSize(),u??t.instanceCount,o||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},s=this._boundIndexBuffer,i={...this._boundBindGroup};this._clearCache();const n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(t);for(const o in r)this._setVertexBuffer(o,r[o]);for(const o in i)this.setBindGroup(o,i[o],null);this._setIndexBuffer(s)}_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}}K.extension={type:[l.WebGPUSystem],name:"encoder",priority:1};class q{constructor(e){this._renderer=e}contextChange(){this.maxTextures=this._renderer.device.gpu.device.limits.maxSampledTexturesPerShaderStage,this.maxBatchableTextures=this.maxTextures}destroy(){}}q.extension={type:[l.WebGPUSystem],name:"limits"};class Y{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:C.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 s=this._renderer;s.pipeline.setStencilMode(e),s.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}Y.extension={type:[l.WebGPUSystem],name:"stencil"};const P={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 Ee(a){const e=a.map(r=>({data:r,offset:0,size:0}));let t=0;for(let r=0;r<e.length;r++){const s=e[r];let i=P[s.data.type].size;const n=P[s.data.type].align;if(!P[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(i=Math.max(i,n)*s.data.size),t=Math.ceil(t/n)*n,s.size=i,s.offset=t,t+=i}return t=Math.ceil(t/16)*16,{uboElements:e,size:t}}function Le(a,e){const{size:t,align:r}=P[a.data.type],s=(r-t)/4,i=a.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
2
2
  v = uv.${a.data.name};
3
3
  ${e!==0?`offset += ${e};`:""}
4
4
 
@@ -1,4 +1,4 @@
1
- import{n as S,o as U,r as R,F as k,p as E,q as w,U as F,s as T,E as H,w as _,P as L,t as u,x as b,y as x}from"./index.nS-neZH_.js";import"./webworkerAll.BXgPGAoF.js";import"./framework.CBLqO2Q1.js";import"./mapValues.D2X8cRgC.js";import"./theme.B9FcKggM.js";const X=9,D=100,Y=0,j=0,I=2,A=1,K=-1e3,N=-1e3,G=2,O=class B{constructor(e,t=S){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){const e=document.createElement("button");e.style.width=`${A}px`,e.style.height=`${A}px`,e.style.position="absolute",e.style.top=`${K}px`,e.style.left=`${N}px`,e.style.zIndex=G.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.position="absolute",this._div.style.top=`${Y}px`,this._div.style.left=`${j}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=I.toString(),this._canvasObserver=new U({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);const e=this._renderer.view.canvas;if(e.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{const t=new MutationObserver(()=>{e.parentNode&&(t.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){var e,t;if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(const i of this._children)(e=i._accessibleDiv)!=null&&e.parentNode&&(i._accessibleDiv.parentNode.removeChild(i._accessibleDiv),i._accessibleDiv=null),i._accessibleActive=!1;for(const i in this._pools)this._pools[i].forEach(s=>{s.parentNode&&s.parentNode.removeChild(s)}),delete this._pools[i];(t=this._div)!=null&&t.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);const t=e.children;if(t)for(let i=0;i<t.length;i++)this._updateAccessibleObjects(t[i])}init(e){const i={accessibilityOptions:{...B.defaultOptions,...(e==null?void 0:e.accessibilityOptions)||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.accessibilityOptions.enabledByDefault&&this._activate(),this._renderer.runners.postrender.remove(this)}postrender(){const e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,(!this._renderer.renderingToScreen||!this._renderer.view.canvas)&&!this._isRunningTests))return;const t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(const i of this._children)i._renderId===this._renderId&&t.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){const n=this._children[i];t.has(i)||(n._accessibleDiv&&n._accessibleDiv.parentNode&&(n._accessibleDiv.parentNode.removeChild(n._accessibleDiv),this._getPool(n.accessibleType).push(n._accessibleDiv),n._accessibleDiv=null),n._accessibleActive=!1,R(this._children,i,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let i=0;i<this._children.length;i++){const n=this._children[i];if(!n._accessibleActive||!n._accessibleDiv)continue;const s=n._accessibleDiv,o=n.hitArea||n.getBounds().rectangle;if(n.hitArea){const r=n.worldTransform;s.style.left=`${r.tx+o.x*r.a}px`,s.style.top=`${r.ty+o.y*r.d}px`,s.style.width=`${o.width*r.a}px`,s.style.height=`${o.height*r.d}px`}else this._capHitArea(o),s.style.left=`${o.x}px`,s.style.top=`${o.y}px`,s.style.width=`${o.width}px`,s.style.height=`${o.height}px`}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let i=this._getPool(e.accessibleType).pop();i?(i.innerHTML="",i.removeAttribute("title"),i.removeAttribute("aria-label"),i.tabIndex=0):(e.accessibleType==="button"?i=document.createElement("button"):(i=document.createElement(e.accessibleType),i.style.cssText=`
1
+ import{n as S,o as U,r as R,F as k,p as E,q as w,U as F,s as T,E as H,w as _,P as L,t as u,x as b,y as x}from"./index.DR0yN-kU.js";import"./webworkerAll.BAL0vGum.js";import"./framework.CBLqO2Q1.js";import"./mapValues.D2X8cRgC.js";import"./theme.Dn4kNa0x.js";const X=9,D=100,Y=0,j=0,I=2,A=1,K=-1e3,N=-1e3,G=2,O=class B{constructor(e,t=S){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){const e=document.createElement("button");e.style.width=`${A}px`,e.style.height=`${A}px`,e.style.position="absolute",e.style.top=`${K}px`,e.style.left=`${N}px`,e.style.zIndex=G.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.position="absolute",this._div.style.top=`${Y}px`,this._div.style.left=`${j}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=I.toString(),this._canvasObserver=new U({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);const e=this._renderer.view.canvas;if(e.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{const t=new MutationObserver(()=>{e.parentNode&&(t.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){var e,t;if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(const i of this._children)(e=i._accessibleDiv)!=null&&e.parentNode&&(i._accessibleDiv.parentNode.removeChild(i._accessibleDiv),i._accessibleDiv=null),i._accessibleActive=!1;for(const i in this._pools)this._pools[i].forEach(s=>{s.parentNode&&s.parentNode.removeChild(s)}),delete this._pools[i];(t=this._div)!=null&&t.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);const t=e.children;if(t)for(let i=0;i<t.length;i++)this._updateAccessibleObjects(t[i])}init(e){const i={accessibilityOptions:{...B.defaultOptions,...(e==null?void 0:e.accessibilityOptions)||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.accessibilityOptions.enabledByDefault&&this._activate(),this._renderer.runners.postrender.remove(this)}postrender(){const e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,(!this._renderer.renderingToScreen||!this._renderer.view.canvas)&&!this._isRunningTests))return;const t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(const i of this._children)i._renderId===this._renderId&&t.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){const n=this._children[i];t.has(i)||(n._accessibleDiv&&n._accessibleDiv.parentNode&&(n._accessibleDiv.parentNode.removeChild(n._accessibleDiv),this._getPool(n.accessibleType).push(n._accessibleDiv),n._accessibleDiv=null),n._accessibleActive=!1,R(this._children,i,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let i=0;i<this._children.length;i++){const n=this._children[i];if(!n._accessibleActive||!n._accessibleDiv)continue;const s=n._accessibleDiv,o=n.hitArea||n.getBounds().rectangle;if(n.hitArea){const r=n.worldTransform;s.style.left=`${r.tx+o.x*r.a}px`,s.style.top=`${r.ty+o.y*r.d}px`,s.style.width=`${o.width*r.a}px`,s.style.height=`${o.height*r.d}px`}else this._capHitArea(o),s.style.left=`${o.x}px`,s.style.top=`${o.y}px`,s.style.width=`${o.width}px`,s.style.height=`${o.height}px`}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let i=this._getPool(e.accessibleType).pop();i?(i.innerHTML="",i.removeAttribute("title"),i.removeAttribute("aria-label"),i.tabIndex=0):(e.accessibleType==="button"?i=document.createElement("button"):(i=document.createElement(e.accessibleType),i.style.cssText=`
2
2
  color: transparent;
3
3
  pointer-events: none;
4
4
  padding: 0;