1globalThis.STRADA_RELEASE={commit:`8baab3aec8ff48dc5fbac483694f40eec8e5f6b2`,branch:`preview`,deploymentId:`8baab3aec8ff48dc5fbac483694f40eec8e5f6b2`};import{s as e}from"./rolldown-runtime-BO1D7fPK.js";import{t}from"./jsx-runtime-B44_mNpU.js";import{t as n}from"./react-BIe5H-YT.js";import{t as r}from"./react-dom-fK_C_gDK.js";import{E as i,j as a}from"./react-Dgkk0PLj.js";import{n as o,r as s}from"./github-slugger-CCPmYqUt.js";var c=e(t(),1),l=e(n(),1),u=new Set([`regular`,`solid`,`light`,`thin`,`sharp-solid`,`duotone`,`brands`]);function buildIconRef({library:e,name:t,style:n}){return e===`fontawesome`?n?`fontawesome:${n}:${t}`:`fontawesome:${t}`:`${e}:${t}`}function isIconLibrary(e){return e===`lucide`||e===`fontawesome`}function parseExplicitIconRef(e){let t=e.split(`:`);if(t.length===2&&isIconLibrary(t[0])&&t[0]!==`fontawesome`&&t[1])return`${t[0]}:${t[1]}`;if(t.length===2&&t[0]===`fontawesome`&&t[1])return buildIconRef({library:`fontawesome`,name:t[1]});if(t.length===3&&t[0]===`fontawesome`&&t[1]&&t[2]&&u.has(t[1]))return buildIconRef({library:`fontawesome`,style:t[1],name:t[2]})}function stringIconToRefs(e,t){if(e===``||isEmoji(e)||isRemoteUrl(e))return[];if(isLocalSvgIcon(e))return[e];let n=parseExplicitIconRef(e);return n?[n]:t.defaultLibrary===`fontawesome`?[buildIconRef({library:`fontawesome`,name:e,...t.iconType&&u.has(t.iconType)?{style:t.iconType}:{}})]:[buildIconRef({library:t.defaultLibrary,name:e})]}function iconToRefs(e,t){if(!e)return[];if(typeof e==`string`)return stringIconToRefs(e,t);let n=e.library??t.defaultLibrary;return!isIconLibrary(n)||!e.name?[]:[buildIconRef({library:n,name:e.name,...n===`fontawesome`&&e.style?{style:e.style}:{}})]}function isEmoji(e){try{return/^(?:\p{Regional_Indicator}{2}|[#*0-9]\uFE0F?\u20E3|(?:\p{Emoji_Presentation}|\p{Emoji}\uFE0F)\p{Emoji_Modifier}?)(?:\u200D(?:\p{Regional_Indicator}{2}|[#*0-9]\uFE0F?\u20E3|(?:\p{Emoji_Presentation}|\p{Emoji}\uFE0F)\p{Emoji_Modifier}?))*$/u.test(e)}catch{return/^[\u{1F600}-\u{1F64F}]|[\u{1F300}-\u{1F5FF}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]$/u.test(e)}}function isRemoteUrl(e){return e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`//`)}function localSvgPathPart(e){return e.split(/[?#]/,1)[0]??``}function isLocalSvgIcon(e){let t=localSvgPathPart(e);return!t.toLowerCase().endsWith(`.svg`)||t.startsWith(`//`)?!1:t.startsWith(`/`)||t.startsWith(`./`)||t.startsWith(`../`)}i.href;function useHolocronDataSafe(){try{return a()}catch(e){if(e instanceof Error&&e.message.includes(`FlightDataContext is missing`))return;throw e}}function withBasePath(e){return!e||!e.startsWith(`/`)||e.startsWith(`//`),e}function cssSize(e){return typeof e==`number`?`${e}px`:e}function hideBrokenImage(e){e.currentTarget.hidden=!0}function renderLibraryIcon(e,t,n,r,i){let a=e.icons[t];if(!a)return null;let o=cssSize(n);return(0,c.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`${a.left??0} ${a.top??0} ${a.width} ${a.height}`,width:o,height:o,className:r,style:{display:`inline-block`,flexShrink:0,width:o,height:o,...i},dangerouslySetInnerHTML:{__html:a.body}})}function Icon({icon:e,size:t=16,className:n,iconType:r,color:i,fallback:a}){let o=useHolocronDataSafe(),s=o?.site?.icons,l=i?{color:i}:void 0;if(!e)return null;if(typeof e==`string`){if(e===``)return null;if(isEmoji(e))return(0,c.jsx)(`span`,{"aria-hidden":`true`,className:n,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,fontSize:cssSize(t),lineHeight:1,flexShrink:0,...l},children:e});if(isLocalSvgIcon(e)){let i=iconToRefs(e,{defaultLibrary:o?.site?.config?.icons?.library??`lucide`,iconType:r})[0];return i&&s?renderLibraryIcon(s,i,t,n,l)??a??null:a??null}if(isRemoteUrl(e)||e.startsWith(`/`)){let r=cssSize(t);return(0,c.jsx)(`img`,{src:withBasePath(e),alt:``,loading:`lazy`,decoding:`async`,onError:hideBrokenImage,width:typeof t==`number`?t:void 0,height:typeof t==`number`?t:void 0,className:n,style:{display:`inline-block`,flexShrink:0,width:r,height:r}})}}let u=iconToRefs(e,{defaultLibrary:o?.site?.config?.icons?.library??`lucide`,iconType:r})[0];return u&&s?renderLibraryIcon(s,u,t,n,l)??a??null:a??null}
1(0,c.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,fill:`currentColor`,"aria-hidden":`true`,children:(0,c.jsx)(`path`,{d:`M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z`})}),(0,c.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,fill:`currentColor`,"aria-hidden":`true`,children:(0,c.jsx)(`path`,{d:`M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575L6.457 1.047ZM8 5a.75.75 0 0 0-.75.75v2.5a.75.75 0 0 0 1.5 0v-2.5A.75.75 0 0 0 8 5Zm1 7a1 1 0 1 0-2 0 1 1 0 0 0 2 0Z`})}),(0,c.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,fill:`currentColor`,"aria-hidden":`true`,children:(0,c.jsx)(`path`,{d:`M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z`})}),(0,c.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,fill:`currentColor`,"aria-hidden":`true`,children:(0,c.jsx)(`path`,{d:`M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75ZM5.75 12a.75.75 0 0 0 0 1.5h4.5a.75.75 0 0 0 0-1.5h-4.5Z`})}),(0,c.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,fill:`currentColor`,"aria-hidden":`true`,children:(0,c.jsx)(`path`,{d:`M8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16Zm3.78-9.72a.751.751 0 0 0-.018-1.042.751.751 0 0 0-1.042-.018L6.75 9.19 5.28 7.72a.751.751 0 0 0-1.042.018.751.751 0 0 0-.018 1.042l2 2a.75.75 0 0 0 1.06 0l4.5-4.5Z`})}),(0,c.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,fill:`currentColor`,"aria-hidden":`true`,children:(0,c.jsx)(`path`,{d:`M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm3.78 4.53v3.5a.75.75 0 0 0 1.5 0v-3.5a.75.75 0 0 0-1.5 0ZM9 11a1 1 0 1 0-2 0 1 1 0 0 0 2 0Z`})});function cn(...e){return o(s(e))}function renderCompatIcon({icon:e,iconType:t,size:n=16,color:r}){return e?typeof e==`string`?(0,c.jsx)(Icon,{icon:e,iconType:t,size:n,color:r}):e:null}function Chevron(){return(0,c.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center text-muted-foreground`,children:[(0,c.jsx)(`svg`,{className:`block h-4 w-4 group-open:hidden`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,c.jsx)(`path`,{d:`M6 4.5 9.5 8 6 11.5`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,c.jsx)(`svg`,{className:`hidden h-4 w-4 group-open:block`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,c.jsx)(`path`,{d:`M4.5 6 8 9.5 11.5 6`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})]})}function Expandable({title:e=`Expandable`,description:t,icon:n,iconType:r,iconLibrary:i,defaultOpen:a=!1,className:o=``,children:s}){let l=a===!0||a===`true`;return(0,c.jsxs)(`details`,{className:cn(`no-bleed group rounded-lg border border-border-subtle bg-background`,o),open:l,children:[(0,c.jsxs)(`summary`,{className:`flex cursor-pointer select-none list-none items-center gap-3 px-4 py-3 text-sm [&::-webkit-details-marker]:hidden`,children:[renderCompatIcon({icon:n,iconType:r,size:16}),(0,c.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,c.jsx)(`span`,{className:`font-semibold text-foreground`,children:e}),t&&(0,c.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:t})]}),(0,c.jsx)(Chevron,{})]}),(0,c.jsx)(`div`,{className:`no-bleed flex flex-col gap-3 px-4 pb-4 text-sm text-foreground`,children:s})]})}r();function compileShader(e,t,n){let r=e.createShader(t);if(!r)throw Error(`WebGL unavailable: createShader returned null (context lost?)`);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS)){let t=e.getShaderInfoLog(r);throw e.deleteShader(r),Error(`Shader compile: ${t}`)}return r}function createGpuProgram(e,t,n){let r=compileShader(e,e.VERTEX_SHADER,t),i=compileShader(e,e.FRAGMENT_SHADER,n),a=e.createProgram();if(!a)throw Error(`WebGL unavailable: createProgram returned null (context lost?)`);if(e.attachShader(a,r),e.attachShader(a,i),e.bindAttribLocation(a,0,`position`),e.bindAttribLocation(a,1,`uv`),e.linkProgram(a),e.deleteShader(r),e.deleteShader(i),!e.getProgramParameter(a,e.LINK_STATUS)){let t=e.getProgramInfoLog(a);throw e.deleteProgram(a),Error(`Program link: ${t}`)}let o=new Map,s=e.getProgramParameter(a,e.ACTIVE_UNIFORMS);for(let t=0;t<s;t++){let n=e.getActiveUniform(a,t);if(!n)continue;let r=e.getUniformLocation(a,n.name);r&&o.set(n.name,r)}return{program:a,loc(e){let t=o.get(e);if(!t)throw Error(`Unknown uniform: ${e}`);return t},dispose(e){e.deleteProgram(a)}}}function createFBO(e,t,n,r){let i=e.createTexture();e.bindTexture(e.TEXTURE_2D,i),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,n,0,e.RGBA,r,null);let a=e.createFramebuffer();return e.bindFramebuffer(e.FRAMEBUFFER,a),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,i,0),e.bindFramebuffer(e.FRAMEBUFFER,null),{framebuffer:a,texture:i,width:t,height:n}}function createDoubleFBO(e,t,n,r){let i={read:createFBO(e,t,n,r),write:createFBO(e,t,n,r),swap(){let e=i.read;i.read=i.write,i.write=e}};return i}function createQuadBuffers(e){let t=new Float32Array([-1,-1,0,1,-1,0,-1,1,0,1,1,0]),n=new Float32Array([0,0,1,0,0,1,1,1]),r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW);let i=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,n,e.STATIC_DRAW),{positionBuffer:r,uvBuffer:i}}function bindQuad(e,t){e.bindBuffer(e.ARRAY_BUFFER,t.positionBuffer),e.enableVertexAttribArray(0),e.vertexAttribPointer(0,3,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,t.uvBuffer),e.enableVertexAttribArray(1),e.vertexAttribPointer(1,2,e.FLOAT,!1,0,0)}function setTexture(e,t,n,r,i){e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,r),e.uniform1i(t.loc(n),i)}function drawPass(e,t){t?(e.bindFramebuffer(e.FRAMEBUFFER,t.framebuffer),e.viewport(0,0,t.width,t.height)):(e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight)),e.drawArrays(e.TRIANGLE_STRIP,0,4)}function createEmptyTexture(e){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array([0,0,0,0])),t}function disposeFBO(e,t){e.deleteFramebuffer(t.framebuffer),e.deleteTexture(t.texture)}function disposeDoubleFBO(e,t){disposeFBO(e,t.read),disposeFBO(e,t.write)}var d=` 2 precision highp float; 3 attribute vec3 position; 4 attribute vec2 uv; 5 varying vec2 vUv; 6 void main() { 7 vUv = uv;
8 gl_Position = vec4(position, 1.0); 9 } 10`,f=` 11 precision highp float; 12 attribute vec2 uv; 13 attribute vec3 position; 14 varying vec2 vUv; 15 varying vec2 vL; 16 varying vec2 vR; 17 varying vec2 vT; 18 varying vec2 vB; 19 uniform vec2 texelSize; 20 21 void main() { 22 vUv = uv; 23 vL = vUv - vec2(texelSize.x, 0.0); 24 vR = vUv + vec2(texelSize.x, 0.0); 25 vT = vUv + vec2(0.0, texelSize.y); 26 vB = vUv - vec2(0.0, texelSize.y); 27 gl_Position = vec4(position, 1.0); 28 } 29`,p=` 30 precision highp float; 31 uniform sampler2D uVelocity; 32 uniform sampler2D uSource; 33 uniform vec2 texelSize; 34 uniform float dt; 35 uniform float dissipation; 36 varying vec2 vUv; 37 38 void main() { 39 vec2 coord = vUv - dt * texture2D(uVelocity, vUv).xy * texelSize; 40 gl_FragColor = dissipation * texture2D(uSource, coord); 41 } 42`,m=` 43 precision highp float; 44 uniform sampler2D uVelocity; 45 varying vec2 vUv; 46 varying vec2 vL; 47 varying vec2 vR; 48 varying vec2 vT; 49 varying vec2 vB; 50 51 void main() { 52 float L = texture2D(uVelocity, vL).x; 53 float R = texture2D(uVelocity, vR).x; 54 float T = texture2D(uVelocity, vT).y; 55 float B = texture2D(uVelocity, vB).y; 56 float div = 0.5 * (R - L + T - B); 57 gl_FragColor = vec4(div, 0.0, 0.0, 1.0); 58 } 59`,h=` 60 precision highp float; 61 uniform sampler2D uVelocity; 62 varying vec2 vUv; 63 varying vec2 vL; 64 varying vec2 vR; 65 varying vec2 vT; 66 varying vec2 vB; 67 68 void main() { 69 float L = texture2D(uVelocity, vL).y; 70 float R = texture2D(uVelocity, vR).y; 71 float T = texture2D(uVelocity, vT).x; 72 float B = texture2D(uVelocity, vB).x; 73 float vorticity = R - L - T + B; 74 gl_FragColor = vec4(0.5 * vorticity, 0.0, 0.0, 1.0); 75 } 76`,g=` 77 precision highp float; 78 uniform sampler2D uVelocity; 79 uniform sampler2D uCurl; 80 uniform float curl; 81 uniform float dt; 82 varying vec2 vUv; 83 varying vec2 vL; 84 varying vec2 vR; 85 varying vec2 vT; 86 varying vec2 vB; 87 88 void main() { 89 float L = texture2D(uCurl, vL).x; 90 float R = texture2D(uCurl, vR).x; 91 float T = texture2D(uCurl, vT).x; 92 float B = texture2D(uCurl, vB).x; 93 float C = texture2D(uCurl, vUv).x; 94 vec2 force = 0.5 * vec2(abs(T) - abs(B), abs(R) - abs(L)); 95 force /= length(force) + 0.0001; 96 force *= curl * C; 97 force.y *= -1.0; 98 vec2 vel = texture2D(uVelocity, vUv).xy; 99 gl_FragColor = vec4(vel + force * dt, 0.0, 1.0); 100 } 101`,_=` 102 precision highp float; 103 uniform sampler2D uPressure; 104 uniform sampler2D uDivergence; 105 varying vec2 vUv; 106 varying vec2 vL; 107 varying vec2 vR; 108 varying vec2 vT; 109 varying vec2 vB; 110 111 void main() { 112 float L = texture2D(uPressure, vL).x; 113 float R = texture2D(uPressure, vR).x; 114 float T = texture2D(uPressure, vT).x; 115 float B = texture2D(uPressure, vB).x; 116 float divergence = texture2D(uDivergence, vUv).x; 117 float pressure = (L + R + B + T - divergence) * 0.25; 118 gl_FragColor = vec4(pressure, 0.0, 0.0, 1.0); 119 } 120`,v=` 121 precision highp float; 122 uniform sampler2D uPressure; 123 uniform sampler2D uVelocity; 124 varying vec2 vUv; 125 varying vec2 vL; 126 varying vec2 vR; 127 varying vec2 vT; 128 varying vec2 vB; 129 130 void main() { 131 float L = texture2D(uPressure, vL).x; 132 float R = texture2D(uPressure, vR).x; 133 float T = texture2D(uPressure, vT).x; 134 float B = texture2D(uPressure, vB).x; 135 vec2 velocity = texture2D(uVelocity, vUv).xy; 136 velocity.xy -= vec2(R - L, T - B); 137 gl_FragColor = vec4(velocity, 0.0, 1.0); 138 } 139`,y=` 140 precision highp float; 141 uniform sampler2D uTarget; 142 uniform float aspectRatio; 143 uniform vec3 color; 144 uniform vec2 point; 145 uniform float radius; 146 varying vec2 vUv; 147 148 void main() { 149 vec2 p = vUv - point; 150 p.x *= aspectRatio; 151 vec3 splat = exp(-dot(p, p) / radius) * color; 152 vec3 base = texture2D(uTarget, vUv).xyz; 153 gl_FragColor = vec4(base + splat, 1.0); 154 } 155`,b=` 156 precision highp float; 157 uniform sampler2D uDye; 158 uniform sampler2D uVideo; 159 uniform sampler2D uMask; 160 uniform bool enableMask; 161 uniform float fluidStrength; 162 uniform float gridCellSize; 163 uniform float dotRadius; 164 uniform float minDotRadius; 165 uniform vec2 videoResolution; 166 uniform float time; 167 uniform float animSpeed; 168 uniform float gamma; 169 uniform int gridLayout; 170 uniform vec3 dotColor; 171 uniform float dotAlphaMultiplier; 172 uniform bool dotsEnabled; 173 uniform float minLuminance; 174 uniform int dotStyle; 175 uniform sampler2D uCharAtlas; 176 uniform float charCount; 177 varying vec2 vUv; 178 179 float random(vec2 st) { 180 return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123); 181 } 182 183 vec4 premultipliedDotColor(float alpha) { 184 float a = clamp(alpha, 0.0, 1.0); 185 return vec4(dotColor * a, a); 186 } 187 188 void main() { 189 vec2 gridPos; 190 vec2 cellCenter; 191 vec2 cellIndex; 192 vec2 centerUv; 193 float distanceFromCenter;
194 float aspectRatio = videoResolution.x / videoResolution.y; 195 196 if (gridLayout == 1) { 197 // Radial layout 198 vec2 pixelPos = vUv * videoResolution; 199 vec2 center = videoResolution * 0.5; 200 float minDim = min(videoResolution.x, videoResolution.y); 201 vec2 normalizedPos = (pixelPos - center) / minDim; 202 float angle = atan(normalizedPos.y, normalizedPos.x); 203 float radius = length(normalizedPos) * minDim; 204 float ringIndex = floor(radius / gridCellSize); 205 vec2 dotCenterNormalized; 206 float dotIndex; 207 if (ringIndex < 0.5) { 208 dotCenterNormalized = vec2(0.0, 0.0); 209 dotIndex = 0.0; 210 } else { 211 float ringRadius = ringIndex * gridCellSize; 212 float circumference = 6.28318 * ringRadius; 213 float numDotsInRing = max(1.0, floor(circumference / gridCellSize)); 214 float anglePerDot = 6.28318 / numDotsInRing; 215 dotIndex = floor(angle / anglePerDot); 216 float dotAngle = (dotIndex + 0.5) * anglePerDot; 217 float dotRad = (ringIndex + 0.5) * gridCellSize; 218 dotCenterNormalized = vec2(cos(dotAngle), sin(dotAngle)) * (dotRad / minDim); 219 } 220 vec2 dotCenterPixel = dotCenterNormalized * minDim + center; 221 vec2 toDotNormalized = normalizedPos - dotCenterNormalized; 222 distanceFromCenter = length(toDotNormalized) * minDim; 223 centerUv = dotCenterPixel / videoResolution; 224 cellIndex = vec2(ringIndex, dotIndex); 225 gridPos = vec2(0.0); 226 cellCenter = vec2(0.0); 227 } else if (gridLayout == 2) { 228 // Alternating grid (brick pattern) 229 cellIndex = floor(vUv * videoResolution / gridCellSize); 230 float rowOffset = mod(cellIndex.y, 2.0) * gridCellSize * 0.5; 231 vec2 offsetPixel = vUv * videoResolution + vec2(rowOffset, 0.0); 232 cellIndex = floor(offsetPixel / gridCellSize); 233 centerUv = ((cellIndex + 0.5) * gridCellSize - vec2(rowOffset, 0.0)) / videoResolution; 234 gridPos = mod(offsetPixel, gridCellSize); 235 cellCenter = vec2(gridCellSize * 0.5); 236 distanceFromCenter = length(gridPos - cellCenter); 237 } else { 238 // Straight layout (default) 239 gridPos = mod(vUv * videoResolution, gridCellSize); 240 cellCenter = vec2(gridCellSize * 0.5); 241 cellIndex = floor(vUv * videoResolution / gridCellSize); 242 centerUv = ((cellIndex + 0.5) * gridCellSize) / videoResolution; 243 distanceFromCenter = length(gridPos - cellCenter); 244 } 245 246 vec4 video = texture2D(uVideo, centerUv); 247 vec4 dye = texture2D(uDye, centerUv); 248 vec3 videoGammaCorrected = pow(video.rgb, vec3(gamma)); 249 vec3 scaledDye = dye.rgb * fluidStrength; 250 scaledDye = pow(scaledDye + 0.001, vec3(0.7)); 251 float videoLuminance = dot(videoGammaCorrected + scaledDye, vec3(0.299, 0.587, 0.114)); 252 float dyeLuminance = dot(dye.rgb, vec3(0.299, 0.587, 0.114)); 253 float luminance = max(max(videoLuminance, dyeLuminance), minLuminance); 254 255 if (enableMask) { 256 vec4 mask = texture2D(uMask, vUv); 257 float maskAlpha = mask.a; 258 luminance = luminance * maskAlpha; 259 } 260 261 luminance = clamp(luminance, 0.0, 1.0); 262 263 if (!dotsEnabled) { 264 gl_FragColor = premultipliedDotColor(luminance * dotAlphaMultiplier); 265 return; 266 } 267 268 // ASCII mode: sample character glyph from a font atlas texture. 269 // Characters are ordered by visual weight in the atlas. Luminance picks 270 // the base index; per-cell random jitter adds variety so neighboring 271 // cells at similar brightness show different characters. 272 if (dotStyle == 1) { 273 // Per-cell hash that changes over time: each cell shifts character 274 // ~3 times/sec with a discrete jump (floor quantizes so it doesn't flicker) 275 float r = random(cellIndex + floor(time * 3.0)); 276 float idx = luminance * (charCount - 1.0) + (r - 0.5) * 5.0; 277 idx = clamp(idx, 0.0, charCount - 1.0); 278 float ci = floor(idx); 279 vec2 cellPos = clamp(gridPos / gridCellSize, vec2(0.01), vec2(0.99)); 280 vec2 atlasUv = vec2((ci + cellPos.x) / charCount, cellPos.y); 281 float charMask = texture2D(uCharAtlas, atlasUv).r; 282 float luminanceCutoff = smoothstep(0.0, 0.05, luminance); 283 float finalAlpha = charMask * luminance * luminanceCutoff * dotAlphaMultiplier; 284 gl_FragColor = premultipliedDotColor(finalAlpha); 285 return; 286 } 287 288 float randomValue = random(cellIndex); 289 float phase = randomValue * 6.28318; 290 float scaleAnimation = sin(time * animSpeed + phase) * 0.5 + 0.5; 291 float randomScale = 1.0 - (scaleAnimation * 0.5); 292 float luminanceMinScale = min(minDotRadius / dotRadius, 1.0); 293 float finalScale = (luminanceMinScale + (luminance * (1.0 - luminanceMinScale))) * randomScale; 294 float scaledRadiusVal = dotRadius * finalScale; 295 float maxRadius = gridCellSize * 0.5; 296 scaledRadiusVal = min(scaledRadiusVal, maxRadius); 297 float edgeWidth = 0.5; 298 float dotMask = 1.0 - smoothstep(scaledRadiusVal - edgeWidth, scaledRadiusVal + edgeWidth, distanceFromCenter); 299 float luminanceCutoff = smoothstep(0.0, 0.1, luminance); 300 float finalAlpha = dotMask * luminance * luminanceCutoff * dotAlphaMultiplier; 301 302 gl_FragColor = premultipliedDotColor(finalAlpha); 303 } 304`,x={maskSrc:``,dotsEnabled:!0,dotSize:6,minDotSize:1,dotMargin:0,dotColor:`#5b7cff`,dotAlphaMultiplier:1,gridLayout:`straight`,enableMask:!1,animSpeed:4,gamma:.9,loopAt:4,fluidCurl:100,fluidVelocityDissipation:.93,fluidDyeDissipation:.95,fluidSplatRadius:.006,fluidPressureIterations:1,fluidStrength:.
30415,minLuminance:.2,dotStyle:`dots`,chars:` .:-~=+x?$%#@A`,charFont:`monospace`};function parseColorNormalized(e){let t=e.trim(),n=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)$/i.exec(t);if(n)return{r:Number(n[1])/255,g:Number(n[2])/255,b:Number(n[3])/255,a:n[4]==null?1:Number(n[4])};let r=t.replace(/^#/,``),i=1,a=1,o=1,s=1;return r.length===3||r.length===4?(i=Number.parseInt(r[0]+r[0],16)/255,a=Number.parseInt(r[1]+r[1],16)/255,o=Number.parseInt(r[2]+r[2],16)/255,r.length===4&&(s=Number.parseInt(r[3]+r[3],16)/255)):(r.length===6||r.length===8)&&(i=Number.parseInt(r.slice(0,2),16)/255,a=Number.parseInt(r.slice(2,4),16)/255,o=Number.parseInt(r.slice(4,6),16)/255,r.length===8&&(s=Number.parseInt(r.slice(6,8),16)/255)),{r:i,g:a,b:o,a:s}}function createCharAtlas(e,t,n){let r=document.createElement(`canvas`);r.width=t.length*64,r.height=64;let i=r.getContext(`2d`);i.fillStyle=`black`,i.fillRect(0,0,r.width,r.height),i.fillStyle=`white`,i.font=`900 54px ${n}`,i.textAlign=`center`,i.textBaseline=`middle`;for(let e=0;e<t.length;e++)i.fillText(t[e],(e+.5)*64,33.28);let a=e.createTexture();return e.bindTexture(e.TEXTURE_2D,a),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,r),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),r.width=0,r.height=0,{texture:a,count:t.length}}function createVideoShaderEngine(e,t){let n=e.clientWidth,r=e.clientHeight,i=Math.min(2,window.devicePixelRatio||1),a=document.createElement(`canvas`);a.width=n*i,a.height=r*i,a.style.width=n+`px`,a.style.height=r+`px`,e.appendChild(a);let o=a.getContext(`webgl`,{antialias:!1,alpha:!0,premultipliedAlpha:!0});if(!o||o.isContextLost())throw a.remove(),Error(`WebGL unavailable: could not create a webgl context`);let s=o,c=s.getExtension(`OES_texture_half_float`);s.getExtension(`OES_texture_float`),s.getExtension(`EXT_color_buffer_half_float`),s.getExtension(`WEBGL_color_buffer_float`);function pickRenderableTexType(){let e=[...c?[c.HALF_FLOAT_OES]:[],s.FLOAT,s.UNSIGNED_BYTE];for(let t of e){let e=createFBO(s,4,4,t);s.bindFramebuffer(s.FRAMEBUFFER,e.framebuffer);let n=s.checkFramebufferStatus(s.FRAMEBUFFER)===s.FRAMEBUFFER_COMPLETE;if(s.bindFramebuffer(s.FRAMEBUFFER,null),disposeFBO(s,e),n)return t}return s.UNSIGNED_BYTE}let l=pickRenderableTexType(),u=Math.floor(n/2),x=Math.floor(r/2),S=createDoubleFBO(s,u,x,l),C=createDoubleFBO(s,u,x,l),w=createFBO(s,u,x,l),T=createFBO(s,u,x,l),E=createDoubleFBO(s,u,x,l),D=document.createElement(`video`);D.src=t.src,D.loop=!1,D.muted=!0,D.playsInline=!0,D.preload=`auto`,D.addEventListener(`ended`,()=>{D.currentTime=t.loopAt,D.play().catch(()=>{})}),t.onReady&&(D.readyState>=3?t.onReady():D.addEventListener(`canplay`,()=>t.onReady(),{once:!0}));let O=createEmptyTexture(s),k=!1,A=createEmptyTexture(s);if(t.enableMask&&t.maskSrc){let e=new Image;e.onload=()=>{k||(s.bindTexture(s.TEXTURE_2D,A),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,e))},e.src=t.maskSrc}let j=t.dotStyle===`ascii`?createCharAtlas(s,t.chars,t.charFont):{texture:createEmptyTexture(s),count:1},M=createQuadBuffers(s);bindQuad(s,M);let N=createGpuProgram(s,f,p),P=createGpuProgram(s,f,m),F=createGpuProgram(s,f,h),I=createGpuProgram(s,f,g),L=createGpuProgram(s,f,_),R=createGpuProgram(s,f,v),z=createGpuProgram(s,f,y),B=createGpuProgram(s,d,b),V=1/u,H=1/x;for(let e of[N,P,F,I,L,R])s.useProgram(e.program),s.uniform2f(e.loc(`texelSize`),V,H);s.useProgram(I.program),s.uniform1f(I.loc(`curl`),t.fluidCurl),s.useProgram(z.program),s.uniform1f(z.loc(`aspectRatio`),n/r),s.uniform1f(z.loc(`radius`),t.fluidSplatRadius);let U={straight:0,radial:1,"alternating-grid":2}[t.gridLayout]||0,W=parseColorNormalized(t.dotColor);s.useProgram(B.program),s.uniform1f(B.loc(`fluidStrength`),t.fluidStrength),s.uniform1f(B.loc(`gridCellSize`),t.dotSize+t.dotMargin),s.uniform1f(B.loc(`dotRadius`),t.dotSize/2),s.uniform1f(B.loc(`minDotRadius`),t.minDotSize/2),s.uniform2f(B.loc(`videoRes
304olution`),n,r),s.uniform1f(B.loc(`animSpeed`),t.animSpeed),s.uniform1f(B.loc(`gamma`),t.gamma),s.uniform1i(B.loc(`gridLayout`),U),s.uniform3f(B.loc(`dotColor`),W.r,W.g,W.b),s.uniform1f(B.loc(`dotAlphaMultiplier`),t.dotAlphaMultiplier*W.a),s.uniform1i(B.loc(`enableMask`),+!!t.enableMask),s.uniform1i(B.loc(`dotsEnabled`),+!!t.dotsEnabled),s.uniform1f(B.loc(`minLuminance`),t.minLuminance),s.uniform1i(B.loc(`dotStyle`),+(t.dotStyle===`ascii`)),s.uniform1f(B.loc(`charCount`),j.count);function stepFluid(e){s.useProgram(N.program),s.uniform1f(N.loc(`dt`),e),setTexture(s,N,`uVelocity`,S.read.texture,0),setTexture(s,N,`uSource`,S.read.texture,1),s.uniform1f(N.loc(`dissipation`),t.fluidVelocityDissipation),drawPass(s,S.write),S.swap(),s.useProgram(N.program),setTexture(s,N,`uVelocity`,S.read.texture,0),setTexture(s,N,`uSource`,C.read.texture,1),s.uniform1f(N.loc(`dissipation`),t.fluidDyeDissipation),drawPass(s,C.write),C.swap(),s.useProgram(F.program),setTexture(s,F,`uVelocity`,S.read.texture,0),drawPass(s,T),s.useProgram(I.program),setTexture(s,I,`uVelocity`,S.read.texture,0),setTexture(s,I,`uCurl`,T.texture,1),s.uniform1f(I.loc(`dt`),e),drawPass(s,S.write),S.swap(),s.useProgram(P.program),setTexture(s,P,`uVelocity`,S.read.texture,0),drawPass(s,w),s.useProgram(L.program),setTexture(s,L,`uDivergence`,w.texture,1);for(let e=0;e<t.fluidPressureIterations;e++)setTexture(s,L,`uPressure`,E.read.texture,0),drawPass(s,E.write),E.swap();s.useProgram(R.program),setTexture(s,R,`uPressure`,E.read.texture,0),setTexture(s,R,`uVelocity`,S.read.texture,1),drawPass(s,S.write),S.swap()}function splat(e,i,a,o){s.useProgram(z.program),s.uniform1f(z.loc(`aspectRatio`),n/r),setTexture(s,z,`uTarget`,S.read.texture,0),s.uniform2f(z.loc(`point`),e/n,1-i/r),s.uniform3f(z.loc(`color`),a*5e3,-o*5e3,0),s.uniform1f(z.loc(`radius`),t.fluidSplatRadius),drawPass(s,S.write),S.swap(),setTexture(s,z,`uTarget`,C.read.texture,0),s.uniform3f(z.loc(`color`),W.r*.8,W.g*.8,W.b*.8),drawPass(s,C.write),C.swap()}let G=0,K=0;function onMouseMove(t){let n=e.getBoundingClientRect(),r=t.clientX-n.left,i=t.clientY-n.top,a=r-G,o=i-K;G=r,K=i,(Math.abs(a)>.1||Math.abs(o)>.1)&&splat(r,i,a*.01,o*.01)}e.addEventListener(`mousemove`,onMouseMove);let q,J=performance.now(),Y=performance.now(),tryPlay;D.play().catch(()=>{tryPlay=()=>{D.play().catch(()=>{}),tryPlay&&document.removeEventListener(`click`,tryPlay),tryPlay=void 0},document.addEventListener(`click`,tryPlay)});function animate(){if(q=requestAnimationFrame(animate),s.isContextLost())return;let e=performance.now(),t=Math.min((e-J)/1e3,.033);J=e;try{D.readyState>=D.HAVE_CURRENT_DATA&&(s.bindTexture(s.TEXTURE_2D,O),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,D)),stepFluid(t),s.useProgram(B.program),s.uniform1f(B.loc(`time`),(e-Y)/1e3),setTexture(s,B,`uDye`,C.read.texture,0),setTexture(s,B,`uVideo`,O,1),setTexture(s,B,`uMask`,A,2),setTexture(s,B,`uCharAtlas`,j.texture,3),drawPass(s,null)}catch(e){cancelAnimationFrame(q),console.warn(`VideoBackgroundShader: render loop stopped`,e)}}function onContextLost(e){e.preventDefault(),cancelAnimationFrame(q)}a.addEventListener(`webglcontextlost`,onContextLost),animate();function onResize(){n=e.clientWidth,r=e.clientHeight,a.width=n*i,a.height=r*i,a.style.width=n+`px`,a.style.height=r+`px`,s.useProgram(B.program),s.uniform2f(B.loc(`videoResolution`),n,r),s.useProgram(z.program),s.uniform1f(z.loc(`aspectRatio`),n/r)}let X=new ResizeObserver(onResize);X.observe(e);function cleanup(){k=!0,cancelAnimationFrame(q),a.removeEventListener(`webglcontextlost`,onContextLost),e.removeEventListener(`mousemove`,onMouseMove),tryPlay&&document.removeEventListener(`click`,tryPlay),X.disconnect(),D.pause(),D.src=``,N.dispose(s),P.dispose(s),F.dispose(s),I.dispose(s),L.dispose(s),R.dispose(s),z.dispose(s),B.dispose(s),disposeDoubleFBO(s,S),disposeDoubleFBO(s,C),disposeFBO(s,w),disposeFBO(s,T),disposeDoubleFBO(s,E),s.deleteTexture(O),s.deleteTexture(A),s.deleteTexture(j.texture),s.deleteBuffer(M.positionBuffer),s.deleteBuffer(M.uvBuffer),a.parentElement&&a.parentElement.removeChild(a);let t=s.getExtension(`WEBGL_lose_context`);t&&t.loseContext()}return{cleanup,canvas:a,video:D}}var S=[`linear-gradient(to bottom,`,`color-mix(in srgb, var(--background) 70%, transparent) 0%,`,`color-mix(in srgb, var(--background) 50%, transparent) 20%,`,`color-mix(in srgb, var(--background) 50%, transparent) 40%,`,`transparent 55%)`].join(` `),C=[`linear-gradient(to top,`,`color-mix(in srgb, var(--background) 70%, transparent) 0%,`,`color-mix(in srgb, var(--background) 50%, transparent) 20%,`,`color-mix(in srgb, var(--background) 50%, transparent) 40%,`,`transparent 55%)`].join(` `);
304function VideoBackgroundShader({children:e,className:t,canvasClassName:n,src:r,fadeTop:i=!0,fadeBottom:a=!0,maxWidth:o=2200,...s}){let u=(0,l.useRef)(null),[d,f]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=u.current;if(!e)return;let t=setTimeout(()=>f(!0),3e3),n;try{n=createVideoShaderEngine(e,{...x,...s,src:r,onReady(){clearTimeout(t),f(!0)}})}catch(n){console.warn(`VideoBackgroundShader: WebGL init failed, rendering without shader background`,n);for(let t of e.querySelectorAll(`canvas`))t.remove();clearTimeout(t),f(!0)}return()=>{clearTimeout(t);try{n?.cleanup()}catch(e){console.warn(`VideoBackgroundShader: cleanup failed`,e)}}},[r,...Object.values(s)]);let p=`opacity 0.4s cubic-bezier(0.23, 1, 0.32, 1)`;return(0,c.jsxs)(`div`,{className:cn(`relative flex flex-col items-center overflow-hidden`,t),children:[(0,c.jsx)(`div`,{ref:u,className:cn(`absolute inset-0 w-full h-full z-0 overflow-hidden`,n),style:{maxWidth:o,margin:`0 auto`,opacity:+!!d,transition:p}}),i&&(0,c.jsx)(`div`,{className:`absolute top-0 inset-x-0 h-[15%] z-[1] pointer-events-none`,style:{background:S,opacity:+!!d,transition:p}}),a&&(0,c.jsx)(`div`,{className:`absolute bottom-0 inset-x-0 h-[12%] z-[1] pointer-events-none`,style:{background:C,opacity:+!!d,transition:p}}),!!e&&(0,c.jsx)(`div`,{className:`relative z-[2] flex flex-col items-center justify-center text-center w-full px-5 py-16 sm:py-24 gap-6`,style:{opacity:+!!d,transition:`opacity 0.3s cubic-bezier(0.23, 1, 0.32, 1)`},children:e})]})}export{Expandable as n,VideoBackgroundShader as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.