shaders 2.0.652 → 2.0.654
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/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/vue/index.js +1 -1
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -504,5 +504,5 @@ ${t.tab}if ( ${u} ) {
|
|
|
504
504
|
`,n+=t.flow.code.replace(/^\t/gm,"")+`
|
|
505
505
|
`,n+="/* ... */ "+r+` /* ... */
|
|
506
506
|
`,n+="// #"+i+`#
|
|
507
|
-
`,e===null?console.log(n):e(t,n),r}};const jpe=(t,e=null)=>Ne(new Gpe(Ne(t),e));H("debug",jpe);const Wpe=Ei(([t])=>WI(t.rgb)),Hpe=Ei(([t,e=zn(1)])=>e.mix(WI(t.rgb),t.rgb)),qpe=Ei(([t,e=zn(1)])=>{let r=EI(t.r,t.g,t.b).div(3),s=t.r.max(t.g.max(t.b)),i=s.sub(r).mul(e).mul(-3);return yy(t.rgb,s,i)}),Xpe=Ei(([t,e=zn(1)])=>{let r=Wh(.57735,.57735,.57735),s=e.cos();return Wh(t.rgb.mul(s).add(r.cross(t.rgb).mul(e.sin()).add(r.mul(bp(r,t.rgb).mul(s.oneMinus())))))}),WI=(t,e=Wh(dr.getLuminanceCoefficients(new ln)))=>bp(t,e),ph={name:"Grayscale",props:{},fragmentNode:({childNode:t})=>{let{vec4:e}=_t;if(!t)return console.error("You must pass a child component into the Grayscale shader."),e(0);let r=t||e(0,0,0,0);return e(Wpe(r.rgb).rgb,r.a)}};function Ype(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const HI={blendMode:"normal"};try{ph&&ph.props&&Object.entries(ph.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(HI[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const Zpe=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${ph.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>Ype(t,HI),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(ph,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,ph.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},mh={name:"Grid",props:{color:{default:"#ffffff",transform:xs,description:"The color of the grid lines",ui:{type:"color",label:"Color"}},cells:{default:10,description:"Number of cells along the shortest canvas edge (creates square cells)",ui:{type:"range",min:1,max:50,step:1,label:"Cells"}},thickness:{default:1,description:"Thickness of grid lines (normalized, 0.0-1.0)",ui:{type:"range",min:0,max:5,step:.1,label:"Thickness"}}},fragmentNode:({uniforms:t})=>{let{vec2:e,vec4:r,fract:s,max:i,screenUV:n,viewportSize:a,fwidth:o,smoothstep:l}=_t,h=a.x.div(a.y),u=e(n.x.mul(h),n.y.oneMinus()),c=t.cells.uniform,d=u.mul(c),p=s(d),m=t.thickness.uniform.mul(.01),f=p.x.min(p.x.oneMinus()),g=p.y.min(p.y.oneMinus()),b=o(d),v=l(m.add(b.x),m,f),w=l(m.add(b.y),m,g),T=i(v,w);return r(t.color.uniform.rgb,t.color.uniform.a.mul(T))}};function Jpe(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const qI={blendMode:"normal"};try{mh&&mh.props&&Object.entries(mh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(qI[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const Qpe=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${mh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>Jpe(t,qI),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(mh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,mh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},fh={name:"GridDistortion",props:{smoothness:{default:0,description:"How smooth and flowing the motion is",ui:{type:"range",min:0,max:1,step:.01,label:"Smoothness"}},intensity:{default:1,description:"Strength of the distortion effect",ui:{type:"range",min:0,max:5,step:.1,label:"Intensity"}},swirl:{default:0,description:"Amount of swirl motion",ui:{type:"range",min:0,max:2,step:.1,label:"Swirl"}},duration:{default:3,description:"How long the effect persists (higher = longer)",ui:{type:"range",min:0,max:10,step:.1,label:"Duration"}},radius:{default:1,description:"Radius of the distortion effect",ui:{type:"range",min:0,max:3,step:.01,label:"Radius"}},gridSize:{default:20,description:"Resolution of the distortion grid (higher = more detailed)",ui:{type:"range",min:8,max:128,step:1,label:"Grid Size"}}},fragmentNode:({uniforms:t,onBeforeRender:e,childNode:r,onCleanup:s,canvas:i})=>{let{vec2:n,vec4:a,float:o,uniform:l,screenUV:h,convertToTexture:u,texture:c}=_t;if(!r)return a(0,0,0,0);let d=Math.round(i.clientWidth),p=Math.round(i.clientHeight),m=u(r,d,p),f=Math.max(8,Math.min(128,Math.floor(t.gridSize.uniform.value))),g=new Float32Array(f*f*2),b=new Gv(g,f,f,Du,Xd);b.magFilter=nn,b.minFilter=nn,b.needsUpdate=!0;let v=c(b),w=l(.5),T=l(.5),N=l(0),S=l(0),_=.5,A=.5,D=Date.now();e(({pointer:ve})=>{let me=Date.now(),he=Math.min((me-D)/1e3,.016);D=me;let Te=he>0?(ve.x-_)/he:0,Ge=he>0?(ve.y-A)/he:0;N.value=N.value*.85+Te*.15,S.value=S.value*.85+Ge*.15,w.value=ve.x,T.value=ve.y;let He=t.duration.uniform.value,ft=t.intensity.uniform.value,ht=t.radius.uniform.value*.05,Ft=t.swirl.uniform.value;for(let ri=0;ri<f;ri++)for(let ar=0;ar<f;ar++){let et=(ri*f+ar)*2;g[et]*=1-He*he,g[et+1]*=1-He*he;let Wr=(ar+.5)/f,qt=(ri+.5)/f,br=Wr-ve.x,Pi=qt-ve.y,ns=Math.sqrt(br*br+Pi*Pi);if(ns<ht*2&&Math.abs(Te)+Math.abs(Ge)>.01){let as=Math.exp(-ns*ns/(ht*ht));if(g[et]+=N.value*as*ft*he*.5,g[et+1]+=S.value*as*ft*he*.5,Ft>0){let Fi=Math.atan2(Pi,br)+Math.PI*.5;g[et]+=Math.cos(Fi)*Ft*as*he*2,g[et+1]+=Math.sin(Fi)*Ft*as*he*2}}g[et]=Math.max(-1,Math.min(1,g[et])),g[et+1]=Math.max(-1,Math.min(1,g[et+1]))}b.needsUpdate=!0,_=ve.x,A=ve.y}),s(()=>{b.dispose()});let K=t.gridSize.uniform,J=o(1).div(K),re=h.div(J).floor().mul(J).add(J.mul(.5)),te=v.sample(re).xy,oe=o(.1),ae=o(-.1),ge=te.clamp(n(ae,ae),n(oe,oe)),fe=h.sub(ge);return m.sample(fe)}};function Kpe(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const XI={blendMode:"normal"};try{fh&&fh.props&&Object.entries(fh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(XI[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const eme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${fh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>Kpe(t,XI),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(fh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,fh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},gh={name:"HueShift",props:{shift:{default:0,description:"The amount to shift the hue by",ui:{type:"range",min:-180,max:180,step:1,label:"Shift"}}},fragmentNode:({uniforms:t,childNode:e})=>{let{vec4:r}=_t;if(!e)return console.error("You must pass a child component into the Hue Shift shader."),r(0);let s=e||r(0,0,0,0);return r(Xpe(s.rgb,t.shift.uniform).rgb,s.a)}};function tme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const YI={blendMode:"normal"};try{gh&&gh.props&&Object.entries(gh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(YI[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const rme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${gh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>tme(t,YI),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(gh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,gh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},yh={name:"ImageTexture",props:{src:{default:"https://picsum.photos/1920/1080",description:"Image URL to display",ui:{type:"text",label:"Source URL"}},fit:{default:"cover",description:"How the image should fit within the canvas"}},fragmentNode:({uniforms:t,onCleanup:e})=>{let{texture:r,screenUV:s}=_t,i=new xK,n=i.load(t.src.uniform.value);n.colorSpace=ci,n.flipY=!0;let a=r(n);e(()=>{n.dispose()});let o=s.xy.setY(s.y.oneMinus());return a.sample(o)}};function sme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const ZI={blendMode:"normal"};try{yh&&yh.props&&Object.entries(yh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(ZI[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const ime=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${yh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>sme(t,ZI),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(yh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,yh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},xh={name:"Invert",props:{},fragmentNode:({childNode:t})=>{let{vec4:e,vec3:r}=_t;if(!t)return console.error("You must pass a child component into the Invert shader."),e(0);let s=t||e(0,0,0,0);return e(r(1,1,1).sub(s.rgb),s.a)}};function nme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const JI={blendMode:"normal"};try{xh&&xh.props&&Object.entries(xh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(JI[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const ame=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${xh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>nme(t,JI),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(xh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,xh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},bh={name:"LinearGradient",props:{startColor:{default:"#1aff00",transform:xs,description:"The starting color of the gradient",ui:{type:"color",label:"Start Color"}},endColor:{default:"#0000ff",transform:xs,description:"The ending color of the gradient",ui:{type:"color",label:"End Color"}},angle:{default:0,transform:Hue,description:"The rotation angle of the gradient (in degrees)",ui:{type:"range",min:0,max:360,step:1,label:"Angle"}},center:{default:{x:.5,y:.5},transform:gp}},fragmentNode:({uniforms:t})=>{let{vec2:e,mix:r,float:s,cos:i,sin:n,dot:a,radians:o,screenUV:l,abs:h,div:u}=_t,c=o(t.angle.uniform),d=i(c),p=n(c),m=e(d,p),f=e(t.center.uniform[0],t.center.uniform[1].oneMinus()),g=l.sub(f),b=a(g,m),v=s(.5).mul(h(d).add(h(p))),w=u(b,v.max(1e-6)),T=w.mul(.5).add(.5).clamp(s(0),s(1));return r(t.startColor.uniform,t.endColor.uniform,T)}};function ome(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const QI={blendMode:"normal"};try{bh&&bh.props&&Object.entries(bh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(QI[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const lme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${bh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>ome(t,QI),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(bh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,bh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},vh={name:"Liquify",props:{smoothness:{default:0,description:"How smooth and flowing the motion is (0-1)",ui:{type:"range",min:0,max:1,step:.01,label:"Smoothness"}},intensity:{default:1,description:"Strength of the distortion effect",ui:{type:"range",min:0,max:5,step:.1,label:"Intensity"}},swirl:{default:0,description:"Amount of swirl motion (0-1)",ui:{type:"range",min:0,max:1,step:.01,label:"Swirl"}},duration:{default:3,description:"How long the effect persists (higher = longer)",ui:{type:"range",min:0,max:10,step:.1,label:"Duration"}},radius:{default:1,description:"Radius of the distortion effect",ui:{type:"range",min:0,max:3,step:.01,label:"Radius"}}},fragmentNode:({uniforms:t,onBeforeRender:e,childNode:r,onCleanup:s,canvas:i})=>{let{vec2:n,vec4:a,float:o,uniform:l,screenUV:h,convertToTexture:u,texture:c}=_t;if(!r)return a(0,0,0,0);let d=Math.round(i.clientWidth),p=Math.round(i.clientHeight),m=u(r,d,p),f=32,g=new Float32Array(f*f*2),b=new Gv(g,f,f,Du,Xd);b.magFilter=nn,b.minFilter=nn,b.needsUpdate=!0;let v=c(b),w=l(.5),T=l(.5),N=l(0),S=l(0),_=.5,A=.5,D=Date.now();e(({pointer:ae})=>{let ge=Date.now(),fe=Math.min((ge-D)/1e3,.016);D=ge;let ve=fe>0?(ae.x-_)/fe:0,me=fe>0?(ae.y-A)/fe:0;N.value=N.value*.85+ve*.15,S.value=S.value*.85+me*.15,w.value=ae.x,T.value=ae.y;let he=t.duration.uniform.value,Te=t.intensity.uniform.value,Ge=t.radius.uniform.value*.05,He=t.swirl.uniform.value;for(let ft=0;ft<f;ft++)for(let ht=0;ht<f;ht++){let Ft=(ft*f+ht)*2;g[Ft]*=1-he*fe,g[Ft+1]*=1-he*fe;let ri=(ht+.5)/f,ar=(ft+.5)/f,et=ri-ae.x,Wr=ar-ae.y,qt=Math.sqrt(et*et+Wr*Wr);if(qt<Ge*2&&Math.abs(ve)+Math.abs(me)>.01){let br=Math.exp(-qt*qt/(Ge*Ge));if(g[Ft]+=N.value*br*Te*fe*.5,g[Ft+1]+=S.value*br*Te*fe*.5,He>0){let Pi=Math.atan2(Wr,et)+Math.PI*.5;g[Ft]+=Math.cos(Pi)*He*br*fe*2,g[Ft+1]+=Math.sin(Pi)*He*br*fe*2}}g[Ft]=Math.max(-1,Math.min(1,g[Ft])),g[Ft+1]=Math.max(-1,Math.min(1,g[Ft+1]))}b.needsUpdate=!0,_=ae.x,A=ae.y}),s(()=>{b.dispose()});let K=v.sample(h).xy,J=o(.2),re=o(-.2),te=K.clamp(n(re,re),n(J,J)),oe=h.sub(te);return m.sample(oe)}};function ume(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const KI={blendMode:"normal"};try{vh&&vh.props&&Object.entries(vh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(KI[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const hme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${vh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>ume(t,KI),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(vh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,vh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},Th={name:"Pixelate",props:{scale:{default:50,description:"Pixel size - higher values create larger, more visible pixels",ui:{type:"range",min:1,max:200,step:1,label:"Scale"}}},fragmentNode:({uniforms:t,childNode:e,canvas:r})=>{let{vec4:s,floor:i,screenUV:n,convertToTexture:a}=_t;if(!e)return s(0,0,0,0);let o=Math.round(r.clientWidth),l=Math.round(r.clientHeight),h=a(e,o,l),u=t.scale.uniform,c=i(n.mul(u)).div(u);return h.sample(c)}};function cme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const ez={blendMode:"normal"};try{Th&&Th.props&&Object.entries(Th.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(ez[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const dme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${Th.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>cme(t,ez),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(Th,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Th.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})};var pme=class extends ti{static get type(){return"PosterizeNode"}constructor(e,r){super(),this.sourceNode=e,this.stepsNode=r}setup(){let{sourceNode:e,stepsNode:r}=this;return e.mul(r).floor().div(r)}};const mme=ue(pme).setParameterLength(2),wh={name:"Posterize",props:{intensity:{default:5,description:"The intensity of the posterization effect (lower is more posterized)",ui:{type:"range",min:2,max:20,step:1,label:"Intensity"}}},fragmentNode:({uniforms:t,childNode:e})=>{let{vec4:r,int:s}=_t;if(!e)return console.error("You must pass a child component into the Posterize shader."),r(0);let i=e||r(0,0,0,0);return mme(i,s(t.intensity.uniform))}};function fme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const tz={blendMode:"normal"};try{wh&&wh.props&&Object.entries(wh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(tz[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const gme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${wh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>fme(t,tz),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(wh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,wh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},Sh={name:"RadialGradient",props:{startColor:{default:"#ff0000",transform:xs,description:"The starting color at the center of the gradient",ui:{type:"color",label:"Start Color"}},endColor:{default:"#0000ff",transform:xs,description:"The ending color at the edge of the gradient",ui:{type:"color",label:"End Color"}},center:{default:{x:.5,y:.5},transform:gp,description:"The center point of the radial gradient"},radius:{default:1,description:"The radius of the gradient (normalized, 0.0-1.0)",ui:{type:"range",min:0,max:2,step:.01,label:"Radius"}}},fragmentNode:({uniforms:t})=>{let{vec2:e,mix:r,float:s,distance:i,screenUV:n,viewportSize:a}=_t,o=a.x.div(a.y),l=e(n.x.mul(o),n.y),h=e(t.center.uniform.x.mul(o),t.center.uniform.y.oneMinus()),u=i(l,h),c=u.div(t.radius.uniform).clamp(s(0),s(1));return r(t.startColor.uniform,t.endColor.uniform,c)}};function yme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const rz={blendMode:"normal"};try{Sh&&Sh.props&&Object.entries(Sh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(rz[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const xme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${Sh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>yme(t,rz),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(Sh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Sh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},Mh={name:"Ripple",props:{intensity:{default:1,description:"Overall ripple intensity",ui:{type:"range",min:0,max:5,step:.1,label:"Intensity"}},rippleSpeed:{default:150,description:"Speed of ripple expansion",ui:{type:"range",min:50,max:500,step:10,label:"Ripple Speed"}},damping:{default:.95,description:"Water damping (higher = less decay)",ui:{type:"range",min:.8,max:.99,step:.01,label:"Damping"}},mouseIntensity:{default:1,description:"Mouse movement ripple strength",ui:{type:"range",min:0,max:3,step:.1,label:"Mouse Intensity"}}},fragmentNode:({uniforms:t,onBeforeRender:e,childNode:r,onCleanup:s,canvas:i})=>{let{vec2:n,vec4:a,screenUV:o,convertToTexture:l,texture:h}=_t;if(!r)return a(0,0,0,0);let u=Math.round(i.clientWidth),c=Math.round(i.clientHeight),d=l(r,u,c),p=128,m={current:new Float32Array(p*p),previous:new Float32Array(p*p)};for(let te=0;te<p*p;te++)m.current[te]=0,m.previous[te]=0;let f=new Gv(m.current,p,p,SQ,Xd);f.minFilter=nn,f.magFilter=nn,f.needsUpdate=!0;let g=h(f),b=.5,v=.5,w=0,T=(te,oe,ae)=>{let ge=te/i.clientWidth,fe=oe/i.clientHeight,ve=Math.floor(ge*p),me=Math.floor(fe*p),he=8,Te=ae*.5;for(let Ge=-8;Ge<=he;Ge++)for(let He=-8;He<=he;He++){let ft=Ge*Ge+He*He;if(ft<=he*he){let ht=ve+Ge,Ft=me+He;if(ht>=0&&ht<p&&Ft>=0&&Ft<p){let ri=Ft*p+ht,ar=Math.sqrt(ft),et=1-ar/he,Wr=Math.cos(ar/he*Math.PI*.5)*Te*et;m.previous[ri]+=Wr}}}},N=()=>{let te=t.damping.uniform.value;for(let ae=1;ae<p-1;ae++)for(let ge=1;ge<p-1;ge++){let fe=ae*p+ge,ve=m.previous[fe-p],me=m.previous[fe+p],he=m.previous[fe-1],Te=m.previous[fe+1];m.current[fe]=(ve+me+he+Te)/2-m.current[fe],m.current[fe]*=te,m.current[fe]=Math.max(-2,Math.min(2,m.current[fe]))}for(let ae=0;ae<p;ae++)m.current[ae]=0,m.current[(p-1)*p+ae]=0,m.current[ae*p]=0,m.current[ae*p+(p-1)]=0;let oe=m.current;m.current=m.previous,m.previous=oe,f.image.data=m.current,f.needsUpdate=!0};e(({pointer:te})=>{let oe=performance.now();if(oe-w>=16){w=oe;let ae=te.x*i.clientWidth,ge=te.y*i.clientHeight,fe=ae-b*i.clientWidth,ve=ge-v*i.clientHeight,me=Math.sqrt(fe*fe+ve*ve);if(me>2){let he=me/16,Te=Math.min(he/10,2),Ge=Math.min(me/20,1),He=Ge*Te*t.mouseIntensity.uniform.value;T(ae,ge,He)}b=te.x,v=te.y}N()}),s(()=>{f.dispose()});let S=o,_=t.intensity.uniform,A=1/p,D=g.sample(S.add(n(A,0))).r.sub(g.sample(S.sub(n(A,0))).r),K=g.sample(S.add(n(0,A))).r.sub(g.sample(S.sub(n(0,A))).r),J=n(D,K).mul(_).mul(.05),re=o.add(J);return d.sample(re)}};function bme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const sz={blendMode:"normal"};try{Mh&&Mh.props&&Object.entries(Mh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(sz[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const vme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${Mh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>bme(t,sz),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(Mh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Mh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},_h={name:"Saturation",props:{intensity:{default:1,description:"The intensity of the saturation effect (1 being no change)",ui:{type:"range",min:0,max:3,step:.01,label:"Intensity"}}},fragmentNode:({uniforms:t,childNode:e})=>{let{vec4:r}=_t;if(!e)return console.error("You must pass a child component into the Saturation shader."),r(0);let s=e||r(0,0,0,0);return r(Hpe(s.rgb,t.intensity.uniform).rgb,s.a)}};function Tme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const iz={blendMode:"normal"};try{_h&&_h.props&&Object.entries(_h.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(iz[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const wme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${_h.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>Tme(t,iz),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(_h,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,_h.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},Nh={name:"SolidColor",props:{color:{default:"#5b18ca",transform:xs,description:"The solid color to display",ui:{type:"color",label:"Color"}}},fragmentNode:({uniforms:t})=>t.color.uniform};function Sme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const nz={blendMode:"normal"};try{Nh&&Nh.props&&Object.entries(Nh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(nz[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const Mme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${Nh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>Sme(t,nz),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(Nh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Nh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},Ah={name:"Spiral",props:{colorBack:{default:"#000000",transform:xs,description:"Background color",ui:{type:"color",label:"Background Color"}},colorFront:{default:"#ffffff",transform:xs,description:"Spiral stroke color",ui:{type:"color",label:"Spiral Color"}},strokeWidth:{default:.5,description:"Thickness of spiral stroke",ui:{type:"range",min:0,max:2,step:.01,label:"Stroke Width"}},strokeFalloff:{default:0,description:"Stroke losing width further from center",ui:{type:"range",min:0,max:1,step:.01,label:"Stroke Falloff"}},softness:{default:0,description:"Color transition sharpness (0 = hard edge, 1 = smooth fade)",ui:{type:"range",min:0,max:1,step:.01,label:"Softness"}},speed:{default:1,description:"Animation speed (negative values reverse direction)",ui:{type:"range",min:-3,max:3,step:.1,label:"Speed"}},center:{default:{x:.5,y:.5},transform:gp,description:"The center point of the spiral"},scale:{default:1,description:"Scale factor for spiral bands (higher = more bands, lower = fewer bands)",ui:{type:"range",min:.1,max:5,step:.1,label:"Scale"}}},fragmentNode:({uniforms:t})=>{let{vec2:e,vec4:r,float:s,atan2:i,length:n,clamp:a,fract:o,abs:l,mix:h,smoothstep:u,screenUV:c,time:d,fwidth:p,viewportSize:m}=_t,f=m.x.div(m.y),g=e(c.x.mul(f),c.y),b=e(t.center.uniform.x.mul(f),t.center.uniform.y.oneMinus()),v=g.sub(b),w=d.mul(t.speed.uniform),T=n(v),N=T,S=i(v.y,v.x).sub(w),_=s(6.283185307),A=S.div(_),D=N.mul(t.scale.uniform).add(A),K=o(D),J=l(K.sub(.5)).mul(2),re=a(t.strokeWidth.uniform,t.strokeFalloff.uniform.mul(.005),1),te=a(t.strokeFalloff.uniform,0,1).mul(T).oneMinus(),oe=re.mul(te),ae=p(D),ge=s(4).sub(u(.05,.4,t.strokeWidth.uniform.mul(2)).mul(u(.05,.4,t.strokeWidth.uniform.oneMinus().mul(2))).mul(3)),fe=h(ge.mul(ae),p(J),a(ae,0,1)),ve=u(oe.sub(fe).sub(t.softness.uniform),oe.add(fe).add(t.softness.uniform),J),me=t.colorFront.uniform.rgb.mul(t.colorFront.uniform.a),he=t.colorFront.uniform.a,Te=t.colorBack.uniform.rgb.mul(t.colorBack.uniform.a),Ge=t.colorBack.uniform.a,He=me.mul(ve),ft=he.mul(ve),ht=He.add(Te.mul(ft.oneMinus())),Ft=ft.add(Ge.mul(ft.oneMinus()));return r(ht,Ft)}};function _me(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const az={blendMode:"normal"};try{Ah&&Ah.props&&Object.entries(Ah.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(az[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const Nme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${Ah.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>_me(t,az),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(Ah,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Ah.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},Ch={name:"Swirl",props:{colorA:{default:"#1275d8",description:"Primary gradient color",transform:xs,ui:{type:"color",label:"Primary Color"}},colorB:{default:"#e19136",description:"Secondary gradient color",transform:xs,ui:{type:"color",label:"Secondary Color"}},colorC:{default:"#320485",description:"Accent gradient color",transform:xs,ui:{type:"color",label:"Accent Color"}},speed:{default:1,description:"Flow animation speed",ui:{type:"range",min:0,max:5,step:.1,label:"Speed"}},scale:{default:5,description:"Gradient scale",ui:{type:"range",min:.1,max:20,step:.1,label:"Scale"}},complexity:{default:5,description:"Flow complexity",ui:{type:"range",min:1,max:10,step:.1,label:"Complexity"}}},fragmentNode:({uniforms:t})=>{let e=Iv(),r=Lv.mul(t.speed.uniform),s=t.scale.uniform,i=t.complexity.uniform,n=no(e.x.mul(s.mul(1.2)).add(r.mul(.8))).mul(.3),a=ff(e.y.mul(s.mul(.9)).sub(r.mul(.6))).mul(.3),o=zv(e.x.add(no(e.y.mul(i.mul(2)).add(r)).mul(.08)),e.y.add(ff(e.x.mul(i.mul(1.5)).sub(r.mul(.7))).mul(.08))),l=no(o.x.mul(s.mul(3)).add(o.y.mul(s.mul(2))).add(r.mul(.5))),h=ff(o.x.sub(o.y).mul(s.mul(2.5)).add(r.mul(.3))),u=no(o.x.mul(i).add(n).add(o.y.mul(i.mul(.8)).add(a)).add(r.mul(.4))),c=ml(l,h,u.mul(.5).add(.5)),d=o.x.mul(.7).add(o.y.mul(.3)).add(c.mul(.2)),p=ml(t.colorA.uniform,t.colorB.uniform,gb(.1,.6,d)),m=ml(p,t.colorC.uniform,gb(.4,.9,d.add(u.mul(.3)))),f=no(r.mul(3).add(d.mul(10))).mul(.02).add(1),g=m.mul(f);return Ur(g,1)}};function Ame(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const oz={blendMode:"normal"};try{Ch&&Ch.props&&Object.entries(Ch.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(oz[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const Cme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${Ch.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>Ame(t,oz),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(Ch,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Ch.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},Rh={name:"Twirl",props:{center:{default:{x:.5,y:.5},transform:gp,description:"The center point of the twirl effect"},intensity:{default:1,description:"The strength of the twirl effect",ui:{type:"range",min:-5,max:5,step:.1,label:"Intensity"}}},fragmentNode:({uniforms:t,childNode:e})=>{let{vec2:r,vec4:s,cos:i,sin:n,length:a,screenUV:o,convertToTexture:l}=_t;if(!e)return console.error("You must pass a child component into the Twirl shader."),s(0);let h=l(e),u=o,c=r(t.center.uniform.x,t.center.uniform.y.oneMinus()),d=u.sub(c),p=t.intensity.uniform.mul(a(d)),m=i(p),f=n(p),g=m.mul(d.x).sub(f.mul(d.y)),b=f.mul(d.x).add(m.mul(d.y)),v=r(g.add(c.x),b.add(c.y));return s(h.sample(v))}};function Rme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const lz={blendMode:"normal"};try{Rh&&Rh.props&&Object.entries(Rh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(lz[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const Eme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${Rh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>Rme(t,lz),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(Rh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Rh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},Eh={name:"Vibrance",props:{intensity:{default:0,description:"The intensity of the vibrance effect",ui:{type:"range",min:-2,max:2,step:.01,label:"Intensity"}}},fragmentNode:({uniforms:t,childNode:e})=>{let{vec4:r}=_t;if(!e)return console.error("You must pass a child component into the Vibrance shader."),r(0);let s=e||r(0,0,0,0);return r(qpe(s.rgb,t.intensity.uniform).rgb,s.a)}};function Pme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const uz={blendMode:"normal"};try{Eh&&Eh.props&&Object.entries(Eh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(uz[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const Fme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${Eh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>Pme(t,uz),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(Eh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Eh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})};exports.Ascii=Goe;exports.Checkerboard=Xue;exports.Circle=Zue;exports.DotGrid=Que;exports.FilmGrain=ehe;exports.GlassTiles=rhe;exports.Grayscale=Zpe;exports.Grid=Qpe;exports.GridDistortion=eme;exports.HueShift=rme;exports.ImageTexture=ime;exports.Invert=ame;exports.LinearGradient=lme;exports.Liquify=hme;exports.Pixelate=dme;exports.Posterize=gme;exports.RadialGradient=xme;exports.Ripple=vme;exports.Saturation=wme;exports.Shader=Doe;exports.SolidColor=Mme;exports.Spiral=Nme;exports.Swirl=Cme;exports.Twirl=Eme;exports.Vibrance=Fme;
|
|
507
|
+
`,e===null?console.log(n):e(t,n),r}};const jpe=(t,e=null)=>Ne(new Gpe(Ne(t),e));H("debug",jpe);const Wpe=Ei(([t])=>WI(t.rgb)),Hpe=Ei(([t,e=zn(1)])=>e.mix(WI(t.rgb),t.rgb)),qpe=Ei(([t,e=zn(1)])=>{let r=EI(t.r,t.g,t.b).div(3),s=t.r.max(t.g.max(t.b)),i=s.sub(r).mul(e).mul(-3);return yy(t.rgb,s,i)}),Xpe=Ei(([t,e=zn(1)])=>{let r=Wh(.57735,.57735,.57735),s=e.cos();return Wh(t.rgb.mul(s).add(r.cross(t.rgb).mul(e.sin()).add(r.mul(bp(r,t.rgb).mul(s.oneMinus())))))}),WI=(t,e=Wh(dr.getLuminanceCoefficients(new ln)))=>bp(t,e),ph={name:"Grayscale",props:{},fragmentNode:({childNode:t})=>{let{vec4:e}=_t;if(!t)return console.error("You must pass a child component into the Grayscale shader."),e(0);let r=t||e(0,0,0,0);return e(Wpe(r.rgb).rgb,r.a)}};function Ype(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const HI={blendMode:"normal"};try{ph&&ph.props&&Object.entries(ph.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(HI[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const Zpe=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${ph.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>Ype(t,HI),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(ph,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,ph.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},mh={name:"Grid",props:{color:{default:"#ffffff",transform:xs,description:"The color of the grid lines",ui:{type:"color",label:"Color"}},cells:{default:10,description:"Number of cells along the shortest canvas edge (creates square cells)",ui:{type:"range",min:1,max:50,step:1,label:"Cells"}},thickness:{default:1,description:"Thickness of grid lines (normalized, 0.0-1.0)",ui:{type:"range",min:0,max:5,step:.1,label:"Thickness"}}},fragmentNode:({uniforms:t})=>{let{vec2:e,vec4:r,fract:s,max:i,screenUV:n,viewportSize:a,fwidth:o,smoothstep:l}=_t,h=a.x.div(a.y),u=e(n.x.mul(h),n.y.oneMinus()),c=t.cells.uniform,d=u.mul(c),p=s(d),m=t.thickness.uniform.mul(.01),f=p.x.min(p.x.oneMinus()),g=p.y.min(p.y.oneMinus()),b=o(d),v=l(m.add(b.x),m,f),w=l(m.add(b.y),m,g),T=i(v,w);return r(t.color.uniform.rgb,t.color.uniform.a.mul(T))}};function Jpe(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const qI={blendMode:"normal"};try{mh&&mh.props&&Object.entries(mh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(qI[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const Qpe=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${mh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>Jpe(t,qI),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(mh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,mh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},fh={name:"GridDistortion",props:{smoothness:{default:0,description:"How smooth and flowing the motion is",ui:{type:"range",min:0,max:1,step:.01,label:"Smoothness"}},intensity:{default:1,description:"Strength of the distortion effect",ui:{type:"range",min:0,max:5,step:.1,label:"Intensity"}},swirl:{default:0,description:"Amount of swirl motion",ui:{type:"range",min:0,max:2,step:.1,label:"Swirl"}},duration:{default:3,description:"How long the effect persists (higher = longer)",ui:{type:"range",min:0,max:10,step:.1,label:"Duration"}},radius:{default:1,description:"Radius of the distortion effect",ui:{type:"range",min:0,max:3,step:.01,label:"Radius"}},gridSize:{default:20,description:"Resolution of the distortion grid (higher = more detailed)",ui:{type:"range",min:8,max:128,step:1,label:"Grid Size"}}},fragmentNode:({uniforms:t,onBeforeRender:e,childNode:r,onCleanup:s,canvas:i})=>{let{vec2:n,vec4:a,float:o,uniform:l,screenUV:h,convertToTexture:u,texture:c}=_t;if(!r)return a(0,0,0,0);let d=Math.round(i.clientWidth),p=Math.round(i.clientHeight),m=u(r,d,p),f=Math.max(8,Math.min(128,Math.floor(t.gridSize.uniform.value))),g=new Float32Array(f*f*2),b=new Gv(g,f,f,Du,Xd);b.magFilter=nn,b.minFilter=nn,b.needsUpdate=!0;let v=c(b),w=l(.5),T=l(.5),N=l(0),S=l(0),_=.5,A=.5,D=Date.now();e(({pointer:ve})=>{let me=Date.now(),he=Math.min((me-D)/1e3,.016);D=me;let Te=he>0?(ve.x-_)/he:0,Ge=he>0?(ve.y-A)/he:0;N.value=N.value*.85+Te*.15,S.value=S.value*.85+Ge*.15,w.value=ve.x,T.value=ve.y;let He=t.duration.uniform.value,ft=t.intensity.uniform.value,ht=t.radius.uniform.value*.05,Ft=t.swirl.uniform.value;for(let ri=0;ri<f;ri++)for(let ar=0;ar<f;ar++){let et=(ri*f+ar)*2;g[et]*=1-He*he,g[et+1]*=1-He*he;let Wr=(ar+.5)/f,qt=(ri+.5)/f,br=Wr-ve.x,Pi=qt-ve.y,ns=Math.sqrt(br*br+Pi*Pi);if(ns<ht*2&&Math.abs(Te)+Math.abs(Ge)>.01){let as=Math.exp(-ns*ns/(ht*ht));if(g[et]+=N.value*as*ft*he*.5,g[et+1]+=S.value*as*ft*he*.5,Ft>0){let Fi=Math.atan2(Pi,br)+Math.PI*.5;g[et]+=Math.cos(Fi)*Ft*as*he*2,g[et+1]+=Math.sin(Fi)*Ft*as*he*2}}g[et]=Math.max(-1,Math.min(1,g[et])),g[et+1]=Math.max(-1,Math.min(1,g[et+1]))}b.needsUpdate=!0,_=ve.x,A=ve.y}),s(()=>{b.dispose()});let K=t.gridSize.uniform,J=o(1).div(K),re=h.div(J).floor().mul(J).add(J.mul(.5)),te=v.sample(re).xy,oe=o(.1),ae=o(-.1),ge=te.clamp(n(ae,ae),n(oe,oe)),fe=h.sub(ge);return m.sample(fe)}};function Kpe(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const XI={blendMode:"normal"};try{fh&&fh.props&&Object.entries(fh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(XI[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const eme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${fh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>Kpe(t,XI),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(fh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,fh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},gh={name:"HueShift",props:{shift:{default:0,description:"The amount to shift the hue by",ui:{type:"range",min:-180,max:180,step:1,label:"Shift"}}},fragmentNode:({uniforms:t,childNode:e})=>{let{vec4:r}=_t;if(!e)return console.error("You must pass a child component into the Hue Shift shader."),r(0);let s=e||r(0,0,0,0);return r(Xpe(s.rgb,t.shift.uniform).rgb,s.a)}};function tme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const YI={blendMode:"normal"};try{gh&&gh.props&&Object.entries(gh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(YI[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const rme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${gh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>tme(t,YI),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(gh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,gh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},yh={name:"ImageTexture",props:{src:{default:"https://picsum.photos/1920/1080",description:"Image URL to display",ui:{type:"text",label:"Source URL"}},fit:{default:"cover",description:"How the image should fit within the canvas"}},fragmentNode:({uniforms:t,onCleanup:e})=>{let{texture:r,screenUV:s}=_t,i=new xK,n=i.load(t.src.uniform.value);n.colorSpace=ci,n.flipY=!0;let a=r(n);e(()=>{n.dispose()});let o=s.xy.setY(s.y.oneMinus());return a.sample(o)}};function sme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const ZI={blendMode:"normal"};try{yh&&yh.props&&Object.entries(yh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(ZI[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const ime=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${yh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>sme(t,ZI),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(yh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,yh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},xh={name:"Invert",props:{},fragmentNode:({childNode:t})=>{let{vec4:e,vec3:r}=_t;if(!t)return console.error("You must pass a child component into the Invert shader."),e(0);let s=t||e(0,0,0,0);return e(r(1,1,1).sub(s.rgb),s.a)}};function nme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const JI={blendMode:"normal"};try{xh&&xh.props&&Object.entries(xh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(JI[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const ame=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${xh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>nme(t,JI),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(xh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,xh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},bh={name:"LinearGradient",props:{startColor:{default:"#1aff00",transform:xs,description:"The starting color of the gradient",ui:{type:"color",label:"Start Color"}},endColor:{default:"#0000ff",transform:xs,description:"The ending color of the gradient",ui:{type:"color",label:"End Color"}},angle:{default:0,transform:Hue,description:"The rotation angle of the gradient (in degrees)",ui:{type:"range",min:0,max:360,step:1,label:"Angle"}},center:{default:{x:.5,y:.5},transform:gp}},fragmentNode:({uniforms:t})=>{let{vec2:e,mix:r,float:s,cos:i,sin:n,dot:a,radians:o,screenUV:l,abs:h,div:u}=_t,c=o(t.angle.uniform),d=i(c),p=n(c),m=e(d,p),f=e(t.center.uniform[0],t.center.uniform[1].oneMinus()),g=l.sub(f),b=a(g,m),v=s(.5).mul(h(d).add(h(p))),w=u(b,v.max(1e-6)),T=w.mul(.5).add(.5).clamp(s(0),s(1));return r(t.startColor.uniform,t.endColor.uniform,T)}};function ome(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const QI={blendMode:"normal"};try{bh&&bh.props&&Object.entries(bh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(QI[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const lme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${bh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>ome(t,QI),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(bh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,bh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},vh={name:"Liquify",props:{smoothness:{default:0,description:"How smooth and flowing the motion is (0-1)",ui:{type:"range",min:0,max:1,step:.01,label:"Smoothness"}},intensity:{default:1,description:"Strength of the distortion effect",ui:{type:"range",min:0,max:5,step:.1,label:"Intensity"}},swirl:{default:0,description:"Amount of swirl motion (0-1)",ui:{type:"range",min:0,max:1,step:.01,label:"Swirl"}},duration:{default:3,description:"How long the effect persists (higher = longer)",ui:{type:"range",min:0,max:10,step:.1,label:"Duration"}},radius:{default:1,description:"Radius of the distortion effect",ui:{type:"range",min:0,max:3,step:.01,label:"Radius"}}},fragmentNode:({uniforms:t,onBeforeRender:e,childNode:r,onCleanup:s,canvas:i})=>{let{vec2:n,vec4:a,float:o,uniform:l,screenUV:h,convertToTexture:u,texture:c}=_t;if(!r)return a(0,0,0,0);let d=Math.round(i.clientWidth),p=Math.round(i.clientHeight),m=u(r,d,p),f=32,g=new Float32Array(f*f*2),b=new Gv(g,f,f,Du,Xd);b.magFilter=nn,b.minFilter=nn,b.needsUpdate=!0;let v=c(b),w=l(.5),T=l(.5),N=l(0),S=l(0),_=.5,A=.5,D=Date.now();e(({pointer:ae})=>{let ge=Date.now(),fe=Math.min((ge-D)/1e3,.016);D=ge;let ve=fe>0?(ae.x-_)/fe:0,me=fe>0?(ae.y-A)/fe:0;N.value=N.value*.85+ve*.15,S.value=S.value*.85+me*.15,w.value=ae.x,T.value=ae.y;let he=t.duration.uniform.value,Te=t.intensity.uniform.value,Ge=t.radius.uniform.value*.05,He=t.swirl.uniform.value;for(let ft=0;ft<f;ft++)for(let ht=0;ht<f;ht++){let Ft=(ft*f+ht)*2;g[Ft]*=1-he*fe,g[Ft+1]*=1-he*fe;let ri=(ht+.5)/f,ar=(ft+.5)/f,et=ri-ae.x,Wr=ar-ae.y,qt=Math.sqrt(et*et+Wr*Wr);if(qt<Ge*2&&Math.abs(ve)+Math.abs(me)>.01){let br=Math.exp(-qt*qt/(Ge*Ge));if(g[Ft]+=N.value*br*Te*fe*.5,g[Ft+1]+=S.value*br*Te*fe*.5,He>0){let Pi=Math.atan2(Wr,et)+Math.PI*.5;g[Ft]+=Math.cos(Pi)*He*br*fe*2,g[Ft+1]+=Math.sin(Pi)*He*br*fe*2}}g[Ft]=Math.max(-1,Math.min(1,g[Ft])),g[Ft+1]=Math.max(-1,Math.min(1,g[Ft+1]))}b.needsUpdate=!0,_=ae.x,A=ae.y}),s(()=>{b.dispose()});let K=v.sample(h).xy,J=o(.2),re=o(-.2),te=K.clamp(n(re,re),n(J,J)),oe=h.sub(te);return m.sample(oe)}};function ume(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const KI={blendMode:"normal"};try{vh&&vh.props&&Object.entries(vh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(KI[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const hme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${vh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>ume(t,KI),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(vh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,vh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},Th={name:"Pixelate",props:{scale:{default:50,description:"Pixel size - higher values create larger, more visible pixels",ui:{type:"range",min:1,max:200,step:1,label:"Scale"}}},fragmentNode:({uniforms:t,childNode:e,canvas:r})=>{let{vec4:s,floor:i,screenUV:n,convertToTexture:a}=_t;if(!e)return s(0,0,0,0);let o=Math.round(r.clientWidth),l=Math.round(r.clientHeight),h=a(e,o,l),u=t.scale.uniform,c=i(n.mul(u)).div(u);return h.sample(c)}};function cme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const ez={blendMode:"normal"};try{Th&&Th.props&&Object.entries(Th.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(ez[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const dme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${Th.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>cme(t,ez),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(Th,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Th.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})};var pme=class extends ti{static get type(){return"PosterizeNode"}constructor(e,r){super(),this.sourceNode=e,this.stepsNode=r}setup(){let{sourceNode:e,stepsNode:r}=this;return e.mul(r).floor().div(r)}};const mme=ue(pme).setParameterLength(2),wh={name:"Posterize",props:{intensity:{default:5,description:"The intensity of the posterization effect (lower is more posterized)",ui:{type:"range",min:2,max:20,step:1,label:"Intensity"}}},fragmentNode:({uniforms:t,childNode:e})=>{let{vec4:r,int:s}=_t;if(!e)return console.error("You must pass a child component into the Posterize shader."),r(0);let i=e||r(0,0,0,0);return mme(i,s(t.intensity.uniform))}};function fme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const tz={blendMode:"normal"};try{wh&&wh.props&&Object.entries(wh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(tz[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const gme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${wh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>fme(t,tz),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(wh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,wh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},Sh={name:"RadialGradient",props:{startColor:{default:"#ff0000",transform:xs,description:"The starting color at the center of the gradient",ui:{type:"color",label:"Start Color"}},endColor:{default:"#0000ff",transform:xs,description:"The ending color at the edge of the gradient",ui:{type:"color",label:"End Color"}},center:{default:{x:.5,y:.5},transform:gp,description:"The center point of the radial gradient"},radius:{default:1,description:"The radius of the gradient (normalized, 0.0-1.0)",ui:{type:"range",min:0,max:2,step:.01,label:"Radius"}}},fragmentNode:({uniforms:t})=>{let{vec2:e,mix:r,float:s,distance:i,screenUV:n,viewportSize:a}=_t,o=a.x.div(a.y),l=e(n.x.mul(o),n.y),h=e(t.center.uniform.x.mul(o),t.center.uniform.y.oneMinus()),u=i(l,h),c=u.div(t.radius.uniform).clamp(s(0),s(1));return r(t.startColor.uniform,t.endColor.uniform,c)}};function yme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const rz={blendMode:"normal"};try{Sh&&Sh.props&&Object.entries(Sh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(rz[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const xme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${Sh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>yme(t,rz),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(Sh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Sh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},Mh={name:"Ripple",props:{intensity:{default:1,description:"Overall ripple intensity",ui:{type:"range",min:0,max:5,step:.1,label:"Intensity"}},rippleSpeed:{default:150,description:"Speed of ripple expansion",ui:{type:"range",min:50,max:500,step:10,label:"Ripple Speed"}},damping:{default:.95,description:"Water damping (higher = less decay)",ui:{type:"range",min:.8,max:.99,step:.01,label:"Damping"}},mouseIntensity:{default:1,description:"Mouse movement ripple strength",ui:{type:"range",min:0,max:3,step:.1,label:"Mouse Intensity"}}},fragmentNode:({uniforms:t,onBeforeRender:e,childNode:r,onCleanup:s,canvas:i})=>{let{vec2:n,vec4:a,screenUV:o,convertToTexture:l,texture:h}=_t;if(!r)return a(0,0,0,0);let u=Math.round(i.clientWidth),c=Math.round(i.clientHeight),d=l(r,u,c),p=128,m={current:new Float32Array(p*p),previous:new Float32Array(p*p)};for(let te=0;te<p*p;te++)m.current[te]=0,m.previous[te]=0;let f=new Gv(m.current,p,p,SQ,Xd);f.minFilter=nn,f.magFilter=nn,f.needsUpdate=!0;let g=h(f),b=.5,v=.5,w=0,T=(te,oe,ae)=>{let ge=te/i.clientWidth,fe=oe/i.clientHeight,ve=Math.floor(ge*p),me=Math.floor(fe*p),he=8,Te=ae*.5;for(let Ge=-8;Ge<=he;Ge++)for(let He=-8;He<=he;He++){let ft=Ge*Ge+He*He;if(ft<=he*he){let ht=ve+Ge,Ft=me+He;if(ht>=0&&ht<p&&Ft>=0&&Ft<p){let ri=Ft*p+ht,ar=Math.sqrt(ft),et=1-ar/he,Wr=Math.cos(ar/he*Math.PI*.5)*Te*et;m.previous[ri]+=Wr}}}},N=()=>{let te=t.damping.uniform.value;for(let ae=1;ae<p-1;ae++)for(let ge=1;ge<p-1;ge++){let fe=ae*p+ge,ve=m.previous[fe-p],me=m.previous[fe+p],he=m.previous[fe-1],Te=m.previous[fe+1];m.current[fe]=(ve+me+he+Te)/2-m.current[fe],m.current[fe]*=te,m.current[fe]=Math.max(-2,Math.min(2,m.current[fe]))}for(let ae=0;ae<p;ae++)m.current[ae]=0,m.current[(p-1)*p+ae]=0,m.current[ae*p]=0,m.current[ae*p+(p-1)]=0;let oe=m.current;m.current=m.previous,m.previous=oe,f.image.data=m.current,f.needsUpdate=!0};e(({pointer:te})=>{let oe=performance.now();if(oe-w>=16){w=oe;let ae=te.x*i.clientWidth,ge=te.y*i.clientHeight,fe=ae-b*i.clientWidth,ve=ge-v*i.clientHeight,me=Math.sqrt(fe*fe+ve*ve);if(me>2){let he=me/16,Te=Math.min(he/10,2),Ge=Math.min(me/20,1),He=Ge*Te*t.mouseIntensity.uniform.value;T(ae,ge,He)}b=te.x,v=te.y}N()}),s(()=>{f.dispose()});let S=o,_=t.intensity.uniform,A=1/p,D=g.sample(S.add(n(A,0))).r.sub(g.sample(S.sub(n(A,0))).r),K=g.sample(S.add(n(0,A))).r.sub(g.sample(S.sub(n(0,A))).r),J=n(D,K).mul(_).mul(.05),re=o.add(J);return d.sample(re)}};function bme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const sz={blendMode:"normal"};try{Mh&&Mh.props&&Object.entries(Mh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(sz[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const vme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${Mh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>bme(t,sz),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(Mh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Mh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},_h={name:"Saturation",props:{intensity:{default:1,description:"The intensity of the saturation effect (1 being no change)",ui:{type:"range",min:0,max:3,step:.01,label:"Intensity"}}},fragmentNode:({uniforms:t,childNode:e})=>{let{vec4:r}=_t;if(!e)return console.error("You must pass a child component into the Saturation shader."),r(0);let s=e||r(0,0,0,0);return r(Hpe(s.rgb,t.intensity.uniform).rgb,s.a)}};function Tme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const iz={blendMode:"normal"};try{_h&&_h.props&&Object.entries(_h.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(iz[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const wme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${_h.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>Tme(t,iz),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(_h,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,_h.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},Nh={name:"SolidColor",props:{color:{default:"#5b18ca",transform:xs,description:"The solid color to display",ui:{type:"color",label:"Color"}}},fragmentNode:({uniforms:t})=>t.color.uniform};function Sme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const nz={blendMode:"normal"};try{Nh&&Nh.props&&Object.entries(Nh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(nz[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const Mme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${Nh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>Sme(t,nz),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(Nh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Nh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},Ah={name:"Spiral",props:{colorBack:{default:"#000000",transform:xs,description:"Background color",ui:{type:"color",label:"Background Color"}},colorFront:{default:"#ffffff",transform:xs,description:"Spiral stroke color",ui:{type:"color",label:"Spiral Color"}},strokeWidth:{default:.5,description:"Thickness of spiral stroke",ui:{type:"range",min:0,max:2,step:.01,label:"Stroke Width"}},strokeFalloff:{default:0,description:"Stroke losing width further from center",ui:{type:"range",min:0,max:1,step:.01,label:"Stroke Falloff"}},softness:{default:0,description:"Color transition sharpness (0 = hard edge, 1 = smooth fade)",ui:{type:"range",min:0,max:1,step:.01,label:"Softness"}},speed:{default:1,description:"Animation speed (negative values reverse direction)",ui:{type:"range",min:-3,max:3,step:.1,label:"Speed"}},center:{default:{x:.5,y:.5},transform:gp,description:"The center point of the spiral"},scale:{default:1,description:"Scale factor for spiral bands (higher = more bands, lower = fewer bands)",ui:{type:"range",min:.1,max:5,step:.1,label:"Scale"}}},fragmentNode:({uniforms:t})=>{let{vec2:e,vec4:r,float:s,atan:i,length:n,clamp:a,fract:o,abs:l,mix:h,smoothstep:u,screenUV:c,time:d,fwidth:p,viewportSize:m}=_t,f=m.x.div(m.y),g=e(c.x.mul(f),c.y),b=e(t.center.uniform.x.mul(f),t.center.uniform.y.oneMinus()),v=g.sub(b),w=d.mul(t.speed.uniform),T=n(v),N=T,S=i(v.y,v.x).sub(w),_=s(6.283185307),A=S.div(_),D=N.mul(t.scale.uniform).add(A),K=o(D),J=l(K.sub(.5)).mul(2),re=a(t.strokeWidth.uniform,t.strokeFalloff.uniform.mul(.005),1),te=a(t.strokeFalloff.uniform,0,1).mul(T).oneMinus(),oe=re.mul(te),ae=p(D),ge=s(4).sub(u(.05,.4,t.strokeWidth.uniform.mul(2)).mul(u(.05,.4,t.strokeWidth.uniform.oneMinus().mul(2))).mul(3)),fe=h(ge.mul(ae),p(J),a(ae,0,1)),ve=u(oe.sub(fe).sub(t.softness.uniform),oe.add(fe).add(t.softness.uniform),J),me=t.colorFront.uniform.rgb.mul(t.colorFront.uniform.a),he=t.colorFront.uniform.a,Te=t.colorBack.uniform.rgb.mul(t.colorBack.uniform.a),Ge=t.colorBack.uniform.a,He=me.mul(ve),ft=he.mul(ve),ht=He.add(Te.mul(ft.oneMinus())),Ft=ft.add(Ge.mul(ft.oneMinus()));return r(ht,Ft)}};function _me(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const az={blendMode:"normal"};try{Ah&&Ah.props&&Object.entries(Ah.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(az[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const Nme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${Ah.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>_me(t,az),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(Ah,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Ah.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},Ch={name:"Swirl",props:{colorA:{default:"#1275d8",description:"Primary gradient color",transform:xs,ui:{type:"color",label:"Primary Color"}},colorB:{default:"#e19136",description:"Secondary gradient color",transform:xs,ui:{type:"color",label:"Secondary Color"}},colorC:{default:"#320485",description:"Accent gradient color",transform:xs,ui:{type:"color",label:"Accent Color"}},speed:{default:1,description:"Flow animation speed",ui:{type:"range",min:0,max:5,step:.1,label:"Speed"}},scale:{default:5,description:"Gradient scale",ui:{type:"range",min:.1,max:20,step:.1,label:"Scale"}},complexity:{default:5,description:"Flow complexity",ui:{type:"range",min:1,max:10,step:.1,label:"Complexity"}}},fragmentNode:({uniforms:t})=>{let e=Iv(),r=Lv.mul(t.speed.uniform),s=t.scale.uniform,i=t.complexity.uniform,n=no(e.x.mul(s.mul(1.2)).add(r.mul(.8))).mul(.3),a=ff(e.y.mul(s.mul(.9)).sub(r.mul(.6))).mul(.3),o=zv(e.x.add(no(e.y.mul(i.mul(2)).add(r)).mul(.08)),e.y.add(ff(e.x.mul(i.mul(1.5)).sub(r.mul(.7))).mul(.08))),l=no(o.x.mul(s.mul(3)).add(o.y.mul(s.mul(2))).add(r.mul(.5))),h=ff(o.x.sub(o.y).mul(s.mul(2.5)).add(r.mul(.3))),u=no(o.x.mul(i).add(n).add(o.y.mul(i.mul(.8)).add(a)).add(r.mul(.4))),c=ml(l,h,u.mul(.5).add(.5)),d=o.x.mul(.7).add(o.y.mul(.3)).add(c.mul(.2)),p=ml(t.colorA.uniform,t.colorB.uniform,gb(.1,.6,d)),m=ml(p,t.colorC.uniform,gb(.4,.9,d.add(u.mul(.3)))),f=no(r.mul(3).add(d.mul(10))).mul(.02).add(1),g=m.mul(f);return Ur(g,1)}};function Ame(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const oz={blendMode:"normal"};try{Ch&&Ch.props&&Object.entries(Ch.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(oz[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const Cme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${Ch.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>Ame(t,oz),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(Ch,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Ch.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},Rh={name:"Twirl",props:{center:{default:{x:.5,y:.5},transform:gp,description:"The center point of the twirl effect"},intensity:{default:1,description:"The strength of the twirl effect",ui:{type:"range",min:-5,max:5,step:.1,label:"Intensity"}}},fragmentNode:({uniforms:t,childNode:e})=>{let{vec2:r,vec4:s,cos:i,sin:n,length:a,screenUV:o,convertToTexture:l}=_t;if(!e)return console.error("You must pass a child component into the Twirl shader."),s(0);let h=l(e),u=o,c=r(t.center.uniform.x,t.center.uniform.y.oneMinus()),d=u.sub(c),p=t.intensity.uniform.mul(a(d)),m=i(p),f=n(p),g=m.mul(d.x).sub(f.mul(d.y)),b=f.mul(d.x).add(m.mul(d.y)),v=r(g.add(c.x),b.add(c.y));return s(h.sample(v))}};function Rme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const lz={blendMode:"normal"};try{Rh&&Rh.props&&Object.entries(Rh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(lz[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const Eme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${Rh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>Rme(t,lz),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(Rh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Rh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})},Eh={name:"Vibrance",props:{intensity:{default:0,description:"The intensity of the vibrance effect",ui:{type:"range",min:-2,max:2,step:.01,label:"Intensity"}}},fragmentNode:({uniforms:t,childNode:e})=>{let{vec4:r}=_t;if(!e)return console.error("You must pass a child component into the Vibrance shader."),r(0);let s=e||r(0,0,0,0);return r(qpe(s.rgb,t.intensity.uniform).rgb,s.a)}};function Pme(t,e){let r={...e};for(const[s,i]of Object.entries(t))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const uz={blendMode:"normal"};try{Eh&&Eh.props&&Object.entries(Eh.props).forEach(([t,e])=>{const r=e;r&&typeof r=="object"&&"default"in r&&(uz[t]=r.default)})}catch(t){console.warn("Error extracting default props:",t)}const Fme=t=>{const e=L.useContext(Ee);if(!e)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=e,a=L.useMemo(()=>t.id||`${Eh.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[t.id]),o=L.useMemo(()=>Pme(t,uz),[t]),l=L.useRef(null);l.current===null&&(l.current=Bt(Eh,o,a));const h=L.useMemo(()=>({...e,ombreParentId:a}),[e,a]);if(L.useEffect(()=>{if(l.current)try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Eh.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,t.blendMode,t.opacity,t.id,t.maskSource,t.maskType]),L.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),L.useEffect(()=>{try{const u={blendMode:t.blendMode||"normal",opacity:t.opacity,id:t.id,mask:t.maskSource?{source:t.maskSource,type:t.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[t.blendMode,t.opacity,t.maskSource,t.maskType,t.id,a,n]),t.ref&&typeof t.ref=="function")try{t.ref(null)}catch{}return wt.jsx(Ee.Provider,{value:h,children:t.children})};exports.Ascii=Goe;exports.Checkerboard=Xue;exports.Circle=Zue;exports.DotGrid=Que;exports.FilmGrain=ehe;exports.GlassTiles=rhe;exports.Grayscale=Zpe;exports.Grid=Qpe;exports.GridDistortion=eme;exports.HueShift=rme;exports.ImageTexture=ime;exports.Invert=ame;exports.LinearGradient=lme;exports.Liquify=hme;exports.Pixelate=dme;exports.Posterize=gme;exports.RadialGradient=xme;exports.Ripple=vme;exports.Saturation=wme;exports.Shader=Doe;exports.SolidColor=Mme;exports.Spiral=Nme;exports.Swirl=Cme;exports.Twirl=Eme;exports.Vibrance=Fme;
|
|
508
508
|
//# sourceMappingURL=index.cjs.map
|