{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "loader-tick-ring",
  "type": "registry:component",
  "title": "Loader Tick Ring",
  "description": "A dial of fine ticks lights up clockwise with a brighter, longer leading tick, and phase markers around the rim switch on as each stage is reached. The center shows the percentage and the current phase.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "loaders",
    "progress",
    "deploy",
    "ring",
    "ticks",
    "phases",
    "svg"
  ],
  "docs": "https://hyperblur.dev/effects/loader-tick-ring",
  "files": [
    {
      "path": "registry/hyperblur/loader-tick-ring.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/loader-tick-ring.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface LoaderTickRingProps extends React.HTMLAttributes<HTMLDivElement> {\n  value?: number;\n  size?: number;\n  ticks?: number;\n  color?: string;\n  accent?: string;\n  phases?: string[];\n  duration?: number;\n  label?: string;\n}\n\nconst css = `\n.hb-vk5 {\n  position: relative;\n  display: inline-flex;\n  flex-direction: column;\n  align-items: center;\n  gap: 0.6em;\n  box-sizing: border-box;\n  font-family: inherit;\n  color: #ededed;\n  vertical-align: middle;\n}\n.hb-vk5 *, .hb-vk5 *::before, .hb-vk5 *::after { box-sizing: border-box; }\n.hb-vk5-g {\n  position: relative;\n  width: var(--hb-vk5-s);\n  height: var(--hb-vk5-s);\n  flex: none;\n  border-radius: 50%;\n  background: radial-gradient(circle at 50% 38%, #171717 0 46%, #0d0d0d 47% 100%);\n  box-shadow: inset 0 0 0 1px #1f1f1f, 0 10px 30px rgba(0,0,0,0.45);\n}\n.hb-vk5-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }\n.hb-vk5-t {\n  stroke: #2a2a2a;\n  stroke-width: 1.6;\n  stroke-linecap: round;\n  transition: stroke 220ms ease, stroke-width 220ms ease;\n}\n.hb-vk5-t[data-on=\"true\"] { stroke: var(--hb-vk5-c); }\n.hb-vk5-t[data-head=\"true\"] {\n  stroke: var(--hb-vk5-a);\n  stroke-width: 2.4;\n  filter: drop-shadow(0 0 2.5px var(--hb-vk5-a));\n}\n.hb-vk5-m { fill: #3a3a3a; transition: fill 300ms ease; }\n.hb-vk5-m[data-on=\"true\"] { fill: var(--hb-vk5-a); }\n.hb-vk5-c {\n  position: absolute;\n  inset: 0;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  gap: 0.25em;\n  text-align: center;\n  pointer-events: none;\n}\n.hb-vk5-n {\n  font-size: calc(var(--hb-vk5-s) * 0.2);\n  font-weight: 600;\n  letter-spacing: -0.03em;\n  line-height: 1;\n  font-variant-numeric: tabular-nums;\n}\n.hb-vk5-n small { font-size: 0.5em; color: #8f8f8f; font-weight: 500; margin-left: 0.06em; }\n.hb-vk5-ph {\n  font-size: calc(var(--hb-vk5-s) * 0.085);\n  line-height: 1.2;\n  letter-spacing: 0.08em;\n  text-transform: uppercase;\n  color: var(--hb-vk5-a);\n  white-space: nowrap;\n  animation: hb-vk5-in 380ms cubic-bezier(0.22, 1, 0.36, 1);\n}\n.hb-vk5-l { font-size: 12px; line-height: 1.3; color: #a1a1a1; white-space: nowrap; }\n.hb-vk5-sr {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  margin: -1px;\n  overflow: hidden;\n  clip-path: inset(50%);\n  white-space: nowrap;\n}\n@keyframes hb-vk5-in { from { opacity: 0; transform: translateY(3px); } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-vk5-t, .hb-vk5-m { transition: none; }\n  .hb-vk5-ph { animation: none; }\n}\n`;\n\nfunction easeInOut(t: number) {\n  return t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2;\n}\n\nexport function LoaderTickRing({\n  value,\n  size = 128,\n  ticks = 60,\n  color = \"#2f7bff\",\n  accent = \"#7fb3ff\",\n  phases = [\"Install\", \"Build\", \"Optimize\", \"Upload\"],\n  duration = 5600,\n  label,\n  className = \"\",\n  style,\n  ...rest\n}: LoaderTickRingProps) {\n  const controlled = typeof value === \"number\" && Number.isFinite(value);\n  const [loop, setLoop] = React.useState(0);\n\n  React.useEffect(() => {\n    if (controlled) return;\n    let raf = 0;\n    if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) {\n      raf = requestAnimationFrame(() => setLoop(100));\n      return () => cancelAnimationFrame(raf);\n    }\n    let t0 = 0;\n    const total = Math.max(1200, duration);\n    const hold = 1100;\n    function tick(now: number) {\n      if (!t0) t0 = now;\n      const t = (now - t0) % (total + hold);\n      setLoop(t >= total ? 100 : easeInOut(t / total) * 100);\n      raf = requestAnimationFrame(tick);\n    }\n    raf = requestAnimationFrame(tick);\n    return () => cancelAnimationFrame(raf);\n  }, [controlled, duration]);\n\n  const n = Math.max(12, Math.min(120, Math.round(ticks)));\n  const pct = Math.min(100, Math.max(0, controlled ? (value as number) : loop));\n  const lit = (pct / 100) * n;\n  const head = pct >= 100 ? -1 : Math.floor(lit);\n  const list = phases.length ? phases : [\"Working\"];\n  const phase = pct >= 100 ? \"Done\" : list[Math.min(list.length - 1, Math.floor((pct / 100) * list.length))];\n  const vars = {\n    \"--hb-vk5-s\": `${size}px`,\n    \"--hb-vk5-c\": color,\n    \"--hb-vk5-a\": accent,\n    ...style,\n  } as React.CSSProperties;\n\n  return (\n    <>\n      <style href=\"hb-loader-tick-ring\" precedence=\"default\">{css}</style>\n      <div className={`hb-vk5 ${className}`} style={vars} {...rest}>\n        <div\n          className=\"hb-vk5-g\"\n          role=\"progressbar\"\n          aria-valuemin={0}\n          aria-valuemax={100}\n          aria-valuenow={Math.round(pct)}\n          aria-valuetext={`${Math.round(pct)}%, ${phase}`}\n          aria-label={label ?? \"Progress\"}\n        >\n          <svg className=\"hb-vk5-svg\" viewBox=\"0 0 100 100\" aria-hidden=\"true\">\n            {Array.from({ length: n }, (_, i) => {\n              const a = (i / n) * Math.PI * 2 - Math.PI / 2;\n              const cos = Math.cos(a);\n              const sin = Math.sin(a);\n              const isHead = i === head;\n              const r1 = isHead ? 36.5 : 39;\n              const r2 = 45;\n              return (\n                <line\n                  key={i}\n                  className=\"hb-vk5-t\"\n                  data-on={i < lit}\n                  data-head={isHead}\n                  x1={(50 + cos * r1).toFixed(2)}\n                  y1={(50 + sin * r1).toFixed(2)}\n                  x2={(50 + cos * r2).toFixed(2)}\n                  y2={(50 + sin * r2).toFixed(2)}\n                />\n              );\n            })}\n            {list.map((p, i) => {\n              const a = (i / list.length) * Math.PI * 2 - Math.PI / 2;\n              return (\n                <circle\n                  key={p + i}\n                  className=\"hb-vk5-m\"\n                  data-on={pct >= (i / list.length) * 100}\n                  cx={(50 + Math.cos(a) * 49).toFixed(2)}\n                  cy={(50 + Math.sin(a) * 49).toFixed(2)}\n                  r=\"1.3\"\n                />\n              );\n            })}\n          </svg>\n          <span className=\"hb-vk5-c\" aria-hidden=\"true\">\n            <span className=\"hb-vk5-n\">\n              {Math.floor(pct)}\n              <small>%</small>\n            </span>\n            <span className=\"hb-vk5-ph\" key={phase}>{phase}</span>\n          </span>\n        </div>\n        {label ? <span className=\"hb-vk5-l\">{label}</span> : null}\n      </div>\n    </>\n  );\n}\n"
    }
  ]
}