{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "bg-grid-beams",
  "type": "registry:component",
  "title": "Grid Beams",
  "description": "A fine grid lit from the top, with beams of light that shoot along its lines and sparks that flash at the crossings. Beams snap to the grid at any size.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "overlay",
    "background",
    "grid",
    "beams",
    "light",
    "css",
    "saas"
  ],
  "docs": "https://hyperblur.dev/effects/bg-grid-beams",
  "files": [
    {
      "path": "registry/hyperblur/bg-grid-beams.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/bg-grid-beams.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface BgGridBeamsProps extends React.HTMLAttributes<HTMLDivElement> {\n  cell?: number;\n  beams?: number;\n  color?: string;\n  accent?: string;\n  background?: string;\n  speed?: number;\n  children?: React.ReactNode;\n}\n\nconst css = `\n.hb-vd7 { position: absolute; inset: 0; overflow: hidden; pointer-events: none; box-sizing: border-box; background: var(--hb-vd7-bg); container-type: size; }\n.hb-vd7 *, .hb-vd7 *::before, .hb-vd7 *::after { box-sizing: border-box; }\n.hb-vd7-stage { position: absolute; inset: 0; -webkit-mask-image: radial-gradient(85% 75% at 50% 0%, #000 30%, rgba(0,0,0,0.35) 62%, transparent 92%); mask-image: radial-gradient(85% 75% at 50% 0%, #000 30%, rgba(0,0,0,0.35) 62%, transparent 92%); }\n.hb-vd7-grid { position: absolute; inset: 0; background-image: linear-gradient(to right, var(--hb-vd7-line) 1px, transparent 1px), linear-gradient(to bottom, var(--hb-vd7-line) 1px, transparent 1px); background-size: var(--hb-vd7-cell) var(--hb-vd7-cell); background-position: 0 0; }\n.hb-vd7-cross { position: absolute; inset: 0; background-image: radial-gradient(circle at 0 0, color-mix(in srgb, var(--hb-vd7-a) 55%, transparent) 0 1.2px, transparent 1.8px); background-size: var(--hb-vd7-cell) var(--hb-vd7-cell); background-position: 0.5px 0.5px; opacity: 0.45; }\n.hb-vd7-v, .hb-vd7-h { position: absolute; overflow: visible; }\n.hb-vd7-v { top: 0; bottom: 0; width: 1px; left: var(--p); }\n.hb-vd7-h { left: 0; right: 0; height: 1px; top: var(--p); }\n.hb-vd7-head { position: absolute; border-radius: 2px; opacity: 0; }\n.hb-vd7-v .hb-vd7-head { left: -1px; width: 3px; height: var(--len); background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--hb-vd7-a) 70%, transparent) 72%, #fff); box-shadow: 0 0 10px var(--hb-vd7-a), 0 0 24px color-mix(in srgb, var(--hb-vd7-a) 60%, transparent); animation: hb-vd7-down calc(var(--d) * var(--hb-vd7-k)) cubic-bezier(0.6, 0.05, 0.3, 1) infinite; animation-delay: var(--dl); }\n.hb-vd7-h .hb-vd7-head { top: -1px; height: 3px; width: var(--len); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--hb-vd7-a) 70%, transparent) 72%, #fff); box-shadow: 0 0 10px var(--hb-vd7-a), 0 0 24px color-mix(in srgb, var(--hb-vd7-a) 60%, transparent); animation: hb-vd7-right calc(var(--d) * var(--hb-vd7-k)) cubic-bezier(0.6, 0.05, 0.3, 1) infinite; animation-delay: var(--dl); }\n.hb-vd7-spark { position: absolute; left: var(--x); top: var(--y); width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 1px; background: #fff; box-shadow: 0 0 8px var(--hb-vd7-a), 0 0 18px var(--hb-vd7-a); opacity: 0; animation: hb-vd7-spark calc(var(--d) * var(--hb-vd7-k)) ease-out infinite; animation-delay: var(--dl); }\n.hb-vd7-glow { position: absolute; left: 50%; top: -30%; width: 90%; height: 70%; translate: -50% 0; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--hb-vd7-a) 38%, transparent), transparent); filter: blur(10px); }\n.hb-vd7-in { position: relative; z-index: 1; width: 100%; height: 100%; pointer-events: auto; font-family: inherit; }\n@keyframes hb-vd7-down {\n  0% { transform: translateY(calc(var(--len) * -1)); opacity: 0; }\n  6% { opacity: 1; }\n  62% { transform: translateY(100cqh); opacity: 1; }\n  63%, 100% { transform: translateY(100cqh); opacity: 0; }\n}\n@keyframes hb-vd7-right {\n  0% { transform: translateX(calc(var(--len) * -1)); opacity: 0; }\n  6% { opacity: 1; }\n  62% { transform: translateX(100cqw); opacity: 1; }\n  63%, 100% { transform: translateX(100cqw); opacity: 0; }\n}\n@keyframes hb-vd7-spark {\n  0%, 100% { opacity: 0; transform: scale(0.4) rotate(45deg); }\n  8% { opacity: 1; transform: scale(1.3) rotate(45deg); }\n  30% { opacity: 0; transform: scale(0.6) rotate(45deg); }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-vd7-head, .hb-vd7-spark { animation: none; }\n  .hb-vd7-v .hb-vd7-head { opacity: 0.8; transform: translateY(var(--rest)); }\n  .hb-vd7-h .hb-vd7-head { opacity: 0.8; transform: translateX(var(--rest)); }\n}\n`;\n\nfunction hash(i: number) {\n  let x = Math.imul(i ^ 0x428a2f98, 0x71374491);\n  x ^= x >>> 15;\n  x = Math.imul(x, 0xb5c0fbcf);\n  x ^= x >>> 13;\n  return (x >>> 0) / 4294967296;\n}\n\nexport function BgGridBeams({\n  cell = 40,\n  beams = 14,\n  color = \"rgba(255,255,255,0.07)\",\n  accent = \"#2f7bff\",\n  background = \"#050608\",\n  speed = 1,\n  children,\n  className = \"\",\n  style,\n  ...rest\n}: BgGridBeamsProps) {\n  const wrapRef = React.useRef<HTMLDivElement>(null);\n  const [size, setSize] = React.useState({ cols: 24, rows: 14 });\n  const c = Math.max(12, cell);\n\n  React.useEffect(() => {\n    const el = wrapRef.current;\n    if (!el) return;\n    const ro = new ResizeObserver(() => {\n      const cols = Math.max(2, Math.floor(el.clientWidth / c));\n      const rows = Math.max(2, Math.floor(el.clientHeight / c));\n      setSize((s) => (s.cols === cols && s.rows === rows ? s : { cols, rows }));\n    });\n    ro.observe(el);\n    return () => ro.disconnect();\n  }, [c]);\n\n  const n = Math.max(0, Math.min(60, Math.round(beams)));\n  const list = Array.from({ length: n }, (_, i) => {\n    const vertical = hash(i * 6 + 1) > 0.38;\n    const max = vertical ? size.cols : Math.max(2, Math.ceil(size.rows * 0.6));\n    const idx = 1 + Math.floor(hash(i * 6 + 2) * (max - 1));\n    const d = 3.6 + hash(i * 6 + 3) * 4.4;\n    const dl = -hash(i * 6 + 4) * d * 2;\n    const len = 50 + Math.round(hash(i * 6 + 5) * 90);\n    return { vertical, p: idx * c, d, dl, len, rest: Math.round(hash(i * 6 + 6) * 300) };\n  });\n  const sparks = Array.from({ length: Math.round(n * 0.8) }, (_, i) => ({\n    x: (1 + Math.floor(hash(i * 5 + 300) * (size.cols - 1))) * c,\n    y: (1 + Math.floor(hash(i * 5 + 301) * Math.max(1, Math.ceil(size.rows * 0.55) - 1))) * c,\n    d: 2.8 + hash(i * 5 + 302) * 4,\n    dl: -hash(i * 5 + 303) * 6,\n  }));\n\n  return (\n    <div\n      ref={wrapRef}\n      className={`hb-vd7 ${className}`}\n      style={\n        {\n          \"--hb-vd7-bg\": background,\n          \"--hb-vd7-a\": accent,\n          \"--hb-vd7-line\": color,\n          \"--hb-vd7-cell\": `${c}px`,\n          \"--hb-vd7-k\": (1 / Math.max(0.05, speed)).toFixed(3),\n          ...style,\n        } as React.CSSProperties\n      }\n      {...rest}\n    >\n      <style href=\"hb-bg-grid-beams\" precedence=\"default\">{css}</style>\n      <div className=\"hb-vd7-glow\" aria-hidden=\"true\" />\n      <div className=\"hb-vd7-stage\" aria-hidden=\"true\">\n        <div className=\"hb-vd7-grid\" />\n        <div className=\"hb-vd7-cross\" />\n        {list.map((b, i) => (\n          <div\n            key={i}\n            className={b.vertical ? \"hb-vd7-v\" : \"hb-vd7-h\"}\n            style={{ \"--p\": `${b.p}px`, \"--len\": `${b.len}px`, \"--d\": `${b.d.toFixed(2)}s`, \"--dl\": `${b.dl.toFixed(2)}s`, \"--rest\": `${b.rest}px` } as React.CSSProperties}\n          >\n            <span className=\"hb-vd7-head\" />\n          </div>\n        ))}\n        {sparks.map((s, i) => (\n          <span\n            key={`s${i}`}\n            className=\"hb-vd7-spark\"\n            style={{ \"--x\": `${s.x}px`, \"--y\": `${s.y}px`, \"--d\": `${s.d.toFixed(2)}s`, \"--dl\": `${s.dl.toFixed(2)}s` } as React.CSSProperties}\n          />\n        ))}\n      </div>\n      {children ? <div className=\"hb-vd7-in\">{children}</div> : null}\n    </div>\n  );\n}\n"
    }
  ]
}