@ray-js/robot-map-sdk 0.0.17-beta.10 → 0.0.17-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constant/methods.js +1 -1
- package/dist/index.d.ts +67 -1
- package/dist/index.rjs.js +1 -1
- package/dist-app/assets/index-DOacnDuz.js +1 -0
- package/dist-app/index.html +1 -1
- package/dist-docs/404.html +2 -2
- package/dist-docs/assets/{app.CEyCC3pk.js → app.B7T6mG8J.js} +1 -1
- package/dist-docs/assets/chunks/@localSearchIndexroot.BQUyJl33.js +1 -0
- package/dist-docs/assets/chunks/{BitmapFont.P11QFENc.js → BitmapFont.XafwwKDu.js} +1 -1
- package/dist-docs/assets/chunks/{BufferResource.Ciw3zoJw.js → BufferResource.0gnbx1Jq.js} +4 -4
- package/dist-docs/assets/chunks/{CanvasRenderer.Bd4TJlpG.js → CanvasRenderer.CMSvp2mg.js} +1 -1
- package/dist-docs/assets/chunks/{RenderTargetSystem.CU6a5B7C.js → RenderTargetSystem.DQmn-9PM.js} +1 -1
- package/dist-docs/assets/chunks/{VPLocalSearchBox.cMcNIo6m.js → VPLocalSearchBox.eN4Tp9AQ.js} +1 -1
- package/dist-docs/assets/chunks/{WebGLRenderer.BQraRxjU.js → WebGLRenderer.MLzk-0Z4.js} +1 -1
- package/dist-docs/assets/chunks/{WebGPURenderer.Qmmhy3Dc.js → WebGPURenderer.CSXWi0v2.js} +1 -1
- package/dist-docs/assets/chunks/browserAll.BMTuala6.js +14 -0
- package/dist-docs/assets/chunks/index.BH9lQ8Z4.js +744 -0
- package/dist-docs/assets/chunks/{theme.mgJ4a6Qj.js → theme.wmxrblvC.js} +3 -3
- package/dist-docs/assets/chunks/{webworkerAll.DiP9iN0J.js → webworkerAll.DDLdSH-L.js} +2 -2
- package/dist-docs/assets/{guide_getting-started.md.BCkW3g7r.js → guide_getting-started.md.BuBRXBIZ.js} +1 -1
- package/dist-docs/assets/{reference_methods.md.CXtsI5Rx.js → reference_methods.md.BUNT8YBG.js} +26 -2
- package/dist-docs/assets/reference_methods.md.BUNT8YBG.lean.js +1 -0
- package/dist-docs/guide/advanced-usage.html +3 -3
- package/dist-docs/guide/concepts.html +3 -3
- package/dist-docs/guide/getting-started.html +5 -5
- package/dist-docs/guide/mcp.html +3 -3
- package/dist-docs/guide/spot-room-binding.html +3 -3
- package/dist-docs/hashmap.json +1 -1
- package/dist-docs/index.html +3 -3
- package/dist-docs/plans/2026-03-04-detected-objects-visibility-design.html +3 -3
- package/dist-docs/plans/2026-03-04-show-detected-objects-implementation-plan.html +3 -3
- package/dist-docs/plans/2026-03-10-simulator-debug-design.html +3 -3
- package/dist-docs/plans/2026-03-10-simulator-events-console-design.html +3 -3
- package/dist-docs/plans/2026-03-10-simulator-events-console-implementation-plan.html +3 -3
- package/dist-docs/plans/2026-03-10-simulator-runtime-controls-design.html +3 -3
- package/dist-docs/plans/2026-03-10-simulator-runtime-controls-implementation-plan.html +3 -3
- package/dist-docs/plans/2026-03-10-testing-rollout-next-steps-plan.html +3 -3
- package/dist-docs/plans/2026-03-11-simulator-logger-dump-implementation-plan.html +3 -3
- package/dist-docs/reference/callbacks.html +3 -3
- package/dist-docs/reference/config.html +3 -3
- package/dist-docs/reference/data.html +3 -3
- package/dist-docs/reference/methods.html +29 -5
- package/dist-docs/reference/runtime.html +3 -3
- package/dist-docs/reference/types.html +3 -3
- package/dist-docs/reference/utils.html +3 -3
- package/dist-docs/simulator/index.html +3 -3
- package/package.json +1 -1
- package/dist-app/assets/index-BD_1VjD4.js +0 -1
- package/dist-docs/assets/chunks/@localSearchIndexroot.DS3IaJJ6.js +0 -1
- package/dist-docs/assets/chunks/browserAll.BDQA54DN.js +0 -14
- package/dist-docs/assets/chunks/index.Cnrqr1lO.js +0 -744
- package/dist-docs/assets/reference_methods.md.CXtsI5Rx.lean.js +0 -1
- /package/dist-docs/assets/{guide_getting-started.md.BCkW3g7r.lean.js → guide_getting-started.md.BuBRXBIZ.lean.js} +0 -0
|
@@ -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.
|
|
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.BH9lQ8Z4.js";import"./framework.CBLqO2Q1.js";import"./mapValues.D2X8cRgC.js";import"./theme.wmxrblvC.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 _,
|
|
1
|
+
import{w as _,t as y,S as c,u as S,B as g,x as m,E as I,y as p}from"./index.BH9lQ8Z4.js";const D={name:"texture-bit",vertex:{header:`
|
|
2
2
|
|
|
3
3
|
struct TextureUniforms {
|
|
4
4
|
uTextureMatrix:mat3x3<f32>,
|
|
@@ -24,7 +24,7 @@ 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.Cnrq
|
|
|
24
24
|
|
|
25
25
|
`,main:`
|
|
26
26
|
outColor = texture(uTexture, vUV);
|
|
27
|
-
`}};function T(e,t){for(const a in e.attributes){const s=e.attributes[a],f=t[a];f?(s.format??(s.format=f.format),s.offset??(s.offset=f.offset),s.instance??(s.instance=f.instance)):_(`Attribute ${a} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}U(e)}function U(e){const{buffers:t,attributes:a}=e,s={},f={};for(const n in t){const r=t[n];s[r.uid]=0,f[r.uid]=0}for(const n in a){const r=a[n];s[r.buffer.uid]+=y(r.format).stride}for(const n in a){const r=a[n];r.stride??(r.stride=s[r.buffer.uid]),r.start??(r.start=f[r.buffer.uid]),f[r.buffer.uid]+=y(r.format).stride}}const d=[];d[c.NONE]=void 0;d[c.DISABLED]={stencilWriteMask:0,stencilReadMask:0};d[c.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};d[c.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};d[c.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};d[c.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"keep"},stencilBack:{compare:"not-equal",passOp:"keep"}};class
|
|
27
|
+
`}};function T(e,t){for(const a in e.attributes){const s=e.attributes[a],f=t[a];f?(s.format??(s.format=f.format),s.offset??(s.offset=f.offset),s.instance??(s.instance=f.instance)):_(`Attribute ${a} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}U(e)}function U(e){const{buffers:t,attributes:a}=e,s={},f={};for(const n in t){const r=t[n];s[r.uid]=0,f[r.uid]=0}for(const n in a){const r=a[n];s[r.buffer.uid]+=y(r.format).stride}for(const n in a){const r=a[n];r.stride??(r.stride=s[r.buffer.uid]),r.start??(r.start=f[r.buffer.uid]),f[r.buffer.uid]+=y(r.format).stride}}const d=[];d[c.NONE]=void 0;d[c.DISABLED]={stencilWriteMask:0,stencilReadMask:0};d[c.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};d[c.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};d[c.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};d[c.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"keep"},stencilBack:{compare:"not-equal",passOp:"keep"}};class A{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!S())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){const a=this.getUniformGroupData(t);t.buffer||(t.buffer=new g({data:new Float32Array(a.layout.size/4),usage:m.UNIFORM|m.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){const a=t._signature;let s=this._syncFunctionHash[a];if(!s){const f=Object.keys(t.uniformStructures).map(l=>t.uniformStructures[l]),n=this._adaptor.createUboElements(f),r=this._generateUboSync(n.uboElements);s=this._syncFunctionHash[a]={layout:n,syncFunction:r}}return this._syncFunctionHash[a]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,a,s){const f=this.getUniformGroupData(t);t.buffer||(t.buffer=new g({data:new Float32Array(f.layout.size/4),usage:m.UNIFORM|m.COPY_DST}));let n=null;return a||(a=t.buffer.data,n=t.buffer.dataInt32),s||(s=0),f.syncFunction(t.uniforms,a,n,s),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;const a=this.syncUniformGroup(t);return t.buffer.update(),a}destroy(){this._syncFunctionHash=null}}const h=[{type:"mat3x3<f32>",test:e=>e.value.a!==void 0,ubo:`
|
|
28
28
|
var matrix = uv[name].toArray(true);
|
|
29
29
|
data[offset] = matrix[0];
|
|
30
30
|
data[offset + 1] = matrix[1];
|
|
@@ -95,7 +95,7 @@ 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.Cnrq
|
|
|
95
95
|
cv[2] = v.blue;
|
|
96
96
|
gl.uniform3f(ud[name].location, v.red, v.green, v.blue);
|
|
97
97
|
}
|
|
98
|
-
`}];function
|
|
98
|
+
`}];function k(e,t,a,s){const f=[`
|
|
99
99
|
var v = null;
|
|
100
100
|
var v2 = null;
|
|
101
101
|
var t = 0;
|
|
@@ -152,4 +152,4 @@ 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.Cnrq
|
|
|
152
152
|
data[offset + 1] = v[1];
|
|
153
153
|
data[offset + 2] = v[2];
|
|
154
154
|
data[offset + 3] = v[3];
|
|
155
|
-
`};class B extends I{constructor({buffer:t,offset:a,size:s}){super(),this.uid=p("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=p("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=a|0,this.size=s,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=p("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null,this.removeAllListeners()}}export{B,d as G,
|
|
155
|
+
`};class B extends I{constructor({buffer:t,offset:a,size:s}){super(),this.uid=p("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=p("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=a|0,this.size=s,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=p("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null,this.removeAllListeners()}}export{B,d as G,A as U,F as a,h as b,k as c,O as d,T as e,D as t,w as u};
|
|
@@ -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.Cnrqr1lO.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.CU6a5B7C.js";import"./framework.CBLqO2Q1.js";import"./mapValues.D2X8cRgC.js";import"./theme.mgJ4a6Qj.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,m as w,G as je,w as Ve,H as Ye,c as we,T as Ie,J as $e,K as Xe,L as Je,N as Ke,O as Qe,Q as ze,U as Re,V as Ze,W as et,q as oe}from"./index.BH9lQ8Z4.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.DQmn-9PM.js";import"./framework.CBLqO2Q1.js";import"./mapValues.D2X8cRgC.js";import"./theme.wmxrblvC.js";const ge=class ${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,X=P&16777215,k=Me(ae(X,z)),_=u.frame,S=x.addressModeU??x.addressMode,ie=x.addressModeV??x.addressMode,Z=$._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?($._tempPatternMatrix.copyFrom(v.transform),Se.matrixAppendRotationInv($._tempPatternMatrix,O,W,F,B,H),r.setContextTransform($._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;$._tempPatternMatrix.set(Pe*ue,ke*me,be*ue,_e*me,Oe*ue,Ne*me),T.applyPatternTransform(pe,$._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 X=A[z];if(X.action==="texture"){const d=X.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=X.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=X.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?$e(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=Xe[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};
|
package/dist-docs/assets/chunks/{RenderTargetSystem.CU6a5B7C.js → RenderTargetSystem.DQmn-9PM.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ab as ze,ac as Ve,a3 as ie,M as m,ad as Ne,ae as je,X as $e,af as oe,m as l,q as W,ag as w,ah as qe,ai as z,aj as T,W as V,ak as le,al as Ke,T as f,S as g,a1 as D,am as de,w as ue,an as Z,ao as ce,ap as he,aq as pe,ar as fe,s as P,a as Ye,c as E,U as N,R as B,as as Xe,at as Je,P as Qe,au as Ze,$ as et,av as ee,aw as te,d as p,y as tt,a2 as R,Q as O,ax as rt,v as st,ay as nt,az as at}from"./index.BH9lQ8Z4.js";var it=`in vec2 vMaskCoord;
|
|
2
2
|
in vec2 vTextureCoord;
|
|
3
3
|
|
|
4
4
|
uniform sampler2D uTexture;
|
package/dist-docs/assets/chunks/{VPLocalSearchBox.cMcNIo6m.js → VPLocalSearchBox.eN4Tp9AQ.js}
RENAMED
|
@@ -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.
|
|
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.wmxrblvC.js";const is={root:()=>Ot(()=>import("./@localSearchIndexroot.BQUyJl33.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.Cnrqr1lO.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.Ciw3zoJw.js";import{R as Ve,S as Xe,d as ke}from"./RenderTargetSystem.CU6a5B7C.js";import"./framework.CBLqO2Q1.js";import"./mapValues.D2X8cRgC.js";import"./theme.mgJ4a6Qj.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{U as R,X as F,m as d,Z as P,x as B,w as p,t as z,ae as ye,a9 as O,T as S,aA as Ce,a2 as q,aB as Ne,S as g,R as V,Q as y,a1 as C,a3 as M,M as Z,aC as Q,aD as De,aE as Ie,aF as J,aG as ee,aH as Ge,V as Ue,W as Fe,q as A}from"./index.BH9lQ8Z4.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.0gnbx1Jq.js";import{R as Ve,S as Xe,d as ke}from"./RenderTargetSystem.DQmn-9PM.js";import"./framework.CBLqO2Q1.js";import"./mapValues.D2X8cRgC.js";import"./theme.wmxrblvC.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.Cnrqr1lO.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.Ciw3zoJw.js";import{R as ve,S as Ue,d as we}from"./RenderTargetSystem.CU6a5B7C.js";import"./framework.CBLqO2Q1.js";import"./mapValues.D2X8cRgC.js";import"./theme.mgJ4a6Qj.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{X as L,Y as A,m as l,Z as D,y as ce,_ as de,U as B,S as C,x as T,B as he,$ as k,a0 as w,w as v,a1 as y,Q as pe,a2 as le,a3 as z,b as M,M as F,a4 as O,a5 as fe,a6 as ge,a7 as me,a8 as I,a9 as W,aa as _e,T as R,V as be,W as ye,q as S}from"./index.BH9lQ8Z4.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.0gnbx1Jq.js";import{R as ve,S as Ue,d as we}from"./RenderTargetSystem.DQmn-9PM.js";import"./framework.CBLqO2Q1.js";import"./mapValues.D2X8cRgC.js";import"./theme.wmxrblvC.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
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{j as C,k as S,r as U,F as A,m as b,n as T,E as R,w as g,o as m,P as k,p as d,q as E,s as L}from"./index.BH9lQ8Z4.js";import"./webworkerAll.DDLdSH-L.js";import"./framework.CBLqO2Q1.js";import"./mapValues.D2X8cRgC.js";import"./theme.wmxrblvC.js";const H=9,w=100,F=0,j=0,D=2,I=1,K=-1e3,X=-1e3,N=2,O=class x{constructor(e,t=C){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=`${I}px`,e.style.height=`${I}px`,e.style.position="absolute",e.style.top=`${K}px`,e.style.left=`${X}px`,e.style.zIndex=N.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=`${F}px`,this._div.style.left=`${j}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=D.toString(),this._canvasObserver=new S({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(n=>{n.parentNode&&n.parentNode.removeChild(n)}),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:{...x.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 s=this._children[i];t.has(i)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._getPool(s.accessibleType).push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,U(this._children,i,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let i=0;i<this._children.length;i++){const s=this._children[i];if(!s._accessibleActive||!s._accessibleDiv)continue;const n=s._accessibleDiv,o=s.hitArea||s.getBounds().rectangle;if(s.hitArea){const r=s.worldTransform;n.style.left=`${r.tx+o.x*r.a}px`,n.style.top=`${r.ty+o.y*r.d}px`,n.style.width=`${o.width*r.a}px`,n.style.height=`${o.height*r.d}px`}else this._capHitArea(o),n.style.left=`${o.x}px`,n.style.top=`${o.y}px`,n.style.width=`${o.width}px`,n.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
|
+
color: transparent;
|
|
3
|
+
pointer-events: none;
|
|
4
|
+
padding: 0;
|
|
5
|
+
margin: 0;
|
|
6
|
+
border: 0;
|
|
7
|
+
outline: 0;
|
|
8
|
+
background: transparent;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
user-select: none;
|
|
11
|
+
-webkit-user-select: none;
|
|
12
|
+
-moz-user-select: none;
|
|
13
|
+
-ms-user-select: none;
|
|
14
|
+
`,e.accessibleText&&(i.innerText=e.accessibleText)),i.style.width=`${w}px`,i.style.height=`${w}px`,i.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",i.style.position="absolute",i.style.zIndex=D.toString(),i.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?i.setAttribute("aria-live","off"):i.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?i.setAttribute("aria-relevant","additions"):i.setAttribute("aria-relevant","text"),i.addEventListener("click",this._onClick.bind(this)),i.addEventListener("focus",this._onFocus.bind(this)),i.addEventListener("focusout",this._onFocusOut.bind(this))),i.style.pointerEvents=e.accessiblePointerEvents,i.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?i.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(i.title=`container ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&i.setAttribute("aria-label",e.accessibleHint),e.interactive?i.tabIndex=e.tabIndex:i.tabIndex=0,this.debug&&this._updateDebugHTML(i),e._accessibleActive=!0,e._accessibleDiv=i,i.container=e,this._children.push(e),this._div.appendChild(e._accessibleDiv)}_dispatchEvent(e,t){const{container:i}=e.target,s=this._renderer.events.rootBoundary,n=Object.assign(new A(s),{target:i});s.rootTarget=this._renderer.lastObjectRendered,t.forEach(o=>s.dispatchEvent(n,o))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode!==H||!this._activateOnTab||this._activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this._deactivate()}destroy(){var e;this._deactivate(),this._destroyTouchHook(),(e=this._canvasObserver)==null||e.destroy(),this._canvasObserver=null,this._div=null,this._pools=null,this._children=null,this._renderer=null,this._hookDiv=null,globalThis.removeEventListener("keydown",this._boundOnKeyDown),this._boundOnKeyDown=null,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._boundOnMouseMove=null}setAccessibilityEnabled(e){e?this._activate():this._deactivate()}_getPool(e){return this._pools[e]||(this._pools[e]=[]),this._pools[e]}};O.extension={type:[b.WebGLSystem,b.WebGPUSystem],name:"accessibility"};O.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};let Y=O;const G={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_accessibleActive:!1,_accessibleDiv:null,_renderId:-1};class y extends T{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}y.DOM_DELTA_PIXEL=0;y.DOM_DELTA_LINE=1;y.DOM_DELTA_PAGE=2;const W=2048,$=new k,_=new k;class z{constructor(e){this.dispatch=new R,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(e,t){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:t,priority:0}),this.mappingTable[e].sort((i,s)=>i.priority-s.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;const t=this.mappingTable[e.type];if(t)for(let i=0,s=t.length;i<s;i++)t[i].fn(e);else g(`[EventBoundary]: Event mapping not defined for ${e.type}`)}hitTest(e,t){m.pauseUpdate=!0;const s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",n=this[s](this.rootTarget,this.rootTarget.eventMode,$.set(e,t),this.hitTestFn,this.hitPruneFn);return n&&n[0]}propagate(e,t){if(!e.target)return;const i=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(let s=0,n=i.length-1;s<n;s++)if(e.currentTarget=i[s],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,t),!(e.propagationStopped||e.propagationImmediatelyStopped)){e.eventPhase=e.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s--)if(e.currentTarget=i[s],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,i=this._allInteractiveElements){if(i.length===0)return;e.eventPhase=e.BUBBLING_PHASE;const s=Array.isArray(t)?t:[t];for(let n=i.length-1;n>=0;n--)s.forEach(o=>{e.currentTarget=i[n],this.notifyTarget(e,o)})}propagationPath(e){const t=[e];for(let i=0;i<W&&e!==this.rootTarget&&e.parent;i++){if(!e.parent)throw new Error("Cannot find propagation path to disconnected target");t.push(e.parent),e=e.parent}return t.reverse(),t}hitTestMoveRecursive(e,t,i,s,n,o=!1){let r=!1;if(this._interactivePrune(e))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(m.pauseUpdate=!1),e.interactiveChildren&&e.children){const v=e.children;for(let u=v.length-1;u>=0;u--){const a=v[u],f=this.hitTestMoveRecursive(a,this._isInteractive(t)?t:a.eventMode,i,s,n,o||n(e,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const c=e.isInteractive();(f.length>0||c)&&(c&&this._allInteractiveElements.push(e),f.push(e)),this._hitElements.length===0&&(this._hitElements=f),r=!0}}}const h=this._isInteractive(t),p=e.isInteractive();return p&&p&&this._allInteractiveElements.push(e),o||this._hitElements.length>0?null:r?this._hitElements:h&&!n(e,i)&&s(e,i)?p?[e]:[]:null}hitTestRecursive(e,t,i,s,n){if(this._interactivePrune(e)||n(e,i))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(m.pauseUpdate=!1),e.interactiveChildren&&e.children){const h=e.children,p=i;for(let v=h.length-1;v>=0;v--){const u=h[v],a=this.hitTestRecursive(u,this._isInteractive(t)?t:u.eventMode,p,s,n);if(a){if(a.length>0&&!a[a.length-1].parent)continue;const f=e.isInteractive();return(a.length>0||f)&&a.push(e),a}}}const o=this._isInteractive(t),r=e.isInteractive();return o&&s(e,i)?r?[e]:[]:null}_isInteractive(e){return e==="static"||e==="dynamic"}_interactivePrune(e){return!e||!e.visible||!e.renderable||!e.measurable||e.eventMode==="none"||e.eventMode==="passive"&&!e.interactiveChildren}hitPruneFn(e,t){if(e.hitArea&&(e.worldTransform.applyInverse(t,_),!e.hitArea.contains(_.x,_.y)))return!0;if(e.effects&&e.effects.length)for(let i=0;i<e.effects.length;i++){const s=e.effects[i];if(s.containsPoint&&!s.containsPoint(t,this.hitTestFn))return!0}return!1}hitTestFn(e,t){return e.hitArea?!0:e!=null&&e.containsPoint?(e.worldTransform.applyInverse(t,_),e.containsPoint(_)):!1}notifyTarget(e,t){var n,o;if(!e.currentTarget.isInteractive())return;t??(t=e.type);const i=`on${t}`;(o=(n=e.currentTarget)[i])==null||o.call(n,e);const s=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?`${t}capture`:t;this._notifyListeners(e,s),e.eventPhase===e.AT_TARGET&&this._notifyListeners(e,t)}mapPointerDown(e){if(!(e instanceof d)){g("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.createPointerEvent(e);if(this.dispatchEvent(t,"pointerdown"),t.pointerType==="touch")this.dispatchEvent(t,"touchstart");else if(t.pointerType==="mouse"||t.pointerType==="pen"){const s=t.button===2;this.dispatchEvent(t,s?"rightdown":"mousedown")}const i=this.trackingData(e.pointerId);i.pressTargetsByButton[e.button]=t.composedPath(),this.freeEvent(t)}mapPointerMove(e){var h,p;if(!(e instanceof d)){g("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const t=this.createPointerEvent(e);this._isPointerMoveEvent=!1;const i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.trackingData(e.pointerId),n=this.findMountedTarget(s.overTargets);if(((h=s.overTargets)==null?void 0:h.length)>0&&n!==t.target){const v=e.type==="mousemove"?"mouseout":"pointerout",u=this.createPointerEvent(e,v,n);if(this.dispatchEvent(u,"pointerout"),i&&this.dispatchEvent(u,"mouseout"),!t.composedPath().includes(n)){const a=this.createPointerEvent(e,"pointerleave",n);for(a.eventPhase=a.AT_TARGET;a.target&&!t.composedPath().includes(a.target);)a.currentTarget=a.target,this.notifyTarget(a),i&&this.notifyTarget(a,"mouseleave"),a.target=a.target.parent;this.freeEvent(a)}this.freeEvent(u)}if(n!==t.target){const v=e.type==="mousemove"?"mouseover":"pointerover",u=this.clonePointerEvent(t,v);this.dispatchEvent(u,"pointerover"),i&&this.dispatchEvent(u,"mouseover");let a=n==null?void 0:n.parent;for(;a&&a!==this.rootTarget.parent&&a!==t.target;)a=a.parent;if(!a||a===this.rootTarget.parent){const c=this.clonePointerEvent(t,"pointerenter");for(c.eventPhase=c.AT_TARGET;c.target&&c.target!==n&&c.target!==this.rootTarget.parent;)c.currentTarget=c.target,this.notifyTarget(c),i&&this.notifyTarget(c,"mouseenter"),c.target=c.target.parent;this.freeEvent(c)}this.freeEvent(u)}const o=[],r=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(t,"pointermove"),r&&o.push("globalpointermove"),t.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),r&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),r&&o.push("globalmousemove"),this.cursor=(p=t.target)==null?void 0:p.cursor),o.length>0&&this.all(t,o),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){var o;if(!(e instanceof d)){g("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),i=this.createPointerEvent(e),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(o=i.target)==null?void 0:o.cursor);const n=this.clonePointerEvent(i,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),s&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;t.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(e){if(!(e instanceof d)){g("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId);if(t.overTargets){const i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.findMountedTarget(t.overTargets),n=this.createPointerEvent(e,"pointerout",s);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");const o=this.createPointerEvent(e,"pointerleave",s);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;t.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(e){if(!(e instanceof d)){g("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=performance.now(),i=this.createPointerEvent(e);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const r=i.button===2;this.dispatchEvent(i,r?"rightup":"mouseup")}const s=this.trackingData(e.pointerId),n=this.findMountedTarget(s.pressTargetsByButton[e.button]);let o=n;if(n&&!i.composedPath().includes(n)){let r=n;for(;r&&!i.composedPath().includes(r);){if(i.currentTarget=r,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const h=i.button===2;this.notifyTarget(i,h?"rightupoutside":"mouseupoutside")}r=r.parent}delete s.pressTargetsByButton[e.button],o=r}if(o){const r=this.clonePointerEvent(i,"click");r.target=o,r.path=null,s.clicksByButton[e.button]||(s.clicksByButton[e.button]={clickCount:0,target:r.target,timeStamp:t});const h=s.clicksByButton[e.button];if(h.target===r.target&&t-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=r.target,h.timeStamp=t,r.detail=h.clickCount,r.pointerType==="mouse"){const p=r.button===2;this.dispatchEvent(r,p?"rightclick":"click")}else r.pointerType==="touch"&&this.dispatchEvent(r,"tap");this.dispatchEvent(r,"pointertap"),this.freeEvent(r)}this.freeEvent(i)}mapPointerUpOutside(e){if(!(e instanceof d)){g("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),i=this.findMountedTarget(t.pressTargetsByButton[e.button]),s=this.createPointerEvent(e);if(i){let n=i;for(;n;)s.currentTarget=n,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(s)}mapWheel(e){if(!(e instanceof y)){g("EventBoundary cannot map a non-wheel event as a wheel event");return}const t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let i=1;i<e.length&&e[i].parent===t;i++)t=e[i];return t}createPointerEvent(e,t,i){const s=this.allocateEvent(d);return this.copyPointerData(e,s),this.copyMouseData(e,s),this.copyData(e,s),s.nativeEvent=e.nativeEvent,s.originalEvent=e,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof t=="string"&&(s.type=t),s}createWheelEvent(e){const t=this.allocateEvent(y);return this.copyWheelData(e,t),this.copyMouseData(e,t),this.copyData(e,t),t.nativeEvent=e.nativeEvent,t.originalEvent=e,t.target=this.hitTest(t.global.x,t.global.y),t}clonePointerEvent(e,t){const i=this.allocateEvent(d);return i.nativeEvent=e.nativeEvent,i.originalEvent=e.originalEvent,this.copyPointerData(e,i),this.copyMouseData(e,i),this.copyData(e,i),i.target=e.target,i.path=e.composedPath().slice(),i.type=t??i.type,i}copyWheelData(e,t){t.deltaMode=e.deltaMode,t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ}copyPointerData(e,t){e instanceof d&&t instanceof d&&(t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist)}copyMouseData(e,t){e instanceof T&&t instanceof T&&(t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.copyFrom(e.client),t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.copyFrom(e.movement),t.screen.copyFrom(e.screen),t.shiftKey=e.shiftKey,t.global.copyFrom(e.global))}copyData(e,t){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.detail=e.detail,t.view=e.view,t.which=e.which,t.layer.copyFrom(e.layer),t.page.copyFrom(e.page)}trackingData(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]}allocateEvent(e){this.eventPool.has(e)||this.eventPool.set(e,[]);const t=this.eventPool.get(e).pop()||new e(this);return t.eventPhase=t.NONE,t.currentTarget=null,t.defaultPrevented=!1,t.path=null,t.target=null,t}freeEvent(e){if(e.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const t=e.constructor;this.eventPool.has(t)||this.eventPool.set(t,[]),this.eventPool.get(t).push(e)}_notifyListeners(e,t){const i=e.currentTarget._events[t];if(i)if("fn"in i)i.once&&e.currentTarget.removeListener(t,i.fn,void 0,!0),i.fn.call(i.context,e);else for(let s=0,n=i.length;s<n&&!e.propagationImmediatelyStopped;s++)i[s].once&&e.currentTarget.removeListener(t,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,e)}}const Z=1,V={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},M=class P{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new z(null),m.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new d(null),this._rootWheelEvent=new y(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...P.defaultEventFeatures},{set:(t,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),t[i]=s,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){const{canvas:t,resolution:i}=this.renderer;this.setTargetElement(t),this.resolution=i,P._defaultEventMode=e.eventMode??"passive",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){m.destroy(),this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(e){e||(e="default");let t=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(t=!1),this._currentCursor===e)return;this._currentCursor=e;const i=this.cursorStyles[e];if(i)switch(typeof i){case"string":t&&(this.domElement.style.cursor=i);break;case"function":i(e);break;case"object":t&&Object.assign(this.domElement.style,i);break}else t&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this._rootPointerEvent}_onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this._normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let i=0,s=t.length;i<s;i++){const n=t[i],o=this._bootstrapEvent(this._rootPointerEvent,n);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(e){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,m.pointerMoved();const t=this._normalizeToPointerData(e);for(let i=0,s=t.length;i<s;i++){const n=this._bootstrapEvent(this._rootPointerEvent,t[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let t=e.target;e.composedPath&&e.composedPath().length>0&&(t=e.composedPath()[0]);const i=t!==this.domElement?"outside":"",s=this._normalizeToPointerData(e);for(let n=0,o=s.length;n<o;n++){const r=this._bootstrapEvent(this._rootPointerEvent,s[n]);r.type+=i,this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this._normalizeToPointerData(e);for(let i=0,s=t.length;i<s;i++){const n=this._bootstrapEvent(this._rootPointerEvent,t[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(e){if(!this.features.wheel)return;const t=this.normalizeWheelEvent(e);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(t)}setTargetElement(e){this._removeEvents(),this.domElement=e,m.domElement=e,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;m.addTickerListener();const e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):this.supportsPointerEvents&&(e.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,!0),this.domElement.addEventListener("pointerdown",this._onPointerDown,!0),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this._onPointerOverOut,!0),globalThis.addEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,!0),this.domElement.addEventListener("mousedown",this._onPointerDown,!0),this.domElement.addEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this._onPointerOverOut,!0),globalThis.addEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,!0),this.domElement.addEventListener("touchend",this._onPointerUp,!0),this.domElement.addEventListener("touchmove",this._onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;m.removeTickerListener();const e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):this.supportsPointerEvents&&(e.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(e,t,i){const s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{width:this.domElement.width,height:this.domElement.height,left:0,top:0},n=1/this.resolution;e.x=(t-s.left)*(this.domElement.width/s.width)*n,e.y=(i-s.top)*(this.domElement.height/s.height)*n}_normalizeToPointerData(e){const t=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(let i=0,s=e.changedTouches.length;i<s;i++){const n=e.changedTouches[i];typeof n.button>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=e.type,t.push(n)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){const i=e;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=Z),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,t.push(i)}else t.push(e);return t}normalizeWheelEvent(e){const t=this._rootWheelEvent;return this._transferMouseData(t,e),t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ,t.deltaMode=e.deltaMode,this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.nativeEvent=e,t.type=e.type,t}_bootstrapEvent(e,t){return e.originalEvent=null,e.nativeEvent=t,e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist,this._transferMouseData(e,t),this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=t.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=V[e.type]||e.type),e}_transferMouseData(e,t){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null,e.shiftKey=t.shiftKey}};M.extension={name:"events",type:[b.WebGLSystem,b.CanvasSystem,b.WebGPUSystem],priority:-1};M.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let B=M;const q={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(l){this.eventMode=l?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??B.defaultEventMode},set eventMode(l){this._internalEventMode=l},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(l,e,t){const i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,s=typeof t=="object"?t.signal:void 0,n=typeof t=="object"?t.once===!0:!1,o=typeof e=="function"?void 0:e;l=i?`${l}capture`:l;const r=typeof e=="function"?e:e.handleEvent,h=this;s&&s.addEventListener("abort",()=>{h.off(l,r,o)}),n?h.once(l,r,o):h.on(l,r,o)},removeEventListener(l,e,t){const i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,s=typeof e=="function"?void 0:e;l=i?`${l}capture`:l,e=typeof e=="function"?e:e.handleEvent,this.off(l,e,s)},dispatchEvent(l){if(!(l instanceof A))throw new Error("Container cannot propagate events outside of the Federated Events API");return l.defaultPrevented=!1,l.path=null,l.target=this,l.manager.dispatchEvent(l),!l.defaultPrevented}};E.add(Y);E.mixin(L,G);E.add(B);E.mixin(L,q);
|