{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "led-ticker",
  "title": "Led Ticker",
  "description": "REMOCN IS LIVE scrolls on a retro LED dot-matrix with a gradient on the last word.",
  "dependencies": ["remotion"],
  "files": [
    {
      "path": "registry/remocn/led-ticker/index.tsx",
      "content": "\"use client\";\n\nimport type React from \"react\";\nimport { useId, useMemo } from \"react\";\nimport {\n  AbsoluteFill,\n  Easing,\n  interpolate,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\n\nexport interface LedTickerProps {\n  text?: string;\n  highlightWord?: string;\n  accent?: string;\n  /** Frames the line takes to scroll in and settle. */\n  scroll?: number;\n  /** Radius of a lit dot, as a share of the grid pitch. */\n  dotSize?: number;\n  /** Color of the lit dots; overrides the theme ink. */\n  ink?: string;\n  /** Background fill; \"transparent\" drops it. */\n  background?: string;\n  /** Size of the dot matrix, around the frame's center. */\n  scale?: number;\n  /** Frames to hold the first frame before anything moves. */\n  delay?: number;\n  /** Film grain over the scene. */\n  grain?: boolean;\n  theme?: \"dark\" | \"light\";\n  speed?: number;\n}\n\nconst EASE_IO = Easing.bezier(0.65, 0, 0.35, 1);\nconst SCROLL = Easing.bezier(0.2, 0.7, 0.25, 1);\nconst CLAMP = {\n  extrapolateLeft: \"clamp\",\n  extrapolateRight: \"clamp\",\n} as const;\n\nconst THEMES = {\n  dark: {\n    bg: \"#0A0A0B\",\n    ink: \"#F3F2EF\",\n    off: \"#FFFFFF\",\n    offAlpha: 0.075,\n    grain: 0.05,\n  },\n  light: {\n    bg: \"#F5F4F0\",\n    ink: \"#141416\",\n    off: \"#141416\",\n    offAlpha: 0.075,\n    grain: 0.04,\n  },\n} as const;\n\nconst GLYPHS: Record<string, string[]> = {\n  A: [\".###.\", \"#...#\", \"#...#\", \"#####\", \"#...#\", \"#...#\", \"#...#\"],\n  B: [\"####.\", \"#...#\", \"#...#\", \"####.\", \"#...#\", \"#...#\", \"####.\"],\n  C: [\".###.\", \"#...#\", \"#....\", \"#....\", \"#....\", \"#...#\", \".###.\"],\n  D: [\"####.\", \"#...#\", \"#...#\", \"#...#\", \"#...#\", \"#...#\", \"####.\"],\n  E: [\"#####\", \"#....\", \"#....\", \"####.\", \"#....\", \"#....\", \"#####\"],\n  F: [\"#####\", \"#....\", \"#....\", \"####.\", \"#....\", \"#....\", \"#....\"],\n  G: [\".###.\", \"#...#\", \"#....\", \"#.###\", \"#...#\", \"#...#\", \".####\"],\n  H: [\"#...#\", \"#...#\", \"#...#\", \"#####\", \"#...#\", \"#...#\", \"#...#\"],\n  I: [\"###\", \".#.\", \".#.\", \".#.\", \".#.\", \".#.\", \"###\"],\n  J: [\"..###\", \"...#.\", \"...#.\", \"...#.\", \"...#.\", \"#..#.\", \".##..\"],\n  K: [\"#...#\", \"#..#.\", \"#.#..\", \"##...\", \"#.#..\", \"#..#.\", \"#...#\"],\n  L: [\"#....\", \"#....\", \"#....\", \"#....\", \"#....\", \"#....\", \"#####\"],\n  M: [\"#...#\", \"##.##\", \"#.#.#\", \"#.#.#\", \"#...#\", \"#...#\", \"#...#\"],\n  N: [\"#...#\", \"#...#\", \"##..#\", \"#.#.#\", \"#..##\", \"#...#\", \"#...#\"],\n  O: [\".###.\", \"#...#\", \"#...#\", \"#...#\", \"#...#\", \"#...#\", \".###.\"],\n  P: [\"####.\", \"#...#\", \"#...#\", \"####.\", \"#....\", \"#....\", \"#....\"],\n  Q: [\".###.\", \"#...#\", \"#...#\", \"#...#\", \"#.#.#\", \"#..#.\", \".##.#\"],\n  R: [\"####.\", \"#...#\", \"#...#\", \"####.\", \"#.#..\", \"#..#.\", \"#...#\"],\n  S: [\".####\", \"#....\", \"#....\", \".###.\", \"....#\", \"....#\", \"####.\"],\n  T: [\"#####\", \"..#..\", \"..#..\", \"..#..\", \"..#..\", \"..#..\", \"..#..\"],\n  U: [\"#...#\", \"#...#\", \"#...#\", \"#...#\", \"#...#\", \"#...#\", \".###.\"],\n  V: [\"#...#\", \"#...#\", \"#...#\", \"#...#\", \"#...#\", \".#.#.\", \"..#..\"],\n  W: [\"#...#\", \"#...#\", \"#...#\", \"#.#.#\", \"#.#.#\", \"#.#.#\", \".#.#.\"],\n  X: [\"#...#\", \"#...#\", \".#.#.\", \"..#..\", \".#.#.\", \"#...#\", \"#...#\"],\n  Y: [\"#...#\", \"#...#\", \".#.#.\", \"..#..\", \"..#..\", \"..#..\", \"..#..\"],\n  Z: [\"#####\", \"....#\", \"...#.\", \"..#..\", \".#...\", \"#....\", \"#####\"],\n  \"0\": [\".###.\", \"#...#\", \"#..##\", \"#.#.#\", \"##..#\", \"#...#\", \".###.\"],\n  \"1\": [\"..#..\", \".##..\", \"..#..\", \"..#..\", \"..#..\", \"..#..\", \".###.\"],\n  \"2\": [\".###.\", \"#...#\", \"....#\", \"...#.\", \"..#..\", \".#...\", \"#####\"],\n  \"3\": [\"#####\", \"...#.\", \"..#..\", \"...#.\", \"....#\", \"#...#\", \".###.\"],\n  \"4\": [\"...#.\", \"..##.\", \".#.#.\", \"#..#.\", \"#####\", \"...#.\", \"...#.\"],\n  \"5\": [\"#####\", \"#....\", \"####.\", \"....#\", \"....#\", \"#...#\", \".###.\"],\n  \"6\": [\"..##.\", \".#...\", \"#....\", \"####.\", \"#...#\", \"#...#\", \".###.\"],\n  \"7\": [\"#####\", \"....#\", \"...#.\", \"..#..\", \".#...\", \".#...\", \".#...\"],\n  \"8\": [\".###.\", \"#...#\", \"#...#\", \".###.\", \"#...#\", \"#...#\", \".###.\"],\n  \"9\": [\".###.\", \"#...#\", \"#...#\", \".####\", \"....#\", \"...#.\", \".##..\"],\n  \".\": [\".\", \".\", \".\", \".\", \".\", \".\", \"#\"],\n  \",\": [\"..\", \"..\", \"..\", \"..\", \"..\", \".#\", \"#.\"],\n  \"!\": [\"#\", \"#\", \"#\", \"#\", \"#\", \".\", \"#\"],\n  \"?\": [\".###.\", \"#...#\", \"....#\", \"...#.\", \"..#..\", \".....\", \"..#..\"],\n  \"-\": [\"....\", \"....\", \"....\", \"####\", \"....\", \"....\", \"....\"],\n  \":\": [\".\", \".\", \"#\", \".\", \".\", \"#\", \".\"],\n  \"'\": [\"#\", \"#\", \".\", \".\", \".\", \".\", \".\"],\n  \"&\": [\".##..\", \"#..#.\", \"#.#..\", \".#...\", \"#.#.#\", \"#..#.\", \".##.#\"],\n  \"/\": [\"....#\", \"...#.\", \"...#.\", \"..#..\", \".#...\", \".#...\", \"#....\"],\n  \"%\": [\"##..#\", \"##..#\", \"...#.\", \"..#..\", \".#...\", \"#..##\", \"#..##\"],\n  \"+\": [\".....\", \"..#..\", \"..#..\", \"#####\", \"..#..\", \"..#..\", \".....\"],\n  \" \": [\"...\", \"...\", \"...\", \"...\", \"...\", \"...\", \"...\"],\n};\n\n// The remocn.dev \"R\" mark on the 7-row grid: top bar with no upper stem,\n// the bowl, and the stem + leg below. Replaces the R when the text opens\n// with the word \"remocn\".\nconst MARK_R = [\n  \"#####.\",\n  \".....#\",\n  \".....#\",\n  \".####.\",\n  \"#..#..\",\n  \"#...#.\",\n  \"#....#\",\n];\n\n// gradients.sh \"halo\" (peach → amber → rose → blue) across the hot word.\nconst HALO = [\"#ffd2ad\", \"#ffb36b\", \"#e2457a\", \"#3d4dff\"];\nconst HOT_STEPS = 9;\n\nfunction ramp(stops: string[], n: number) {\n  return Array.from({ length: n }, (_, i) => {\n    const k = (i / (n - 1)) * (stops.length - 1);\n    const j = Math.min(stops.length - 2, Math.floor(k));\n    const f = k - j;\n    const a = Number.parseInt(stops[j].slice(1), 16);\n    const b = Number.parseInt(stops[j + 1].slice(1), 16);\n    const ch = (sh: number) =>\n      Math.round(((a >> sh) & 255) * (1 - f) + ((b >> sh) & 255) * f)\n        .toString(16)\n        .padStart(2, \"0\");\n    return `#${ch(16)}${ch(8)}${ch(0)}`;\n  });\n}\n\nconst ROWS = 7;\nconst TRAIL = [1, 0.4, 0.16, 0.06];\nconst BUCKETS = 6;\n\nfunction hash(n: number) {\n  const x = Math.sin(n * 127.1 + 311.7) * 43758.5453;\n  return x - Math.floor(x);\n}\n\ninterface Cell {\n  c: number;\n  r: number;\n  hot: number;\n}\n\nfunction layout(text: string, highlightWord?: string) {\n  const chars = text.toUpperCase().split(\"\");\n  const target = highlightWord?.trim().toUpperCase();\n  const brand = /^REMOCN(\\s|$)/.test(chars.join(\"\"));\n  const cells: Cell[] = [];\n  let col = 0;\n  let wordStart = 0;\n  let hotRange: [number, number] | null = null;\n  let word = \"\";\n  const closeWord = (end: number) => {\n    if (!hotRange && target && word === target) hotRange = [wordStart, end];\n    word = \"\";\n  };\n  chars.forEach((ch, i) => {\n    const g = brand && i === 0 ? MARK_R : (GLYPHS[ch] ?? GLYPHS[\" \"]);\n    if (ch === \" \") {\n      closeWord(col - 2);\n    } else if (word === \"\") {\n      wordStart = col;\n      word = ch;\n    } else {\n      word += ch;\n    }\n    const gw = g[0].length;\n    for (let r = 0; r < ROWS; r++) {\n      for (let x = 0; x < gw; x++) {\n        if (g[r][x] === \"#\") cells.push({ c: col + x, r, hot: 0 });\n      }\n    }\n    col += gw + (i < chars.length - 1 ? 1 : 0);\n  });\n  closeWord(col - 1);\n  const range = hotRange as [number, number] | null;\n  if (range) {\n    for (const cell of cells) {\n      if (cell.c >= range[0] && cell.c <= range[1]) {\n        cell.hot = cell.c - range[0] + 1;\n      }\n    }\n  }\n  return {\n    cells,\n    width: Math.max(1, col),\n    hotWidth: range ? range[1] - range[0] + 1 : 0,\n  };\n}\n\nconst ENTER = 2;\nconst SCROLL_DUR = 54;\nconst HOT_STEP = 0.8;\nconst HOT_DUR = 6;\n\n/** The foreground at `scale`, around the frame's center; nothing extra at 1. */\nfunction ScaleLayer({\n  scale,\n  children,\n}: {\n  scale: number;\n  children: React.ReactNode;\n}) {\n  if (scale === 1) return children;\n  return (\n    <AbsoluteFill style={{ transform: `scale(${scale})` }}>\n      {children}\n    </AbsoluteFill>\n  );\n}\n\nexport function LedTicker({\n  text = \"remocn is live\",\n  highlightWord = \"live\",\n  accent = \"#3B5BFD\",\n  scroll = SCROLL_DUR,\n  dotSize = 0.45,\n  ink: inkColor,\n  background,\n  scale = 1,\n  delay = 0,\n  grain = true,\n  theme = \"dark\",\n  speed = 1,\n}: LedTickerProps) {\n  const t = Math.max(0, useCurrentFrame() - delay) * speed;\n  const { width: W, height: H } = useVideoConfig();\n  const uid = useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n  const pal = THEMES[theme];\n  const fg = inkColor ?? pal.ink;\n  const bg =\n    background === \"transparent\" ? \"transparent\" : (background ?? pal.bg);\n  const hotStart = ENTER + scroll + 14;\n\n  const {\n    cells,\n    width: textCols,\n    hotWidth,\n  } = useMemo(() => layout(text, highlightWord), [text, highlightWord]);\n\n  const pitch = Math.min((W * 0.86) / textCols, H / 13);\n  const cols = Math.ceil(W / pitch) + 2;\n  const rows = Math.ceil(H / pitch) + 2;\n  const x0 = (W - cols * pitch) / 2;\n  const y0 = (H - rows * pitch) / 2;\n  const home = Math.round((cols - textCols) / 2);\n  const band = Math.round((rows - ROWS) / 2);\n  const rOff = pitch * 0.3;\n  const rOn = pitch * dotSize;\n\n  const offsetAt = (f: number) => {\n    const p = interpolate(f, [ENTER, ENTER + scroll], [0, 1], CLAMP);\n    return home + Math.round((cols - home) * (1 - SCROLL(p)));\n  };\n\n  const lit = new Map<number, { b: number; hot: number }>();\n  TRAIL.forEach((w, k) => {\n    const f = Math.floor(t) - k;\n    if (f < ENTER - 1) return;\n    const o = offsetAt(f);\n    for (const cell of cells) {\n      const c = o + cell.c;\n      if (c < 0 || c >= cols) continue;\n      const key = (band + cell.r) * cols + c;\n      const prev = lit.get(key);\n      if (!prev || prev.b < w) lit.set(key, { b: w, hot: cell.hot });\n    }\n  });\n\n  const cx = W / 2;\n  const cy = H / 2;\n  const ink: string[][] = Array.from({ length: BUCKETS }, () => []);\n  const hot: string[][] = Array.from({ length: BUCKETS * HOT_STEPS }, () => []);\n  const hotColors = ramp(\n    [HALO[0], HALO[1], HALO[2], accent].slice(theme === \"light\" ? 1 : 0),\n    HOT_STEPS,\n  );\n  for (const [key, v] of lit) {\n    const r = Math.floor(key / cols);\n    const c = key % cols;\n    const x = x0 + (c + 0.5) * pitch;\n    const y = y0 + (r + 0.5) * pitch;\n    const nx = (x - cx) / (W * 0.6);\n    const ny = (y - cy) / (H * 0.6);\n    const falloff = 1 - Math.min(1, nx * nx + ny * ny) * 0.22;\n    let b = v.b * falloff * (0.94 + hash(key * 0.37) * 0.06);\n    let isHot = false;\n    if (v.hot > 0 && v.b === 1) {\n      const start = hotStart + (v.hot - 1) * HOT_STEP;\n      const p = (t - start) / HOT_DUR;\n      if (p > 0) {\n        const dip = p < 0.45 ? 1 - p / 0.45 : Math.min(1, (p - 0.45) / 0.55);\n        b *= 0.12 + 0.88 * EASE_IO(dip);\n        isHot = p >= 0.45;\n      }\n    }\n    const bucket = Math.min(BUCKETS - 1, Math.floor(b * BUCKETS));\n    const rad = rOff + (rOn - rOff) * Math.min(1, b);\n    const seg = `M${(x - rad).toFixed(2)} ${y.toFixed(2)}a${rad.toFixed(2)} ${rad.toFixed(2)} 0 1 0 ${(2 * rad).toFixed(2)} 0a${rad.toFixed(2)} ${rad.toFixed(2)} 0 1 0 ${(-2 * rad).toFixed(2)} 0`;\n    if (isHot) {\n      const k = hotWidth > 1 ? (v.hot - 1) / (hotWidth - 1) : 0;\n      const step = Math.round(k * (HOT_STEPS - 1));\n      hot[bucket * HOT_STEPS + step].push(seg);\n    } else {\n      ink[bucket].push(seg);\n    }\n  }\n\n  const total = hotStart + hotWidth * HOT_STEP + HOT_DUR + 40;\n  const cam = interpolate(t, [0, total], [1.035, 1], {\n    ...CLAMP,\n    easing: EASE_IO,\n  });\n  const bucketOpacity = (i: number) => (i + 1) / BUCKETS;\n\n  return (\n    <AbsoluteFill style={{ background: bg, overflow: \"hidden\" }}>\n      <ScaleLayer scale={scale}>\n        <AbsoluteFill\n          style={{ transform: `scale(${cam})`, transformOrigin: \"50% 50%\" }}\n        >\n          <svg\n            width={W}\n            height={H}\n            viewBox={`0 0 ${W} ${H}`}\n            style={{ position: \"absolute\", inset: 0 }}\n            aria-hidden\n          >\n            <defs>\n              <pattern\n                id={`${uid}-dot`}\n                patternUnits=\"userSpaceOnUse\"\n                x={x0}\n                y={y0}\n                width={pitch}\n                height={pitch}\n              >\n                <circle\n                  cx={pitch / 2}\n                  cy={pitch / 2}\n                  r={rOff}\n                  fill={pal.off}\n                  fillOpacity={pal.offAlpha}\n                />\n              </pattern>\n              <radialGradient id={`${uid}-fall`} cx=\"50%\" cy=\"50%\" r=\"62%\">\n                <stop offset=\"0%\" stopColor=\"#fff\" stopOpacity={1} />\n                <stop offset=\"55%\" stopColor=\"#fff\" stopOpacity={0.62} />\n                <stop offset=\"100%\" stopColor=\"#fff\" stopOpacity={0.18} />\n              </radialGradient>\n              <mask id={`${uid}-mask`}>\n                <rect width={W} height={H} fill={`url(#${uid}-fall)`} />\n              </mask>\n            </defs>\n            <rect\n              width={W}\n              height={H}\n              fill={`url(#${uid}-dot)`}\n              mask={`url(#${uid}-mask)`}\n            />\n            {ink.map((segs, i) =>\n              segs.length ? (\n                <path\n                  key={`i${i}`}\n                  d={segs.join(\"\")}\n                  fill={fg}\n                  opacity={bucketOpacity(i)}\n                />\n              ) : null,\n            )}\n            {hot.map((segs, i) =>\n              segs.length ? (\n                <path\n                  key={`h${i}`}\n                  d={segs.join(\"\")}\n                  fill={hotColors[i % HOT_STEPS]}\n                  opacity={bucketOpacity(Math.floor(i / HOT_STEPS))}\n                />\n              ) : null,\n            )}\n          </svg>\n        </AbsoluteFill>\n      </ScaleLayer>\n      {grain ? (\n        <svg\n          width=\"100%\"\n          height=\"100%\"\n          style={{\n            position: \"absolute\",\n            inset: 0,\n            opacity: pal.grain,\n            pointerEvents: \"none\",\n          }}\n          aria-hidden\n        >\n          <filter id={`${uid}-grain`}>\n            <feTurbulence\n              type=\"fractalNoise\"\n              baseFrequency=\"0.9\"\n              numOctaves={2}\n              seed={5}\n              stitchTiles=\"stitch\"\n            />\n            <feColorMatrix values=\"0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0.9 0\" />\n          </filter>\n          <rect width=\"100%\" height=\"100%\" filter={`url(#${uid}-grain)`} />\n        </svg>\n      ) : null}\n    </AbsoluteFill>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/remocn/led-ticker.tsx"
    }
  ],
  "type": "registry:component"
}
