glre 0.31.0 → 0.33.0

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/solid.js CHANGED
@@ -1,70 +1,40 @@
1
- import{durable as J,event as mt}from"reev";import{createFrame as xt,createQueue as dt}from"refr";import{nested as Z}from"reev";var v={arr:Array.isArray,bol:e=>typeof e=="boolean",str:e=>typeof e=="string",num:e=>typeof e=="number",int:e=>Number.isInteger(e),fun:e=>typeof e=="function",und:e=>typeof e>"u",nul:e=>e===null,set:e=>e instanceof Set,map:e=>e instanceof Map,obj:e=>!!e&&e.constructor.name==="Object",nan:e=>typeof e=="number"&&Number.isNaN(e)},We=(e,t)=>e.forEach(t),vt=(e,...t)=>{We(e,r=>r(...t))},yt=(e="",t="_",r="/")=>e.split(t).join(r),Xt=(e=".pdf")=>e.split(".").pop()?.toLowerCase()??"",_t=(e=0)=>`${e}`.split(".")[1]?.length??0,Tt=(e=0)=>`${e}`.split(".")[0]?.length-(e<0?1:0),ht=(e=0,t=-2)=>(t*=-1,t=Math.pow(10,t),e*=t,e=Math.round(e),e/=t,e);var Nt=["x","y","z","w","r","g","b","a","s","t","p","q"],R=["bool","uint","int","float","bvec2","ivec2","uvec2","vec2","bvec3","ivec3","uvec3","vec3","bvec4","ivec4","uvec4","vec4","color","mat2","mat3","mat4"],B=["toBool","toUint","toInt","toFloat","toBvec2","toIvec2","toUvec2","toVec2","toBvec3","toIvec3","toUvec3","toVec3","toBvec4","toIvec4","toUvec4","toVec4","toColor","toMat2","toMat3","toMat4"],M={add:"+",sub:"-",mul:"*",div:"/",mod:"%",equal:"==",notEqual:"!=",lessThan:"<",lessThanEqual:"<=",greaterThan:">",greaterThanEqual:">=",and:"&&",or:"||",bitAnd:"&",bitOr:"|",bitXor:"^",shiftLeft:"<<",shiftRight:">>"},te=Object.keys(M),D=["dot","distance","length","lengthSq","determinant","luminance"],V=["all","any"],z=["abs","sign","floor","ceil","round","fract","trunc","sin","cos","tan","asin","acos","atan","exp","exp2","log","log2","sqrt","inverseSqrt","normalize","oneMinus","saturate","negate","reciprocal","dFdx","dFdy","fwidth"],W=["cross"],q=["reflect","refract"],k=["min","max","mix","clamp","step","smoothstep"],Y=["texture","textureLod","textureSize","cubeTexture"],qe=["atan2","degrees","faceforward","bitcast","cbrt","difference","equals","pow","pow2","pow3","pow4","radians","transformDirection"],re=[...D,...V,...z,...W,...q,...k,...Y,...qe],oe={float:"f32",int:"i32",uint:"u32",bool:"bool",vec2:"vec2f",vec3:"vec3f",vec4:"vec4f",mat2:"mat2x2f",mat3:"mat3x3f",mat4:"mat4x4f",ivec2:"vec2i",ivec3:"vec3i",ivec4:"vec4i",uvec2:"vec2u",uvec3:"vec3u",uvec4:"vec4u",bvec2:"vec2<bool>",bvec3:"vec3<bool>",bvec4:"vec4<bool>"},j={1:"float",2:"vec2",3:"vec3",4:"vec4",9:"mat3",16:"mat4"},ne={position:"vec4",vertex_index:"uint",instance_index:"uint",front_facing:"bool",frag_depth:"float",sample_index:"uint",sample_mask:"uint",point_coord:"vec2",positionLocal:"vec3",positionWorld:"vec3",positionView:"vec3",normalLocal:"vec3",normalWorld:"vec3",normalView:"vec3",screenCoordinate:"vec2",screenUV:"vec2",gl_FragCoord:"vec4",gl_VertexID:"uint",gl_InstanceID:"uint",gl_FrontFacing:"bool",gl_FragDepth:"float",gl_SampleID:"uint",gl_SampleMask:"uint",gl_PointCoord:"vec2",normal:"vec3",uv:"vec2",color:"vec4"},se=["equal","notEqual","lessThan","lessThanEqual","greaterThan","greaterThanEqual"],ie=["and","or"],ae={position:"gl_FragCoord",vertex_index:"gl_VertexID",instance_index:"gl_InstanceID",front_facing:"gl_FrontFacing",frag_depth:"gl_FragDepth",sample_index:"gl_SampleID",sample_mask:"gl_SampleMask",point_coord:"gl_PointCoord",uv:"gl_FragCoord.xy"};var H=e=>v.str(e)&&/^[xyzwrgbastpq]{1,4}$/.test(e),ce=e=>te.includes(e),ue=e=>re.includes(e),pe=e=>B.includes(e),L=e=>!e||typeof e!="object"?!1:e.isProxy,fe=e=>{let t=(e>>16&255)/255,r=(e>>8&255)/255,o=(e&255)/255;return[t,r,o]},ke=0,K=()=>`i${ke++}`,I=(e,t)=>e.filter(r=>!v.und(r)&&!v.nul(r)).map(r=>u(r,t)).join(", "),C=(e,t)=>v.str(e)?t?.isWebGL?e:oe[e]:"",le=e=>M[e]||e,me=e=>ae[e],xe=e=>{let t=B.indexOf(e);return t!==-1?R[t]:"float"},de=e=>Array.from(e.headers).map(([,t])=>t).join(`
2
- `),ge=(e,t)=>{let{id:r,children:o=[],layout:n}=e,[s,a,...c]=o,x=n?.type&&n?.type!=="auto"?n?.type:a?T(a,t):"void",l=[],p=[];if(n?.inputs)for(let b of n.inputs)l.push([b.name,b.type]);else for(let b=0;b<c.length;b++)l.push([`p${b}`,T(c[b],t)]);let f="";if(t?.isWebGL){for(let[b,E]of l)p.push(`${E} ${b}`);f+=`${x} ${r}(${p}) {
3
- `}else{for(let[b,E]of l)p.push(`${b}: ${C(E,t)}`);f+=`fn ${r}(${p}) -> ${C(x,t)} {
4
- `}let N=u(s,t);return N&&(f+=N+`
5
- `),a&&(f+=`return ${u(a,t)};`),f+=`
6
- }`,f},Ye=`
7
- #version 300 es
8
- precision mediump float;
9
- out vec4 fragColor;
10
- `.trim(),je=`
11
- @fragment
12
- fn main(@builtin(position) position: vec4f) -> @location(0) vec4f {
13
- `.trim(),He=(e,t,r=!0)=>{let o="";return r&&(o+=Ye),t&&(o+=`
14
- `+t+`
15
- `),r?o+=`void main() {
16
- fragColor = ${e};`:(o+=je+`
17
- `,o+=` return ${e};`),o+=`
18
- }`,o},Ke=(e,t,r=!0)=>"",F=(e,t={})=>{let r=u(e,t),o=de(t),n=He(r,o,t.isWebGL);return console.log(`// \u2193\u2193\u2193 generated \u2193\u2193\u2193
19
-
20
- ${n}
21
-
22
- `),n},U=(e,t)=>{let r=u(e,t),o=de(t);return Ke(r,o,t.isWebGL)};var Ze=(e,t)=>e.reduce((r,o)=>{let n=T(o,t),s=R.indexOf(r);return R.indexOf(n)>s?n:r},"float"),Qe=e=>ne[e],Je=(e,t,r)=>{let o=t.length>0?T(t[0],r):"float";return q.includes(e)?o:D.includes(e)?"float":V.includes(e)?"bool":z.includes(e)?o:W.includes(e)?"vec3":Y.includes(e)?"vec4":k.includes(e)?Ze(t,r):o},be=(e,t,r)=>{if(se.includes(r)||ie.includes(r))return"bool";if(e===t||e.includes("vec")&&!t.includes("vec"))return e;if(t.includes("vec")&&!e.includes("vec"))return t;let o=R.indexOf(e),n=R.indexOf(t);return o>=n?e:t},et=e=>v.bol(e)?"bool":v.num(e)?"float":v.arr(e)&&j[e.length]||"float",tt=e=>j[e],rt=(e,t)=>{let{type:r,props:o}=e,{id:n,children:s=[],inferFrom:a}=o,[c,x,l]=s;return a?T(a,t):r==="conversion"?c:r==="operator"?be(T(x,t),T(l,t),c):r==="function"?Je(c,s.slice(1),t):r==="swizzle"?tt(c.length):r==="ternary"?be(T(x,t),T(l,t),"add"):r==="builtin"?Qe(n):r==="define"?o.layout?.type&&o.layout?.type!=="auto"?o.layout.type:x?T(x,t):"void":T(c,t)},T=(e,t)=>{if(t||(t={}),!L(e))return et(e);if(t.infers||(t.infers=new WeakMap),t.infers.has(e))return t.infers.get(e);let r=rt(e,t);return t.infers.set(e,r),r};var u=(e,t)=>{if(t||(t={}),t.headers||(t.headers=new Map),v.str(e))return e;if(v.num(e)){let p=`${e}`;return p.includes(".")?p:p+".0"}if(v.bol(e))return e?"true":"false";if(!e)return"";let{type:r,props:o}=e,{id:n="",children:s=[]}=o,[a,c,x]=s,l="";if(r==="attribute"){if(t.headers.has(n))return n;l=`${T(e,t)} ${n}`}if(r==="uniform"){if(t.headers.has(n))return n;t.binding||(t.binding=0);let p=T(e,t);l=t.isWebGL?`uniform ${p} ${n};`:`@group(0) @binding(${t.binding++}) var<uniform> ${n}: ${C(p,t)};`}if(r==="constant"){if(t.headers.has(n))return n;let p=T(e,t),f=u(a,t);l=t.isWebGL?`const ${p} ${n} = ${f};`:`const ${n}: ${C(p,t)} = ${f};`}if(r==="varying"){if(t.headers.has(n))return n;l=`${T(e,t)} ${n}`}if(l)return t.headers.set(n,l),t.onMount?.(n),n;if(r==="variable")return n;if(r==="swizzle")return`${u(c,t)}.${u(a,t)}`;if(r==="ternary")return`(${u(a,t)} ? ${u(c,t)} : ${u(x,t)})`;if(r==="builtin")return t?.isWebGL?me(n):n;if(r==="conversion")return`${C(a,t)}(${I(s.slice(1),t)})`;if(r==="operator")return a==="not"||a==="bitNot"?`!${u(c,t)}`:`(${u(c,t)} ${le(a)} ${u(x,t)})`;if(r==="function")return a==="negate"?`(-${I(s.slice(1),t)})`:`${a}(${I(s.slice(1),t)})`;if(r==="scope")return s.map(p=>u(p,t)).join(`
23
- `);if(r==="assign")return`${u(a,t)} = ${u(c,t)};`;if(r==="loop")return t.isWebGL?`for (int i = 0; i < ${a}; i += 1) {
24
- ${u(c,t)}
25
- }`:`for (var i: i32 = 0; i < ${a}; i++) {
26
- ${u(c,t)}
27
- }`;if(r==="define"){let p=s.slice(2),f=`${n}(${p.map(N=>u(N,t))})`;return t.headers.has(n)||t.headers.set(n,ge(o,t)),f}if(r==="if"){let p=`if (${u(a,t)}) {
28
- ${u(c,t)}
29
- }`;for(let f=2;f<s.length;f+=2){let N=f>=s.length-1;p+=N?` else {
30
- ${u(s[f],t)}
31
- }`:` else if (${u(s[f],t)}) {
32
- ${u(s[f+1],t)}
33
- }`}return p}if(r==="switch"){let p=`switch (${u(a,t)}) {
34
- `;for(let f=1;f<s.length;f+=2)f>=s.length-1&&s.length%2===0?p+=`default:
35
- ${u(s[f],t)}
1
+ import{durable as ye,event as Ft}from"reev";import{createFrame as At,createQueue as Bt}from"refr";import{nested as be}from"reev";var l={arr:Array.isArray,bol:e=>typeof e=="boolean",str:e=>typeof e=="string",num:e=>typeof e=="number",int:e=>Number.isInteger(e),fun:e=>typeof e=="function",und:e=>typeof e>"u",nul:e=>e===null,set:e=>e instanceof Set,map:e=>e instanceof Map,obj:e=>!!e&&e.constructor.name==="Object",nan:e=>typeof e=="number"&&Number.isNaN(e)},_t=(e,t)=>e.forEach(t),zt=(e,...t)=>{_t(e,r=>r(...t))},kt=(e="",t="_",r="/")=>e.split(t).join(r),qt=(e=".pdf")=>e.split(".").pop()?.toLowerCase()??"",Yt=(e=0)=>`${e}`.split(".")[1]?.length??0,Ht=(e=0)=>`${e}`.split(".")[0]?.length-(e<0?1:0),jt=(e=0,t=-2)=>(t*=-1,t=Math.pow(10,t),e*=t,e=Math.round(e),e/=t,e);var Z={bool:"bool",uint:"u32",int:"i32",float:"f32",bvec2:"vec2<bool>",ivec2:"vec2i",uvec2:"vec2u",vec2:"vec2f",bvec3:"vec3<bool>",ivec3:"vec3i",uvec3:"vec3u",vec3:"vec3f",bvec4:"vec4<bool>",ivec4:"vec4i",uvec4:"vec4u",vec4:"vec4f",color:"color",mat2:"mat2x2f",mat3:"mat3x3f",mat4:"mat4x4f",texture:"texture_2d<f32>",sampler2D:"sampler",struct:"struct"},O=Object.keys(Z),Q=["toBool","toUint","toInt","toFloat","toBvec2","toIvec2","toUvec2","toVec2","toBvec3","toIvec3","toUvec3","toVec3","toBvec4","toIvec4","toUvec4","toVec4","toColor","toMat2","toMat3","toMat4"],J={add:"+",sub:"-",mul:"*",div:"/",mod:"%",equal:"==",notEqual:"!=",lessThan:"<",lessThanEqual:"<=",greaterThan:">",greaterThanEqual:">=",and:"&&",or:"||",bitAnd:"&",bitOr:"|",bitXor:"^",shiftLeft:"<<",shiftRight:">>"},Xe=Object.keys(J),ee=["dot","distance","length","lengthSq","determinant","luminance"],te=["all","any"],re=["abs","sign","floor","ceil","round","fract","trunc","sin","cos","tan","asin","acos","atan","exp","exp2","log","log2","sqrt","inverseSqrt","normalize","oneMinus","saturate","negate","reciprocal","dFdx","dFdy","fwidth"],oe=["cross"],ne=["reflect","refract"],se=["min","max","mix","clamp","step","smoothstep"],ie=["texture","textureLod","textureSize","cubeTexture"],Et=["atan2","degrees","faceforward","bitcast","cbrt","difference","equals","pow","pow2","pow3","pow4","radians","transformDirection"],Te=[...ee,...te,...re,...oe,...ne,...se,...ie,...Et],ae={1:"float",2:"vec2",3:"vec3",4:"vec4",9:"mat3",16:"mat4"},_e={position:"vec4",vertex_index:"uint",instance_index:"uint",front_facing:"bool",frag_depth:"float",sample_index:"uint",sample_mask:"uint",point_coord:"vec2",positionLocal:"vec3",positionWorld:"vec3",positionView:"vec3",normalLocal:"vec3",normalWorld:"vec3",normalView:"vec3",screenCoordinate:"vec2",screenUV:"vec2",gl_FragCoord:"vec4",gl_VertexID:"uint",gl_InstanceID:"uint",gl_FrontFacing:"bool",gl_FragDepth:"float",gl_SampleID:"uint",gl_SampleMask:"uint",gl_PointCoord:"vec2",normal:"vec3",uv:"vec2",color:"vec4"},Ee=["equal","notEqual","lessThan","lessThanEqual","greaterThan","greaterThanEqual"],Ne=["and","or"],Ce={position:"gl_FragCoord",vertex_index:"gl_VertexID",instance_index:"gl_InstanceID",front_facing:"gl_FrontFacing",frag_depth:"gl_FragDepth",sample_index:"gl_SampleID",sample_mask:"gl_SampleMask",point_coord:"gl_PointCoord",uv:"gl_FragCoord.xy"};var Pe=e=>l.str(e)&&/^[xyzwrgbastpq]{1,4}$/.test(e),Le=e=>Xe.includes(e),Se=e=>Te.includes(e),we=e=>Q.includes(e),V=e=>!e||typeof e!="object"?!1:e.isProxy,ue=e=>l.str(e)?O.includes(e):!1,$e=e=>{let t=(e>>16&255)/255,r=(e>>8&255)/255,n=(e&255)/255;return[t,r,n]},Nt=0,S=()=>`i${Nt++}`,w=(e,t)=>l.str(e)?t?.isWebGL?e:Z[e]||e:"",Ge=e=>J[e]||e,Re=e=>Ce[e],Oe=e=>{let t=Q.indexOf(e);return t!==-1?O[t]:"float"},pe=(e,t,r=!1,n=!1)=>e.isWebGL?r?o=>e.gl?.attribute?.(t,o):n?o=>e.gl?.texture?.(t,o):o=>e.gl?.uniform?.(t,o):r?o=>e.gl?._attribute?.(t,o):n?o=>e.gl?._texture?.(t,o):o=>e.gl?._uniform?.(t,o),ce=(e,t)=>{if(!e)return;if(!V(e))return t(e);if(e.type!=="conversion")return;let r=e.props.children?.slice(1).filter(Boolean);r?.length&&t(r)},Ie=e=>(e.code||(e.code={headers:new Map,fragInputs:new Map,vertInputs:new Map,vertOutputs:new Map,vertVaryings:new Map,dependencies:new Map},e.isWebGL||(e.code.fragInputs.set("position","@builtin(position) position: vec4f"),e.code.vertOutputs.set("position","@builtin(position) position: vec4f"))),e),z=(e,t="",r)=>{e.code?.dependencies?.has(t)||e.code.dependencies.set(t,new Set),ue(r)||e.code.dependencies.get(t).add(r)},Ue=(e,t)=>{let r=[],n=new Set,o=new Set,s=i=>{if(o.has(i)||n.has(i))return;o.add(i);let c=t.get(i)||new Set;for(let a of c)e.has(a)&&s(a);o.delete(i),n.add(i),e.has(i)&&r.push([i,e.get(i)])};for(let[i]of e)s(i);return r};var Ct=(e,t)=>e.reduce((r,n)=>{let o=y(n,t),s=O.indexOf(r);return O.indexOf(o)>s?o:r},"float"),Pt=e=>_e[e],Lt=(e,t,r)=>{let n=t.length>0?y(t[0],r):"float";return ne.includes(e)?n:ee.includes(e)?"float":te.includes(e)?"bool":re.includes(e)?n:oe.includes(e)?"vec3":ie.includes(e)?"vec4":se.includes(e)?Ct(t,r):n},Fe=(e,t,r)=>{if(Ee.includes(r)||Ne.includes(r))return"bool";if(e===t||e.includes("vec")&&!t.includes("vec"))return e;if(t.includes("vec")&&!e.includes("vec"))return t;let n=O.indexOf(e),o=O.indexOf(t);return n>=o?e:t},St=e=>l.bol(e)?"bool":l.str(e)?"texture":l.num(e)?Number.isInteger(e)?"int":"float":l.arr(e)&&ae[e.length]||"float",fe=e=>ae[e],wt=(e,t)=>{if(e.length===0)return"void";let[r]=e;if(l.str(r))return r;let n=y(r,t);for(let o of e.slice(1))if(n!==y(o,t))throw new Error("glre node system error: defined scope return mismatch");return n},$t=(e,t)=>{let{type:r,props:n}=e,{id:o,children:s=[],layout:i,inferFrom:c}=n,[a,p,g]=s;if(r==="conversion")return a;if(r==="operator")return Fe(y(p,t),y(g,t),a);if(r==="function")return Lt(a,s.slice(1),t);if(r==="ternary")return Fe(y(p,t),y(g,t),"add");if(r==="builtin")return Pt(o);if(r==="define"&&ue(i?.type))return i?.type;if(r==="attribute"&&l.arr(a)&&t.gl?.count)return fe(a.length/t.gl.count);if(r==="member"){if(Pe(a))return fe(a.length);if(V(p)&&l.str(a)){let C=p.props.fields?.[a];if(C)return y(C,t)}return"float"}return c?wt(c,t):y(a,t)},y=(e,t)=>{if(t||(t={}),!V(e))return St(e);if(l.arr(e))return fe(e.length);if(t.infers||(t.infers=new WeakMap),t.infers.has(e))return t.infers.get(e);let r=$t(e,t);return t.infers.set(e,r),r};var R=(e,t)=>e.filter(r=>!l.und(r)&&!l.nul(r)).map(r=>f(r,t)).join(", "),Ae=(e,t,r,n)=>{if(e.isWebGL)return`texture(${R(n?[t,r,n]:[t,r],e)})`;let o=f(t,e),s=[o,o+"Sampler",f(r,e)];return n?(s.push(f(n,e)),`textureSampleLevel(${s})`):`textureSample(${s})`},Be=(e,t,r,n)=>{let o=`if (${f(t,e)}) {
2
+ ${f(r,e)}
3
+ }`;for(let s=2;s<n.length;s+=2){let i=s>=n.length-1;o+=i?` else {
4
+ ${f(n[s],e)}
5
+ }`:` else if (${f(n[s],e)}) {
6
+ ${f(n[s+1],e)}
7
+ }`}return o},De=(e,t,r)=>{let n=`switch (${f(t,e)}) {
8
+ `;for(let o=1;o<r.length;o+=2)o>=r.length-1&&r.length%2===0?n+=`default:
9
+ ${f(r[o],e)}
36
10
  break;
37
- `:f+1<s.length&&(p+=`case ${u(s[f],t)}:
38
- ${u(s[f+1],t)}
11
+ `:o+1<r.length&&(n+=`case ${f(r[o],e)}:
12
+ ${f(r[o+1],e)}
39
13
  break;
40
- `);return p+="}",p}if(r==="declare"){let p=T(a,t),f=c?.props?.id;if(t.isWebGL)return`${p} ${f} = ${u(a,t)};`;let N=C(p);return`var ${f}: ${N} = ${u(a,t)};`}return u(a,t)};var w=null,O=(e,t=()=>{})=>{let r=w;w=e,t(),w=r},G=e=>{w&&(w.props.children||(w.props.children=[]),w.props.children.push(e))},ve=(e,t)=>{t||(t=K());let r=m("variable",{id:t,inferFrom:e}),o=m("declare",null,e,r);return G(o),r},ye=(e,t)=>{let r=m("assign",null,e,t);return G(r),e},zt=(e,t)=>{let r=m("scope");O(r,t);let o=m("if",null,e,r);G(o);let n=()=>({ElseIf:(s,a)=>{let c=m("scope");return O(c,a),o.props.children.push(s,c),n()},Else:s=>{let a=m("scope");O(a,s),o.props.children.push(a)}});return n()},Wt=(e,t)=>{let r=m("scope");O(r,()=>t({i:m("variable",{id:"i",inferFrom:Xe(0)})}));let o=m("loop",null,e,r);return G(o),o},qt=e=>{let t=m("switch",null,e);G(t);let r=()=>({Case:(...o)=>n=>{let s=m("scope");O(s,n);for(let a of o)t.props.children.push(a,s);return r()},Default:o=>{let n=m("scope");O(n,o),t.props.children.push(n)}});return r()},kt=e=>{let t,r=(...o)=>{let n=t?.name||K(),s=m("scope"),a,c=[],x=[];if(t?.inputs)for(let l of t.inputs)x.push({id:l.name,inferFrom:y(l.type)});else for(let l=0;l<o.length;l++)x.push({id:`p${l}`,inferFrom:o[l]});for(let l of x)c.push(m("variable",l));return O(s,()=>a=e(c)),m("define",{id:n,layout:t},s,a,...o)};return r.setLayout=o=>(t=o,r),r};var ot=(e,t)=>{if(t==="string")return u(e)},m=(e,t,...r)=>{t||(t={}),r.length&&(t.children=r);let o=(a,c)=>{if(c==="type")return e;if(c==="props")return t;if(c==="toVar")return ve.bind(null,s);if(c==="assign")return ye.bind(null,s);if(c==="isProxy")return!0;if(c==="toString")return u.bind(null,s);if(c===Symbol.toPrimitive)return ot.bind(null,s);if(H(c))return _e(c,s);if(ce(c))return(...x)=>nt(c,s,...x);if(ue(c))return(...x)=>i(c,s,...x);if(pe(c))return()=>y(xe(c),s)},n=(a,c,x)=>H(c)?(_e(c,s).assign(x),!0):!1,s=new Proxy({},{get:o,set:n});return s},Zt=(e,t)=>m("varying",{id:t},e),A=(e,t)=>m("uniform",{id:t},e),Qt=(e,t)=>m("varying",{id:t},e),Jt=(e,t)=>m("constant",{id:t},e),er=e=>m("variable",{id:e}),h=e=>m("builtin",{id:e}),_e=(e,t)=>m("swizzle",null,e,t),nt=(e,...t)=>m("operator",null,e,...t),i=(e,...t)=>m("function",null,e,...t),y=(e,...t)=>m("conversion",null,e,...t),tr=(e,t,r)=>m("ternary",null,e,t,r);var ir=h("position"),ar=h("vertex_index"),cr=h("instance_index"),ur=h("front_facing"),pr=h("frag_depth"),fr=h("sample_index"),lr=h("sample_mask"),mr=h("point_coord"),xr=h("normalLocal"),dr=h("normalWorld"),gr=h("normalView"),br=h("position"),vr=h("positionWorld"),yr=h("positionView"),Xr=h("screenCoordinate"),_r=h("screenUV"),st=e=>y("float",e),Xe=e=>y("int",e),Tr=e=>y("uint",e),hr=e=>y("bool",e),he=(e,t)=>y("vec2",e,t),Te=(e,t,r)=>y("vec3",e,t,r),Er=(e,t,r,o)=>y("vec4",e,t,r,o),Nr=(...e)=>y("mat2",...e),Pr=(...e)=>y("mat3",...e),Sr=(...e)=>y("mat4",...e),Lr=(e,t)=>y("ivec2",e,t),Rr=(e,t,r)=>y("ivec3",e,t,r),Cr=(e,t,r,o)=>y("ivec4",e,t,r,o),wr=(e,t)=>y("uvec2",e,t),Or=(e,t,r)=>y("uvec3",e,t,r),Gr=(e,t,r,o)=>y("uvec4",e,t,r,o),Ir=(e,t)=>y("bvec2",e,t),Fr=(e,t,r)=>y("bvec3",e,t,r),Ur=(e,t,r,o)=>y("bvec4",e,t,r,o),Ar=(e,t,r)=>v.num(e)&&v.und(t)&&v.und(r)?Te(...fe(e)):Te(e,t,r),$r=A(he(1280,800),"iResolution"),Br=A(he(0,0),"iMouse"),Mr=A(st(0),"iTime"),Dr=(e,t,r)=>i("texture",e,t,r),Vr=(e,t,r)=>i("cubeTexture",e,t,r),zr=(e,t)=>i("textureSize",e,t),Wr=e=>i("abs",e),qr=e=>i("acos",e),kr=e=>i("all",e),Yr=e=>i("any",e),jr=e=>i("asin",e),Hr=(e,t)=>t!==void 0?i("atan",e,t):i("atan",e),Kr=(e,t)=>i("atan",e,t),Zr=(e,t)=>i("bitcast",e,t),Qr=e=>i("cbrt",e),Jr=e=>i("ceil",e),eo=(e,t,r)=>i("clamp",e,t,r),to=e=>i("cos",e),ro=(e,t)=>i("cross",e,t),oo=e=>i("dFdx",e),no=e=>i("dFdy",e),so=e=>i("degrees",e),io=(e,t)=>i("difference",e,t),ao=(e,t)=>i("distance",e,t),co=(e,t)=>i("dot",e,t),uo=(e,t)=>i("equals",e,t),po=e=>i("exp",e),fo=e=>i("exp2",e),lo=(e,t,r)=>i("faceforward",e,t,r),mo=e=>i("floor",e),xo=e=>i("fract",e),go=e=>i("fwidth",e),bo=e=>i("inverseSqrt",e),vo=e=>i("length",e),yo=e=>i("lengthSq",e),Xo=e=>i("log",e),_o=e=>i("log2",e),To=(e,t)=>i("max",e,t),ho=(e,t)=>i("min",e,t),Eo=(e,t,r)=>i("mix",e,t,r),No=e=>i("negate",e),Po=e=>i("normalize",e),So=e=>i("oneMinus",e),Lo=(e,t)=>i("pow",e,t),Ro=e=>i("pow2",e),Co=e=>i("pow3",e),wo=e=>i("pow4",e),Oo=e=>i("radians",e),Go=e=>i("reciprocal",e),Io=(e,t)=>i("reflect",e,t),Fo=(e,t,r)=>i("refract",e,t,r),Uo=e=>i("round",e),Ao=e=>i("saturate",e),$o=e=>i("sign",e),Bo=e=>i("sin",e),Mo=(e,t,r)=>i("smoothstep",e,t,r),Do=e=>i("sqrt",e),Vo=(e,t)=>i("step",e,t),zo=e=>i("tan",e),Wo=(e,t)=>i("transformDirection",e,t),qo=e=>i("trunc",e);var it=`
41
- #version 300 es
42
- void main() {
43
- float x = float(gl_VertexID % 2) * 4.0 - 1.0;
44
- float y = float(gl_VertexID / 2) * 4.0 - 1.0;
45
- gl_Position = vec4(x, y, 0.0, 1.0);
46
- }
47
- `,at=`
14
+ `);return n+="}",n},Me=(e,t,r)=>{let n=y(t,e),o=r?.props?.id;if(e.isWebGL)return`${n} ${o} = ${f(t,e)};`;let s=w(n);return`var ${o}: ${s} = ${f(t,e)};`},We=(e,t,r)=>{let{id:n,children:o=[],layout:s}=t,[i,...c]=o,a=[],p=[];if(s?.inputs)for(let v of s.inputs)a.push([v.name,v.type]);else for(let v=0;v<c.length;v++)a.push([`p${v}`,y(c[v],e)]);let g=[];if(e?.isWebGL){for(let[v,m]of a)z(e,n,m),p.push(`${m} ${v}`);z(e,n,r),g.push(`${r} ${n}(${p}) {`)}else{for(let[v,m]of a)p.push(`${v}: ${w(m,e)}`);g.push(`fn ${n}(${p}) -> ${w(r,e)} {`)}let C=f(i,e);return C&&g.push(C),g.push("}"),g.join(`
15
+ `)},Ve=(e,t,r={})=>{let n=[];for(let s in r){let i=r[s],c=y(i,e);e.isWebGL&&z(e,t,c),n.push(e.isWebGL?`${c} ${s};`:`${s}: ${w(c,e)},`)}let o=n.join(`
16
+ `);return`struct ${t} {
17
+ ${o}
18
+ };`},ze=(e,t,r="",n,o)=>{if(e.isWebGL)if(o){let s=[];for(let i in n)s.push(o[i]);return`${t} ${r} = ${t}(${R(s,e)});`}else return`${t} ${r};`;else if(o){let s=[];for(let i in n)s.push(o[i]);return`var ${r}: ${t} = ${t}(${R(s,e)});`}else return`var ${r}: ${t};`},ke=(e,t,r)=>e.isWebGL?`${r} ${t};`:`@location(${e.code?.vertVaryings?.size||0}) ${t}: ${w(r,e)}`,qe=(e,t,r)=>{let n=r==="sampler2D"||r==="texture";if(e.isWebGL)return n?`uniform sampler2D ${t};`:`uniform ${r} ${t};`;if(n){let{group:c=1,binding:a=0}=e.gl?.webgpu?.textures.map.get(t)||{};return`@group(${c}) @binding(${a}) var ${t}Sampler: sampler;
19
+ @group(${c}) @binding(${a+1}) var ${t}: texture_2d<f32>;`}let{group:o=0,binding:s=0}=e.gl?.webgpu?.uniforms.map.get(t)||{},i=w(r,e);return`@group(${o}) @binding(${s}) var<uniform> ${t}: ${i};`},Ye=(e,t,r)=>{if(e.isWebGL)return`${r} ${t};`;let{location:n=0}=e.gl?.webgpu?.attribs.map.get(t)||{},o=w(r,e);return`@location(${n}) ${t}: ${o}`},He=(e,t,r,n)=>e.isWebGL?`const ${r} ${t} = ${n};`:`const ${t}: ${w(r,e)} = ${n};`;var f=(e,t)=>{if(t||(t={}),Ie(t),l.arr(e))return R(e,t);if(l.str(e))return e;if(l.num(e)){let m=`${e}`;return m.includes(".")?m:m+".0"}if(l.bol(e))return e?"true":"false";if(!e)return"";let{type:r,props:n}=e,{id:o="",children:s=[],fields:i,initialValues:c}=n,[a,p,g,C]=s;if(r==="variable")return o;if(r==="member")return`${f(p,t)}.${f(a,t)}`;if(r==="ternary")return t.isWebGL?`(${f(a,t)} ? ${f(p,t)} : ${f(g,t)})`:`select(${f(g,t)}, ${f(p,t)}, ${f(a,t)})`;if(r==="conversion")return`${w(a,t)}(${R(s.slice(1),t)})`;if(r==="operator")return a==="not"||a==="bitNot"?`!${f(p,t)}`:`(${f(p,t)} ${Ge(a)} ${f(g,t)})`;if(r==="function")return a==="negate"?`(-${R(s.slice(1),t)})`:a==="texture"?Ae(t,p,g,C):`${a}(${R(s.slice(1),t)})`;if(r==="scope")return s.map(m=>f(m,t)).join(`
20
+ `);if(r==="assign")return`${f(a,t)} = ${f(p,t)};`;if(r==="return")return`return ${f(a,t)};`;if(r==="loop")return t.isWebGL?`for (int i = 0; i < ${a}; i += 1) {
21
+ ${f(p,t)}
22
+ }`:`for (var i: i32 = 0; i < ${a}; i++) {
23
+ ${f(p,t)}
24
+ }`;if(r==="if")return Be(t,a,p,s);if(r==="switch")return De(t,a,s);if(r==="declare")return Me(t,a,p);if(r==="define")return t.code?.headers.has(o)||t.code?.headers.set(o,We(t,n,y(e,t))),`${o}(${R(s.slice(1),t)})`;if(r==="struct")return t.code?.headers.has(o)||t.code?.headers.set(o,Ve(t,o,i)),ze(t,o,a.props.id,i,c);if(r==="varying"){if(t.code?.vertOutputs.has(o))return t.isWebGL?`${o}`:`out.${o}`;let m=ke(t,o,y(e,t));return t.code?.fragInputs.set(o,m),t.code?.vertOutputs.set(o,m),t.code?.vertVaryings.set(o,f(a,t)),t.isWebGL?`${o}`:`out.${o}`}if(r==="builtin"){if(t.isWebGL)return Re(o);if(o==="position")return"out.position";let m=`@builtin(${o}) ${o}: ${w(y(e,t),t)}`;return t.isFrag?t.code?.fragInputs.set(o,m):t.code?.vertInputs.set(o,m),`in.${o}`}if(r==="attribute"){let m=pe(t,o,!0);return ce(a,m),e.listeners.add(m),t.code?.vertInputs.set(o,Ye(t,o,y(e,t))),t.isWebGL?`${o}`:`in.${o}`}if(t.code?.headers.has(o))return o;let v="";if(r==="uniform"){let m=y(e,t),D=pe(t,o,!1,m==="texture");ce(a,D),e.listeners.add(D),v=qe(t,o,m)}return r==="constant"&&(v=He(t,o,y(e,t),f(a,t))),v?(t.code?.headers.set(o,v),o):f(a,t)};var I=null,B=null,F=e=>{if(!I||(I.props.children||(I.props.children=[]),I.props.children.push(e),e.type!=="return"||!B))return;let{props:t}=B;t.inferFrom||(t.inferFrom=[]),t.inferFrom.push(e)},je=(e,t)=>{t||(t=S());let r=d("variable",{id:t,inferFrom:[e]}),n=d("declare",null,e,r);return F(n),r},Ke=(e,t)=>{let r=d("assign",null,e,t);return F(r),e},Gt=e=>{let t=d("return",{inferFrom:[e]},e);return F(t),t},yr=(e,t=S())=>(r={},n=S())=>{let o=d("variable",{id:n,inferFrom:[t]}),s=d("struct",{id:t,fields:e,initialValues:r},o);return F(s),o},U=(e,t,r=B)=>{let n=I,o=B;I=e,B=r,n&&(e.props.parent=n);let s=t();s&&Gt(s),I=n,B=o},hr=(e,t)=>{let r=d("scope");U(r,t);let n=d("if",null,e,r);F(n);let o=()=>({ElseIf:(s,i)=>{let c=d("scope");return U(c,i),n.props.children.push(s,c),o()},Else:s=>{let i=d("scope");U(i,s),n.props.children.push(i)}});return o()},Xr=(e,t)=>{let r=d("scope");U(r,()=>t({i:d("variable",{id:"i",inferFrom:[A(0)]})}));let n=d("loop",null,e,r);return F(n),n},Tr=e=>{let t=d("switch",null,e);F(t);let r=()=>({Case:(...n)=>o=>{let s=d("scope");U(s,o);for(let i of n)t.props.children.push(i,s);return r()},Default:n=>{let o=d("scope");U(o,n),t.props.children.push(o)}});return r()},_r=e=>{let t,r=(...n)=>{let o=t?.name||S(),s=d("scope"),i=[],c=[];if(t?.inputs)for(let p of t.inputs)c.push({id:p.name,inferFrom:[x(p.type)]});else for(let p=0;p<n.length;p++)c.push({id:`p${p}`,inferFrom:[n[p]]});for(let p of c)i.push(d("variable",p));let a=d("define",{id:o,layout:t},s,...n);return U(s,()=>e(i),a),a};return r.setLayout=n=>void(t=n),r};var Rt=(e,t)=>{if(t==="string")return f(e)},d=(e,t,...r)=>{t||(t={}),r.length&&(t.children=r);let n=new Set,o=(c,a)=>{if(a==="type")return e;if(a==="props")return t;if(a==="toVar")return je.bind(null,i);if(a==="assign")return Ke.bind(null,i);if(a==="isProxy")return!0;if(a==="toString")return f.bind(null,i);if(a===Symbol.toPrimitive)return Rt.bind(null,i);if(a==="listeners")return n;if(Le(a))return(...p)=>Ot(a,i,...p);if(Se(a))return(...p)=>u(a,i,...p);if(we(a))return()=>x(Oe(a),i);if(l.str(a))return Ze(a,i)},s=(c,a,p)=>(a==="value"&&n.forEach(g=>g(p)),l.str(a)&&Ze(a,i).assign(p),!0),i=new Proxy({},{get:o,set:s});return i},Sr=(e,t=S())=>d("attribute",{id:t},e),wr=(e,t=S())=>d("constant",{id:t},e),k=(e,t=S())=>d("uniform",{id:t},e),$r=(e=S())=>d("variable",{id:e}),T=(e=S())=>d("builtin",{id:e}),Gr=(e,t=S())=>d("varying",{id:t,inferFrom:[e]},e),Ot=(e,...t)=>d("operator",null,e,...t),u=(e,...t)=>d("function",null,e,...t),x=(e,...t)=>d("conversion",null,e,...t),Ze=(e,t)=>d("member",null,e,t),Rr=(e,t,r)=>d("ternary",null,e,t,r);var It=`
48
25
  #version 300 es
49
26
  precision mediump float;
50
- uniform vec2 iResolution;
51
27
  out vec4 fragColor;
52
- void main() {
53
- fragColor = vec4(fract(gl_FragCoord.xy / iResolution), 0, 1);
54
- }
55
- `,Ee=(e,t,r)=>{let o=e.createShader(r);if(!o)throw new Error("Failed to create shader");if(e.shaderSource(o,t.trim()),e.compileShader(o),e.getShaderParameter(o,e.COMPILE_STATUS))return o;let n=e.getShaderInfoLog(o);e.deleteShader(o),console.warn(`Could not compile shader: ${n}`)},Ne=(e,t=it,r=at,o=()=>{})=>{L(r)&&(r=F(r,{isWebGL:!0})),L(t)&&(t=U(r,{isWebGL:!0}));let n=e.createProgram(),s=Ee(e,t,e.VERTEX_SHADER),a=Ee(e,r,e.FRAGMENT_SHADER);if(!s||!a)return o();if(e.attachShader(n,s),e.attachShader(n,a),e.linkProgram(n),e.getProgramParameter(n,e.LINK_STATUS))return n;let c=e.getProgramInfoLog(n);e.deleteProgram(n),o(),console.warn(`Could not link pg: ${c}`)},Pe=(e,t)=>{let r=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array(t),e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,null),r},Se=(e,t)=>{let r=e.createBuffer();return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r),e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Int16Array(t),e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),r},Le=(e,t,r)=>{r&&(e=Math.max(...r)+1);let o=t.length/e;return Math.floor(o)},Re=(e,t,r,o,n)=>{e.bindBuffer(e.ARRAY_BUFFER,o),e.enableVertexAttribArray(r),e.vertexAttribPointer(r,t,e.FLOAT,!1,0,0),n&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n)},Ce=(e,t,r,o)=>{let n=e.createTexture();e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.generateMipmap(e.TEXTURE_2D),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),e.uniform1i(r,o),e.activeTexture(e.TEXTURE0+o),e.bindTexture(e.TEXTURE_2D,n)};var we=async e=>{let t=e.el.getContext("webgl2"),r=Ne(t,e.vs,e.fs,()=>void(e.isLoop=!1));t.useProgram(r);let o=0,n=Z(b=>t.getUniformLocation(r,b)),s=Z(b=>t.getAttribLocation(r,b)),a=Z(()=>o++);return{webgl:{context:t,program:r},render:()=>{t.clear(t.COLOR_BUFFER_BIT),t.viewport(0,0,...e.size),t.drawArrays(t.TRIANGLES,0,3)},clean:()=>t.deleteProgram(r),_attribute:(b="",E,P)=>{let S=s(b,!0),_=Pe(t,E),d=Se(t,P),g=Le(e.count,E,P);Re(t,g,S,_,d)},_uniform:(b,E)=>{let P=n(b);if(v.num(E))return t.uniform1f(P,E);let S=E.length;if(S<=4)return t[`uniform${S}fv`](P,E);S=Math.sqrt(S)<<0,t[`uniformMatrix${S}fv`](P,!1,E)},_texture:(b,E)=>{let P=new Image;Object.assign(P,{src:E,crossOrigin:"anonymous"}),P.decode().then(()=>{let S=n(b),_=a(b);Ce(t,P,S,_)})}}};import{nested as Q}from"reev";var ct=`
56
- @vertex
57
- fn main(@builtin(vertex_index) vertex_index: u32) -> @builtin(position) vec4f {
58
- let x = f32(vertex_index % 2u) * 4.0 - 1.0;
59
- let y = f32(vertex_index / 2u) * 4.0 - 1.0;
60
- return vec4f(x, y, 0.0, 1.0);
61
- }
62
- `,ut=`
63
- @group(0) @binding(0) var<uniform> iResolution: vec2f;
64
-
65
- @fragment
66
- fn main(@builtin(position) position: vec4f) -> @location(0) vec4f {
67
- return vec4f(position.xy / iResolution, 0.0, 1.0);
68
- }
69
- `,Oe=async e=>{let t=navigator.gpu,r=t.getPreferredCanvasFormat(),n=await(await t.requestAdapter()).requestDevice();return e.configure({device:n,format:r,alphaMode:"opaque"}),{device:n,format:r}},Ge=(e,t,r,o,n=ct,s=ut)=>{L(n)&&(n=U(n,{isWebGL:!1})),L(s)&&(s=F(s,{isWebGL:!1}));let a=e.createPipelineLayout({bindGroupLayouts:o});return e.createRenderPipeline({vertex:{module:e.createShaderModule({code:n.trim()}),entryPoint:"main",buffers:r},fragment:{module:e.createShaderModule({code:s.trim()}),entryPoint:"main",targets:[{format:t}]},layout:a,primitive:{topology:"triangle-list"}})},Ie=(e,t)=>{let r=[],o=[];t.forEach((a,c)=>{if(!a)return;let x="buffer"in a,l=a instanceof GPUTextureView,p=a instanceof GPUSampler;if(x)r.push({binding:c,visibility:3,buffer:{type:"uniform"}});else if(l)r.push({binding:c,visibility:2,texture:{}});else if(p)r.push({binding:c,visibility:2,sampler:{}});else return;o.push({binding:c,resource:a})});let n=e.createBindGroupLayout({entries:r}),s=e.createBindGroup({layout:n,entries:o});return{layout:n,bindGroup:s}},Fe=e=>({colorAttachments:[{view:e.getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]}),pt=e=>Math.ceil(e/256)*256,Ue=(e,t)=>{let r=new Float32Array(t),o=e.createBuffer({size:r.byteLength,usage:40});return{array:r,buffer:o}},Ae=(e,t)=>{let r=new Float32Array(t),o=pt(r.byteLength),n=e.createBuffer({size:o,usage:72});return{array:r,buffer:n}},$e=(e,t=1280,r=800)=>{let o=e.createTexture({size:[t,r],format:"rgba8unorm",usage:22}),n=e.createSampler({magFilter:"linear",minFilter:"linear"});return{texture:o,sampler:n}},ft=(e,t)=>e/t,lt=e=>e===2?"float32x2":e===3?"float32x3":e===4?"float32x4":"float32",Be=(e,t,r=6)=>{let o=ft(t,r);return{arrayStride:o*4,attributes:[{shaderLocation:e,offset:0,format:lt(o)}]}};var Me=async e=>{let t=e.el.getContext("webgpu"),{device:r,format:o}=await Oe(t),n={device:r,context:t,resources:[[],[]],loadingImg:0,needsUpdate:!0},s=[],a=[],c=[],x=Q((_,d)=>{let{array:g,buffer:X}=Ue(r,d);return a.push(X),c.push(Be(c.length,g.length,e.count)),n.needsUpdate=!0,{array:g,buffer:X}}),l=Q((_,d)=>{let{array:g,buffer:X}=Ae(r,d);return n.resources[0].push({buffer:X}),n.needsUpdate=!0,{array:g,buffer:X}}),p=Q((_,{width:d,height:g})=>{let{texture:X,sampler:$}=$e(r,d,g);return n.resources[1].push($,X.createView()),n.needsUpdate=!0,{texture:X,width:d,height:g}}),f=()=>{let _=[];s.length=0,n.resources.forEach(d=>{if(!d.length)return;let{layout:g,bindGroup:X}=Ie(r,d);_.push(g),s.push(X)}),n.pipeline=Ge(r,o,c,_,e.vs,e.fs)};return{webgpu:n,render:()=>{if(n.loadingImg)return;n.needsUpdate&&f(),n.needsUpdate=!1;let _=r.createCommandEncoder(),d=_.beginRenderPass(Fe(t));d.setPipeline(n.pipeline),s.forEach((g,X)=>d.setBindGroup(X,g)),a.forEach((g,X)=>d.setVertexBuffer(X,g)),d.draw(e.count,1,0,0),d.end(),r.queue.submit([_.finish()])},clean:()=>{},_attribute:(_="",d)=>{let{array:g,buffer:X}=x(_,d);r.queue.writeBuffer(X,0,g)},_uniform:(_,d)=>{v.num(d)&&(d=[d]);let{array:g,buffer:X}=l(_,d);g.set(d),r.queue.writeBuffer(X,0,g)},_texture:(_,d)=>{n.loadingImg++;let g=Object.assign(new Image,{src:d,crossOrigin:"anonymous"});g.decode().then(()=>{let{texture:X,width:$,height:ze}=p(_,g);r.queue.copyExternalImageToTexture({source:g},{texture:X},{width:$,height:ze}),n.loadingImg--})}}};var De=e=>v.obj(e)?"isGL"in e:!1,gt=()=>typeof window>"u",bt=()=>gt()?!1:"gpu"in navigator,ee=performance.now(),Ve=e=>{let t=mt({isNative:!1,isWebGL:!0,isLoop:!0,isGL:!0,size:[0,0],mouse:[0,0],count:6,webgl:{},webgpu:{}});return t.queue=dt(),t.frame=xt(),t.attribute=J((r,o,n)=>t.queue(()=>t._attribute?.(r,o,n))),t.texture=J((r,o)=>t.queue(()=>t._texture?.(r,o))),t.uniform=J((r,o,n)=>t.queue(()=>t._uniform?.(r,o,n))),t.uniform({iResolution:t.size,iMouse:[0,0],iTime:ee}),t("mount",async()=>{t.vs=t.vs||t.vert||t.vertex,t.fs=t.fs||t.frag||t.fragment,bt()||(t.isWebGL=!0),t.isWebGL?t(await we(t)):t(await Me(t)),t.resize(),t.frame(()=>(t.loop(),t.queue.flush(),t.render(),t.isLoop)),!t.isNative&&(window.addEventListener("resize",t.resize),t.el.addEventListener("mousemove",t.mousemove))}),t("clean",()=>{t.frame.stop(),t.frame.clean(t.render),!t.isNative&&(window.removeEventListener("resize",t.resize),t.el.removeEventListener("mousemove",t.mousemove))}),t("resize",()=>{let r=t.width||window.innerWidth,o=t.height||window.innerHeight;t.size[0]=t.el.width=r,t.size[1]=t.el.height=o,t.uniform("iResolution",t.size)}),t("mousemove",(r,o=r.clientX,n=r.clientY)=>{let[s,a]=t.size,{top:c,left:x}=t.el.getBoundingClientRect();t.mouse[0]=(o-c-s/2)/(s/2),t.mouse[1]=-(n-x-a/2)/(a/2),t.uniform("iMouse",t.mouse)}),t("loop",()=>{ee=performance.now()/1e3,t.uniform("iTime",ee)}),t(e)};var Sn=e=>{let t=De(e)?e:Ve(e);return t.ref=r=>{r?(t.el=r,t.mount()):t.clean()},t};export{qe as ADDITIONAL_FUNCTIONS,V as BOOL_RETURN_FUNCTIONS,ne as BUILTIN_TYPES,se as COMPARISON_OPERATORS,j as COMPONENT_COUNT_TO_TYPE,R as CONSTANTS,B as CONVERSIONS,q as FIRST_ARG_TYPE_FUNCTIONS,re as FUNCTIONS,kt as Fn,k as HIGHEST_TYPE_FUNCTIONS,zt as If,ie as LOGICAL_OPERATORS,Wt as Loop,M as OPERATORS,te as OPERATOR_KEYS,z as PRESERVE_TYPE_FUNCTIONS,D as SCALAR_RETURN_FUNCTIONS,Nt as SWIZZLES,qt as Switch,oe as TYPE_MAPPING,W as VEC3_RETURN_FUNCTIONS,Y as VEC4_RETURN_FUNCTIONS,ae as WGSL_TO_GLSL_BUILTIN,Wr as abs,qr as acos,pt as alignTo256,kr as all,Yr as any,jr as asin,ye as assign,Hr as atan,Kr as atan2,Zt as attribute,Zr as bitcast,hr as bool,h as builtin,Ir as bvec2,Fr as bvec3,Ur as bvec4,Qr as cbrt,Jr as ceil,eo as clamp,u as code,Ar as color,Jt as constant,y as conversion,xe as conversionToConstant,to as cos,Re as createAttrib,Ie as createBindGroup,Be as createBufferLayout,Fe as createDescriptor,Oe as createDevice,Ve as createGL,Se as createIbo,Ge as createPipeline,Ne as createProgram,Ce as createTexture,$e as createTextureSampler,Ae as createUniformBuffer,Pe as createVbo,Ue as createVertexBuffer,ro as cross,Vr as cubeTexture,oo as dFdx,no as dFdy,at as defaultFragmentGLSL,it as defaultVertexGLSL,so as degrees,io as difference,Tt as dig,ao as distance,co as dot,We as each,uo as equals,po as exp,fo as exp2,Xt as ext,lo as faceforward,_t as fig,st as float,mo as floor,vt as flush,C as formatConversions,xo as fract,pr as fragDepth,F as fragment,ur as frontFacing,i as function_,go as fwidth,ge as generateDefine,me as getBluiltin,K as getId,le as getOperator,Le as getStride,fe as hex2rgb,Br as iMouse,$r as iResolution,Mr as iTime,T as infer,rt as inferImpl,cr as instanceIndex,Xe as int,bo as inverseSqrt,v as is,pe as isConversion,ue as isFunction,De as isGL,L as isNodeProxy,ce as isOperator,gt as isServer,H as isSwizzle,bt as isWebGPUSupported,Lr as ivec2,Rr as ivec3,Cr as ivec4,I as joins,vo as length,yo as lengthSq,Xo as log,_o as log2,Nr as mat2,Pr as mat3,Sr as mat4,To as max,ho as min,Eo as mix,No as negate,m as node,xr as normalLocal,gr as normalView,dr as normalWorld,Po as normalize,Sn as onGL,So as oneMinus,nt as operator,mr as pointCoord,ir as position,br as positionLocal,yr as positionView,vr as positionWorld,Lo as pow,Ro as pow2,Co as pow3,wo as pow4,Oo as radians,Go as reciprocal,Io as reflect,Fo as refract,yt as replace,Uo as round,fr as sampleIndex,lr as sampleMask,Ao as saturate,Xr as screenCoordinate,_r as screenUV,tr as select,ht as sig,$o as sign,Bo as sin,Mo as smoothstep,Do as sqrt,Vo as step,_e as swizzle,zo as tan,Dr as texture,zr as textureSize,ve as toVar,Wo as transformDirection,qo as trunc,Tr as uint,A as uniform,wr as uvec2,Or as uvec3,Gr as uvec4,er as variable,Qt as varying,he as vec2,Te as vec3,Er as vec4,U as vertex,ar as vertexIndex,we as webgl,Me as webgpu};
28
+ `.trim(),Je=(e,t)=>{let r=f(e,t),n="";return t.isWebGL&&t.code?.dependencies?n=Ue(t.code.headers,t.code.dependencies).map(([,s])=>s).join(`
29
+ `):n=Array.from(t.code?.headers?.values()||[]).join(`
30
+ `),[n,r]},le=(e,t)=>`struct ${e} {
31
+ ${Array.from(t.values()).join(`,
32
+ `)}
33
+ }`,q=(e,t)=>{if(l.str(e))return e.trim();t.code?.headers?.clear(),t.isFrag=!1;let[r,n]=Je(e,t),o=[];if(t.isWebGL){o.push("#version 300 es");for(let i of t.code?.vertInputs?.values()||[])o.push(`in ${i}`);for(let i of t.code?.vertOutputs?.values()||[])o.push(`out ${i}`);o.push(r),o.push("void main() {"),o.push(` gl_Position = ${n};`);for(let[i,c]of t.code?.vertVaryings?.entries()||[])o.push(` ${i} = ${c};`)}else{t.code?.vertInputs?.size&&o.push(le("In",t.code.vertInputs)),t.code?.vertOutputs?.size&&o.push(le("Out",t.code.vertOutputs)),o.push(r),o.push("@vertex"),o.push(`fn main(${t.code?.vertInputs?.size?"in: In":""}) -> Out {`),o.push(" var out: Out;"),o.push(` out.position = ${n};`);for(let[i,c]of t.code?.vertVaryings?.entries()||[])o.push(` out.${i} = ${c};`);o.push(" return out;")}o.push("}");let s=o.filter(Boolean).join(`
34
+ `).trim();return console.log(`\u2193\u2193\u2193generated\u2193\u2193\u2193
35
+ ${s}`),s},Y=(e,t)=>{if(l.str(e))return e.trim();t.code?.headers?.clear(),t.isFrag=!0;let[r,n]=Je(e,t),o=[];if(t.isWebGL){o.push(It);for(let i of t.code?.fragInputs?.values()||[])o.push(`in ${i}`);o.push(r),o.push(`void main() {
36
+ fragColor = ${n};`)}else t.code?.fragInputs?.size&&o.push(le("Out",t.code.fragInputs)),o.push(r),o.push(`@fragment
37
+ fn main(out: Out) -> @location(0) vec4f {`),o.push(` return ${n};`);o.push("}");let s=o.filter(Boolean).join(`
38
+ `).trim();return console.log(`\u2193\u2193\u2193generated\u2193\u2193\u2193
39
+ ${s}`),s},de=T("position"),me=T("vertex_index"),Br=T("instance_index"),Dr=T("front_facing"),Mr=T("frag_depth"),Wr=T("sample_index"),Vr=T("sample_mask"),zr=T("point_coord"),kr=T("normalLocal"),qr=T("normalWorld"),Yr=T("normalView"),Hr=T("position"),jr=T("positionWorld"),Kr=T("positionView"),Zr=T("screenCoordinate"),Qr=T("screenUV"),H=e=>x("float",e),A=e=>x("int",e),Jr=e=>x("uint",e),eo=e=>x("bool",e),et=(e,t)=>x("vec2",e,t),Qe=(e,t,r)=>x("vec3",e,t,r),xe=(e,t,r,n)=>x("vec4",e,t,r,n),to=(...e)=>x("mat2",...e),ro=(...e)=>x("mat3",...e),oo=(...e)=>x("mat4",...e),no=(e,t)=>x("ivec2",e,t),so=(e,t,r)=>x("ivec3",e,t,r),io=(e,t,r,n)=>x("ivec4",e,t,r,n),ao=(e,t)=>x("uvec2",e,t),uo=(e,t,r)=>x("uvec3",e,t,r),po=(e,t,r,n)=>x("uvec4",e,t,r,n),co=(e,t)=>x("bvec2",e,t),fo=(e,t,r)=>x("bvec3",e,t,r),lo=(e,t,r,n)=>x("bvec4",e,t,r,n),mo=e=>x("texture",e),xo=()=>x("sampler2D"),go=(e,t,r)=>l.num(e)&&l.und(t)&&l.und(r)?Qe(...$e(e)):Qe(e,t,r),ge=k(et(),"iResolution"),bo=k(et(),"iMouse"),vo=k(H(),"iTime"),yo=()=>de.xy.div(ge),ho=(e,t,r)=>u("texture",e,t,r),Xo=(e,t,r)=>u("cubeTexture",e,t,r),To=(e,t)=>u("textureSize",e,t),_o=e=>u("abs",e),Eo=e=>u("acos",e),No=e=>u("all",e),Co=e=>u("any",e),Po=e=>u("asin",e),Lo=(e,t)=>t!==void 0?u("atan",e,t):u("atan",e),So=(e,t)=>u("atan",e,t),wo=(e,t)=>u("bitcast",e,t),$o=e=>u("cbrt",e),Go=e=>u("ceil",e),Ro=(e,t,r)=>u("clamp",e,t,r),Oo=e=>u("cos",e),Io=(e,t)=>u("cross",e,t),Uo=e=>u("dFdx",e),Fo=e=>u("dFdy",e),Ao=e=>u("degrees",e),Bo=(e,t)=>u("difference",e,t),Do=(e,t)=>u("distance",e,t),Mo=(e,t)=>u("dot",e,t),Wo=(e,t)=>u("equals",e,t),Vo=e=>u("exp",e),zo=e=>u("exp2",e),ko=(e,t,r)=>u("faceforward",e,t,r),qo=e=>u("floor",e),tt=e=>u("fract",e),Yo=e=>u("fwidth",e),Ho=e=>u("inverseSqrt",e),jo=e=>u("length",e),Ko=e=>u("lengthSq",e),Zo=e=>u("log",e),Qo=e=>u("log2",e),Jo=(e,t)=>u("max",e,t),en=(e,t)=>u("min",e,t),tn=(e,t,r)=>u("mix",e,t,r),rn=e=>u("negate",e),on=e=>u("normalize",e),nn=e=>u("oneMinus",e),sn=(e,t)=>u("pow",e,t),an=e=>u("pow2",e),un=e=>u("pow3",e),pn=e=>u("pow4",e),cn=e=>u("radians",e),fn=e=>u("reciprocal",e),ln=(e,t)=>u("reflect",e,t),dn=(e,t,r)=>u("refract",e,t,r),mn=e=>u("round",e),xn=e=>u("saturate",e),gn=e=>u("sign",e),bn=e=>u("sin",e),vn=(e,t,r)=>u("smoothstep",e,t,r),yn=e=>u("sqrt",e),hn=(e,t)=>u("step",e,t),Xn=e=>u("tan",e),Tn=(e,t)=>u("transformDirection",e,t),_n=e=>u("trunc",e);var rt=(e,t,r)=>{let n=e.createShader(r);if(!n)throw new Error("Failed to create shader");if(e.shaderSource(n,t.trim()),e.compileShader(n),e.getShaderParameter(n,e.COMPILE_STATUS))return n;let o=e.getShaderInfoLog(n);e.deleteShader(n),console.warn(`Could not compile shader: ${o}`)},ot=(e,t,r,n=()=>{})=>{let o=e.createProgram(),s=rt(e,r,e.FRAGMENT_SHADER),i=rt(e,t,e.VERTEX_SHADER);if(!s||!i)return n();if(e.attachShader(o,i),e.attachShader(o,s),e.linkProgram(o),e.getProgramParameter(o,e.LINK_STATUS))return o;let c=e.getProgramInfoLog(o);e.deleteProgram(o),n(),console.warn(`Could not link program: ${c}`)},nt=(e,t)=>{let r=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array(t),e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,null),r},st=(e,t)=>{let r=e.createBuffer();return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r),e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Int16Array(t),e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),r},it=(e,t,r)=>{r&&(e=Math.max(...r)+1);let n=t.length/e;return Math.floor(n)},at=(e,t,r,n,o)=>{e.bindBuffer(e.ARRAY_BUFFER,n),e.enableVertexAttribArray(r),e.vertexAttribPointer(r,t,e.FLOAT,!1,0,0),o&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o)},ut=(e,t,r,n)=>{let o=e.createTexture();e.bindTexture(e.TEXTURE_2D,o),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.generateMipmap(e.TEXTURE_2D),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),e.uniform1i(r,n),e.activeTexture(e.TEXTURE0+n),e.bindTexture(e.TEXTURE_2D,o)};var pt=async e=>{let t=e.el.getContext("webgl2"),r={isWebGL:!0,gl:e},n=Y(e.fs,r),o=q(e.vs,r),s=ot(t,o,n,()=>void(e.isLoop=!1));t.useProgram(s);let i=0,c=be(P=>t.getUniformLocation(s,P)),a=be(P=>t.getAttribLocation(s,P)),p=be(()=>i++);return{render:()=>{t.clear(t.COLOR_BUFFER_BIT),t.viewport(0,0,...e.size),t.drawArrays(t.TRIANGLES,0,3)},clean:()=>t.deleteProgram(s),_attribute:(P="",E,L)=>{let $=a(P,!0),M=nt(t,E),j=st(t,L),h=it(e.count,E,L);at(t,h,$,M,j)},_uniform:(P,E)=>{let L=c(P);if(l.num(E))return t.uniform1f(L,E);let $=E.length;if($<=4)return t[`uniform${$}fv`](L,E);$=Math.sqrt($)<<0,t[`uniformMatrix${$}fv`](L,!1,E)},_texture:(P,E)=>{let L=new Image;Object.assign(L,{src:E,crossOrigin:"anonymous"}),L.decode().then(()=>{let $=c(P),M=p(P);ut(t,L,$,M)})},webgl:{context:t,program:s}}};import{nested as ve}from"reev";var ct=async e=>{let t=navigator.gpu,r=t.getPreferredCanvasFormat(),o=await(await t.requestAdapter()).requestDevice();return e.configure({device:o,format:r,alphaMode:"opaque"}),{device:o,format:r}},ft=()=>{let e=0,t=0,r=0;return{uniform:()=>{let n=Math.floor(e/12),o=e%12;return e++,{group:n,binding:o}},texture:()=>{let o=Math.floor(e/12)+1+Math.floor(t/6),s=t%6*2;return t++,{group:o,binding:s}},attrib:()=>{let n=r;return r++,{location:n}}}},Ut=e=>e===2?"float32x2":e===3?"float32x3":e===4?"float32x4":"float32",lt=e=>{let t=[],r=[];for(let{buffer:n,location:o,stride:s}of e)t[o]=n,r[o]={arrayStride:s*4,attributes:[{shaderLocation:o,offset:0,format:Ut(s)}]};return{vertexBuffers:t,bufferLayouts:r}},dt=(e,t,r)=>{let n=new Map,o={bindGroups:[],bindGroupLayouts:[]},s=(i,c,a)=>{n.has(i)||n.set(i,{layouts:[],bindings:[]});let{layouts:p,bindings:g}=n.get(i);p.push(c),g.push(a)};for(let{binding:i,buffer:c,group:a}of t)s(a,{binding:i,visibility:3,buffer:{type:"uniform"}},{binding:i,resource:{buffer:c}});for(let{binding:i,group:c,sampler:a,view:p}of r)s(c,{binding:i,visibility:2,sampler:{}},{binding:i,resource:a}),s(c,{binding:i+1,visibility:2,texture:{}},{binding:i+1,resource:p});for(let[i,{layouts:c,bindings:a}]of n)o.bindGroupLayouts[i]=e.createBindGroupLayout({entries:c}),o.bindGroups[i]=e.createBindGroup({layout:o.bindGroupLayouts[i],entries:a});return o},mt=(e,t,r,n,o,s)=>e.createRenderPipeline({vertex:{module:e.createShaderModule({label:"vert",code:o}),entryPoint:"main",buffers:r},fragment:{module:e.createShaderModule({label:"frag",code:s}),entryPoint:"main",targets:[{format:t}]},layout:e.createPipelineLayout({bindGroupLayouts:n}),primitive:{topology:"triangle-list"},depthStencil:{depthWriteEnabled:!0,depthCompare:"less",format:"depth24plus"}}),xt=(e,t)=>{let r=new Float32Array(t),n=Math.ceil(r.byteLength/256)*256,o=e.createBuffer({size:n,usage:72});return{array:r,buffer:o}},gt=(e,t)=>{let r=new Float32Array(t),n=e.createBuffer({size:r.byteLength,usage:40});return{array:r,buffer:n}},bt=(e,t)=>({colorAttachments:[{view:e.getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}],depthStencilAttachment:{view:t.createView(),depthClearValue:1,depthLoadOp:"clear",depthStoreOp:"store"}}),vt=(e,t=1280,r=800)=>{let n=e.createTexture({size:[t,r],format:"rgba8unorm",usage:22}),o=e.createSampler({magFilter:"linear",minFilter:"linear"});return{texture:n,sampler:o}},yt=(e,t,r)=>e.createTexture({size:[t,r],format:"depth24plus",usage:GPUTextureUsage.RENDER_ATTACHMENT});var ht=async e=>{let t=e.el.getContext("webgpu"),{device:r,format:n}=await ct(t),o=ft(),s,i,c=h=>{},a=0,p=!0,g,C=ve((h,b)=>{p=!0;let{array:X,buffer:_}=xt(r,b),{binding:G,group:N}=o.uniform();return{binding:G,group:N,array:X,buffer:_}}),v=ve((h,b=0,X=0)=>{p=!0;let{texture:_,sampler:G}=vt(r,b,X),{binding:N,group:W}=o.texture();return{binding:N,group:W,texture:_,sampler:G,view:_.createView()}}),m=ve((h,b)=>{p=!0;let X=b.length/e.count,{location:_}=o.attrib(),{array:G,buffer:N}=gt(r,b);return{array:G,buffer:N,location:_,stride:X}}),D=()=>{let{vertexBuffers:h,bufferLayouts:b}=lt(m.map.values()),{bindGroups:X,bindGroupLayouts:_}=dt(r,C.map.values(),v.map.values()),G=mt(r,n,b,_,i,s);c=N=>{N.setPipeline(G),X.forEach((W,K)=>N.setBindGroup(K,W)),h.forEach((W,K)=>N.setVertexBuffer(K,W)),N.draw(e.count,1,0,0),N.end()}},P=()=>{if(!s||!i){let b={isWebGL:!1,gl:e};s=Y(e.fs,b),i=q(e.vs,b)}if(a)return;p&&D(),p=!1;let h=r.createCommandEncoder();c(h.beginRenderPass(bt(t,g))),r.queue.submit([h.finish()])},E=()=>{let h=e.el;g?.destroy(),g=yt(r,h.width,h.height)},L=()=>{g?.destroy()},$=(h="",b)=>{let{array:X,buffer:_}=m(h,b);X.set(b),r.queue.writeBuffer(_,0,X)},M=(h,b)=>{l.num(b)&&(b=[b]);let{array:X,buffer:_}=C(h,b);X.set(b),r.queue.writeBuffer(_,0,X)},j=(h,b)=>{a++;let X=Object.assign(new Image,{src:b,crossOrigin:"anonymous"});X.decode().then(()=>{let{width:_,height:G}=X,{texture:N}=v(h,_,G);r.queue.copyExternalImageToTexture({source:X},{texture:N},{width:_,height:G}),a--})};return E(),{webgpu:{device:r,uniforms:C,textures:v,attribs:m},render:P,resize:E,clean:L,_attribute:$,_uniform:M,_texture:j}};var Xt=e=>l.obj(e)?"isGL"in e:!1,Dt=()=>typeof window>"u",Mt=()=>Dt()?!1:"gpu"in navigator,he=performance.now(),Wt=()=>xe(tt(de.xy.div(ge)),0,1),Vt=()=>xe(H(A(me).mod(A(2))).mul(4).sub(1),H(A(me).div(A(2))).mul(4).sub(1),0,1),Tt=e=>{let t=Ft({isNative:!1,isWebGL:!0,isLoop:!0,isGL:!0,size:[0,0],mouse:[0,0],count:6,webgl:{},webgpu:{}});return t.queue=Bt(),t.frame=At(),t.attribute=ye((r,n,o)=>t.queue(()=>t._attribute?.(r,n,o)),t),t.uniform=ye((r,n,o)=>t.queue(()=>t._uniform?.(r,n,o)),t),t.texture=ye((r,n)=>t.queue(()=>t._texture?.(r,n)),t),t.uniform({iResolution:t.size,iMouse:[0,0],iTime:he}),t("mount",async()=>{t.vs=t.vs||t.vert||t.vertex||Vt(),t.fs=t.fs||t.frag||t.fragment||Wt(),Mt()||(t.isWebGL=!0),t.isWebGL?t(await pt(t)):t(await ht(t)),t.resize(),t.frame(()=>(t.loop(),t.queue.flush(),t.render(),t.isLoop)),!t.isNative&&(window.addEventListener("resize",t.resize),t.el.addEventListener("mousemove",t.mousemove))}),t("clean",()=>{t.frame.stop(),t.frame.clean(t.render),!t.isNative&&(window.removeEventListener("resize",t.resize),t.el.removeEventListener("mousemove",t.mousemove))}),t("resize",()=>{let r=t.width||window.innerWidth,n=t.height||window.innerHeight;t.size[0]=t.el.width=r,t.size[1]=t.el.height=n,t.uniform("iResolution",t.size)}),t("mousemove",(r,n=r.clientX,o=r.clientY)=>{let[s,i]=t.size,{top:c,left:a}=t.el.getBoundingClientRect();t.mouse[0]=(n-c-s/2)/(s/2),t.mouse[1]=-(o-a-i/2)/(i/2),t.uniform("iMouse",t.mouse)}),t("loop",()=>{he=performance.now()/1e3,t.uniform("iTime",he)}),t(e)};var os=e=>{let t=Xt(e)?e:Tt(e);return t.ref=r=>{r?(t.el=r,t.mount()):t.clean()},t};export{_r as Fn,hr as If,Xr as Loop,Gt as Return,Tr as Switch,_o as abs,Eo as acos,z as addDependency,No as all,Co as any,Po as asin,Ke as assign,Lo as atan,So as atan2,Sr as attribute,wo as bitcast,eo as bool,T as builtin,co as bvec2,fo as bvec3,lo as bvec4,$o as cbrt,Go as ceil,Ro as clamp,f as code,go as color,wr as constant,x as conversion,Oe as conversionToConstant,Oo as cos,at as createAttrib,gt as createAttribBuffer,dt as createBindGroup,ft as createBindings,yt as createDepthTexture,bt as createDescriptor,ct as createDevice,Tt as createGL,st as createIbo,mt as createPipeline,ot as createProgram,ut as createTexture,vt as createTextureSampler,xt as createUniformBuffer,nt as createVbo,lt as createVertexBuffers,Io as cross,Xo as cubeTexture,Uo as dFdx,Fo as dFdy,Ao as degrees,Bo as difference,Ht as dig,Do as distance,Mo as dot,_t as each,Wo as equals,Vo as exp,zo as exp2,qt as ext,ko as faceforward,Yt as fig,H as float,qo as floor,zt as flush,w as formatConversions,tt as fract,Mr as fragDepth,Y as fragment,Dr as frontFacing,u as function_,Yo as fwidth,Re as getBluiltin,pe as getEventFun,S as getId,Ge as getOperator,it as getStride,$e as hex2rgb,bo as iMouse,ge as iResolution,vo as iTime,Ie as initNodeContext,Br as instanceIndex,A as int,Ho as inverseSqrt,l as is,ue as isConstants,we as isConversion,Se as isFunction,Xt as isGL,V as isNodeProxy,Le as isOperator,Dt as isServer,Pe as isSwizzle,Mt as isWebGPUSupported,no as ivec2,so as ivec3,io as ivec4,jo as length,Ko as lengthSq,Zo as log,Qo as log2,to as mat2,ro as mat3,oo as mat4,Jo as max,Ze as member,en as min,tn as mix,rn as negate,d as node,kr as normalLocal,Yr as normalView,qr as normalWorld,on as normalize,os as onGL,nn as oneMinus,Ot as operator,zr as pointCoord,de as position,Hr as positionLocal,Kr as positionView,jr as positionWorld,sn as pow,an as pow2,un as pow3,pn as pow4,cn as radians,fn as reciprocal,ln as reflect,dn as refract,kt as replace,mn as round,ce as safeEventCall,Wr as sampleIndex,Vr as sampleMask,xo as sampler2D,xn as saturate,Zr as screenCoordinate,Qr as screenUV,Rr as select,jt as sig,gn as sign,bn as sin,vn as smoothstep,Ue as sortHeadersByDependencies,yn as sqrt,hn as step,yr as struct,Xn as tan,ho as texture,mo as texture2D,To as textureSize,je as toVar,Tn as transformDirection,_n as trunc,Jr as uint,k as uniform,yo as uv,ao as uvec2,uo as uvec3,po as uvec4,$r as variable,et as vec2,Qe as vec3,xe as vec4,q as vertex,me as vertexIndex,Gr as vertexStage,pt as webgl,ht as webgpu};
70
40
  //# sourceMappingURL=solid.js.map