{
	"$schema": "https://ui.shadcn.com/schema/registry-item.json",
	"name": "NeonLogo-JS-TW",
	"title": "NeonLogo",
	"description": "Turns any logo or word into a neon heat map that melts open under the cursor.",
	"type": "registry:component",
	"files": [
		{
			"type": "registry:component",
			"path": "NeonLogo/NeonLogo.jsx",
			"content": "'use client';\n\nimport { useEffect, useRef, useState } from 'react';\n\nconst FLOOR = 34;\nconst MAX_RENDER_DIM = 2400;\nconst GROW_SECONDS = 0.9;\nconst FLARE_LEAD = 1;\nconst FLARE_HOLD = 0.95;\nconst FLARE_SECONDS = 2.2;\nconst DEFAULT_COLORS = ['#ffc9f4', '#ea6fe0', '#d351b6', '#a6f3fa', '#6fd6f7', '#5aaef0', '#2b4bb8', '#121646'];\nconst DEFAULT_FONT = 'Inter, system-ui, sans-serif';\n\nconst VERTEX = `#version 300 es\nvoid main() {\n  vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));\n  gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);\n}`;\n\nconst FRAGMENT = `#version 300 es\nprecision highp float;\nuniform sampler2D uField;\nuniform sampler2D uPalette;\nuniform vec2 uRes;\nuniform vec3 uBase;\nuniform float uGain;\nuniform float uGrow;\nuniform vec3 uHand;\nuniform vec3 uRadii;\nuniform float uCool;\nuniform float uSwell;\nuniform float uLit;\nuniform vec4 uFlare;\nuniform float uFlareWidth;\nuniform float uOpacity;\nout vec4 outColor;\n\nvoid main() {\n  vec2 frag = gl_FragCoord.xy;\n  float f = min(texture(uField, frag / uRes).r * uGain, 1.0) * uGrow;\n  vec2 dv = frag - uHand.xy;\n  float d2 = dot(dv, dv);\n  float on = uHand.z;\n  float m = uLit;\n  if (on > 0.002) {\n    f = min(f * (1.0 + uSwell * on * exp(-d2 / (uRadii.z * uRadii.z))), 1.0);\n    float r = sqrt(d2) / uRadii.x;\n    float k = r < 0.45 ? mix(1.0, 0.6, r / 0.45) : mix(0.6, 0.0, clamp((r - 0.45) / 0.55, 0.0, 1.0));\n    f *= 1.0 - uCool * on * k;\n    float t = clamp(1.0 - d2 / (uRadii.y * uRadii.y), 0.0, 1.0);\n    m = max(m, on * t * t * (3.0 - 2.0 * t));\n  }\n  if (uFlare.z > 0.0) {\n    float fd = length(frag - uFlare.xy);\n    float lead = clamp((uFlare.z - fd) / uFlareWidth + 0.5, 0.0, 1.0);\n    float trail = clamp((uFlare.w - fd) / uFlareWidth + 0.5, 0.0, 1.0);\n    lead = lead * lead * (3.0 - 2.0 * lead);\n    trail = trail * trail * (3.0 - 2.0 * trail);\n    m = max(m, lead * (1.0 - trail));\n  }\n  vec4 heat = texture(uPalette, vec2((f * 255.0 + 0.5) / 256.0, 0.5));\n  float grey = clamp((f * 255.0 - 70.0) / 45.0, 0.0, 1.0);\n  vec3 rgb = mix(uBase, heat.rgb, m);\n  float alpha = mix(grey, heat.a, m) * uOpacity;\n  outColor = vec4(rgb * alpha, alpha);\n}`;\n\nconst UNIFORMS = [\n  'uField',\n  'uPalette',\n  'uRes',\n  'uBase',\n  'uGain',\n  'uGrow',\n  'uHand',\n  'uRadii',\n  'uCool',\n  'uSwell',\n  'uLit',\n  'uFlare',\n  'uFlareWidth',\n  'uOpacity'\n];\n\nconst clamp = (value, min, max) => Math.min(max, Math.max(min, value));\n\nconst num = (value, fallback) => {\n  const parsed = Number(value);\n  return Number.isFinite(parsed) ? parsed : fallback;\n};\n\nconst compileShader = (gl, type, source) => {\n  const shader = gl.createShader(type);\n  if (!shader) return null;\n  gl.shaderSource(shader, source);\n  gl.compileShader(shader);\n  return shader;\n};\n\nconst startProgram = gl => {\n  const vertex = compileShader(gl, gl.VERTEX_SHADER, VERTEX);\n  const fragment = compileShader(gl, gl.FRAGMENT_SHADER, FRAGMENT);\n  const program = vertex && fragment ? gl.createProgram() : null;\n  if (!vertex || !fragment || !program) {\n    if (vertex) gl.deleteShader(vertex);\n    if (fragment) gl.deleteShader(fragment);\n    return null;\n  }\n  gl.attachShader(program, vertex);\n  gl.attachShader(program, fragment);\n  gl.linkProgram(program);\n  return { program, vertex, fragment };\n};\n\nconst finishProgram = (gl, job) => {\n  const { program, vertex, fragment } = job;\n  const linked = gl.getProgramParameter(program, gl.LINK_STATUS);\n  if (!linked && !gl.isContextLost()) {\n    const broken = [vertex, fragment].filter(shader => !gl.getShaderParameter(shader, gl.COMPILE_STATUS));\n    if (broken.length) broken.forEach(shader => console.error(gl.getShaderInfoLog(shader)));\n    else console.error(gl.getProgramInfoLog(program));\n  }\n  gl.deleteShader(vertex);\n  gl.deleteShader(fragment);\n  if (!linked) {\n    gl.deleteProgram(program);\n    return null;\n  }\n  const uniforms = {};\n  for (const name of UNIFORMS) uniforms[name] = gl.getUniformLocation(program, name);\n  return { program, uniforms };\n};\n\nconst makeTexture = gl => {\n  const texture = gl.createTexture();\n  gl.bindTexture(gl.TEXTURE_2D, texture);\n  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA8, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));\n  return texture;\n};\n\nconst keyedMask = (image, width, height) => {\n  const canvas = document.createElement('canvas');\n  canvas.width = Math.max(1, Math.round(width));\n  canvas.height = Math.max(1, Math.round(height));\n  const context = canvas.getContext('2d', { willReadFrequently: true });\n  if (!context) return image;\n  context.drawImage(image, 0, 0, canvas.width, canvas.height);\n  let pixels;\n  try {\n    pixels = context.getImageData(0, 0, canvas.width, canvas.height);\n  } catch {\n    return image;\n  }\n  const data = pixels.data;\n  const w = canvas.width;\n  const h = canvas.height;\n  const corners = [0, (w - 1) * 4, (h - 1) * w * 4, ((h - 1) * w + w - 1) * 4];\n  if (corners.some(index => data[index + 3] < 250)) return canvas;\n  const key = [0, 1, 2].map(c => corners.reduce((sum, index) => sum + data[index + c], 0) / 4);\n  for (let i = 0; i < data.length; i += 4) {\n    const distance = Math.hypot(data[i] - key[0], data[i + 1] - key[1], data[i + 2] - key[2]);\n    data[i] = 255;\n    data[i + 1] = 255;\n    data[i + 2] = 255;\n    data[i + 3] = Math.round(255 * clamp((distance - 24) / 60, 0, 1));\n  }\n  context.putImageData(pixels, 0, 0);\n  return canvas;\n};\n\nconst measureText = (context, text, font) => {\n  context.font = font;\n  const metrics = context.measureText(text);\n  const left = metrics.actualBoundingBoxLeft || 0;\n  const right = metrics.actualBoundingBoxRight || metrics.width;\n  const ascent = metrics.actualBoundingBoxAscent || 72;\n  const descent = metrics.actualBoundingBoxDescent || 0;\n  return { left, right, ascent, descent, width: left + right, height: ascent + descent };\n};\n\nconst strokeWidth = (paint, width, height, box) => {\n  const scale = Math.min(1, 220 / Math.max(box[2], box[3], 1));\n  const w = Math.max(2, Math.round(width * scale));\n  const h = Math.max(2, Math.round(height * scale));\n  const canvas = document.createElement('canvas');\n  canvas.width = w;\n  canvas.height = h;\n  const context = canvas.getContext('2d', { willReadFrequently: true });\n  if (!context) return 0;\n  context.setTransform(scale, 0, 0, scale, 0, 0);\n  paint(context, 0);\n  const data = context.getImageData(0, 0, w, h).data;\n  const far = 1e6;\n  const dist = new Float32Array(w * h);\n  for (let i = 0; i < w * h; i++) dist[i] = data[i * 4 + 3] > 127 ? far : 0;\n  const d2 = Math.SQRT2;\n  for (let y = 0; y < h; y++) {\n    for (let x = 0; x < w; x++) {\n      const i = y * w + x;\n      if (!dist[i]) continue;\n      let v = dist[i];\n      if (x > 0) v = Math.min(v, dist[i - 1] + 1);\n      if (y > 0) {\n        v = Math.min(v, dist[i - w] + 1);\n        if (x > 0) v = Math.min(v, dist[i - w - 1] + d2);\n        if (x < w - 1) v = Math.min(v, dist[i - w + 1] + d2);\n      }\n      dist[i] = v;\n    }\n  }\n  for (let y = h - 1; y >= 0; y--) {\n    for (let x = w - 1; x >= 0; x--) {\n      const i = y * w + x;\n      if (!dist[i]) continue;\n      let v = dist[i];\n      if (x < w - 1) v = Math.min(v, dist[i + 1] + 1);\n      if (y < h - 1) {\n        v = Math.min(v, dist[i + w] + 1);\n        if (x < w - 1) v = Math.min(v, dist[i + w + 1] + d2);\n        if (x > 0) v = Math.min(v, dist[i + w - 1] + d2);\n      }\n      dist[i] = v;\n    }\n  }\n  const inside = [];\n  for (let i = 0; i < w * h; i++) if (dist[i] > 0 && dist[i] < far) inside.push(dist[i]);\n  if (!inside.length) return 0;\n  inside.sort((a, b) => a - b);\n  return (2 * inside[Math.floor(inside.length * 0.92)]) / scale;\n};\n\nconst buildField = (canvas, shape, settings, width, height) => {\n  canvas.width = width;\n  canvas.height = height;\n  const context = canvas.getContext('2d');\n  if (!context) return null;\n  context.setTransform(1, 0, 0, 1, 0, 0);\n  context.shadowColor = 'transparent';\n  context.fillStyle = '#000';\n  context.fillRect(0, 0, width, height);\n  if (!shape) return { unit: 1, box: [width / 2, height / 2, 0, 0] };\n  const boxW = width * settings.scale;\n  const boxH = height * settings.scale;\n  const cx = width / 2;\n  const cy = height / 2;\n  let drawW = boxW;\n  let drawH = boxH;\n  let paint = null;\n  if (shape.kind === 'text') {\n    const base = `${settings.fontWeight} 100px ${settings.fontFamily}`;\n    const m = measureText(context, shape.text, base);\n    const k = Math.min(boxW / Math.max(m.width, 1), boxH / Math.max(m.height, 1));\n    const font = `${settings.fontWeight} ${100 * k}px ${settings.fontFamily}`;\n    drawW = m.width * k;\n    drawH = m.height * k;\n    const x = cx - drawW / 2 + m.left * k;\n    const y = cy + ((m.ascent - m.descent) / 2) * k;\n    paint = (target, offset) => {\n      target.font = font;\n      target.textAlign = 'left';\n      target.textBaseline = 'alphabetic';\n      target.fillStyle = '#fff';\n      target.fillText(shape.text, x - offset, y);\n    };\n  } else {\n    const image = shape.image;\n    const iw = image.naturalWidth || image.width || 1;\n    const ih = image.naturalHeight || image.height || 1;\n    const k = Math.min(boxW / iw, boxH / ih);\n    drawW = iw * k;\n    drawH = ih * k;\n    const source = keyedMask(image, drawW, drawH);\n    paint = (target, offset) => target.drawImage(source, cx - drawW / 2 - offset, cy - drawH / 2, drawW, drawH);\n  }\n  const box = [cx, cy, drawW, drawH];\n  const unit = Math.sqrt(Math.max(drawW * drawH, 1)) / 139;\n  const stroke = strokeWidth(paint, width, height, box);\n  const blurUnit = stroke > 0 ? Math.min(unit, stroke / 17) : unit;\n  const offset = width * 3 + 64;\n  context.shadowColor = '#fff';\n  context.shadowBlur = (6 + settings.softness * 16) * blurUnit;\n  context.shadowOffsetX = offset;\n  context.shadowOffsetY = 0;\n  paint(context, offset);\n  paint(context, offset);\n  context.shadowColor = 'transparent';\n  return { unit, box };\n};\n\nconst measureGain = canvas => {\n  const probe = document.createElement('canvas');\n  const scale = Math.min(1, 320 / Math.max(canvas.width, canvas.height));\n  probe.width = Math.max(1, Math.round(canvas.width * scale));\n  probe.height = Math.max(1, Math.round(canvas.height * scale));\n  const context = probe.getContext('2d', { willReadFrequently: true });\n  if (!context) return 1;\n  context.drawImage(canvas, 0, 0, probe.width, probe.height);\n  const data = context.getImageData(0, 0, probe.width, probe.height).data;\n  let peak = 0;\n  for (let i = 0; i < data.length; i += 4) if (data[i] > peak) peak = data[i];\n  return peak > 0 ? clamp(235 / peak, 1, 4) : 1;\n};\n\nconst NeonLogo = ({\n  src,\n  text = 'NEON',\n  fontFamily = DEFAULT_FONT,\n  fontWeight = 500,\n  scale = 0.7,\n  baseColor = '#a855f7',\n  colors = DEFAULT_COLORS,\n  heat = 0.5,\n  radius = 1.5,\n  softness = 0.25,\n  swell = 0.1,\n  idle = 'drift',\n  speed = 2,\n  igniteOnClick = true,\n  interactive = true,\n  intro = true,\n  opacity = 1,\n  dpr,\n  className = '',\n  ...rest\n}) => {\n  const containerRef = useRef(null);\n  const canvasRef = useRef(null);\n  const wakeRef = useRef(null);\n  const releaseRef = useRef(0);\n  const [generation, setGeneration] = useState(0);\n  const [shape, setShape] = useState(null);\n  const palette = Array.isArray(colors) && colors.length ? colors.map(String) : DEFAULT_COLORS;\n  const settings = {\n    src: src || '',\n    text: String(text ?? ''),\n    fontFamily: fontFamily || DEFAULT_FONT,\n    fontWeight: num(fontWeight, 500),\n    scale: clamp(num(scale, 0.7), 0.1, 1),\n    baseColor: String(baseColor),\n    colors: palette,\n    heat: clamp(num(heat, 0.5), 0, 1),\n    radius: clamp(num(radius, 1.5), 0.2, 3),\n    softness: clamp(num(softness, 0.25), 0, 1),\n    swell: clamp(num(swell, 0.1), 0, 2),\n    idle,\n    speed: clamp(num(speed, 2), 0, 4),\n    igniteOnClick,\n    interactive,\n    intro,\n    opacity: clamp(num(opacity, 1), 0, 1),\n    dpr\n  };\n  const settingsRef = useRef(settings);\n  settingsRef.current = settings;\n  const shapeRef = useRef(shape);\n  shapeRef.current = shape;\n\n  useEffect(() => {\n    let alive = true;\n    if (settings.src) {\n      const image = new Image();\n      image.crossOrigin = 'anonymous';\n      image.decoding = 'async';\n      image.onload = () => {\n        if (alive) setShape({ kind: 'image', image, key: settings.src });\n      };\n      image.src = settings.src;\n      return () => {\n        alive = false;\n        image.onload = null;\n      };\n    }\n    const next = {\n      kind: 'text',\n      text: settings.text,\n      key: `${settings.text}|${settings.fontFamily}|${settings.fontWeight}`\n    };\n    const fonts = document.fonts;\n    if (!fonts?.load) {\n      setShape(next);\n      return undefined;\n    }\n    fonts\n      .load(`${settings.fontWeight} 100px ${settings.fontFamily}`, settings.text || 'A')\n      .catch(() => null)\n      .then(() => {\n        if (alive) setShape(next);\n      });\n    return () => {\n      alive = false;\n    };\n  }, [settings.src, settings.text, settings.fontFamily, settings.fontWeight]);\n\n  useEffect(() => {\n    wakeRef.current?.(shape);\n  });\n\n  useEffect(() => {\n    const container = containerRef.current;\n    const canvas = canvasRef.current;\n    if (!container || !canvas) return undefined;\n    cancelAnimationFrame(releaseRef.current);\n    releaseRef.current = 0;\n    const gl = canvas.getContext('webgl2', {\n      alpha: true,\n      premultipliedAlpha: true,\n      antialias: false,\n      depth: false,\n      stencil: false,\n      powerPreference: 'default'\n    });\n    if (!gl) return undefined;\n    const parallel = gl.getExtension('KHR_parallel_shader_compile');\n    let job = startProgram(gl);\n    if (!job) return undefined;\n    let surface = null;\n    if (!parallel) {\n      surface = finishProgram(gl, job);\n      job = null;\n      if (!surface) return undefined;\n    }\n    const vao = gl.createVertexArray();\n    const fieldTexture = makeTexture(gl);\n    const paletteTexture = makeTexture(gl);\n    const fieldCanvas = document.createElement('canvas');\n    const probe = document.createElement('canvas');\n    probe.width = 1;\n    probe.height = 1;\n    const probeContext = probe.getContext('2d', { willReadFrequently: true });\n    const reduce = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;\n    const state = {\n      width: 1,\n      height: 1,\n      ratio: 1,\n      shape: null,\n      fieldKey: '',\n      paletteKey: '',\n      base: [0.66, 0.33, 0.97],\n      baseKey: '',\n      gain: 1,\n      unit: 1,\n      box: [0, 0, 0, 0],\n      grow: 0,\n      growing: false,\n      shown: false,\n      pointer: { x: 0, y: 0, inside: false },\n      hand: { x: 0, y: 0, tx: 0, ty: 0, power: 0, placed: false },\n      drift: 0,\n      release: 1,\n      anchor: null,\n      flare: null\n    };\n    let raf = 0;\n    let last = 0;\n    let visible = true;\n    let alive = true;\n    let lost = false;\n\n    const toRgb = (value, fallback) => {\n      if (!probeContext || !value) return fallback;\n      const css = /^[0-9a-f]{3,8}$/i.test(value) ? `#${value}` : value;\n      probeContext.clearRect(0, 0, 1, 1);\n      probeContext.fillStyle = '#000000';\n      probeContext.fillStyle = css;\n      probeContext.fillRect(0, 0, 1, 1);\n      const [r, g, b] = probeContext.getImageData(0, 0, 1, 1).data;\n      return [r, g, b];\n    };\n\n    const syncPalette = s => {\n      const key = s.colors.join('|');\n      if (key === state.paletteKey) return;\n      state.paletteKey = key;\n      const stops = s.colors.map(color => toRgb(color, [255, 255, 255]));\n      if (stops.length === 1) stops.push(stops[0]);\n      const table = new Uint8Array(256 * 4);\n      for (let i = FLOOR; i < 256; i++) {\n        const x = ((i - FLOOR) / (255 - FLOOR)) * (stops.length - 1);\n        const k = Math.min(stops.length - 2, Math.floor(x));\n        const f = x - k;\n        for (let c = 0; c < 3; c++) table[i * 4 + c] = Math.round(stops[k][c] + (stops[k + 1][c] - stops[k][c]) * f);\n        table[i * 4 + 3] = Math.round(255 * clamp((i - FLOOR) / 26, 0, 1));\n      }\n      gl.bindTexture(gl.TEXTURE_2D, paletteTexture);\n      gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);\n      gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);\n      gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA8, 256, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, table);\n    };\n\n    const syncBase = s => {\n      if (s.baseColor === state.baseKey) return;\n      state.baseKey = s.baseColor;\n      state.base = toRgb(s.baseColor, [168, 85, 247]).map(v => v / 255);\n    };\n\n    const syncField = () => {\n      const s = settingsRef.current;\n      const key = `${state.shape?.key ?? ''}|${canvas.width}x${canvas.height}|${s.scale}|${s.softness}`;\n      if (key === state.fieldKey) return;\n      state.fieldKey = key;\n      const built = buildField(fieldCanvas, state.shape, s, canvas.width, canvas.height);\n      if (!built) return;\n      state.unit = built.unit;\n      state.box = built.box;\n      state.gain = state.shape ? measureGain(fieldCanvas) : 1;\n      gl.bindTexture(gl.TEXTURE_2D, fieldTexture);\n      gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n      gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);\n      gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA8, gl.RGBA, gl.UNSIGNED_BYTE, fieldCanvas);\n      gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);\n    };\n\n    const render = () => {\n      if (!surface || lost) return;\n      const s = settingsRef.current;\n      syncPalette(s);\n      syncBase(s);\n      syncField();\n      const u = surface.uniforms;\n      const r = state.ratio;\n      const spread = s.radius;\n      const unit = state.unit;\n      const hand = state.hand;\n      gl.viewport(0, 0, canvas.width, canvas.height);\n      gl.disable(gl.BLEND);\n      gl.clearColor(0, 0, 0, 0);\n      gl.clear(gl.COLOR_BUFFER_BIT);\n      gl.useProgram(surface.program);\n      gl.bindVertexArray(vao);\n      gl.activeTexture(gl.TEXTURE0);\n      gl.bindTexture(gl.TEXTURE_2D, fieldTexture);\n      gl.activeTexture(gl.TEXTURE1);\n      gl.bindTexture(gl.TEXTURE_2D, paletteTexture);\n      gl.uniform1i(u.uField, 0);\n      gl.uniform1i(u.uPalette, 1);\n      gl.uniform2f(u.uRes, canvas.width, canvas.height);\n      gl.uniform3f(u.uBase, state.base[0], state.base[1], state.base[2]);\n      gl.uniform1f(u.uGain, state.gain);\n      const grow = state.grow;\n      gl.uniform1f(u.uGrow, grow * grow * (3 - 2 * grow));\n      gl.uniform3f(u.uHand, hand.x * r, canvas.height - hand.y * r, hand.power);\n      gl.uniform3f(\n        u.uRadii,\n        (60 + s.heat * 50) * unit * spread,\n        (95 + s.heat * 55) * unit * spread,\n        62 * unit * spread\n      );\n      gl.uniform1f(u.uCool, 0.35 + s.heat * 0.55);\n      gl.uniform1f(u.uSwell, 0.75 * s.swell);\n      gl.uniform1f(u.uLit, s.idle === 'lit' ? 1 : 0);\n      const flare = state.flare;\n      const flareWidth = 70 * unit;\n      if (flare) {\n        const [cx, cy, bw, bh] = state.box;\n        const fx = flare.x * r;\n        const fy = flare.y * r;\n        const reach =\n          Math.max(\n            Math.hypot(fx - (cx - bw / 2), fy - (cy - bh / 2)),\n            Math.hypot(fx - (cx + bw / 2), fy - (cy - bh / 2)),\n            Math.hypot(fx - (cx - bw / 2), fy - (cy + bh / 2)),\n            Math.hypot(fx - (cx + bw / 2), fy - (cy + bh / 2))\n          ) +\n          flareWidth * 1.5;\n        const lead = clamp(flare.age / FLARE_LEAD, 0, 1);\n        const trail = clamp((flare.age - FLARE_HOLD) / (FLARE_SECONDS - FLARE_HOLD), 0, 1);\n        const leadFront = reach * (1 - (1 - lead) * (1 - lead)) - flareWidth;\n        const trailFront = trail > 0 ? reach * trail * trail * (3 - 2 * trail) - flareWidth : -1e6;\n        gl.uniform4f(u.uFlare, fx, canvas.height - fy, Math.max(leadFront, 0.001), trailFront);\n      } else {\n        gl.uniform4f(u.uFlare, 0, 0, 0, 0);\n      }\n      gl.uniform1f(u.uFlareWidth, flareWidth);\n      gl.uniform1f(u.uOpacity, s.opacity);\n      gl.drawArrays(gl.TRIANGLES, 0, 3);\n      gl.bindVertexArray(null);\n    };\n\n    const resize = () => {\n      const s = settingsRef.current;\n      const width = Math.max(1, container.clientWidth);\n      const height = Math.max(1, container.clientHeight);\n      const base = Math.min(s.dpr || window.devicePixelRatio || 1, 2);\n      const longest = Math.max(width, height) * base;\n      const ratio = longest > MAX_RENDER_DIM ? (base * MAX_RENDER_DIM) / longest : base;\n      const pixelWidth = Math.max(1, Math.round(width * ratio));\n      const pixelHeight = Math.max(1, Math.round(height * ratio));\n      if (canvas.width !== pixelWidth || canvas.height !== pixelHeight) {\n        canvas.width = pixelWidth;\n        canvas.height = pixelHeight;\n      }\n      state.width = width;\n      state.height = height;\n      state.ratio = pixelHeight / height;\n      render();\n    };\n\n    const ready = () => {\n      if (surface) return true;\n      if (!job || !parallel || !gl.getProgramParameter(job.program, parallel.COMPLETION_STATUS_KHR)) return false;\n      surface = finishProgram(gl, job);\n      job = null;\n      return Boolean(surface);\n    };\n\n    const driftTarget = () => {\n      const [cx, cy, bw, bh] = state.box;\n      const r = state.ratio || 1;\n      const t = state.drift;\n      return {\n        x: (cx + Math.sin(t * 0.53) * bw * 0.42 + Math.sin(t * 1.31 + 1.7) * bw * 0.06) / r,\n        y: (cy + Math.sin(t * 0.79 + 0.6) * bh * 0.32) / r\n      };\n    };\n\n    const frame = now => {\n      raf = 0;\n      if (!alive || !visible || document.hidden || lost) return;\n      if (!ready()) {\n        if (job) raf = requestAnimationFrame(frame);\n        return;\n      }\n      const s = settingsRef.current;\n      const dt = last ? Math.min(0.05, (now - last) / 1000) : 0;\n      last = now;\n      if (state.growing) {\n        state.grow = Math.min(1, state.grow + dt / GROW_SECONDS);\n        if (state.grow >= 1) state.growing = false;\n      }\n      const hand = state.hand;\n      const pointer = state.pointer;\n      const hovering = s.interactive && pointer.inside;\n      const drifting = !hovering && s.idle === 'drift' && !reduce && Boolean(state.shape);\n      let want = 0;\n      if (hovering) {\n        hand.tx = pointer.x;\n        hand.ty = pointer.y;\n        state.anchor = { x: hand.x, y: hand.y };\n        state.release = 0;\n        want = 1;\n      } else if (drifting) {\n        state.drift += dt * s.speed;\n        state.release = Math.min(1, state.release + dt / 1.4);\n        const spot = driftTarget();\n        const blend = state.release * state.release * (3 - 2 * state.release);\n        const from = state.anchor || spot;\n        hand.tx = from.x + (spot.x - from.x) * blend;\n        hand.ty = from.y + (spot.y - from.y) * blend;\n        want = state.grow;\n      }\n      if (!hand.placed && want) {\n        hand.x = hand.tx;\n        hand.y = hand.ty;\n        hand.placed = true;\n      }\n      const follow = 1 - Math.pow(0.002, dt);\n      hand.x += (hand.tx - hand.x) * follow;\n      hand.y += (hand.ty - hand.y) * follow;\n      hand.power += (want - hand.power) * (1 - Math.pow(0.01, dt));\n      if (!want && hand.power < 0.004) {\n        hand.power = 0;\n        hand.placed = false;\n      }\n      if (state.flare) {\n        state.flare.age += dt;\n        if (state.flare.age >= FLARE_SECONDS) state.flare = null;\n      }\n      render();\n      const settling =\n        state.growing ||\n        Math.abs(want - hand.power) > 0.004 ||\n        Math.abs(hand.tx - hand.x) > 0.05 ||\n        Math.abs(hand.ty - hand.y) > 0.05 ||\n        Boolean(state.flare) ||\n        drifting;\n      if (settling) raf = requestAnimationFrame(frame);\n      else last = 0;\n    };\n\n    const wake = () => {\n      if (!raf && alive && visible && !document.hidden && !lost) raf = requestAnimationFrame(frame);\n    };\n\n    const adopt = next => {\n      if (!next || next === state.shape) return;\n      const first = !state.shown;\n      state.shape = next;\n      state.shown = true;\n      const animate = !reduce && (first ? settingsRef.current.intro : true);\n      state.grow = animate ? 0 : 1;\n      state.growing = animate;\n    };\n\n    const locate = event => {\n      const rect = container.getBoundingClientRect();\n      const x = event.clientX - rect.left;\n      const y = event.clientY - rect.top;\n      return { x, y, inside: x >= 0 && y >= 0 && x <= rect.width && y <= rect.height };\n    };\n\n    const onPointerMove = event => {\n      const spot = locate(event);\n      state.pointer.x = spot.x;\n      state.pointer.y = spot.y;\n      state.pointer.inside = spot.inside;\n      wake();\n    };\n\n    const onPointerDown = event => {\n      const s = settingsRef.current;\n      if (!s.interactive || !s.igniteOnClick || event.button !== 0 || reduce) return;\n      const spot = locate(event);\n      if (!spot.inside) return;\n      state.flare = { x: spot.x, y: spot.y, age: 0 };\n      wake();\n    };\n\n    const onPointerLeave = () => {\n      state.pointer.inside = false;\n      wake();\n    };\n\n    const onVisibility = () => {\n      last = 0;\n      wake();\n    };\n\n    const onLost = event => {\n      event.preventDefault();\n      lost = true;\n      cancelAnimationFrame(raf);\n      raf = 0;\n    };\n\n    const onRestored = () => setGeneration(value => value + 1);\n\n    const resizeObserver = new ResizeObserver(resize);\n    resizeObserver.observe(container);\n    const intersection = new IntersectionObserver(entries => {\n      visible = entries.some(entry => entry.isIntersecting);\n      if (visible) {\n        last = 0;\n        wake();\n      }\n    });\n    intersection.observe(container);\n    window.addEventListener('pointermove', onPointerMove, { passive: true });\n    container.addEventListener('pointerdown', onPointerDown);\n    document.documentElement.addEventListener('pointerleave', onPointerLeave);\n    document.addEventListener('visibilitychange', onVisibility);\n    canvas.addEventListener('webglcontextlost', onLost);\n    canvas.addEventListener('webglcontextrestored', onRestored);\n    adopt(shapeRef.current);\n    resize();\n    wake();\n    wakeRef.current = next => {\n      adopt(next);\n      if (!raf) render();\n      wake();\n    };\n\n    return () => {\n      alive = false;\n      cancelAnimationFrame(raf);\n      wakeRef.current = null;\n      resizeObserver.disconnect();\n      intersection.disconnect();\n      window.removeEventListener('pointermove', onPointerMove);\n      container.removeEventListener('pointerdown', onPointerDown);\n      document.documentElement.removeEventListener('pointerleave', onPointerLeave);\n      document.removeEventListener('visibilitychange', onVisibility);\n      canvas.removeEventListener('webglcontextlost', onLost);\n      canvas.removeEventListener('webglcontextrestored', onRestored);\n      if (!gl.isContextLost()) {\n        gl.deleteVertexArray(vao);\n        gl.deleteTexture(fieldTexture);\n        gl.deleteTexture(paletteTexture);\n        if (surface) gl.deleteProgram(surface.program);\n        const release = () => {\n          if (!job || gl.isContextLost()) return;\n          if (parallel && !gl.getProgramParameter(job.program, parallel.COMPLETION_STATUS_KHR)) {\n            requestAnimationFrame(release);\n            return;\n          }\n          gl.deleteShader(job.vertex);\n          gl.deleteShader(job.fragment);\n          gl.deleteProgram(job.program);\n          job = null;\n        };\n        release();\n      }\n      const free = () => {\n        releaseRef.current = 0;\n        if (!canvas.isConnected && !gl.isContextLost()) gl.getExtension('WEBGL_lose_context')?.loseContext();\n      };\n      if (canvas.isConnected) releaseRef.current = requestAnimationFrame(free);\n      else free();\n    };\n  }, [generation]);\n\n  return (\n    <div\n      ref={containerRef}\n      className={['relative h-full w-full overflow-hidden', className].filter(Boolean).join(' ')}\n      {...rest}\n    >\n      <canvas ref={canvasRef} className=\"absolute inset-0 block h-full w-full\" aria-hidden=\"true\" />\n    </div>\n  );\n};\n\nexport default NeonLogo;\n"
		}
	],
	"registryDependencies": [],
	"dependencies": []
}