{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hero-particles",
  "type": "registry:component",
  "title": "Hero Particles",
  "description": "A constellation hero: drifting points linked by proximity lines that lean toward the pointer, behind a centered headline with a shimmering gradient phrase and a copyable install command.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "hero",
    "hero",
    "particles",
    "constellation",
    "canvas",
    "landing",
    "network"
  ],
  "docs": "https://hyperblur.dev/effects/hero-particles",
  "files": [
    {
      "path": "registry/hyperblur/hero-particles.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/hero-particles.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface HeroParticlesAction {\n  label: string;\n  href: string;\n}\n\nexport interface HeroParticlesProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  eyebrow?: string;\n  title?: string;\n  highlight?: string;\n  subtitle?: string;\n  primaryCta?: HeroParticlesAction | null;\n  secondaryCta?: HeroParticlesAction | null;\n  command?: string;\n  accent?: string;\n  density?: number;\n  linkDistance?: number;\n  seed?: number;\n}\n\nconst css = `\n@keyframes hb-hrc-up {\n  from { opacity: 0; transform: translate3d(0, 16px, 0); }\n  to { opacity: 1; transform: translate3d(0, 0, 0); }\n}\n@keyframes hb-hrc-sheen {\n  from { background-position: 0% 50%; }\n  to { background-position: 200% 50%; }\n}\n@keyframes hb-hrc-ping {\n  0% { transform: scale(1); opacity: .7; }\n  80%, 100% { transform: scale(2.6); opacity: 0; }\n}\n.hb-hrc {\n  --hb-hrc-accent: #2f7bff;\n  position: relative;\n  isolation: isolate;\n  box-sizing: border-box;\n  display: flex;\n  flex-direction: column;\n  justify-content: center;\n  width: 100%;\n  min-height: 560px;\n  overflow: hidden;\n  container-type: inline-size;\n  background:\n    radial-gradient(90% 60% at 50% -10%, color-mix(in srgb, var(--hb-hrc-accent) 20%, transparent), transparent 65%),\n    #07080b;\n  color: #ededed;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-hrc *, .hb-hrc *::before, .hb-hrc *::after { box-sizing: border-box; }\n.hb-hrc-canvas {\n  position: absolute;\n  inset: 0;\n  z-index: -1;\n  display: block;\n  width: 100%;\n  height: 100%;\n  pointer-events: none;\n  -webkit-mask-image: radial-gradient(ellipse 42% 38% at 50% 48%, rgba(0, 0, 0, .28), #000 100%);\n  mask-image: radial-gradient(ellipse 42% 38% at 50% 48%, rgba(0, 0, 0, .28), #000 100%);\n}\n.hb-hrc::after {\n  content: \"\";\n  position: absolute;\n  inset: auto 0 0;\n  z-index: -1;\n  height: 140px;\n  pointer-events: none;\n  background: linear-gradient(to bottom, transparent, #07080b);\n}\n.hb-hrc-inner {\n  position: relative;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  width: 100%;\n  max-width: 1000px;\n  margin: 0 auto;\n  padding: 96px 24px 80px;\n  text-align: center;\n}\n.hb-hrc-a {\n  animation: hb-hrc-up .8s cubic-bezier(.2, .8, .2, 1) both;\n  animation-delay: calc(var(--hb-hrc-i, 0) * 80ms);\n}\n.hb-hrc-eyebrow {\n  display: inline-flex;\n  align-items: center;\n  gap: 10px;\n  max-width: 100%;\n  margin: 0 0 24px;\n  padding: 5px 14px 5px 12px;\n  border: 1px solid color-mix(in srgb, var(--hb-hrc-accent) 35%, rgba(255, 255, 255, .08));\n  border-radius: 999px;\n  background: color-mix(in srgb, var(--hb-hrc-accent) 9%, rgba(10, 10, 14, .7));\n  color: #c9d6f2;\n  font-size: 13px;\n  line-height: 18px;\n  backdrop-filter: blur(8px);\n}\n.hb-hrc-eyebrow span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.hb-hrc-dot {\n  position: relative;\n  flex: none;\n  width: 7px;\n  height: 7px;\n  border-radius: 50%;\n  background: var(--hb-hrc-accent);\n}\n.hb-hrc-dot::after {\n  content: \"\";\n  position: absolute;\n  inset: 0;\n  border-radius: 50%;\n  background: var(--hb-hrc-accent);\n  animation: hb-hrc-ping 2s cubic-bezier(0, 0, .2, 1) infinite;\n}\n.hb-hrc-title {\n  max-width: 860px;\n  margin: 0;\n  color: #f4f5f7;\n  font-size: clamp(34px, 7.2cqi, 72px);\n  font-weight: 700;\n  line-height: 1.04;\n  letter-spacing: -.04em;\n  text-wrap: balance;\n}\n.hb-hrc-mark {\n  background: linear-gradient(90deg, var(--hb-hrc-accent), color-mix(in srgb, var(--hb-hrc-accent) 35%, #ffffff), #ffffff, color-mix(in srgb, var(--hb-hrc-accent) 35%, #ffffff), var(--hb-hrc-accent));\n  background-size: 200% 100%;\n  -webkit-background-clip: text;\n  background-clip: text;\n  color: transparent;\n  animation: hb-hrc-sheen 7s linear infinite;\n}\n.hb-hrc-sub {\n  max-width: 600px;\n  margin: 22px 0 0;\n  color: #9a9ca3;\n  font-size: clamp(16px, 1.95cqi, 18.5px);\n  line-height: 1.6;\n  text-wrap: pretty;\n}\n.hb-hrc-actions {\n  display: flex;\n  flex-wrap: wrap;\n  justify-content: center;\n  gap: 12px;\n  margin-top: 32px;\n}\n.hb-hrc-btn {\n  display: inline-flex;\n  align-items: center;\n  justify-content: center;\n  gap: 8px;\n  min-height: 46px;\n  padding: 0 22px;\n  border: 1px solid rgba(255, 255, 255, .14);\n  border-radius: 12px;\n  background: rgba(12, 13, 18, .6);\n  color: #ededed;\n  font: inherit;\n  font-size: 15px;\n  font-weight: 600;\n  line-height: 1;\n  text-decoration: none;\n  white-space: nowrap;\n  backdrop-filter: blur(8px);\n  transition: transform .2s ease, background-color .2s ease, border-color .2s ease, box-shadow .25s ease, filter .2s ease;\n}\n.hb-hrc-btn:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .26); transform: translate3d(0, -1px, 0); }\n.hb-hrc-btn:active { transform: scale(.98); }\n.hb-hrc-btn:focus-visible { outline: 2px solid var(--hb-hrc-accent); outline-offset: 3px; }\n.hb-hrc-btn svg { transition: transform .2s ease; }\n.hb-hrc-btn:hover svg { transform: translate3d(3px, 0, 0); }\n.hb-hrc-btn[data-primary=\"true\"] {\n  border-color: color-mix(in srgb, var(--hb-hrc-accent) 60%, #ffffff);\n  background: linear-gradient(180deg, color-mix(in srgb, var(--hb-hrc-accent) 78%, #ffffff), var(--hb-hrc-accent));\n  color: #ffffff;\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 12px 32px -10px var(--hb-hrc-accent);\n}\n.hb-hrc-btn[data-primary=\"true\"]:hover { filter: brightness(1.08); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 16px 40px -10px var(--hb-hrc-accent); }\n.hb-hrc-cmd {\n  position: relative;\n  display: inline-flex;\n  align-items: center;\n  gap: 12px;\n  max-width: 100%;\n  margin-top: 28px;\n  padding: 6px 6px 6px 16px;\n  border: 1px solid rgba(255, 255, 255, .08);\n  border-radius: 12px;\n  background: rgba(14, 15, 20, .75);\n  color: #c7c9d1;\n  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n  font-size: 13.5px;\n  line-height: 1;\n  backdrop-filter: blur(8px);\n}\n.hb-hrc-cmd > span { color: var(--hb-hrc-accent); user-select: none; }\n.hb-hrc-cmd code {\n  overflow: hidden;\n  font: inherit;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n}\n.hb-hrc-copy {\n  display: inline-grid;\n  flex: none;\n  place-items: center;\n  width: 30px;\n  height: 30px;\n  padding: 0;\n  border: 0;\n  border-radius: 8px;\n  background: transparent;\n  color: #8f8f8f;\n  cursor: pointer;\n  transition: background-color .15s ease, color .15s ease;\n}\n.hb-hrc-copy:hover { background: rgba(255, 255, 255, .07); color: #ededed; }\n.hb-hrc-copy:focus-visible { outline: 2px solid var(--hb-hrc-accent); outline-offset: 1px; }\n.hb-hrc-copy[data-done=\"true\"] { color: #3ddc97; }\n@container (max-width: 520px) {\n  .hb-hrc-inner { padding: 72px 20px 60px; }\n  .hb-hrc-actions { flex-direction: column; align-self: stretch; }\n  .hb-hrc-btn { width: 100%; }\n  .hb-hrc-cmd { font-size: 12.5px; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-hrc-a, .hb-hrc-mark, .hb-hrc-dot::after { animation: none; }\n  .hb-hrc-btn, .hb-hrc-btn svg, .hb-hrc-copy { transition: none; }\n  .hb-hrc-btn:hover, .hb-hrc-btn:hover svg { transform: none; }\n}\n`;\n\nconst defaultPrimary: HeroParticlesAction = { label: \"Get started\", href: \"#\" };\nconst defaultSecondary: HeroParticlesAction = { label: \"Read the docs\", href: \"#\" };\nconst MAX_POINTS = 260;\n\nfunction rnd(seed: number, i: number) {\n  let x = (Math.imul(i + 1, 0x9e3779b1) ^ Math.imul((seed | 0) + 7, 0x85ebca6b)) >>> 0;\n  x = Math.imul((x >>> 16) ^ x, 0x45d9f3b) >>> 0;\n  x = Math.imul((x >>> 16) ^ x, 0x45d9f3b) >>> 0;\n  x = ((x >>> 16) ^ x) >>> 0;\n  return x / 4294967296;\n}\n\nfunction delay(index: number) {\n  return { \"--hb-hrc-i\": index } as React.CSSProperties;\n}\n\nexport function HeroParticles({\n  eyebrow = \"Graph engine v4 is now generally available\",\n  title = \"Connect every signal in your stack\",\n  highlight = \"every signal\",\n  subtitle = \"Lattice maps services, queues and databases into one live dependency graph and flags what breaks before you deploy.\",\n  primaryCta = defaultPrimary,\n  secondaryCta = defaultSecondary,\n  command = \"npx shadcn@latest add https://hyperblur.dev/r/hero-particles.json\",\n  accent = \"#2f7bff\",\n  density = 1.5,\n  linkDistance = 120,\n  seed = 7,\n  className = \"\",\n  style,\n  ...rest\n}: HeroParticlesProps) {\n  const rootRef = React.useRef<HTMLElement>(null);\n  const canvasRef = React.useRef<HTMLCanvasElement>(null);\n  const timerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n  const [copied, setCopied] = React.useState(false);\n\n  React.useEffect(() => {\n    const root = rootRef.current;\n    const canvas = canvasRef.current;\n    const ctx = canvas?.getContext(\"2d\");\n    if (!root || !canvas || !ctx) return;\n\n    const reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n    const TAU = Math.PI * 2;\n    const link = Math.max(20, linkDistance);\n    const link2 = link * link;\n    const reach = link * 1.7;\n    const reach2 = reach * reach;\n    const x = new Float32Array(MAX_POINTS);\n    const y = new Float32Array(MAX_POINTS);\n    const vx = new Float32Array(MAX_POINTS);\n    const vy = new Float32Array(MAX_POINTS);\n    const bx = new Float32Array(MAX_POINTS);\n    const by = new Float32Array(MAX_POINTS);\n    const rad = new Float32Array(MAX_POINTS);\n    const base = new Float32Array(MAX_POINTS);\n    const phase = new Float32Array(MAX_POINTS);\n    const tw = new Float32Array(MAX_POINTS);\n\n    for (let i = 0; i < MAX_POINTS; i++) {\n      const a = rnd(seed, i * 9 + 1) * TAU;\n      const v = 5 + rnd(seed, i * 9 + 2) * 11;\n      bx[i] = Math.cos(a) * v;\n      by[i] = Math.sin(a) * v;\n      vx[i] = bx[i];\n      vy[i] = by[i];\n      rad[i] = 0.7 + rnd(seed, i * 9 + 5) * 1.3;\n      base[i] = 0.35 + rnd(seed, i * 9 + 6) * 0.55;\n      phase[i] = rnd(seed, i * 9 + 7) * TAU;\n      tw[i] = 0.6 + rnd(seed, i * 9 + 8) * 1.6;\n    }\n\n    let w = 0;\n    let h = 0;\n    let n = 0;\n    let placed = false;\n    let pointer = false;\n    let mx = 0;\n    let my = 0;\n    let visible = true;\n    let raf = 0;\n    let last = 0;\n    let time = 0;\n\n    function draw() {\n      if (!ctx || !w || !h) return;\n      ctx.clearRect(0, 0, w, h);\n      ctx.lineWidth = 1;\n      ctx.strokeStyle = accent;\n      for (let i = 0; i < n; i++) {\n        const xi = x[i];\n        const yi = y[i];\n        for (let j = i + 1; j < n; j++) {\n          const dx = x[j] - xi;\n          const dy = y[j] - yi;\n          const d2 = dx * dx + dy * dy;\n          if (d2 >= link2) continue;\n          const k = 1 - Math.sqrt(d2) / link;\n          ctx.globalAlpha = k * k * 0.55;\n          ctx.beginPath();\n          ctx.moveTo(xi, yi);\n          ctx.lineTo(x[j], y[j]);\n          ctx.stroke();\n        }\n      }\n      if (pointer) {\n        for (let i = 0; i < n; i++) {\n          const dx = mx - x[i];\n          const dy = my - y[i];\n          const d2 = dx * dx + dy * dy;\n          if (d2 >= reach2) continue;\n          const k = 1 - Math.sqrt(d2) / reach;\n          ctx.globalAlpha = k * k * 0.8;\n          ctx.beginPath();\n          ctx.moveTo(x[i], y[i]);\n          ctx.lineTo(mx, my);\n          ctx.stroke();\n        }\n      }\n      ctx.fillStyle = \"#ffffff\";\n      for (let i = 0; i < n; i++) {\n        const glow = reduce ? 1 : 0.75 + 0.25 * Math.sin(time * tw[i] + phase[i]);\n        ctx.globalAlpha = base[i] * glow;\n        ctx.beginPath();\n        ctx.arc(x[i], y[i], rad[i], 0, TAU);\n        ctx.fill();\n      }\n      if (pointer) {\n        ctx.fillStyle = accent;\n        ctx.globalAlpha = 0.9;\n        ctx.beginPath();\n        ctx.arc(mx, my, 2.4, 0, TAU);\n        ctx.fill();\n      }\n      ctx.globalAlpha = 1;\n    }\n\n    function step(dt: number) {\n      const relax = Math.min(1, dt * 2.2);\n      const m = 16;\n      for (let i = 0; i < n; i++) {\n        let tx = bx[i];\n        let ty = by[i];\n        if (pointer) {\n          const dx = mx - x[i];\n          const dy = my - y[i];\n          const d2 = dx * dx + dy * dy;\n          if (d2 < reach2 && d2 > 64) {\n            const d = Math.sqrt(d2);\n            const f = (1 - d / reach) * 46;\n            tx += (dx / d) * f;\n            ty += (dy / d) * f;\n          }\n        }\n        vx[i] += (tx - vx[i]) * relax;\n        vy[i] += (ty - vy[i]) * relax;\n        x[i] += vx[i] * dt;\n        y[i] += vy[i] * dt;\n        if (x[i] < -m) x[i] = w + m;\n        else if (x[i] > w + m) x[i] = -m;\n        if (y[i] < -m) y[i] = h + m;\n        else if (y[i] > h + m) y[i] = -m;\n      }\n    }\n\n    function frame(now: number) {\n      raf = 0;\n      const dt = last ? Math.min(0.05, (now - last) / 1000) : 0.016;\n      last = now;\n      time += dt;\n      step(dt);\n      draw();\n      if (visible) raf = requestAnimationFrame(frame);\n    }\n\n    function start() {\n      if (reduce || raf || !visible) return;\n      last = 0;\n      raf = requestAnimationFrame(frame);\n    }\n\n    function resize() {\n      if (!canvas || !ctx) return;\n      const nw = canvas.clientWidth;\n      const nh = canvas.clientHeight;\n      if (!nw || !nh) return;\n      const dpr = Math.min(2, window.devicePixelRatio || 1);\n      canvas.width = Math.round(nw * dpr);\n      canvas.height = Math.round(nh * dpr);\n      ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n      if (!placed) {\n        for (let i = 0; i < MAX_POINTS; i++) {\n          x[i] = rnd(seed, i * 9 + 3) * nw;\n          y[i] = rnd(seed, i * 9 + 4) * nh;\n        }\n        placed = true;\n      } else if (w && h) {\n        const sx = nw / w;\n        const sy = nh / h;\n        for (let i = 0; i < MAX_POINTS; i++) {\n          x[i] *= sx;\n          y[i] *= sy;\n        }\n      }\n      w = nw;\n      h = nh;\n      n = Math.max(16, Math.min(MAX_POINTS, Math.round(((w * h) / 10000) * Math.max(0.1, density))));\n      draw();\n    }\n\n    function local(e: PointerEvent) {\n      if (!root) return { x: 0, y: 0 };\n      const r = root.getBoundingClientRect();\n      const sx = r.width ? root.offsetWidth / r.width : 1;\n      const sy = r.height ? root.offsetHeight / r.height : 1;\n      return { x: (e.clientX - r.left) * sx, y: (e.clientY - r.top) * sy };\n    }\n\n    function onMove(e: PointerEvent) {\n      const p = local(e);\n      mx = p.x;\n      my = p.y;\n      pointer = true;\n      if (reduce) draw();\n    }\n\n    function onLeave() {\n      pointer = false;\n      if (reduce) draw();\n    }\n\n    resize();\n    const ro = new ResizeObserver(resize);\n    ro.observe(canvas);\n    const io = new IntersectionObserver((entries) => {\n      visible = entries[0]?.isIntersecting ?? true;\n      if (visible) start();\n      else if (raf) {\n        cancelAnimationFrame(raf);\n        raf = 0;\n      }\n    });\n    io.observe(root);\n    root.addEventListener(\"pointermove\", onMove);\n    root.addEventListener(\"pointerdown\", onMove);\n    root.addEventListener(\"pointerleave\", onLeave);\n    root.addEventListener(\"pointercancel\", onLeave);\n    start();\n\n    return () => {\n      if (raf) cancelAnimationFrame(raf);\n      ro.disconnect();\n      io.disconnect();\n      root.removeEventListener(\"pointermove\", onMove);\n      root.removeEventListener(\"pointerdown\", onMove);\n      root.removeEventListener(\"pointerleave\", onLeave);\n      root.removeEventListener(\"pointercancel\", onLeave);\n    };\n  }, [accent, density, linkDistance, seed]);\n\n  React.useEffect(() => {\n    return () => {\n      if (timerRef.current) clearTimeout(timerRef.current);\n    };\n  }, []);\n\n  function copy() {\n    if (!command) return;\n    navigator.clipboard?.writeText(command).catch(() => undefined);\n    setCopied(true);\n    if (timerRef.current) clearTimeout(timerRef.current);\n    timerRef.current = setTimeout(() => setCopied(false), 1600);\n  }\n\n  const vars = { \"--hb-hrc-accent\": accent, ...style } as React.CSSProperties;\n  const at = highlight ? title.indexOf(highlight) : -1;\n\n  return (\n    <section ref={rootRef} className={`hb-hrc ${className}`} style={vars} {...rest}>\n      <style href=\"hb-hero-particles\" precedence=\"default\">{css}</style>\n      <canvas ref={canvasRef} className=\"hb-hrc-canvas\" aria-hidden=\"true\" />\n      <div className=\"hb-hrc-inner\">\n        {eyebrow ? (\n          <p className=\"hb-hrc-eyebrow hb-hrc-a\" style={delay(0)}>\n            <span className=\"hb-hrc-dot\" aria-hidden=\"true\" />\n            <span>{eyebrow}</span>\n          </p>\n        ) : null}\n        <h1 className=\"hb-hrc-title hb-hrc-a\" style={delay(1)}>\n          {at >= 0 ? (\n            <>\n              {title.slice(0, at)}\n              <span className=\"hb-hrc-mark\">{highlight}</span>\n              {title.slice(at + highlight.length)}\n            </>\n          ) : (\n            title\n          )}\n        </h1>\n        {subtitle ? (\n          <p className=\"hb-hrc-sub hb-hrc-a\" style={delay(2)}>\n            {subtitle}\n          </p>\n        ) : null}\n        {primaryCta || secondaryCta ? (\n          <div className=\"hb-hrc-actions hb-hrc-a\" style={delay(3)}>\n            {primaryCta ? (\n              <a className=\"hb-hrc-btn\" data-primary=\"true\" href={primaryCta.href}>\n                {primaryCta.label}\n                <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                  <path d=\"M5 12h14M13 6l6 6-6 6\" />\n                </svg>\n              </a>\n            ) : null}\n            {secondaryCta ? (\n              <a className=\"hb-hrc-btn\" href={secondaryCta.href}>\n                {secondaryCta.label}\n              </a>\n            ) : null}\n          </div>\n        ) : null}\n        {command ? (\n          <div className=\"hb-hrc-cmd hb-hrc-a\" style={delay(4)}>\n            <span aria-hidden=\"true\">$</span>\n            <code>{command}</code>\n            <button type=\"button\" className=\"hb-hrc-copy\" data-done={copied} onClick={copy} aria-label={copied ? \"Copied\" : \"Copy command\"}>\n              {copied ? (\n                <svg width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                  <path d=\"M5 12.5l4.5 4.5L19 7.5\" />\n                </svg>\n              ) : (\n                <svg width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                  <rect x=\"9\" y=\"9\" width=\"11\" height=\"11\" rx=\"2.5\" />\n                  <path d=\"M15 9V6.5A2.5 2.5 0 0 0 12.5 4h-6A2.5 2.5 0 0 0 4 6.5v6A2.5 2.5 0 0 0 6.5 15H9\" />\n                </svg>\n              )}\n            </button>\n            <span className=\"hb-hrc-sr\" role=\"status\" aria-live=\"polite\" style={{ position: \"absolute\", width: 1, height: 1, overflow: \"hidden\", clip: \"rect(0 0 0 0)\" }}>\n              {copied ? \"Command copied\" : \"\"}\n            </span>\n          </div>\n        ) : null}\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}