{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hero-dot-galaxy",
  "type": "registry:component",
  "title": "Hero Dot Galaxy",
  "description": "Large slowly turning spiral galaxy bleeding past the edges on midnight navy, with magenta, cyan and amber star clusters and a dim dark core under the centered title.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "hero",
    "hero",
    "galaxy",
    "space",
    "canvas",
    "dots"
  ],
  "docs": "https://hyperblur.dev/effects/hero-dot-galaxy",
  "files": [
    {
      "path": "registry/hyperblur/hero-dot-galaxy.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/hero-dot-galaxy.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface HeroDotGalaxyLink {\n  label: string;\n  href: string;\n}\n\nexport interface HeroDotGalaxyProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  title?: string;\n  subtitle?: string;\n  caption?: string;\n  command?: string;\n  primaryCta?: HeroDotGalaxyLink | null;\n  brand?: string;\n  nav?: HeroDotGalaxyLink[];\n  navCta?: HeroDotGalaxyLink | null;\n  learnMore?: HeroDotGalaxyLink | null;\n  accent?: string;\n  density?: number;\n  speed?: number;\n  arms?: number;\n  tightness?: number;\n  headingAs?: \"h1\" | \"h2\";\n  onSearch?: () => void;\n  showBar?: boolean;\n}\n\ntype HeroLink = HeroDotGalaxyLink;\n\nconst css = `\n@keyframes hb-hh4-up {\n  from { opacity: 0; transform: translate3d(0, 14px, 0); }\n  to { opacity: 1; transform: translate3d(0, 0, 0); }\n}\n.hb-hh4 {\n  --hb-hh4-accent: #ff5fd2;\n  --hb-hh4-ink: #0a0f24;\n  --hb-hh4-fg: #e8ecff;\n  --hb-hh4-mute: rgba(190, 202, 245, .66);\n  --hb-hh4-line: rgba(150, 170, 255, .28);\n  --hb-hh4-panel: rgba(6, 10, 30, .62);\n  --hb-hh4-align: center;\n  --hb-hh4-mono: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);\n  position: relative;\n  isolation: isolate;\n  box-sizing: border-box;\n  display: flex;\n  flex-direction: column;\n  width: 100%;\n  min-height: 720px;\n  overflow: hidden;\n  container-type: inline-size;\n  background: radial-gradient(75% 70% at 50% 52%, #0c1840 0%, #070e2a 52%, #040818 100%);\n  color: var(--hb-hh4-fg);\n  font-family: var(--font-sans, ui-sans-serif, system-ui, sans-serif);\n  -webkit-font-smoothing: antialiased;\n}\n.hb-hh4 *, .hb-hh4 *::before, .hb-hh4 *::after { box-sizing: border-box; }\n.hb-hh4-canvas { position: absolute; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; pointer-events: none; }\n.hb-hh4-bar {\n  position: relative; z-index: 3; display: flex; align-items: baseline; justify-content: space-between; gap: 24px;\n  width: 100%; margin: 0 auto; padding: 26px 40px;\n  font-family: var(--hb-hh4-mono); font-size: 12px; letter-spacing: .06em;\n}\n.hb-hh4-brand { color: #fff; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; text-decoration: none; }\n.hb-hh4-menu { display: flex; align-items: baseline; gap: 30px; }\n.hb-hh4-links { display: flex; align-items: baseline; gap: 30px; margin: 0; padding: 0; list-style: none; }\n.hb-hh4-link, .hb-hh4-text {\n  padding: 0; border: 0; background: none; color: rgba(210, 220, 255, .74); font: inherit; letter-spacing: inherit; text-decoration: none; cursor: pointer; transition: color .2s ease;\n}\n.hb-hh4-link:hover, .hb-hh4-text:hover { color: #fff; }\n.hb-hh4-accentlink { color: var(--hb-hh4-accent); }\n.hb-hh4-accentlink:hover { color: #fff; }\n.hb-hh4-main {\n  position: relative; z-index: 2; flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;\n  width: 100%; max-width: 760px; margin: 0 auto; padding: 8px 28px 72px; text-align: center;\n}\n.hb-hh4-title {\n  max-width: 12em; margin: 0; color: #fff; font-size: clamp(34px, 5.6cqi, 80px); font-weight: 600; line-height: 1; letter-spacing: -.045em; text-wrap: balance;\n  text-shadow: 0 2px 40px rgba(4, 8, 24, 1), 0 0 10px rgba(4, 8, 24, .8);\n  animation: hb-hh4-up .8s cubic-bezier(.2, .7, .2, 1) both;\n}\n.hb-hh4-sub {\n  max-width: 32em; margin: 0; color: rgba(214, 222, 255, .86); font-size: 16px; line-height: 1.55; text-wrap: pretty;\n  text-shadow: 0 1px 24px rgba(4, 8, 24, 1), 0 0 8px rgba(4, 8, 24, .9);\n  animation: hb-hh4-up .8s .08s cubic-bezier(.2, .7, .2, 1) both;\n}\n.hb-hh4-caption, .hb-hh4-more, .hb-hh4-bar { text-shadow: 0 0 10px #040818, 0 0 4px #040818; }\n.hb-hh4-side { animation: hb-hh4-up .8s .16s cubic-bezier(.2, .7, .2, 1) both; }\n.hb-hh4-more { color: var(--hb-hh4-accent); font-family: var(--hb-hh4-mono); font-size: 12px; letter-spacing: .08em; text-decoration: none; }\n.hb-hh4-more:hover { color: #fff; }\n.hb-hh4-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; align-items: var(--hb-hh4-align, flex-start); }\n.hb-hh4-row { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; max-width: 100%; justify-content: var(--hb-hh4-align, flex-start); }\n.hb-hh4-cta {\n  display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 6px;\n  height: 44px; padding: 0 16px 0 20px; border-radius: 8px;\n  background: var(--hb-hh4-accent); color: var(--hb-hh4-ink);\n  font-size: 14px; font-weight: 600; letter-spacing: -.01em; text-decoration: none; white-space: nowrap;\n  transition: filter .2s ease, transform .2s ease;\n}\n.hb-hh4-cta:hover { filter: brightness(1.08); }\n.hb-hh4-cta svg { transition: transform .2s ease; }\n.hb-hh4-cta:hover svg { transform: translateX(2px); }\n.hb-hh4-cmd {\n  display: flex; align-items: center; gap: 8px; min-width: 0; height: 44px; padding: 0 6px 0 14px;\n  border: 1px solid var(--hb-hh4-line); border-radius: 8px; background: var(--hb-hh4-panel);\n  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);\n}\n.hb-hh4-prompt { flex: none; color: var(--hb-hh4-accent); font-family: var(--hb-hh4-mono); font-size: 12px; }\n.hb-hh4-code { min-width: 0; overflow: hidden; color: var(--hb-hh4-fg); font-family: var(--hb-hh4-mono); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }\n.hb-hh4-copybtn {\n  display: inline-grid; flex: none; place-items: center; width: 30px; height: 30px; padding: 0;\n  border: 0; border-radius: 6px; background: transparent; color: var(--hb-hh4-mute); cursor: pointer;\n  transition: color .2s ease, background-color .2s ease;\n}\n.hb-hh4-copybtn:hover { color: var(--hb-hh4-fg); background: var(--hb-hh4-line); }\n.hb-hh4-copybtn[data-done=\"true\"] { color: var(--hb-hh4-accent); }\n.hb-hh4-caption { margin: 0; color: var(--hb-hh4-mute); font-family: var(--hb-hh4-mono); font-size: 11.5px; letter-spacing: .04em; }\n.hb-hh4-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n.hb-hh4 a:focus-visible, .hb-hh4 button:focus-visible { outline: 2px solid var(--hb-hh4-accent); outline-offset: 2px; }\n\n@container (max-width: 760px) {\n  .hb-hh4-bar { padding: 20px 24px; }\n}\n@container (max-width: 640px) {\n  .hb-hh4-links { display: none; }\n  .hb-hh4-menu { gap: 18px; }\n  .hb-hh4-main { padding: 8px 22px 48px; gap: 18px; }\n  .hb-hh4-sub { font-size: 14.5px; }\n  .hb-hh4-side, .hb-hh4-row { align-self: stretch; }\n  .hb-hh4-row { flex-direction: column; }\n  .hb-hh4-cta { width: 100%; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-hh4-title, .hb-hh4-sub, .hb-hh4-caption, .hb-hh4-more, .hb-hh4-bar { text-shadow: 0 0 10px #040818, 0 0 4px #040818; }\n.hb-hh4-side { animation: none; }\n  .hb-hh4-link, .hb-hh4-text, .hb-hh4-cta, .hb-hh4-cta svg, .hb-hh4-copybtn { transition: none; }\n}\n`;\n\nconst defaultNav: HeroDotGalaxyLink[] = [\n  { label: \"Atlas\", href: \"#\" },\n  { label: \"Missions\", href: \"#\" },\n  { label: \"Archive\", href: \"#\" },\n];\nconst defaultNavCta: HeroDotGalaxyLink = { label: \"Join the survey\", href: \"#\" };\nconst defaultPrimary: HeroDotGalaxyLink = { label: \"Explore the map\", href: \"#\" };\nconst defaultMore: HeroDotGalaxyLink = { label: \"How we chart it\", href: \"#\" };\n\nconst TAU = Math.PI * 2;\n\nfunction hash(i: number, salt: number) {\n  let x = (Math.imul(i + 1, 0x9e3779b1) ^ Math.imul(salt + 11, 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 hexRgb(value: string): [number, number, number] | null {\n  const m = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(value.trim());\n  if (!m) return null;\n  let h = m[1];\n  if (h.length === 3) h = h[0] + h[0] + h[1] + h[1] + h[2] + h[2];\n  const n = parseInt(h, 16);\n  return [(n >> 16) & 255, (n >> 8) & 255, n & 255];\n}\n\nfunction resolveRgb(value: string, ctx: CanvasRenderingContext2D, fallback: [number, number, number]): [number, number, number] {\n  const direct = hexRgb(value);\n  if (direct) return direct;\n  ctx.fillStyle = \"#000000\";\n  ctx.fillStyle = value;\n  const out = String(ctx.fillStyle);\n  const hex = hexRgb(out);\n  if (hex) return hex;\n  const nums = out.match(/[\\d.]+/g);\n  if (nums && nums.length >= 3) return [Number(nums[0]), Number(nums[1]), Number(nums[2])];\n  return fallback;\n}\n\nfunction inkFor(accent: string, dark: string) {\n  const rgb = hexRgb(accent);\n  if (!rgb) return dark;\n  const lum = (0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]) / 255;\n  return lum > 0.55 ? dark : \"#ffffff\";\n}\n\nfunction clampNum(v: number, lo: number, hi: number, fallback: number) {\n  if (!Number.isFinite(v)) return fallback;\n  return Math.min(hi, Math.max(lo, v));\n}\n\nfunction smooth(t: number) {\n  if (t <= 0) return 0;\n  if (t >= 1) return 1;\n  return t * t * (3 - 2 * t);\n}\n\nfunction makeSprite(rgb: [number, number, number], size: number, core: number) {\n  const c = document.createElement(\"canvas\");\n  c.width = size;\n  c.height = size;\n  const g = c.getContext(\"2d\");\n  if (!g) return c;\n  const r = size / 2;\n  const grad = g.createRadialGradient(r, r, 0, r, r, r);\n  const mix = (v: number) => Math.round(v + (255 - v) * core);\n  grad.addColorStop(0, `rgba(${mix(rgb[0])}, ${mix(rgb[1])}, ${mix(rgb[2])}, 1)`);\n  grad.addColorStop(0.2, `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, 0.9)`);\n  grad.addColorStop(0.5, `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, 0.28)`);\n  grad.addColorStop(1, `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, 0)`);\n  g.fillStyle = grad;\n  g.fillRect(0, 0, size, size);\n  return c;\n}\n\nfunction useCopy(command: string) {\n  const timerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n  const [copied, setCopied] = React.useState(false);\n  React.useEffect(() => {\n    return () => {\n      if (timerRef.current) clearTimeout(timerRef.current);\n    };\n  }, []);\n  const copy = React.useCallback(() => {\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  }, [command]);\n  return { copied, copy };\n}\n\nfunction Actions({\n  caption,\n  command,\n  primaryCta,\n  copied,\n  onCopy,\n}: {\n  caption: string;\n  command: string;\n  primaryCta: HeroLink | null;\n  copied: boolean;\n  onCopy: () => void;\n}) {\n  if (!caption && !command && !primaryCta) return null;\n  return (\n    <div className=\"hb-hh4-side\">\n      {command || primaryCta ? (\n        <div className=\"hb-hh4-row\">\n          {primaryCta ? (\n            <a className=\"hb-hh4-cta\" href={primaryCta.href}>\n              {primaryCta.label}\n              <svg width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.4\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                <path d=\"M9 6l6 6-6 6\" />\n              </svg>\n            </a>\n          ) : null}\n          {command ? (\n            <div className=\"hb-hh4-cmd\">\n              <span className=\"hb-hh4-prompt\" aria-hidden=\"true\">$</span>\n              <code className=\"hb-hh4-code\">{command}</code>\n              <button type=\"button\" className=\"hb-hh4-copybtn\" data-done={copied} onClick={onCopy} 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.2\" 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=\"1.9\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                    <rect x=\"8.5\" y=\"8.5\" width=\"11\" height=\"11\" rx=\"2\" />\n                    <path d=\"M15.5 8.5V6.7a2.2 2.2 0 0 0-2.2-2.2H6.7a2.2 2.2 0 0 0-2.2 2.2v6.6a2.2 2.2 0 0 0 2.2 2.2h1.8\" />\n                  </svg>\n                )}\n                <span className=\"hb-hh4-sr\" aria-live=\"polite\">{copied ? \"Copied\" : \"\"}</span>\n              </button>\n            </div>\n          ) : null}\n        </div>\n      ) : null}\n      {caption ? <p className=\"hb-hh4-caption\">{caption}</p> : null}\n    </div>\n  );\n}\n\n\nconst PALETTE: [number, number, number][] = [\n  [255, 184, 77],\n  [96, 214, 255],\n  [255, 95, 210],\n  [214, 224, 255],\n  [120, 140, 255],\n];\nconst LEVELS = [0.4, 0.62, 0.82, 1];\nconst VOID = 0.4;\n\nfunction gauss(i: number, salt: number) {\n  const u = Math.max(1e-6, hash(i, salt));\n  const v = hash(i, salt + 1);\n  return Math.sqrt(-2 * Math.log(u)) * Math.cos(TAU * v);\n}\n\nexport function HeroDotGalaxy({\n  title = \"A whole universe of effects, one command away.\",\n  subtitle = \"Every piece is plain React you copy into your repo. No runtime to install, no account, nothing orbiting your bundle.\",\n  caption = \"3 spiral arms · 20k stars · MIT licensed\",\n  command = \"npx shadcn@latest add https://hyperblur.dev/r/hero-dot-galaxy.json\",\n  primaryCta = defaultPrimary,\n  brand = \"Your brand\",\n  nav = defaultNav,\n  navCta = defaultNavCta,\n  learnMore = defaultMore,\n  accent = \"#ff5fd2\",\n  density = 1,\n  speed = 1,\n  arms = 3,\n  tightness = 0.35,\n  headingAs = \"h1\",\n  onSearch,\n  showBar = false,\n  className = \"\",\n  style,\n  ...rest\n}: HeroDotGalaxyProps) {\n  const rootRef = React.useRef<HTMLElement>(null);\n  const canvasRef = React.useRef<HTMLCanvasElement>(null);\n  const { copied, copy } = useCopy(command);\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    const reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n    const mult = clampNum(density, 0.2, 2, 1);\n    const pace = clampNum(speed, 0, 4, 1);\n    const nArms = Math.round(clampNum(arms, 1, 8, 3));\n    const tight = clampNum(tightness, 0.12, 1.2, 0.35);\n    const wind = 0.6 + 2.2 * tight;\n    const acc = resolveRgb(accent, ctx, [255, 95, 210]);\n    const colors = PALETTE.map((c, i) => (i === 2 ? acc : c));\n\n    const nBase = Math.round(24000 * mult);\n    const nClust = Math.round(120 * Math.min(1.5, mult));\n    const perClust = 14;\n    const nBulge = Math.round(1100 * mult);\n    const cap = nBase + nClust * perClust + nBulge;\n    const tr = new Float32Array(cap);\n    const tt = new Float32Array(cap);\n    const tc = new Uint8Array(cap);\n    const tb = new Uint8Array(cap);\n    const tsz = new Float32Array(cap);\n    let n = 0;\n    const armAngle = (arm: number, r: number) => (arm / nArms) * TAU + TAU * wind * r;\n    const pushStar = (r: number, th: number, c: number, b: number, s: number) => {\n      tr[n] = r;\n      tt[n] = th;\n      tc[n] = c;\n      tb[n] = Math.min(3, Math.max(0, Math.floor(b * 4)));\n      tsz[n] = s;\n      n++;\n    };\n    const voidDim = (r: number) => 0.12 + 0.88 * smooth((r - VOID * 0.55) / (VOID * 0.9));\n    for (let i = 0; i < nBase; i++) {\n      const disk = hash(i, 1) < 0.2;\n      const u = hash(i, 2);\n      const r = 0.1 + 0.9 * Math.pow(u, 0.72);\n      const arm = Math.floor(hash(i, 3) * nArms) % nArms;\n      const spread = 0.16 + 0.32 * r;\n      const th = disk ? hash(i, 4) * TAU : armAngle(arm, r) + gauss(i, 5) * spread * (1.1 - 0.5 * r) * 0.85;\n      const rr = r + (disk ? 0 : gauss(i, 7) * 0.012);\n      const hot = hash(i, 8);\n      let c: number;\n      if (r < 0.36) c = hot < 0.7 ? 0 : 3;\n      else if (r < 0.7) c = hot < 0.45 ? 1 : hot < 0.7 ? 3 : hot < 0.88 ? 4 : 2;\n      else c = hot < 0.4 ? 2 : hot < 0.65 ? 4 : hot < 0.85 ? 1 : 3;\n      const dim = voidDim(r) * (disk ? 0.55 : 1);\n      if (hash(i, 9) > dim + 0.12) continue;\n      const b = (0.25 + 0.75 * Math.pow(hash(i, 10), 1.6)) * (0.35 + 0.65 * dim);\n      pushStar(rr, th, c, b, 1.5 + hash(i, 11) * 1.3 + (hash(i, 12) > 0.96 ? 1.6 : 0));\n    }\n    const clR = new Float32Array(nClust);\n    const clT = new Float32Array(nClust);\n    const clC = new Uint8Array(nClust);\n    const clS = new Float32Array(nClust);\n    for (let k = 0; k < nClust; k++) {\n      const r = VOID * 0.85 + (0.98 - VOID * 0.85) * Math.pow(hash(k, 31), 0.8);\n      const arm = Math.floor(hash(k, 32) * nArms) % nArms;\n      const th = armAngle(arm, r) + gauss(k, 33) * 0.05;\n      const pick = hash(k, 34);\n      const c = pick < 0.4 ? 2 : pick < 0.75 ? 1 : 0;\n      clR[k] = r;\n      clT[k] = th;\n      clC[k] = c;\n      clS[k] = 0.55 + hash(k, 35) * 0.9;\n      for (let q = 0; q < perClust; q++) {\n        const rr = r + gauss(n, 36) * 0.011;\n        const tq = th + gauss(n, 38) * 0.014 / Math.max(0.3, r);\n        pushStar(rr, tq, c, 0.55 + 0.45 * hash(n, 40), 1.3 + hash(n, 41) * 1.6);\n      }\n    }\n    for (let i = 0; i < nBulge && n < cap; i++) {\n      const r = Math.abs(gauss(i, 51)) * 0.1;\n      pushStar(r, hash(i, 52) * TAU, hash(i, 53) < 0.8 ? 0 : 3, 0.18 + hash(i, 54) * 0.3, 1 + hash(i, 55));\n    }\n    const nHaze = 260;\n    const hzR = new Float32Array(nHaze);\n    const hzT = new Float32Array(nHaze);\n    const hzC = new Uint8Array(nHaze);\n    const hzS = new Float32Array(nHaze);\n    for (let k = 0; k < nHaze; k++) {\n      const r = VOID * 0.95 + (1 - VOID * 0.95) * Math.pow(hash(k, 71), 0.85);\n      const arm = Math.floor(hash(k, 72) * nArms) % nArms;\n      hzR[k] = r;\n      hzT[k] = armAngle(arm, r) + gauss(k, 73) * 0.12;\n      hzC[k] = r < 0.55 ? (hash(k, 74) < 0.5 ? 1 : 0) : hash(k, 74) < 0.55 ? 2 : 1;\n      hzS[k] = 0.6 + hash(k, 75);\n    }\n    const nStar = n;\n    const idx = Array.from({ length: nStar }, (_, i) => i);\n    idx.sort((a, b) => tc[a] * 4 + tb[a] - (tc[b] * 4 + tb[b]));\n    const sr = new Float32Array(nStar);\n    const st = new Float32Array(nStar);\n    const ssz = new Float32Array(nStar);\n    const sBucket = new Uint8Array(nStar);\n    const bStart = new Int32Array(21);\n    for (let i = 0; i < nStar; i++) {\n      const o = idx[i];\n      sr[i] = tr[o];\n      st[i] = tt[o];\n      ssz[i] = tsz[o];\n      sBucket[i] = tc[o] * 4 + tb[o];\n    }\n    for (let i = 0; i < nStar; i++) bStart[sBucket[i] + 1]++;\n    for (let k = 0; k < 20; k++) bStart[k + 1] += bStart[k];\n    const fills: string[] = [];\n    for (let c = 0; c < 5; c++) {\n      for (let l = 0; l < 4; l++) fills.push(`rgba(${colors[c][0]}, ${colors[c][1]}, ${colors[c][2]}, ${LEVELS[l]})`);\n    }\n    const spr = [makeSprite(colors[0], 96, 0.4), makeSprite(colors[1], 96, 0.4), makeSprite(colors[2], 96, 0.4)];\n    const sprBulge = makeSprite(colors[0], 128, 0.1);\n    const PX = new Float32Array(nStar);\n    const PY = new Float32Array(nStar);\n\n    let w = 0;\n    let h = 0;\n    let dpr = 1;\n    let cx = 0;\n    let cy = 0;\n    let R = 600;\n    let ky = 0.62;\n    let roll = -0.35;\n    let unit = 1;\n    let visible = true;\n    let raf = 0;\n    let last = 0;\n    let time = reduce ? 22 : 0;\n\n    function layout() {\n      if (!root || !canvas) return;\n      const rect = root.getBoundingClientRect();\n      w = rect.width;\n      h = rect.height;\n      dpr = Math.min(2, window.devicePixelRatio || 1);\n      canvas.width = Math.max(1, Math.round(w * dpr));\n      canvas.height = Math.max(1, Math.round(h * dpr));\n      const small = w < 640;\n      cx = w / 2;\n      cy = h * 0.52;\n      R = small ? Math.max(h * 0.72, w * 1.3) : Math.max(w * 0.64, h * 0.95);\n      ky = small ? 0.8 : 0.6;\n      roll = small ? -0.5 : -0.3;\n      unit = Math.max(0.7, Math.min(1.6, R / 800));\n    }\n\n    function draw() {\n      if (!ctx || !w || !h) return;\n      ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n      ctx.clearRect(0, 0, w, h);\n      for (let k = 0; k < 150; k++) {\n        const tw = reduce ? 0.7 : 0.5 + 0.5 * Math.sin(time * (0.5 + hash(k, 61)) + hash(k, 62) * TAU);\n        ctx.fillStyle = `rgba(214, 224, 255, ${(0.1 + 0.4 * tw * hash(k, 63)).toFixed(3)})`;\n        ctx.fillRect(hash(k, 64) * w, hash(k, 65) * h, 1.3, 1.3);\n      }\n      const cR = Math.cos(roll);\n      const sR = Math.sin(roll);\n      const rot = time * 0.045 * pace;\n      for (let i = 0; i < nStar; i++) {\n        const r = sr[i];\n        const th = st[i] + rot * (0.55 / (0.22 + r));\n        const x = Math.cos(th) * r;\n        const y = Math.sin(th) * r * ky;\n        PX[i] = cx + (x * cR - y * sR) * R;\n        PY[i] = cy + (x * sR + y * cR) * R;\n      }\n      ctx.globalCompositeOperation = \"lighter\";\n      for (let k = 0; k < nHaze; k++) {\n        const r = hzR[k];\n        const th = hzT[k] + rot * (0.55 / (0.22 + r));\n        const x = Math.cos(th) * r;\n        const y = Math.sin(th) * r * ky;\n        const px = cx + (x * cR - y * sR) * R;\n        const py = cy + (x * sR + y * cR) * R;\n        const s = (150 + 170 * hzS[k]) * unit;\n        if (px < -s || px > w + s || py < -s || py > h + s) continue;\n        ctx.globalAlpha = 0.05 * (0.5 + 0.5 * hzS[k]);\n        ctx.drawImage(spr[hzC[k]], px - s / 2, py - s / 2, s, s);\n      }\n      ctx.globalAlpha = 0.07;\n      const bs = R * 0.5;\n      ctx.drawImage(sprBulge, cx - bs / 2, cy - bs * ky * 0.5, bs, bs * ky);\n      for (let k = 0; k < nClust; k++) {\n        const r = clR[k];\n        const th = clT[k] + rot * (0.55 / (0.22 + r));\n        const x = Math.cos(th) * r;\n        const y = Math.sin(th) * r * ky;\n        const px = cx + (x * cR - y * sR) * R;\n        const py = cy + (x * sR + y * cR) * R;\n        if (px < -80 || px > w + 80 || py < -80 || py > h + 80) continue;\n        const pulse = reduce ? 1 : 0.8 + 0.2 * Math.sin(time * 1.1 + k);\n        ctx.globalAlpha = 0.5 * pulse;\n        const s = (22 + 34 * clS[k]) * unit;\n        ctx.drawImage(spr[clC[k]], px - s / 2, py - s / 2, s, s);\n      }\n      ctx.globalAlpha = 1;\n      for (let b = 0; b < 20; b++) {\n        const a = bStart[b];\n        const z = bStart[b + 1];\n        if (a === z) continue;\n        ctx.fillStyle = fills[b];\n        ctx.beginPath();\n        for (let i = a; i < z; i++) {\n          const x = PX[i];\n          const y = PY[i];\n          if (x < -4 || x > w + 4 || y < -4 || y > h + 4) continue;\n          const s = ssz[i] * unit;\n          ctx.rect(x - s / 2, y - s / 2, s, s);\n        }\n        ctx.fill();\n      }\n      ctx.globalCompositeOperation = \"source-over\";\n    }\n\n    function frame(now: number) {\n      raf = 0;\n      const step = last ? Math.min(0.05, (now - last) / 1000) : 0;\n      last = now;\n      time += step;\n      draw();\n      schedule();\n    }\n\n    function schedule() {\n      if (reduce || raf || !visible || document.hidden) return;\n      raf = requestAnimationFrame(frame);\n    }\n\n    function stop() {\n      if (raf) cancelAnimationFrame(raf);\n      raf = 0;\n      last = 0;\n    }\n\n    function onVisibility() {\n      if (document.hidden) stop();\n      else schedule();\n    }\n\n    layout();\n    draw();\n    const ro = new ResizeObserver(() => {\n      layout();\n      draw();\n    });\n    ro.observe(root);\n    const io = new IntersectionObserver((entries) => {\n      visible = entries[0]?.isIntersecting ?? true;\n      if (visible) schedule();\n      else stop();\n    });\n    io.observe(root);\n    document.addEventListener(\"visibilitychange\", onVisibility);\n    schedule();\n\n    return () => {\n      stop();\n      ro.disconnect();\n      io.disconnect();\n      document.removeEventListener(\"visibilitychange\", onVisibility);\n    };\n  }, [accent, density, speed, arms, tightness]);\n\n  const Heading = headingAs;\n  const vars = { \"--hb-hh4-accent\": accent, \"--hb-hh4-ink\": inkFor(accent, \"#0a0f24\"), ...style } as React.CSSProperties;\n\n  return (\n    <section ref={rootRef} className={`hb-hh4 ${className}`} style={vars} {...rest}>\n      <style href=\"hb-hero-dot-galaxy\" precedence=\"default\">{css}</style>\n      <canvas ref={canvasRef} className=\"hb-hh4-canvas\" aria-hidden=\"true\" />\n      {showBar ? (\n      <header className=\"hb-hh4-bar\">\n        <a className=\"hb-hh4-brand\" href=\"#\">\n          {brand}\n        </a>\n        <div className=\"hb-hh4-menu\">\n          {nav.length ? (\n            <nav aria-label=\"Primary\">\n              <ul className=\"hb-hh4-links\">\n                {nav.map((item) => (\n                  <li key={item.label}>\n                    <a className=\"hb-hh4-link\" href={item.href}>\n                      {item.label}\n                    </a>\n                  </li>\n                ))}\n              </ul>\n            </nav>\n          ) : null}\n          <button type=\"button\" className=\"hb-hh4-text\" onClick={onSearch}>\n            Search\n          </button>\n          {navCta ? (\n            <a className=\"hb-hh4-link hb-hh4-accentlink\" href={navCta.href}>\n              {navCta.label}\n            </a>\n          ) : null}\n        </div>\n      </header>\n      ) : null}\n      <div className=\"hb-hh4-main\">\n        <Heading className=\"hb-hh4-title\">{title}</Heading>\n        {subtitle ? <p className=\"hb-hh4-sub\">{subtitle}</p> : null}\n        <Actions caption={caption} command={command} primaryCta={primaryCta} copied={copied} onCopy={copy} />\n        {learnMore ? (\n          <a className=\"hb-hh4-more\" href={learnMore.href}>\n            {learnMore.label}\n          </a>\n        ) : null}\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}