{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "stats-counters",
  "type": "registry:component",
  "title": "Stats Counters",
  "description": "Four oversized numbers that count up when the row scrolls into view, separated by hairlines, each with a label, a sparkline that draws itself and a small change note.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "stats",
    "stats",
    "numbers",
    "count up",
    "sparkline",
    "metrics",
    "section"
  ],
  "docs": "https://hyperblur.dev/effects/stats-counters",
  "files": [
    {
      "path": "registry/hyperblur/stats-counters.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/stats-counters.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface CounterStat {\n  value: number;\n  decimals?: number;\n  prefix?: string;\n  suffix?: string;\n  label: string;\n  delta?: string;\n  trend?: number[];\n}\n\nexport interface StatsCountersProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  eyebrow?: string;\n  title?: string;\n  subtitle?: string;\n  stats?: CounterStat[];\n  duration?: number;\n  footnote?: string;\n  accent?: string;\n}\n\nconst css = `\n.hb-ka6 {\n  --hb-ka6-accent: #f5a524;\n  box-sizing: border-box;\n  width: 100%;\n  container-type: inline-size;\n  background: #0a0a0a;\n  color: #ededed;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-ka6 *, .hb-ka6 *::before, .hb-ka6 *::after { box-sizing: border-box; }\n.hb-ka6-wrap { max-width: 1120px; margin: 0 auto; padding: 96px 24px 104px; }\n.hb-ka6-head {\n  display: flex;\n  align-items: flex-end;\n  justify-content: space-between;\n  gap: 24px 48px;\n  margin-bottom: 56px;\n}\n.hb-ka6-eyebrow {\n  margin: 0 0 16px;\n  color: #8f8f8f;\n  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);\n  font-size: 12px;\n  letter-spacing: .1em;\n  text-transform: uppercase;\n}\n.hb-ka6-eyebrow b { color: var(--hb-ka6-accent); font-weight: 500; }\n.hb-ka6-title {\n  margin: 0;\n  max-width: 620px;\n  font-size: clamp(28px, 4.2cqw, 44px);\n  font-weight: 600;\n  line-height: 1.08;\n  letter-spacing: -.03em;\n  text-wrap: balance;\n}\n.hb-ka6-sub { margin: 0; max-width: 340px; color: #8f8f8f; font-size: 15px; line-height: 1.6; }\n.hb-ka6-grid {\n  display: grid;\n  grid-template-columns: repeat(4, minmax(0, 1fr));\n  margin: 0;\n  padding: 0;\n  list-style: none;\n  border-top: 1px solid rgba(255, 255, 255, .08);\n  border-bottom: 1px solid rgba(255, 255, 255, .08);\n}\n.hb-ka6-cell {\n  position: relative;\n  display: flex;\n  flex-direction: column;\n  min-width: 0;\n  padding: 36px 28px 28px;\n}\n.hb-ka6-cell + .hb-ka6-cell { border-left: 1px solid rgba(255, 255, 255, .08); }\n.hb-ka6-cell::before {\n  content: \"\";\n  position: absolute;\n  top: -1px;\n  left: 0;\n  width: 100%;\n  height: 1px;\n  background: linear-gradient(90deg, var(--hb-ka6-accent), transparent 70%);\n  transform: scaleX(0);\n  transform-origin: left;\n  transition: transform 1.2s cubic-bezier(.2, .8, .2, 1);\n  transition-delay: var(--hb-ka6-d, 0s);\n}\n.hb-ka6[data-in=\"true\"] .hb-ka6-cell::before { transform: scaleX(1); }\n.hb-ka6-num {\n  display: flex;\n  align-items: baseline;\n  margin: 0;\n  font-size: clamp(36px, 6.6cqw, 76px);\n  font-weight: 500;\n  line-height: 1;\n  letter-spacing: -.05em;\n  font-variant-numeric: tabular-nums;\n  white-space: nowrap;\n}\n.hb-ka6-affix { color: #6f6f6f; font-size: .62em; font-weight: 500; letter-spacing: -.02em; }\n.hb-ka6-affix[data-side=\"pre\"] { margin-right: .04em; }\n.hb-ka6-affix[data-side=\"post\"] { margin-left: .04em; }\n.hb-ka6-label { margin: 14px 0 0; color: #a1a1a1; font-size: 14px; line-height: 1.5; }\n.hb-ka6-spark { display: block; width: 100%; height: 40px; margin-top: 22px; overflow: visible; }\n.hb-ka6-line {\n  fill: none;\n  stroke: var(--hb-ka6-accent);\n  stroke-width: 1.5;\n  stroke-linecap: round;\n  stroke-linejoin: round;\n  stroke-dasharray: 1;\n  stroke-dashoffset: 1;\n  transition: stroke-dashoffset 1.6s cubic-bezier(.4, 0, .2, 1);\n  transition-delay: var(--hb-ka6-d, 0s);\n}\n.hb-ka6-area { opacity: 0; transition: opacity 1s ease; transition-delay: calc(var(--hb-ka6-d, 0s) + .6s); }\n.hb-ka6[data-in=\"true\"] .hb-ka6-line { stroke-dashoffset: 0; }\n.hb-ka6[data-in=\"true\"] .hb-ka6-area { opacity: 1; }\n.hb-ka6-delta {\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  margin-top: 14px;\n  color: #8f8f8f;\n  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);\n  font-size: 12px;\n}\n.hb-ka6-delta svg { width: 10px; height: 10px; color: var(--hb-ka6-accent); }\n.hb-ka6-foot { margin: 20px 0 0; color: #5f5f5f; font-size: 12px; }\n.hb-ka6-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n@container (max-width: 860px) {\n  .hb-ka6-head { flex-direction: column; align-items: flex-start; }\n  .hb-ka6-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }\n  .hb-ka6-cell:nth-child(3) { border-left: 0; }\n  .hb-ka6-cell:nth-child(n + 3) { border-top: 1px solid rgba(255, 255, 255, .08); }\n  .hb-ka6-num { font-size: clamp(32px, 10cqw, 72px); }\n}\n@container (max-width: 520px) {\n  .hb-ka6-wrap { padding: 64px 16px 72px; }\n  .hb-ka6-head { margin-bottom: 36px; }\n  .hb-ka6-cell { padding: 24px 14px 20px; }\n  .hb-ka6-cell:nth-child(odd) { padding-left: 0; }\n  .hb-ka6-num { font-size: clamp(28px, 9.4cqw, 48px); }\n  .hb-ka6-spark { height: 30px; margin-top: 16px; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-ka6-cell::before, .hb-ka6-line, .hb-ka6-area { transition: none; }\n}\n`;\n\nfunction useProgress<T extends Element>(ref: React.RefObject<T | null>, duration: number) {\n  const [t, setT] = React.useState(0);\n  React.useEffect(() => {\n    const el = ref.current;\n    if (!el) return;\n    let raf = 0;\n    const run = () => {\n      if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) {\n        setT(1);\n        return;\n      }\n      const start = performance.now();\n      const tick = (now: number) => {\n        const p = Math.min((now - start) / duration, 1);\n        setT(p);\n        if (p < 1) raf = requestAnimationFrame(tick);\n      };\n      raf = requestAnimationFrame(tick);\n    };\n    if (typeof IntersectionObserver === \"undefined\") {\n      raf = requestAnimationFrame(() => setT(1));\n      return () => cancelAnimationFrame(raf);\n    }\n    const io = new IntersectionObserver(\n      (entries) => {\n        if (entries.some((e) => e.isIntersecting)) {\n          io.disconnect();\n          run();\n        }\n      },\n      { threshold: 0.2 },\n    );\n    io.observe(el);\n    return () => {\n      io.disconnect();\n      cancelAnimationFrame(raf);\n    };\n  }, [ref, duration]);\n  return t;\n}\n\nfunction ease(x: number) {\n  return 1 - Math.pow(1 - x, 4);\n}\n\nfunction format(n: number, decimals: number) {\n  return n.toLocaleString(\"en-US\", { minimumFractionDigits: decimals, maximumFractionDigits: decimals });\n}\n\nfunction sparkPaths(points: number[]) {\n  const w = 120;\n  const h = 32;\n  const min = Math.min(...points);\n  const max = Math.max(...points);\n  const span = max - min || 1;\n  const step = points.length > 1 ? w / (points.length - 1) : w;\n  const xy = points.map((p, i) => [i * step, h - 2 - ((p - min) / span) * (h - 6)]);\n  const line = xy.map(([x, y], i) => `${i ? \"L\" : \"M\"}${x.toFixed(2)} ${y.toFixed(2)}`).join(\" \");\n  const area = `${line} L${w} ${h} L0 ${h} Z`;\n  return { line, area };\n}\n\nconst defaultStats: CounterStat[] = [\n  { value: 4.2, decimals: 1, prefix: \"$\", suffix: \"B\", label: \"Payment volume processed in 2026\", delta: \"+38% year over year\", trend: [12, 14, 13, 17, 19, 18, 23, 26, 25, 31, 34, 38] },\n  { value: 38000, suffix: \"+\", label: \"Teams running payroll on Meridian\", delta: \"+9,400 since January\", trend: [8, 9, 11, 12, 12, 15, 17, 19, 22, 24, 27, 30] },\n  { value: 99.995, decimals: 3, suffix: \"%\", label: \"API uptime over the last 12 months\", delta: \"26 min total downtime\", trend: [30, 31, 30, 31, 31, 29, 31, 31, 30, 31, 31, 31] },\n  { value: 142, label: \"Countries with paying customers\", delta: \"+17 new markets\", trend: [70, 76, 81, 88, 92, 99, 104, 112, 118, 125, 133, 142] },\n];\n\nexport function StatsCounters({\n  eyebrow = \"Meridian in numbers\",\n  title = \"Quietly moving money for teams in 142 countries\",\n  subtitle = \"Every figure below is pulled from production systems and refreshed on the first of each month.\",\n  stats = defaultStats,\n  duration = 2200,\n  footnote = \"Figures as of October 31, 2026.\",\n  accent = \"#f5a524\",\n  className = \"\",\n  style,\n  ...rest\n}: StatsCountersProps) {\n  const uid = React.useId();\n  const ref = React.useRef<HTMLUListElement>(null);\n  const t = useProgress(ref, Math.max(duration, 200));\n  const vars = { \"--hb-ka6-accent\": accent, ...style } as React.CSSProperties;\n  const gradId = `hb-ka6-g${uid.replace(/[^a-zA-Z0-9]/g, \"\")}`;\n\n  return (\n    <section className={`hb-ka6 ${className}`} style={vars} data-in={t > 0} aria-labelledby={`${uid}-t`} {...rest}>\n      <style href=\"hb-stats-counters\" precedence=\"default\">{css}</style>\n      <div className=\"hb-ka6-wrap\">\n        <header className=\"hb-ka6-head\">\n          <div>\n            {eyebrow && (\n              <p className=\"hb-ka6-eyebrow\">\n                <b>&#9679;</b> {eyebrow}\n              </p>\n            )}\n            <h2 id={`${uid}-t`} className=\"hb-ka6-title\">{title}</h2>\n          </div>\n          {subtitle && <p className=\"hb-ka6-sub\">{subtitle}</p>}\n        </header>\n        <ul ref={ref} className=\"hb-ka6-grid\">\n          {stats.map((s, i) => {\n            const decimals = s.decimals ?? 0;\n            const stagger = 0.08;\n            const local = Math.min(Math.max((t - i * stagger) / (1 - stagger * Math.max(stats.length - 1, 0)), 0), 1);\n            const shown = t >= 1 ? s.value : s.value * ease(local);\n            const spark = s.trend && s.trend.length > 1 ? sparkPaths(s.trend) : null;\n            const full = `${s.prefix ?? \"\"}${format(s.value, decimals)}${s.suffix ?? \"\"}`;\n            return (\n              <li key={`${s.label}-${i}`} className=\"hb-ka6-cell\" style={{ \"--hb-ka6-d\": `${(i * 0.15).toFixed(2)}s` } as React.CSSProperties}>\n                <p className=\"hb-ka6-num\">\n                  <span className=\"hb-ka6-sr\">{full}</span>\n                  <span aria-hidden=\"true\" style={{ display: \"contents\" }}>\n                    {s.prefix && <span className=\"hb-ka6-affix\" data-side=\"pre\">{s.prefix}</span>}\n                    {format(shown, decimals)}\n                    {s.suffix && <span className=\"hb-ka6-affix\" data-side=\"post\">{s.suffix}</span>}\n                  </span>\n                </p>\n                <p className=\"hb-ka6-label\">{s.label}</p>\n                {spark && (\n                  <svg className=\"hb-ka6-spark\" viewBox=\"0 0 120 32\" preserveAspectRatio=\"none\" aria-hidden=\"true\">\n                    <defs>\n                      <linearGradient id={`${gradId}-${i}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n                        <stop offset=\"0\" stopColor={accent} stopOpacity=\".28\" />\n                        <stop offset=\"1\" stopColor={accent} stopOpacity=\"0\" />\n                      </linearGradient>\n                    </defs>\n                    <path className=\"hb-ka6-area\" d={spark.area} fill={`url(#${gradId}-${i})`} />\n                    <path className=\"hb-ka6-line\" d={spark.line} pathLength={1} />\n                  </svg>\n                )}\n                {s.delta && (\n                  <span className=\"hb-ka6-delta\">\n                    {/^[+\\-\\u2212]/.test(s.delta) && (\n                      <svg viewBox=\"0 0 10 10\" fill=\"currentColor\" aria-hidden=\"true\">\n                        <path d={s.delta.startsWith(\"+\") ? \"M5 1l4 6H1z\" : \"M5 9L1 3h8z\"} />\n                      </svg>\n                    )}\n                    {s.delta}\n                  </span>\n                )}\n              </li>\n            );\n          })}\n        </ul>\n        {footnote && <p className=\"hb-ka6-foot\">{footnote}</p>}\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}