vendor: 7,498 bytes, line 1
1import{O as e,_ as t,c as n,d as r,i,j as a,n as o,r as s,s as c,t as l,u,v as d,z as f}from"./Geometry-P65o1n-k.js";function p(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=m(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=ee(e,t,a,n)),e.length>80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return g(a,o,n,s,c,l,0),o}function m(e,t,n,r,i){let a;if(i===me(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=pe(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=pe(i/r|0,e[i],e[i+1],a);return a&&w(a,a.next)&&(k(a),a=a.next),a}function h(e,t){if(!e)return e;t||=e;let n=e,r;do if(r=!1,!n.steiner&&(w(n,n.next)||C(n.prev,n,n.next)===0)){if(k(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function g(e,t,n,r,i,a,o){if(!e)return;!o&&a&&ae(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?v(e,r,i,a):_(e)){t.push(c.i,e.i,l.i),k(e),e=l.next,s=l.next;continue}if(e=l,e===s){o?o===1?(e=y(h(e),t),g(e,t,n,r,i,a,2)):o===2&&b(e,t,n,r,i,a):g(h(e),t,n,r,i,a,1);break}}}function _(e){let t=e.prev,n=e,r=e.next;if(C(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=Math.min(i,a,o),d=Math.min(s,c,l),f=Math.max(i,a,o),p=Math.max(s,c,l),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&S(i,s,a,c,o,l,m.x,m.y)&&C(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function v(e,t,n,r){let i=e.prev,a=e,o=e.next;if(C(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=Math.min(s,c,l),m=Math.min(u,d,f),h=Math.max(s,c,l),g=Math.max(u,d,f),_=x(p,m,t,n,r),v=x(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&S(s,u,c,d,l,f,y.x,y.y)&&C(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&S(s,u,c,d,l,f,b.x,b.y)&&C(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&S(s,u,c,d,l,f,y.x,y.y)&&C(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&S(s,u,c,d,l,f,b.x,b.y)&&C(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function y(e,t){let n=e;do{let r=n.prev,i=n.next.next;!w(r,i)&&T(r,n,n.next,i)&&O(r,i)&&O(i,r)&&(t.push(r.i,n.i,i.i),k(n),k(n.next),n=e=i),n=n.next}while(n!==e);return h(n)}function b(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&le(o,e)){let s=fe(o,e);o=h(o,o.next),s=h(s,s.next),g(o,t,n,r,i,a,0),g(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function ee(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=m(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push(se(o))}i.sort(te);for(let e=0;e<i.length;e++)n=ne(i[e],n);return n}function te(e,t){let n=e.x-t.x;return n===0&&(n=e.y-t.y,n===0&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x))),n}function ne(e,t){let n=re(e,t);if(!n)return t;let r=fe(n,e);return h(r,r.next),h(n,n.next)}function re(e,t){let n=t,r=e.x,i=e.y,a=-1/0,o;if(w(e,n))return n;do{if(w(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a&&(a=e,o=n.x<n.next.x?n:n.next,e===r))return o}n=n.next}while(n!==t);if(!o)return null;let s=o,c=o.x,l=o.y,u=1/0;n=o;do{if(r>=n.x&&n.x>=c&&r!==n.x&&ce(i<l?r:a,i,c,l,i<l?a:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);O(n,e)&&(t<u||t===u&&(n.x>o.x||n.x===o.x&&ie(o,n)))&&(o=n,u=t)}n=n.next}while(n!==s);return o}function ie(e,t){return C(e.prev,e,t.prev)<0&&C(t.next,e,e.next)<0}function ae(e,t,n,r){let i=e;do i.z===0&&(i.z=x(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,oe(i)}function oe(e){let t,n=1;do{let r=e,i;e=null;let a=null;for(t=0;r;){t++;let o=r,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,s--):(i=o,o=o.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=o}a.nextZ=null,n*=2}while(t>1);return e}function x(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function se(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function ce(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function S(e,t,n,r,i,a,o,s){return!(e===o&&t===s)&&ce(e,t,n,r,i,a,o,s)}function le(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!ue(e,t)&&(O(e,t)&&O(t,e)&&de(e,t)&&(C(e.prev,e,t.prev)||C(e,t.prev,t))||w(e,t)&&C(e.prev,e,e.next)>0&&C(t.prev,t,t.next)>0)}function C(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function w(e,t){return e.x===t.x&&e.y===t.y}function T(e,t,n,r){let i=D(C(e,t,n)),a=D(C(e,t,r)),o=D(C(n,r,e)),s=D(C(n,r,t));return!!(i!==a&&o!==s||i===0&&E(e,n,t)||a===0&&E(e,r,t)||o===0&&E(n,e,r)||s===0&&E(n,t,r))}function E(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function D(e){return e>0?1:e<0?-1:0}function ue(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&T(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function O(e,t){return C(e.prev,e,e.next)<0?C(e,t,e.next)>=0&&C(e,e.prev,t)>=0:C(e,t,e.prev)<0||C(e,e.next,t)<0}function de(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function fe(e,t){let n=A(e.i,e.x,e.y),r=A(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function pe(e,t,n,r){let i=A(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function k(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function A(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function me(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}var he=p.default||p,j=class{constructor(e){typeof e==`number`?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||=new Int8Array(this.rawBinaryData),this._int8View}get uint8View(){return this._uint8View||=new Uint8Array(this.rawBinaryData),this._uint8View}get int16View(){return this._int16View||=new Int16Array(this.rawBinaryData),this._int16View}get int32View(){return this._int32View||=new Int32Array(this.rawBinaryData),this._int32View}get float64View(){return this._float64Array||=new Float64Array(this.rawBinaryData),this._float64Array}get bigUint64View(){return this._bigUint64Array||=new BigUint64Array(this.rawBinaryData),this._bigUint64Array}view(e){return this[`${e}View`]}destroy(){this.rawBinaryData=null,this.uint32View=null,this.float32View=null,this.uint16View=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._int32View=null,this._float64Array=null,this._bigUint64Array=null}static sizeOf(e){switch(e){case`int8`:case`uint8`:return 1;case`int16`:case`uint16`:return 2;case`int32`:case`uint32`:case`float32`:return 4;default:throw Error(`${e} isn't a valid view type`)}}};
1function M(e,t,n,r){if(n??=0,r??=Math.min(e.byteLength-n,t.byteLength),!(n&7)&&!(r&7)){let i=r/8;new Float64Array(t,0,i).set(new Float64Array(e,n,i))}else if(!(n&3)&&!(r&3)){let i=r/4;new Float32Array(t,0,i).set(new Float32Array(e,n,i))}else new Uint8Array(t).set(new Uint8Array(e,n,r))}var ge={normal:`normal-npm`,add:`add-npm`,screen:`screen-npm`},N=(e=>(e[e.DISABLED=0]=`DISABLED`,e[e.RENDERING_MASK_ADD=1]=`RENDERING_MASK_ADD`,e[e.MASK_ACTIVE=2]=`MASK_ACTIVE`,e[e.INVERSE_MASK_ACTIVE=3]=`INVERSE_MASK_ACTIVE`,e[e.RENDERING_MASK_REMOVE=4]=`RENDERING_MASK_REMOVE`,e[e.NONE=5]=`NONE`,e))(N||{});function P(e,t){return t.alphaMode===`no-premultiply-alpha`&&ge[e]||e}var _e=[`precision mediump float;`,`void main(void){`,`float test = 0.1;`,`%forloop%`,`gl_FragColor = vec4(0.0);`,`}`].join(` 2`);function ve(e){let t=``;for(let n=0;n<e;++n)n>0&&(t+=` 3else `),n<e-1&&(t+=`if(test == ${n}.0){}`);return t}function F(e,t){if(e===0)throw Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let n=t.createShader(t.FRAGMENT_SHADER);try{for(;;){let r=_e.replace(/%forloop%/gi,ve(e));if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS))e=e/2|0;else break}}finally{t.deleteShader(n)}return e}var I=null;function ye(){if(I)return I;let e=r();return I=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),I=F(I,e),e.getExtension(`WEBGL_lose_context`)?.loseContext(),I}var be=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let e=0;e<this.count;e++){let t=this.textures[e];this.textures[e]=null,this.ids[t.uid]=null}this.count=0}},xe=class{constructor(){this.renderPipeId=`batch`,this.action=`startBatch`,this.start=0,this.size=0,this.textures=new be,this.blendMode=`normal`,this.topology=`triangle-strip`,this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null,this.elements=null}},L=[],R=0;t.register({clear:()=>{if(L.length>0)for(let e of L)e&&e.destroy();L.length=0,R=0}});function z(){return R>0?L[--R]:new xe}function B(e){e.elements=null,L[R++]=e}var V=0,H=class t{constructor(n){this.uid=a(`batcher`),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],n={...t.defaultOptions,...n},n.maxTextures||(e(`v8.8.0`,`maxTextures is a required option for Batcher now, please pass it in the options`),n.maxTextures=ye());let{maxTextures:r,attributesInitialSize:i,indicesInitialSize:o}=n;this.attributeBuffer=new j(i*4),this.indexBuffer=new Uint16Array(o),this.maxTextures=r}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let e=0;e<this.batchIndex;e++)B(this.batches[e]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(e){this._elements[this.elementSize++]=e,e._indexStart=this.indexSize,e._attributeStart=this.attributeSize,e._batcher=this,this.indexSize+=e.indexSize,this.attributeSize+=e.attributeSize*this.vertexSize}checkAndUpdateTexture(e,t){let n=e._batch.textures.ids[t._source.uid];return!n&&n!==0?!1:(e._textureId=n,e.texture=t,!0)}updateElement(e){this.dirty=!0;let t=this.attributeBuffer;e.packAsQuad?this.packQuadAttributes(e,t.float32View,t.uint32View,e._attributeStart,e._textureId):this.packAttributes(e,t.float32View,t.uint32View,e._attributeStart,e._textureId)}break(e){let t=this._elements;if(!t[this.elementStart])return;let n=z(),r=n.textures;r.clear();let i=t[this.elementStart],a=P(i.blendMode,i.texture._source),o=i.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let s=this.attributeBuffer.float32View,c=this.attributeBuffer.uint32View,l=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,f=`startBatch`,p=[],m=this.maxTextures;for(let i=this.elementStart;i<this.elementSize;++i){let h=t[i];t[i]=null;let g=h.texture._source,_=P(h.blendMode,g),v=a!==_||o!==h.topology;if(g._batchTick===V&&!v){h._textureId=g._textureBindLocation,u+=h.indexSize,h.packAsQuad?(this.packQuadAttributes(h,s,c,h._attributeStart,h._textureId),this.packQuadIndex(l,h._indexStart,h._attributeStart/this.vertexSize)):(this.packAttributes(h,s,c,h._attributeStart,h._textureId),this.packIndex(h,l,h._indexStart,h._attributeStart/this.vertexSize)),h._batch=n,p.push(h);continue}g._batchTick=V,(r.count>=m||v)&&(this._finishBatch(n,d,u-d,r,a,o,e,f,p),f=`renderBatch`,d=u,a=_,o=h.topology,n=z(),r=n.textures,r.clear(),p=[],++V),h._textureId=g._textureBindLocation=r.count,r.ids[g.uid]=r.count,r.textures[r.count++]=g,h._batch=n,p.push(h),u+=h.indexSize,h.packAsQuad?(this.packQuadAttributes(h,s,c,h._attributeStart,h._textureId),this.packQuadIndex(l,h._indexStart,h._attributeStart/this.vertexSize)):(this.packAttributes(h,s,c,h._attributeStart,h._textureId),this.packIndex(h,l,h._indexStart,h._attributeStart/this.vertexSize))}r.count>0&&(this._finishBatch(n,d,u-d,r,a,o,e,f,p),d=u,++V),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(e,t,n,r,i,a,o,s,c){e.gpuBindGroup=null,e.bindGroup=null,e.action=s,e.batcher=this,e.textures=r,e.blendMode=i,e.topology=a,e.start=t,e.size=n,e.elements=c,++V,this.batches[this.batchIndex++]=e,o.add(e)}finish(e){this.break(e)}ensureAttributeBuffer(e){e*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(e*4)}ensureIndexBuffer(e){e<=this.indexBuffer.length||this._resizeIndexBuffer(e)}_resizeAttributeBuffer(e){let t=new j(Math.max(e,this.attributeBuffer.size*2));M(this.attributeBuffer.rawBinaryData,t.rawBinaryData),this.attributeBuffer=t}_resizeIndexBuffer(e){let t=this.indexBuffer,n=Math.max(e,t.length*1.5);n+=n%2;let r=n>65535?new Uint32Array(n):new Uint16Array(n);if(r.BYTES_PER_ELEMENT!==t.BYTES_PER_ELEMENT)for(let e=0;e<t.length;e++)r[e]=t[e];else M(t.buffer,r.buffer);this.indexBuffer=r}packQuadIndex(e,t,n){e[t]=n+0,e[t+1]=n+1,e[t+2]=n+2,e[t+3]=n+0,e[t+4]=n+2,e[t+5]=n+3}packIndex(e,t,n,r){let i=e.indices,a=e.indexSize,o=e.indexOffset,s=e.attributeOffset;for(let e=0;e<a;e++)t[n++]=r+i[e+o]-s}destroy(e={}){if(this.batches!==null){for(let e=0;e<this.batchIndex;e++)B(this.batches[e]);this.batches=null,this.geometry.destroy(!0),this.geometry=null,e.shader&&(this.shader?.destroy(),this.shader=null);for(let e=0;e<this._elements.length;e++)this._elements[e]&&(this._elements[e]._batch=null);this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}}};H.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};var Se=H,Ce=new Float32Array(1),we=new Uint32Array(1),Te=class extends l{constructor(){let e=new o({data:Ce,label:`attribute-batch-buffer`,usage:s.VERTEX|s.COPY_DST,shrinkToFit:!1}),t=new o({data:we,label:`index-batch-buffer`,usage:s.INDEX|s.COPY_DST,shrinkToFit:!1});super({attributes:{aPosition:{buffer:e,format:`float32x2`,stride:24,offset:0},aUV:{buffer:e,format:`float32x2`,stride:24,offset:8},aColor:{buffer:e,format:`unorm8x4`,stride:24,offset:16},aTextureIdAndRound:{buffer:e,format:`uint16x2`,stride:24,offset:20}},indexBuffer:t})}};function U(e,t,n){if(e)for(let r in e){let i=t[r.toLocaleLowerCase()];if(i){let t=e[r];r===`header`&&(t=t.replace(/@in\s+[^;]+;\s*/g,``).replace(/@out\s+[^;]+;\s*/g,``)),n&&i.push(`//----${n}----//`),i.push(t)}else d(`${r} placement hook does not exist in shader`)}}var Ee=/\{\{(.*?)\}\}/g;function W(e){let t={};return(e.match(Ee)?.map(e=>e.replace(/[{()}
3]/g,``))??[]).forEach(e=>{t[e]=[]}),t}function G(e,t){let n,r=/@in\s+([^;]+);/g;for(;(n=r.exec(e))!==null;)t.push(n[1])}function K(e,t,n=!1){let r=[];G(t,r),e.forEach(e=>{e.header&&G(e.header,r)});let i=r;n&&i.sort();let a=i.map((e,t)=>` @location(${t}) ${e},`).join(` 4`),o=t.replace(/@in\s+[^;]+;\s*/g,``);return o=o.replace(`{{in}}`,` 5${a} 6`),o}function q(e,t){let n,r=/@out\s+([^;]+);/g;for(;(n=r.exec(e))!==null;)t.push(n[1])}function De(e){let t=/\b(\w+)\s*:/g.exec(e);return t?t[1]:``}function Oe(e){return e.replace(/@.*?\s+/g,``)}function ke(e,t){let n=[];q(t,n),e.forEach(e=>{e.header&&q(e.header,n)});let r=0,i=n.sort().map(e=>e.indexOf(`builtin`)>-1?e:`@location(${r++}) ${e}`).join(`, 7`),a=n.sort().map(e=>` var ${Oe(e)};`).join(` 8`),o=`return VSOutput( 9 ${n.sort().map(e=>` ${De(e)}`).join(`, 10`)});`,s=t.replace(/@out\s+[^;]+;\s*/g,``);return s=s.replace(`{{struct}}`,` 11${i} 12`),s=s.replace(`{{start}}`,` 13${a} 14`),s=s.replace(`{{return}}`,` 15${o} 16`),s}function Ae(e,t){let n=e;for(let e in t){let r=t[e];n=r.join(` 17`).length?n.replace(`{{${e}}}`,`//-----${e} START-----// 18${r.join(` 19`)} 20//----${e} FINISH----//`):n.replace(`{{${e}}}`,``)}return n}var J=Object.create(null),Y=new Map,je=0;function Me({template:e,bits:t}){let n=Fe(e,t);if(J[n])return J[n];let{vertex:r,fragment:i}=Pe(e,t);return J[n]=Ie(r,i,t),J[n]}function Ne({template:e,bits:t}){let n=Fe(e,t);return J[n]||(J[n]=Ie(e.vertex,e.fragment,t)),J[n]}function Pe(e,t){let n=t.map(e=>e.vertex).filter(e=>!!e),r=t.map(e=>e.fragment).filter(e=>!!e),i=K(n,e.vertex,!0);i=ke(n,i);let a=K(r,e.fragment,!0);return{vertex:i,fragment:a}}function Fe(e,t){return t.map(e=>(Y.has(e)||Y.set(e,je++),Y.get(e))).sort((e,t)=>e-t).join(`-`)+e.vertex+e.fragment}function Ie(e,t,n){let r=W(e),i=W(t);return n.forEach(e=>{U(e.vertex,r,e.name),U(e.fragment,i,e.name)}),{vertex:Ae(e,r),fragment:Ae(t,i)}}var Le=` 21 @in aPosition: vec2<f32>; 22 @in aUV: vec2<f32>; 23 24 @out @builtin(position) vPosition: vec4<f32>; 25 @out vUV : vec2<f32>; 26 @out vColor : vec4<f32>; 27 28 {{header}} 29 30 struct VSOutput { 31 {{struct}} 32 }; 33 34 @vertex 35 fn main( {{in}} ) -> VSOutput { 36 37 var worldTransformMatrix = globalUniforms.uWorldTransformMatrix; 38 var modelMatrix = mat3x3<f32>( 39 1.0, 0.0, 0.0, 40 0.0, 1.0, 0.0, 41 0.0, 0.0, 1.0 42 ); 43 var position = aPosition; 44 var uv = aUV; 45 46 {{start}} 47 48 vColor = vec4<f32>(1., 1., 1., 1.); 49 50 {{main}} 51 52 vUV = uv; 53 54 var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix; 55 56 vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0); 57 58 vColor *= globalUniforms.uWorldColorAlpha; 59 60 {{end}} 61 62 {{return}} 63 }; 64`,Re=` 65 @in vUV : vec2<f32>; 66 @in vColor : vec4<f32>; 67 68 {{header}} 69 70 @fragment 71 fn main( 72 {{in}} 73 ) -> @location(0) vec4<f32> { 74 75 {{start}} 76 77 var outColor:vec4<f32>; 78 79 {{main}} 80 81 var finalColor:vec4<f32> = outColor * vColor; 82 83 {{end}} 84 85 return finalColor; 86 }; 87`,ze=` 88 in vec2 aPosition; 89 in vec2 aUV; 90 91 out vec4 vColor; 92 out vec2 vUV; 93 94 {{header}} 95 96 void main(void){ 97 98 mat3 worldTransformMatrix = uWorldTransformMatrix; 99 mat3 modelMatrix = mat3( 100 1.0, 0.0, 0.0, 101 0.0, 1.0, 0.0, 102 0.0, 0.0, 1.0 103 ); 104 vec2 position = aPosition; 105 vec2 uv = aUV; 106 107 {{start}} 108 109 vColor = vec4(1.); 110 111 {{main}} 112 113 vUV = uv; 114 115 mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix; 116 117 gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); 118 119 vColor *= uWorldColorAlpha; 120 121 {{end}} 122 } 123`,Be=` 124 125 in vec4 vColor; 126 in vec2 vUV; 127 128 out vec4 finalColor; 129 130 {{header}} 131 132 void main(void) { 133 134 {{start}} 135 136 vec4 outColor; 137 138 {{main}} 139 140 finalColor = outColor * vColor; 141 142 {{end}} 143 } 144`,Ve={name:`global-uniforms-bit`,vertex:{header:` 145 struct GlobalUniforms { 146 uProjectionMatrix:mat3x3<f32>, 147 uWorldTransformMatrix:mat3x3<f32>, 148 uWorldColorAlpha: vec4<f32>, 149 uResolution: vec2<f32>, 150 } 151 152 @group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms; 153 `}},He={name:`global-uniforms-bit`,vertex:{header:` 154 uniform mat3 uProjectionMatrix; 155 uniform mat3 uWorldTransformMatrix; 156 uniform vec4 uWorldColorAlpha; 157 uniform vec2 uResolution; 158 `}};function Ue({bits:e,name:t}){let r=Me({template:{fragment:Re,vertex:Le},bits:[Ve,...e]});return n.from({name:t,vertex:{source:r.vertex,entryPoint:`main`},fragment:{source:r.fragment,entryPoint:`main`}})}function We({bits:e,name:t}){return new u({name:t,...Ne({template:{vertex:ze,fragment:Be},bits:[He,...e]})})}var Ge={name:`color-bit`,vertex:{header:` 159 @in aColor: vec4<f32>; 160 `,main:` 161 vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a); 162 `}},Ke={name:`color-bit`,vertex:{header:` 163 in vec4 aColor; 164 `,main:` 165 vColor *= vec4(aColor.rgb * aColor.a, aColor.a); 166 `}},X={};function qe(e){let t=[];if(e===1)t.push(`@group(1) @binding(0) var textureSource1: texture_2d<f32>;`),t.push(`@group(1) @binding(1) var textureSampler1: sampler;`);else{let n=0;for(let r=0;r<e;r++)t.push(`@group(1) @binding(${n++}) var textureSource${r+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${n++}) var textureSampler${r+1}: sampler;`)}return t.join(` 167`)}function Je(e){let t=[];if(e===1)t.push(`outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);`);else{t.push(`switch vTextureId {`);for(let n=0;n<e;n++)n===e-1?t.push(` default:{`):t.push(` case ${n}:{`),t.push(` outColor = textureSampleGrad(textureSource${n+1}, textureSampler${n+1}, vUV, uvDx, uvDy);`),t.push(` break;}`);t.push(`}`)}return t.join(` 168`)}function Ye(e){return X[e]||(X[e]={name:`texture-batch-bit`,vertex:{header:` 169 @in aTextureIdAndRound: vec2<u32>; 170 @out @interpolate(flat) vTextureId : u32; 171 `,main:` 172 vTextureId = aTextureIdAndRound.y; 173 `,end:` 174 if(aTextureIdAndRound.x == 1) 175 { 176 vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw); 177 } 178 `},fragment:{header:` 179 @in @interpolate(flat) vTextureId: u32; 180 181 ${qe(e)} 182 `,main:` 183 var uvDx = dpdx(vUV); 184 var uvDy = dpdy(vUV); 185 186 ${Je(e)} 187 `}}),X[e]}var Z={};function Xe(e){let t=[];for(let n=0;n<e;n++)n>0&&t.push(`else`),n<e-1&&t.push(`if(vTextureId < ${n}
187.5)`),t.push(`{`),t.push(` outColor = texture(uTextures[${n}], vUV);`),t.push(`}`);return t.join(` 188`)}function Ze(e){return Z[e]||(Z[e]={name:`texture-batch-bit`,vertex:{header:` 189 in vec2 aTextureIdAndRound; 190 out float vTextureId; 191 192 `,main:` 193 vTextureId = aTextureIdAndRound.y; 194 `,end:` 195 if(aTextureIdAndRound.x == 1.) 196 { 197 gl_Position.xy = roundPixels(gl_Position.xy, uResolution); 198 } 199 `},fragment:{header:` 200 in float vTextureId; 201 202 uniform sampler2D uTextures[${e}]; 203 204 `,main:` 205 206 ${Xe(e)} 207 `}}),Z[e]}var Qe={name:`round-pixels-bit`,vertex:{header:` 208 fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32> 209 { 210 return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; 211 } 212 `}},$e={name:`round-pixels-bit`,vertex:{header:` 213 vec2 roundPixels(vec2 position, vec2 targetSize) 214 { 215 return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; 216 } 217 `}},et={};function tt(e){let t=et[e];if(t)return t;let n=new Int32Array(e);for(let t=0;t<e;t++)n[t]=t;return t=et[e]=new c({uTextures:{value:n,type:`i32`,size:e}},{isStatic:!0}),t}var nt=class extends i{constructor(e){let t=We({name:`batch`,bits:[Ke,Ze(e),$e]}),n=Ue({name:`batch`,bits:[Ge,Ye(e),Qe]});super({glProgram:t,gpuProgram:n,resources:{batchSamplers:tt(e)}}),this.maxTextures=e}},Q=null,$=class e extends Se{constructor(t){super(t),this.geometry=new Te,this.name=e.extension.name,this.vertexSize=6,Q??=new nt(t.maxTextures),this.shader=Q}packAttributes(e,t,n,r,i){let a=i<<16|e.roundPixels&65535,o=e.transform,s=o.a,c=o.b,l=o.c,u=o.d,d=o.tx,f=o.ty,{positions:p,uvs:m}=e,h=e.color,g=e.attributeOffset,_=g+e.attributeSize;for(let e=g;e<_;e++){let i=e*2,o=p[i],g=p[i+1];t[r++]=s*o+l*g+d,t[r++]=u*g+c*o+f,t[r++]=m[i],t[r++]=m[i+1],n[r++]=h,n[r++]=a}}packQuadAttributes(e,t,n,r,i){let a=e.texture,o=e.transform,s=o.a,c=o.b,l=o.c,u=o.d,d=o.tx,f=o.ty,p=e.bounds,m=p.maxX,h=p.minX,g=p.maxY,_=p.minY,v=a.uvs,y=e.color,b=i<<16|e.roundPixels&65535;t[r+0]=s*h+l*_+d,t[r+1]=u*_+c*h+f,t[r+2]=v.x0,t[r+3]=v.y0,n[r+4]=y,n[r+5]=b,t[r+6]=s*m+l*_+d,t[r+7]=u*_+c*m+f,t[r+8]=v.x1,t[r+9]=v.y1,n[r+10]=y,n[r+11]=b,t[r+12]=s*m+l*g+d,t[r+13]=u*g+c*m+f,t[r+14]=v.x2,t[r+15]=v.y2,n[r+16]=y,n[r+17]=b,t[r+18]=s*h+l*g+d,t[r+19]=u*g+c*h+f,t[r+20]=v.x3,t[r+21]=v.y3,n[r+22]=y,n[r+23]=b}_updateMaxTextures(e){this.shader.maxTextures!==e&&(Q=new nt(e),this.shader=Q)}destroy(){this.shader=null,super.destroy()}};$.extension={type:[f.Batcher],name:`default`};var rt=$,it=class{constructor(e){this.items=Object.create(null);let{renderer:t,type:n,onUnload:r,priority:i,name:a}=e;this._renderer=t,t.gc.addResourceHash(this,`items`,n,i??0),this._onUnload=r,this.name=a}add(e){return this.items[e.uid]?!1:(this.items[e.uid]=e,e.once(`unload`,this.remove,this),e._gcLastUsed=this._renderer.gc.now,!0)}remove(e,...t){if(!this.items[e.uid])return;let n=e._gpuData[this._renderer.uid];n&&(this._onUnload?.(e,...t),n.destroy(),e._gpuData[this._renderer.uid]=null,this.items[e.uid]=null)}removeAll(...e){Object.values(this.items).forEach(t=>t&&this.remove(t,...e))}destroy(...e){this.removeAll(...e),this.items=Object.create(null),this._renderer=null,this._onUnload=null}};export{$e as a,Ge as c,Ue as d,F as f,he as g,M as h,Qe as i,Ke as l,N as m,rt as n,Ye as o,P as p,tt as r,Ze as s,it as t,We as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.