{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hero-live-metrics",
  "type": "registry:component",
  "title": "Hero Live Metrics",
  "description": "A hero that ends in a working dashboard: revenue ticks up, the line chart slides a new point in every beat and fresh payments drop into the feed. It pauses offscreen and holds still for reduced motion.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "hero",
    "hero",
    "dashboard",
    "live",
    "chart",
    "analytics",
    "saas"
  ],
  "docs": "https://hyperblur.dev/effects/hero-live-metrics",
  "files": [
    {
      "path": "registry/hyperblur/hero-live-metrics.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/hero-live-metrics.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface HeroLiveMetricsAction {\n  label: string;\n  href: string;\n}\n\nexport interface HeroLiveMetricsProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  eyebrow?: string;\n  title?: string;\n  subtitle?: string;\n  primaryCta?: HeroLiveMetricsAction | null;\n  secondaryCta?: HeroLiveMetricsAction | null;\n  baseRevenue?: number;\n  currency?: string;\n  locale?: string;\n  interval?: number;\n  accent?: string;\n  live?: boolean;\n  headingAs?: \"h1\" | \"h2\";\n}\n\nconst css = `\n.hb-vb9 {\n  --hb-vb9-accent: #2f7bff;\n  --hb-vb9-step: 1400ms;\n  position: relative;\n  box-sizing: border-box;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  width: 100%;\n  min-height: 640px;\n  padding: 56px clamp(16px, 5cqi, 48px) 0;\n  overflow: hidden;\n  isolation: isolate;\n  container-type: inline-size;\n  background: radial-gradient(80% 60% at 50% 110%, color-mix(in srgb, var(--hb-vb9-accent) 20%, transparent), transparent 70%), #08090b;\n  color: #ededed;\n  font-family: inherit;\n  text-align: center;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-vb9 *, .hb-vb9 *::before, .hb-vb9 *::after { box-sizing: border-box; }\n.hb-vb9-in { animation: hb-vb9-up .9s cubic-bezier(.16, 1, .3, 1) both; animation-delay: var(--hb-vb9-d, 0ms); }\n@keyframes hb-vb9-up {\n  from { opacity: 0; transform: translate3d(0, 14px, 0); }\n  to { opacity: 1; transform: none; }\n}\n.hb-vb9-eyebrow {\n  display: inline-flex;\n  align-items: center;\n  gap: 8px;\n  margin: 0;\n  padding: 5px 12px;\n  border: 1px solid rgba(255, 255, 255, .1);\n  border-radius: 999px;\n  color: rgba(237, 237, 237, .72);\n  font-size: 12.5px;\n}\n.hb-vb9-pulse { position: relative; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }\n.hb-vb9-pulse::after { content: \"\"; position: absolute; inset: 0; border-radius: 50%; background: #22c55e; animation: hb-vb9-ping 1.6s cubic-bezier(0, 0, .2, 1) infinite; }\n@keyframes hb-vb9-ping {\n  to { transform: scale(2.8); opacity: 0; }\n}\n.hb-vb9-title {\n  max-width: 760px;\n  margin: 16px 0 0;\n  color: #f5f5f5;\n  font-size: clamp(34px, 5.6cqi, 58px);\n  font-weight: 640;\n  line-height: 1.03;\n  letter-spacing: -.045em;\n  text-wrap: balance;\n}\n.hb-vb9-sub { max-width: 520px; margin: 14px 0 0; color: rgba(237, 237, 237, .56); font-size: clamp(14.5px, 1.6cqi, 16px); line-height: 1.55; }\n.hb-vb9-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }\n.hb-vb9-btn {\n  display: inline-flex;\n  align-items: center;\n  gap: 8px;\n  min-height: 44px;\n  padding: 0 20px;\n  border: 1px solid rgba(255, 255, 255, .14);\n  border-radius: 10px;\n  color: #ededed;\n  font: inherit;\n  font-size: 14.5px;\n  font-weight: 550;\n  text-decoration: none;\n  white-space: nowrap;\n  transition: transform .25s cubic-bezier(.2, .8, .2, 1), background .25s ease, border-color .25s ease;\n}\n.hb-vb9-btn:hover { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .26); transform: translateY(-1px); }\n.hb-vb9-btn:active { transform: scale(.98); }\n.hb-vb9-btn:focus-visible { outline: 2px solid var(--hb-vb9-accent); outline-offset: 3px; }\n.hb-vb9-btn[data-primary] { border-color: transparent; background: var(--hb-vb9-accent); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 10px 30px -12px var(--hb-vb9-accent); }\n.hb-vb9-btn[data-primary]:hover { background: color-mix(in srgb, var(--hb-vb9-accent) 88%, #ffffff); }\n.hb-vb9-panel {\n  display: grid;\n  grid-template-columns: minmax(0, 1fr) 250px;\n  width: 100%;\n  max-width: 840px;\n  margin-top: 36px;\n  overflow: hidden;\n  border: 1px solid rgba(255, 255, 255, .09);\n  border-bottom: 0;\n  border-radius: 16px 16px 0 0;\n  background: linear-gradient(180deg, #111215, #0b0c0e);\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 -20px 80px -30px color-mix(in srgb, var(--hb-vb9-accent) 50%, transparent);\n  text-align: left;\n}\n.hb-vb9-main { min-width: 0; padding: 18px 20px 20px; }\n.hb-vb9-label { display: flex; align-items: center; justify-content: space-between; color: rgba(237, 237, 237, .5); font-size: 12px; }\n.hb-vb9-range { display: inline-flex; gap: 2px; padding: 2px; border-radius: 7px; background: rgba(255, 255, 255, .05); }\n.hb-vb9-range span { padding: 3px 8px; border-radius: 5px; font-size: 11px; }\n.hb-vb9-range span:first-child { background: rgba(255, 255, 255, .1); color: #fff; }\n.hb-vb9-value {\n  margin-top: 6px;\n  color: #fafafa;\n  font-family: var(--font-grotesk, inherit);\n  font-size: clamp(28px, 4.4cqi, 40px);\n  font-weight: 600;\n  letter-spacing: -.03em;\n  font-variant-numeric: tabular-nums;\n}\n.hb-vb9-delta { display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; color: #4ade80; font-size: 12.5px; font-variant-numeric: tabular-nums; }\n.hb-vb9-delta span { color: rgba(237, 237, 237, .4); }\n.hb-vb9-flash { animation: hb-vb9-flash .9s ease-out; }\n@keyframes hb-vb9-flash {\n  from { color: color-mix(in srgb, var(--hb-vb9-accent) 50%, #ffffff); }\n}\n.hb-vb9-chart { display: block; width: 100%; height: auto; margin-top: 12px; overflow: hidden; }\n.hb-vb9-shift { animation: hb-vb9-shift var(--hb-vb9-step) linear both; }\n@keyframes hb-vb9-shift {\n  from { transform: translateX(var(--hb-vb9-dx)); }\n  to { transform: translateX(0); }\n}\n.hb-vb9-side { display: flex; flex-direction: column; min-width: 0; padding: 18px 16px; border-left: 1px solid rgba(255, 255, 255, .06); }\n.hb-vb9-side h3 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; color: rgba(237, 237, 237, .5); font-size: 12px; font-weight: 500; }\n.hb-vb9-feed { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }\n.hb-vb9-event {\n  display: grid;\n  grid-template-columns: 28px minmax(0, 1fr) auto;\n  align-items: center;\n  gap: 9px;\n  padding: 8px;\n  border: 1px solid rgba(255, 255, 255, .05);\n  border-radius: 10px;\n  background: rgba(255, 255, 255, .02);\n  font-size: 12px;\n}\n.hb-vb9-event:first-child { animation: hb-vb9-drop .6s cubic-bezier(.34, 1.56, .64, 1); border-color: color-mix(in srgb, var(--hb-vb9-accent) 35%, transparent); }\n@keyframes hb-vb9-drop {\n  from { opacity: 0; transform: translate3d(0, -10px, 0) scale(.97); }\n  to { opacity: 1; transform: none; }\n}\n.hb-vb9-av { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: #fff; font-size: 10.5px; font-weight: 650; }\n.hb-vb9-who { overflow: hidden; color: #ededed; white-space: nowrap; text-overflow: ellipsis; }\n.hb-vb9-who span { display: block; overflow: hidden; color: rgba(237, 237, 237, .42); font-size: 11px; text-overflow: ellipsis; }\n.hb-vb9-amt { color: #4ade80; font-family: var(--font-mono, ui-monospace, monospace); font-size: 11.5px; }\n.hb-vb9-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }\n.hb-vb9-kpi { padding: 10px; border-radius: 10px; background: rgba(255, 255, 255, .03); }\n.hb-vb9-kpi b { display: block; color: #fafafa; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }\n.hb-vb9-kpi span { color: rgba(237, 237, 237, .45); font-size: 11px; }\n@container (max-width: 680px) {\n  .hb-vb9-panel { grid-template-columns: 1fr; }\n  .hb-vb9-side { border-left: 0; border-top: 1px solid rgba(255, 255, 255, .06); }\n}\n@container (max-width: 480px) {\n  .hb-vb9-actions { flex-direction: column; align-items: stretch; width: 100%; max-width: 320px; }\n  .hb-vb9-btn { justify-content: center; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-vb9-in, .hb-vb9-pulse::after, .hb-vb9-shift, .hb-vb9-event:first-child, .hb-vb9-flash { animation: none; }\n  .hb-vb9-btn { transition: none; }\n}\n`;\n\nfunction hash(n: number) {\n  let x = Math.imul((n >>> 0) + 11, 2246822519);\n  x = Math.imul(x ^ (x >>> 15), 3266489917);\n  x ^= x >>> 16;\n  return (x >>> 0) / 4294967296;\n}\n\nconst W = 600;\nconst H = 170;\nconst COUNT = 41;\nconst STEP = (W - 14) / (COUNT - 1);\n\nfunction sample(i: number) {\n  return 52 + Math.sin(i * 0.33) * 14 + Math.sin(i * 0.11 + 1.3) * 10 + hash(i) * 16;\n}\n\nconst people = [\n  { n: \"Maya Chen\", c: \"#6366f1\" },\n  { n: \"Diego Ramos\", c: \"#f97316\" },\n  { n: \"Aisha Bello\", c: \"#10b981\" },\n  { n: \"Tom Becker\", c: \"#0ea5e9\" },\n  { n: \"Lena Novak\", c: \"#ec4899\" },\n  { n: \"Kenji Ito\", c: \"#eab308\" },\n  { n: \"Sara Lund\", c: \"#8b5cf6\" },\n  { n: \"Omar Haddad\", c: \"#14b8a6\" },\n];\nconst plans = [\n  { p: \"Pro annual\", v: 288 },\n  { p: \"Team monthly\", v: 79 },\n  { p: \"Pro monthly\", v: 29 },\n  { p: \"Business annual\", v: 1188 },\n  { p: \"Seat add-on\", v: 12 },\n];\nconst cities = [\"Lisbon\", \"Austin\", \"Berlin\", \"Seoul\", \"Toronto\", \"Nairobi\", \"Melbourne\", \"Bogota\"];\n\nfunction eventAt(i: number) {\n  const person = people[Math.floor(hash(i * 7 + 1) * people.length)];\n  const plan = plans[Math.floor(hash(i * 13 + 2) * plans.length)];\n  const city = cities[Math.floor(hash(i * 5 + 3) * cities.length)];\n  return { id: i, name: person.n, color: person.c, plan: plan.p, value: plan.v, city };\n}\n\nconst defaultPrimary: HeroLiveMetricsAction = { label: \"Connect Stripe\", href: \"#\" };\nconst defaultSecondary: HeroLiveMetricsAction = { label: \"Open the live demo\", href: \"#\" };\n\nfunction d(ms: number) {\n  return { \"--hb-vb9-d\": `${ms}ms` } as React.CSSProperties;\n}\n\nexport function HeroLiveMetrics({\n  eyebrow = \"Live now · 1,204 teams watching\",\n  title = \"Watch your revenue move as it happens\",\n  subtitle = \"Pulse streams every charge, upgrade and churn into one calm dashboard, updated the second money moves.\",\n  primaryCta = defaultPrimary,\n  secondaryCta = defaultSecondary,\n  baseRevenue = 1284392,\n  currency = \"USD\",\n  locale = \"en-US\",\n  interval = 1400,\n  accent = \"#2f7bff\",\n  live = true,\n  headingAs = \"h1\",\n  className = \"\",\n  style,\n  ...rest\n}: HeroLiveMetricsProps) {\n  const Heading = headingAs;\n  const uid = React.useId().replace(/:/g, \"\");\n  const root = React.useRef<HTMLElement>(null);\n  const [tick, setTick] = React.useState(0);\n  const [visible, setVisible] = React.useState(true);\n  const vars = { \"--hb-vb9-accent\": accent, \"--hb-vb9-step\": `${interval}ms`, ...style } as React.CSSProperties;\n\n  React.useEffect(() => {\n    const node = root.current;\n    if (!node || typeof IntersectionObserver === \"undefined\") return;\n    const io = new IntersectionObserver(([entry]) => setVisible(entry.isIntersecting));\n    io.observe(node);\n    return () => io.disconnect();\n  }, []);\n\n  React.useEffect(() => {\n    if (!live || !visible) return;\n    if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n    const id = window.setInterval(() => setTick((t) => t + 1), Math.max(interval, 400));\n    return () => window.clearInterval(id);\n  }, [live, visible, interval]);\n\n  const money = React.useMemo(() => new Intl.NumberFormat(locale, { style: \"currency\", currency, maximumFractionDigits: 0 }), [locale, currency]);\n\n  const points = Array.from({ length: COUNT }, (_, i) => sample(tick + i));\n  const max = 96;\n  const coords = points.map((v, i) => [i * STEP, H - 14 - (v / max) * (H - 30)] as const);\n  const line = coords.map(([x, y], i) => `${i ? \"L\" : \"M\"}${x.toFixed(1)} ${y.toFixed(1)}`).join(\" \");\n  const area = `${line} L${((COUNT - 1) * STEP).toFixed(1)} ${H} L0 ${H} Z`;\n  const last = coords[COUNT - 1];\n\n  let gained = 0;\n  for (let i = 0; i < tick; i += 1) gained += eventAt(i + 1000).value;\n  const recent = Array.from({ length: 4 }, (_, i) => tick - 1 - i)\n    .filter((i) => i >= -4)\n    .map((i) => eventAt(i + 1000));\n  const minute = recent.reduce((sum, e) => sum + e.value, 0);\n\n  return (\n    <section ref={root} className={`hb-vb9 ${className}`} style={vars} {...rest}>\n      <style href=\"hb-hero-live-metrics\" precedence=\"default\">{css}</style>\n      {eyebrow ? (\n        <p className=\"hb-vb9-eyebrow hb-vb9-in\" style={d(40)}>\n          <span className=\"hb-vb9-pulse\" aria-hidden=\"true\" />\n          {eyebrow}\n        </p>\n      ) : null}\n      <Heading className=\"hb-vb9-title hb-vb9-in\" style={d(120)}>\n        {title}\n      </Heading>\n      {subtitle ? (\n        <p className=\"hb-vb9-sub hb-vb9-in\" style={d(200)}>\n          {subtitle}\n        </p>\n      ) : null}\n      {primaryCta || secondaryCta ? (\n        <div className=\"hb-vb9-actions hb-vb9-in\" style={d(280)}>\n          {primaryCta ? (\n            <a className=\"hb-vb9-btn\" data-primary=\"\" href={primaryCta.href}>\n              {primaryCta.label}\n            </a>\n          ) : null}\n          {secondaryCta ? (\n            <a className=\"hb-vb9-btn\" href={secondaryCta.href}>\n              {secondaryCta.label}\n            </a>\n          ) : null}\n        </div>\n      ) : null}\n      <div className=\"hb-vb9-panel hb-vb9-in\" style={d(380)} role=\"img\" aria-label={`Live revenue dashboard showing ${money.format(baseRevenue + gained)} this month`}>\n        <div className=\"hb-vb9-main\" aria-hidden=\"true\">\n          <div className=\"hb-vb9-label\">\n            <span>Net revenue, this month</span>\n            <span className=\"hb-vb9-range\">\n              <span>Live</span>\n              <span>7d</span>\n              <span>30d</span>\n            </span>\n          </div>\n          <div key={`v${tick}`} className={`hb-vb9-value${tick ? \" hb-vb9-flash\" : \"\"}`}>\n            {money.format(baseRevenue + gained)}\n          </div>\n          <div className=\"hb-vb9-delta\">\n            +{money.format(minute)} <span>in the last minute</span>\n          </div>\n          <svg className=\"hb-vb9-chart\" viewBox={`0 0 ${W} ${H}`}>\n            <defs>\n              <linearGradient id={`${uid}-area`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n                <stop offset=\"0\" stopColor={accent} stopOpacity=\".35\" />\n                <stop offset=\"1\" stopColor={accent} stopOpacity=\"0\" />\n              </linearGradient>\n            </defs>\n            {[0.25, 0.5, 0.75].map((f) => (\n              <line key={f} x1=\"0\" x2={W} y1={(H * f).toFixed(1)} y2={(H * f).toFixed(1)} stroke=\"rgba(255,255,255,.05)\" strokeDasharray=\"3 5\" />\n            ))}\n            <g key={`g${tick}`} className={tick ? \"hb-vb9-shift\" : undefined} style={{ \"--hb-vb9-dx\": `${STEP.toFixed(2)}px` } as React.CSSProperties}>\n              <path d={area} fill={`url(#${uid}-area)`} />\n              <path d={line} fill=\"none\" stroke={accent} strokeWidth=\"2\" strokeLinejoin=\"round\" />\n              <circle cx={last[0].toFixed(1)} cy={last[1].toFixed(1)} r=\"4\" fill=\"#fff\" stroke={accent} strokeWidth=\"2.5\" />\n            </g>\n          </svg>\n          <div className=\"hb-vb9-kpis\">\n            <div className=\"hb-vb9-kpi\">\n              <b>{(4.8 + hash(tick) * 0.3).toFixed(2)}%</b>\n              <span>Trial to paid</span>\n            </div>\n            <div className=\"hb-vb9-kpi\">\n              <b>{312 + (tick % 9)}</b>\n              <span>Active checkouts</span>\n            </div>\n            <div className=\"hb-vb9-kpi\">\n              <b>1.9%</b>\n              <span>Monthly churn</span>\n            </div>\n          </div>\n        </div>\n        <div className=\"hb-vb9-side\" aria-hidden=\"true\">\n          <h3>\n            Latest payments <span>{tick + 214}</span>\n          </h3>\n          <ul className=\"hb-vb9-feed\">\n            {recent.map((event) => (\n              <li key={event.id} className=\"hb-vb9-event\">\n                <span className=\"hb-vb9-av\" style={{ background: event.color }}>\n                  {event.name\n                    .split(\" \")\n                    .map((part) => part.charAt(0))\n                    .join(\"\")}\n                </span>\n                <span className=\"hb-vb9-who\">\n                  {event.name}\n                  <span>\n                    {event.plan} · {event.city}\n                  </span>\n                </span>\n                <span className=\"hb-vb9-amt\">+{money.format(event.value)}</span>\n              </li>\n            ))}\n          </ul>\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}