{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "loader-stack-build",
  "type": "registry:component",
  "title": "Loader Stack Build",
  "description": "Isometric slabs drop one by one onto a stack, landing with a small squash, while a dashed outline marks where the next one goes. When the stack is complete it lifts away and the build starts over.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "loaders",
    "loader",
    "build",
    "layers",
    "isometric",
    "docker",
    "svg"
  ],
  "docs": "https://hyperblur.dev/effects/loader-stack-build",
  "files": [
    {
      "path": "registry/hyperblur/loader-stack-build.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/loader-stack-build.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface LoaderStackBuildProps extends React.HTMLAttributes<HTMLSpanElement> {\n  value?: number;\n  layers?: number;\n  size?: number;\n  color?: string;\n  accent?: string;\n  interval?: number;\n  unit?: string;\n  label?: string;\n}\n\nconst css = `\n.hb-vk9 {\n  position: relative;\n  display: inline-flex;\n  flex-direction: column;\n  align-items: center;\n  gap: 0.5em;\n  box-sizing: border-box;\n  font-family: inherit;\n  color: #ededed;\n  vertical-align: middle;\n}\n.hb-vk9 *, .hb-vk9 *::before, .hb-vk9 *::after { box-sizing: border-box; }\n.hb-vk9-svg { display: block; width: var(--hb-vk9-s); height: var(--hb-vk9-s); overflow: visible; flex: none; }\n.hb-vk9-top { fill: color-mix(in srgb, var(--hb-vk9-c) 55%, #ffffff); }\n.hb-vk9-left { fill: var(--hb-vk9-c); }\n.hb-vk9-right { fill: color-mix(in srgb, var(--hb-vk9-c) 55%, #05070d); }\n.hb-vk9-rim { fill: none; stroke: rgba(255,255,255,0.55); stroke-width: 0.6; stroke-linejoin: round; }\n.hb-vk9-layer {\n  transform-box: fill-box;\n  transform-origin: 50% 100%;\n  animation: hb-vk9-drop 520ms cubic-bezier(0.3, 0, 0.2, 1) both;\n}\n.hb-vk9-layer[data-new=\"true\"] .hb-vk9-top { fill: color-mix(in srgb, var(--hb-vk9-a) 70%, #ffffff); }\n.hb-vk9-ghost {\n  fill: none;\n  stroke: color-mix(in srgb, var(--hb-vk9-a) 60%, transparent);\n  stroke-width: 0.7;\n  stroke-dasharray: 2 1.6;\n  animation: hb-vk9-march 900ms linear infinite;\n}\n.hb-vk9-shadow { fill: color-mix(in srgb, var(--hb-vk9-c) 40%, transparent); filter: blur(3px); }\n.hb-vk9-all { transition: transform 600ms cubic-bezier(0.5, 0, 0.75, 0), opacity 600ms ease; }\n.hb-vk9[data-ship=\"true\"] .hb-vk9-all { transform: translateY(-14px); opacity: 0; }\n.hb-vk9-count {\n  font-size: 11px;\n  line-height: 1;\n  color: #8f8f8f;\n  font-variant-numeric: tabular-nums;\n  letter-spacing: 0.02em;\n}\n.hb-vk9-count b { color: var(--hb-vk9-a); font-weight: 600; }\n.hb-vk9-l { font-size: 12px; line-height: 1.3; color: #a1a1a1; white-space: nowrap; }\n.hb-vk9-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-vk9-drop {\n  0% { transform: translateY(-26px); opacity: 0; }\n  55% { transform: translateY(0) scaleY(1); opacity: 1; }\n  70% { transform: translateY(0) scaleY(0.82); }\n  85% { transform: translateY(-1.5px) scaleY(1.04); }\n  100% { transform: translateY(0) scaleY(1); opacity: 1; }\n}\n@keyframes hb-vk9-march { to { stroke-dashoffset: -7.2; } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-vk9-layer, .hb-vk9-ghost { animation: none; }\n  .hb-vk9-all { transition: none; }\n}\n`;\n\nfunction faces(cy: number, w: number, h: number, t: number) {\n  const l = 50 - w;\n  const r = 50 + w;\n  const p = (pts: number[][]) => pts.map(([x, y]) => `${x.toFixed(2)},${y.toFixed(2)}`).join(\" \");\n  return {\n    top: p([[50, cy - h], [r, cy], [50, cy + h], [l, cy]]),\n    left: p([[l, cy], [50, cy + h], [50, cy + h + t], [l, cy + t]]),\n    right: p([[50, cy + h], [r, cy], [r, cy + t], [50, cy + h + t]]),\n    rim: p([[l, cy], [50, cy - h], [r, cy]]),\n  };\n}\n\nexport function LoaderStackBuild({\n  value,\n  layers = 5,\n  size = 96,\n  color = \"#2f7bff\",\n  accent = \"#7fb3ff\",\n  interval = 620,\n  unit = \"layers\",\n  label,\n  className = \"\",\n  style,\n  ...rest\n}: LoaderStackBuildProps) {\n  const total = Math.max(2, Math.min(8, Math.round(layers)));\n  const controlled = typeof value === \"number\" && Number.isFinite(value);\n  const [auto, setAuto] = React.useState({ count: 0, ship: false });\n\n  React.useEffect(() => {\n    if (controlled) return;\n    let id = 0;\n    if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) {\n      id = window.setTimeout(() => setAuto({ count: total, ship: false }), 0);\n      return () => window.clearTimeout(id);\n    }\n    let count = 0;\n    const gap = Math.max(200, interval);\n    function next() {\n      if (count < total) {\n        count += 1;\n        setAuto({ count, ship: false });\n        id = window.setTimeout(next, count === total ? gap * 2.2 : gap);\n      } else {\n        setAuto({ count, ship: true });\n        id = window.setTimeout(() => {\n          count = 0;\n          setAuto({ count: 0, ship: false });\n          id = window.setTimeout(next, gap * 0.8);\n        }, 650);\n      }\n    }\n    id = window.setTimeout(next, gap * 0.6);\n    return () => window.clearTimeout(id);\n  }, [controlled, total, interval]);\n\n  const count = controlled ? Math.round((Math.min(100, Math.max(0, value as number)) / 100) * total) : auto.count;\n  const ship = controlled ? false : auto.ship;\n  const w = 28;\n  const h = 14;\n  const t = Math.max(4, Math.min(9, 40 / total));\n  const step = t + 1.8;\n  const baseCy = 50 + ((total - 1) * step) / 2 - t / 2 + 4;\n  const vars = {\n    \"--hb-vk9-s\": `${size}px`,\n    \"--hb-vk9-c\": color,\n    \"--hb-vk9-a\": accent,\n    ...style,\n  } as React.CSSProperties;\n  const ghost = count < total ? faces(baseCy - count * step, w, h, t) : null;\n\n  return (\n    <>\n      <style href=\"hb-loader-stack-build\" precedence=\"default\">{css}</style>\n      <span role=\"status\" className={`hb-vk9 ${className}`} data-ship={ship} style={vars} {...rest}>\n        <svg className=\"hb-vk9-svg\" viewBox=\"0 0 100 100\" aria-hidden=\"true\">\n          <ellipse className=\"hb-vk9-shadow\" cx=\"50\" cy={(baseCy + h + t + 2).toFixed(2)} rx={w + 4} ry={h * 0.55} />\n          {ghost ? <polygon className=\"hb-vk9-ghost\" points={ghost.top} /> : null}\n          <g className=\"hb-vk9-all\">\n            {Array.from({ length: count }, (_, i) => {\n              const f = faces(baseCy - i * step, w, h, t);\n              return (\n                <g key={i} className=\"hb-vk9-layer\" data-new={i === count - 1}>\n                  <polygon className=\"hb-vk9-left\" points={f.left} />\n                  <polygon className=\"hb-vk9-right\" points={f.right} />\n                  <polygon className=\"hb-vk9-top\" points={f.top} />\n                  <polyline className=\"hb-vk9-rim\" points={f.rim} />\n                </g>\n              );\n            })}\n          </g>\n        </svg>\n        <span className=\"hb-vk9-count\" aria-hidden=\"true\">\n          <b>{count}</b> / {total} {unit}\n        </span>\n        <span className={label ? \"hb-vk9-l\" : \"hb-vk9-sr\"}>{label ?? \"Building\"}</span>\n      </span>\n    </>\n  );\n}\n"
    }
  ]
}