{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "loader-liquid-progress",
  "type": "registry:component",
  "title": "Loader Liquid Progress",
  "description": "A progress pill filled with liquid: the leading edge sloshes as a live wave and bubbles rise inside. The percentage changes color exactly where the liquid passes under it.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "loaders",
    "progress",
    "upload",
    "liquid",
    "wave",
    "bar",
    "determinate"
  ],
  "docs": "https://hyperblur.dev/effects/loader-liquid-progress",
  "files": [
    {
      "path": "registry/hyperblur/loader-liquid-progress.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/loader-liquid-progress.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface LoaderLiquidProgressProps extends React.HTMLAttributes<HTMLDivElement> {\n  value?: number;\n  color?: string;\n  accent?: string;\n  height?: number;\n  duration?: number;\n  showValue?: boolean;\n  label?: string;\n}\n\nconst curve: [number, number][] = [\n  [0, 0],\n  [0.16, 0.19],\n  [0.3, 0.27],\n  [0.52, 0.56],\n  [0.66, 0.63],\n  [0.86, 0.94],\n  [0.92, 1],\n  [1, 1],\n];\n\nfunction sample(t: number) {\n  for (let i = 1; i < curve.length; i++) {\n    const [t1, v1] = curve[i];\n    const [t0, v0] = curve[i - 1];\n    if (t <= t1) {\n      const f = (t - t0) / (t1 - t0 || 1);\n      const s = f * f * (3 - 2 * f);\n      return v0 + (v1 - v0) * s;\n    }\n  }\n  return 1;\n}\n\nconst bubbles = [\n  { x: 12, s: 4, d: 0 },\n  { x: 31, s: 3, d: 0.9 },\n  { x: 48, s: 5, d: 0.35 },\n  { x: 66, s: 3, d: 1.4 },\n  { x: 82, s: 4, d: 0.65 },\n];\n\nconst css = `\n.hb-vk4 {\n  width: 100%;\n  box-sizing: border-box;\n  font-family: inherit;\n  color: #ededed;\n}\n.hb-vk4 *, .hb-vk4 *::before, .hb-vk4 *::after { box-sizing: border-box; }\n.hb-vk4-l {\n  display: block;\n  margin-bottom: 8px;\n  font-size: 12px;\n  line-height: 1.3;\n  color: #a1a1a1;\n}\n.hb-vk4-track {\n  position: relative;\n  height: var(--hb-vk4-h);\n  border-radius: 999px;\n  overflow: hidden;\n  background: linear-gradient(180deg, #0c0c0c, #151515);\n  box-shadow: inset 0 1px 2px rgba(0,0,0,0.7), inset 0 0 0 1px #232323, 0 1px 0 rgba(255,255,255,0.04);\n  isolation: isolate;\n}\n.hb-vk4-fill {\n  position: absolute;\n  left: 0;\n  top: 0;\n  bottom: 0;\n  width: var(--hb-vk4-p);\n  min-width: calc(var(--hb-vk4-h) * 0.5);\n  background: linear-gradient(90deg, color-mix(in srgb, var(--hb-vk4-c) 70%, #0a0a0a), var(--hb-vk4-c) 55%, var(--hb-vk4-a));\n  transition: width 260ms cubic-bezier(0.22, 1, 0.36, 1);\n}\n.hb-vk4-fill::before {\n  content: \"\";\n  position: absolute;\n  left: 0;\n  right: 0;\n  top: 2px;\n  height: 34%;\n  border-radius: 999px;\n  margin: 0 6px;\n  background: linear-gradient(180deg, rgba(255,255,255,0.38), rgba(255,255,255,0));\n}\n.hb-vk4-edge {\n  position: absolute;\n  top: 0;\n  right: calc(var(--hb-vk4-h) * -0.34);\n  width: calc(var(--hb-vk4-h) * 0.36);\n  height: 100%;\n  overflow: hidden;\n}\n.hb-vk4-wave {\n  position: absolute;\n  left: 0;\n  top: 0;\n  width: 100%;\n  height: 200%;\n  display: block;\n  animation: hb-vk4-slosh 1.15s linear infinite;\n}\n.hb-vk4-bub {\n  position: absolute;\n  bottom: -6px;\n  border-radius: 50%;\n  border: 1px solid rgba(255,255,255,0.55);\n  background: rgba(255,255,255,0.12);\n  animation: hb-vk4-rise 2.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n.hb-vk4-txt {\n  position: absolute;\n  inset: 0;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  font-size: calc(var(--hb-vk4-h) * 0.42);\n  font-weight: 600;\n  letter-spacing: -0.01em;\n  font-variant-numeric: tabular-nums;\n  color: #a1a1a1;\n  pointer-events: none;\n}\n.hb-vk4-txt[data-on=\"true\"] {\n  color: #ffffff;\n  text-shadow: 0 1px 2px rgba(0,0,0,0.35);\n  clip-path: inset(0 calc(100% - var(--hb-vk4-p)) 0 0);\n  transition: clip-path 260ms cubic-bezier(0.22, 1, 0.36, 1);\n}\n.hb-vk4-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-vk4-slosh { to { transform: translateY(-50%); } }\n@keyframes hb-vk4-rise {\n  0% { transform: translateY(0) scale(0.6); opacity: 0; }\n  20% { opacity: 1; }\n  100% { transform: translateY(calc(var(--hb-vk4-h) * -1.1)) scale(1); opacity: 0; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-vk4-wave, .hb-vk4-bub { animation: none; }\n  .hb-vk4-bub { display: none; }\n  .hb-vk4-fill, .hb-vk4-txt[data-on=\"true\"] { transition: none; }\n}\n`;\n\nconst wavePath = (() => {\n  const pts: string[] = [];\n  for (let i = 0; i <= 40; i++) {\n    const y = (i / 40) * 200;\n    const x = 50 + Math.sin((i / 40) * Math.PI * 8) * 38;\n    pts.push(`${x.toFixed(2)} ${y.toFixed(2)}`);\n  }\n  return `M0 0L${pts.join(\"L\")}L0 200Z`;\n})();\n\nexport function LoaderLiquidProgress({\n  value,\n  color = \"#2f7bff\",\n  accent = \"#7fb3ff\",\n  height = 30,\n  duration = 6000,\n  showValue = true,\n  label,\n  className = \"\",\n  style,\n  ...rest\n}: LoaderLiquidProgressProps) {\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(68));\n      return () => cancelAnimationFrame(raf);\n    }\n    let t0 = 0;\n    const total = Math.max(1200, duration);\n    function tick(now: number) {\n      if (!t0) t0 = now;\n      setLoop(Math.round(sample(((now - t0) % total) / total) * 1000) / 10);\n      raf = requestAnimationFrame(tick);\n    }\n    raf = requestAnimationFrame(tick);\n    return () => cancelAnimationFrame(raf);\n  }, [controlled, duration]);\n\n  const pct = Math.min(100, Math.max(0, controlled ? (value as number) : loop));\n  const shown = Math.floor(pct);\n  const vars = {\n    \"--hb-vk4-p\": `${pct.toFixed(1)}%`,\n    \"--hb-vk4-h\": `${Math.max(12, height)}px`,\n    \"--hb-vk4-c\": color,\n    \"--hb-vk4-a\": accent,\n    ...style,\n  } as React.CSSProperties;\n\n  return (\n    <>\n      <style href=\"hb-loader-liquid-progress\" precedence=\"default\">{css}</style>\n      <div className={`hb-vk4 ${className}`} style={vars} {...rest}>\n        {label ? <span className=\"hb-vk4-l\">{label}</span> : null}\n        <div\n          className=\"hb-vk4-track\"\n          role=\"progressbar\"\n          aria-valuemin={0}\n          aria-valuemax={100}\n          aria-valuenow={shown}\n          aria-label={label ?? \"Progress\"}\n        >\n          <div className=\"hb-vk4-fill\">\n            {bubbles.map((b, i) => (\n              <span\n                key={i}\n                className=\"hb-vk4-bub\"\n                style={{ left: `${b.x}%`, width: `${b.s}px`, height: `${b.s}px`, animationDelay: `${b.d}s` }}\n              />\n            ))}\n            {pct < 100 ? (\n              <span className=\"hb-vk4-edge\" aria-hidden=\"true\">\n                <svg className=\"hb-vk4-wave\" viewBox=\"0 0 100 200\" preserveAspectRatio=\"none\">\n                  <path d={wavePath} fill={accent} />\n                </svg>\n              </span>\n            ) : null}\n          </div>\n          {showValue ? (\n            <>\n              <span className=\"hb-vk4-txt\" aria-hidden=\"true\">{shown}%</span>\n              <span className=\"hb-vk4-txt\" data-on=\"true\" aria-hidden=\"true\">{shown}%</span>\n            </>\n          ) : null}\n        </div>\n      </div>\n    </>\n  );\n}\n"
    }
  ]
}