/**
 * GLSL Shaders for SpotlightBorder effect
 * Uses Signed Distance Functions (SDFs) with aspect-correct coordinates
 * Supports larger canvas for external glow and suppresses inner glow.
 */
export declare const vertexShader = "\nvarying vec2 v_texcoord;\nvoid main() {\n    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n    v_texcoord = uv;\n}\n";
export declare const fragmentShader = "\nvarying vec2 v_texcoord;\n\nuniform vec2 u_mouse;\nuniform vec2 u_resolution;         // Canvas resolution\nuniform vec2 u_contentResolution;  // Card/Content resolution\nuniform vec2 u_offset;             // Pixel offset of content within canvas\nuniform float u_pixelRatio;\nuniform vec3 u_color;\n\nuniform float u_shapeSize;\nuniform float u_roundness;\nuniform float u_borderSize;\nuniform float u_spotlightSize;\nuniform float u_spotlightEdge;\nuniform float u_glowIntensity;\n\n#ifndef PI\n#define PI 3.1415926535897932384626433832795\n#endif\n#ifndef TWO_PI\n#define TWO_PI 6.2831853071795864769252867665590\n#endif\n\n#ifndef VAR\n#define VAR 0\n#endif\n\n// Signed Distance Function for rounded box\nfloat sdRoundedBox(vec2 p, vec2 b, float r) {\n    vec2 q = abs(p) - b + r;\n    return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - r;\n}\n\n// Signed Distance Function for circle\nfloat sdCircle(vec2 p, float r) {\n    return length(p) - r;\n}\n\n// Signed Distance Function for equilateral triangle\nfloat sdPoly(vec2 p, float r, int sides) {\n    float an = PI / float(sides);\n    float en = TWO_PI / float(sides);\n    float he = r * tan(0.5 * an);\n    float a = atan(p.x, -p.y) + an; \n    float bn = floor(a / en);\n    a -= (bn + 0.5) * en;\n    p = length(p) * vec2(cos(a), sin(a));\n    return p.x * cos(an) - p.y * sin(an) - r * cos(an);\n}\n\n// Smooth stroke with anti-aliasing\nfloat smoothStroke(float d, float width, float pixelSize) {\n    float halfWidth = width * 0.5;\n    float alpha = smoothstep(halfWidth + pixelSize, halfWidth - pixelSize, abs(d));\n    return alpha;\n}\n\n// Smooth fill\nfloat smoothFill(float d, float pixelSize) {\n    return 1.0 - smoothstep(-pixelSize, pixelSize, d);\n}\n\nvoid main() {\n    // 1. Setup Coordinates relative to CONTENT area\n    // gl_FragCoord is in canvas pixels. We subtract offset to get relative to card.\n    vec2 fragRelative = gl_FragCoord.xy - u_offset;\n    vec2 uv = fragRelative / u_contentResolution.xy;\n    \n    // We want the shader to be centered at 0.5 in CONTENT area\n    float aspect = u_contentResolution.x / u_contentResolution.y;\n    vec2 p = (uv - 0.5) * vec2(aspect, 1.0);\n    \n    // Mouse setup (mouse is also relative to card)\n    vec2 mouseUV = u_mouse * u_pixelRatio / u_contentResolution.xy;\n    vec2 m = (mouseUV - 0.5) * vec2(aspect, 1.0);\n    m.y *= -1.0; \n    \n    // 2. Shape Parameters\n    vec2 boxSize = vec2(aspect, 1.0) * 0.5 * u_shapeSize;\n    float pixelSize = 1.0 / u_contentResolution.y; \n    \n    // 3. Mouse Interaction (Spotlight)\n    float mouseDist = length(p - m);\n    \n    // Spotlight follows mouse - reveal factor\n    float spotlight = smoothstep(u_spotlightSize + u_spotlightEdge, u_spotlightSize * 0.1, mouseDist);\n    \n    // 4. Draw Shape\n    float d = 0.0;\n    float borderAlpha = 0.0;\n    float glowAlpha = 0.0;\n    \n    if (VAR == 0) {\n        // Correctly scale corner radius by the shortest dimension in p-space\n        float radius = u_roundness * 0.5 * min(aspect, 1.0);\n        d = sdRoundedBox(p, boxSize, radius);\n        \n        // Sharp border stroke\n        float strokeD = d + u_borderSize * 0.5;\n        borderAlpha = smoothStroke(strokeD, u_borderSize, pixelSize * 2.0);\n        \n        // Gradual glow - ONLY OUTSIDE (d > 0)\n        float glowRadius = u_borderSize * 15.0; \n        if (d > 0.0) {\n            glowAlpha = exp(-d / (glowRadius * 0.25)) * 0.5 * u_glowIntensity;\n        } else {\n            // Suppress inner glow\n            glowAlpha = 0.0;\n        }\n    } \n    else if (VAR == 1) {\n        d = sdCircle(p, 0.5 * u_shapeSize); \n        borderAlpha = smoothFill(d, pixelSize);\n        if (d > 0.0) glowAlpha = exp(-d / 0.1) * 0.3 * u_glowIntensity;\n    }\n    else if (VAR == 2) {\n        d = sdCircle(p, 0.5 * u_shapeSize);\n        float strokeD = d + u_borderSize * 0.5;\n        borderAlpha = smoothStroke(strokeD, u_borderSize, pixelSize * 2.0);\n        if (d > 0.0) glowAlpha = exp(-d / (u_borderSize * 5.0)) * 0.4 * u_glowIntensity;\n    }\n    else if (VAR == 3) {\n        d = sdPoly(p + vec2(0.0, 0.1), 0.3 * u_shapeSize, 3);\n        borderAlpha = smoothFill(d, pixelSize);\n        if (d > 0.0) glowAlpha = exp(-d / 0.1) * 0.3 * u_glowIntensity;\n    }\n    \n    // Apply spotlight mask\n    borderAlpha *= spotlight;\n    glowAlpha *= spotlight;\n    \n    // Combine\n    float finalAlpha = max(glowAlpha, borderAlpha);\n\n    gl_FragColor = vec4(u_color, finalAlpha);\n}\n";
