{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "liquid-fill",
  "type": "registry:component",
  "title": "Liquid Fill",
  "description": "A glass flask that fills with liquid.",
  "author": "Marcelo Treviño Velázquez <https://furin.dev>",
  "dependencies": [],
  "categories": [
    "Loaders"
  ],
  "docs": "Installed in components/furin/liquid-fill/. Docs, live controls and props table: https://furin.dev/components/liquid-fill/",
  "files": [
    {
      "path": "registry/liquid-fill/LiquidFill.tsx",
      "content": "\"use client\";\nimport { useEffect, useId, useRef, useState } from \"react\";\nimport type { CSSProperties } from \"react\";\nimport \"./LiquidFill.css\";\n\nexport interface LiquidFillProps {\n  /** Progreso de 0 a 100; si se omite, el matraz se llena y se vacía solo en bucle. */\n  value?: number;\n  /** Color del líquido. */\n  color?: string;\n  /** Velocidad del llenado y de las olas (1 = normal). */\n  speed?: number;\n  /** Muestra el porcentaje grande sobre el matraz. */\n  showPercent?: boolean;\n  /** Texto opcional bajo el matraz. */\n  label?: string;\n  /** Alto del matraz en px. */\n  size?: number;\n  /** Clase extra para el contenedor. */\n  className?: string;\n  /** Estilos extra para el contenedor. */\n  style?: CSSProperties;\n}\n\n/* ───────────── Geometría del matraz (viewBox 0 0 200 260) ─────────────\n   Cada perfil describe el lado izquierdo de arriba a abajo con curvas cúbicas;\n   el derecho es su espejo. El contorno exterior y el interior comparten forma,\n   así el grosor del vidrio es parejo y el líquido se recorta por el interior. */\n\ntype Seg = readonly [number, number, number, number, number, number];\ninterface Profile {\n  start: readonly [number, number];\n  segs: readonly Seg[];\n}\n\nconst OUTER: Profile = {\n  start: [83, 20],\n  segs: [\n    [83, 40, 83, 60, 83, 80],\n    [83, 106, 27, 158, 24, 208],\n    [23, 232, 38, 244, 62, 244],\n  ],\n};\nconst INNER: Profile = {\n  start: [89, 22],\n  segs: [\n    [89, 40, 89, 62, 89, 82],\n    [89, 106, 33, 160, 30, 208],\n    [29, 228, 42, 238, 64, 238],\n  ],\n};\n\n/** Silueta cerrada: lado izquierdo, base recta y lado derecho en espejo. */\nfunction closedPath(p: Profile, open = false): string {\n  let d = `M${p.start[0]} ${p.start[1]}`;\n  for (const s of p.segs) d += `C${s[0]} ${s[1]} ${s[2]} ${s[3]} ${s[4]} ${s[5]}`;\n  const end = p.segs[p.segs.length - 1];\n  d += `L${200 - end[4]} ${end[5]}`;\n  for (let i = p.segs.length - 1; i >= 0; i--) {\n    const s = p.segs[i];\n    const prev = i > 0 ? p.segs[i - 1] : null;\n    const sx = prev ? prev[4] : p.start[0];\n    const sy = prev ? prev[5] : p.start[1];\n    d += `C${200 - s[2]} ${s[3]} ${200 - s[0]} ${s[1]} ${200 - sx} ${sy}`;\n  }\n  return open ? d : `${d}Z`;\n}\n\n/** Un solo costado desplazado hacia adentro (para reflejos que siguen la curva del vidrio). */\nfunction edgePath(p: Profile, side: \"L\" | \"R\", inset: number, from = 0): string {\n  const X = (x: number) => (side === \"L\" ? x + inset : 200 - x - inset) as number;\n  let d = \"\";\n  let px = p.start[0];\n  let py = p.start[1];\n  p.segs.forEach((s, i) => {\n    if (i >= from) {\n      if (d === \"\") d = `M${X(px)} ${py}`;\n      d += `C${X(s[0])} ${s[1]} ${X(s[2])} ${s[3]} ${X(s[4])} ${s[5]}`;\n    }\n    px = s[4];\n    py = s[5];\n  });\n  return d;\n}\n\nconst OUTER_D = closedPath(OUTER);\nconst INNER_D = closedPath(INNER);\n// Contornos abiertos: sin la línea de arriba, que queda escondida bajo la boca.\nconst OUTER_OPEN = closedPath(OUTER, true);\nconst INNER_OPEN = closedPath(INNER, true);\nconst WALL_D = `${OUTER_D}${INNER_D}`;\n\n/** Tabla [y, semiancho] del interior, para saber qué tan ancho es el matraz a cada altura. */\nconst HW: Array<[number, number]> = [];\n(() => {\n  let px = INNER.start[0];\n  let py = INNER.start[1];\n  for (const s of INNER.segs) {\n    for (let k = 0; k <= 14; k++) {\n      const t = k / 14;\n      const m = 1 - t;\n      const x = m * m * m * px + 3 * m * m * t * s[0] + 3 * m * t * t * s[2] + t * t * t * s[4];\n      const y = m * m * m * py + 3 * m * m * t * s[1] + 3 * m * t * t * s[3] + t * t * t * s[5];\n      HW.push([y, 100 - x]);\n    }\n    px = s[4];\n    py = s[5];\n  }\n})();\nfunction halfWidthAt(y: number): number {\n  if (y <= HW[0][0]) return HW[0][1];\n  for (let i = 1; i < HW.length; i++) {\n    if (y <= HW[i][0]) {\n      const [y0, w0] = HW[i - 1];\n      const [y1, w1] = HW[i];\n      return y1 === y0 ? w1 : w0 + ((w1 - w0) * (y - y0)) / (y1 - y0);\n    }\n  }\n  return HW[HW.length - 1][1];\n}\n\n/* ───────────── Ola: suma de senos ───────────── */\n\nconst Y_BOT = 238; // fondo interior del vidrio\nconst Y_TOP = 40; // nivel al 100 %, dentro del cuello\nconst Y_REST = 245.5; // nivel al 0 %: bajo el fondo grueso del vidrio, no se ve nada\nconst NP = 33;\nconst X0 = 10;\nconst X1 = 190;\nconst XS: number[] = Array.from({ length: NP }, (_, i) => X0 + ((X1 - X0) * i) / (NP - 1));\nconst ysFront: number[] = new Array(NP).fill(0);\nconst ysBack: number[] = new Array(NP).fill(0);\n\nconst clamp = (v: number, a: number, b: number) => Math.min(b, Math.max(a, v));\nconst f1 = (n: number) => (Math.round(n * 10) / 10).toString();\nconst levelToY = (level: number) => Y_REST - ((Y_REST - Y_TOP) * level) / 100;\n\nfunction fillWave(ys: number[], base: number, t: number, amp: number, slosh: number, hw: number, back: boolean) {\n  for (let i = 0; i < NP; i++) {\n    const x = XS[i];\n    const dx = x - 100;\n    let y = base;\n    if (back) {\n      y += amp * (0.5 * Math.sin(0.058 * x - t * 1.55 + 2.1) + 0.32 * Math.sin(0.11 * x + t * 1.15 + 0.4) + 0.18 * Math.sin(0.19 * x - t * 2.3));\n      y += slosh * Math.sin(t * 2.2 - 0.9) * (dx / 70);\n    } else {\n      y += amp * (0.55 * Math.sin(0.072 * x + t * 1.9) + 0.3 * Math.sin(0.128 * x - t * 1.35 + 1.7) + 0.15 * Math.sin(0.21 * x + t * 2.6 + 0.6));\n      y += slosh * Math.sin(t * 2.2) * (dx / 70);\n    }\n    // Menisco: el líquido sube un poco pegado a la pared.\n    const edge = Math.max(hw - Math.abs(dx), 0);\n    y -= (back ? 1.2 : 2.1) * Math.exp(-edge / 2.6);\n    ys[i] = y;\n  }\n}\n\n/** Traza suave por puntos medios; devuelve la línea abierta y la silueta cerrada hacia el fondo. */\nfunction wavePaths(ys: number[], bottom: number): [string, string] {\n  let open = `M${f1(XS[0])} ${f1(ys[0])}`;\n  for (let i = 1; i < NP - 1; i++) {\n    open += `Q${f1(XS[i])} ${f1(ys[i])} ${f1((XS[i] + XS[i + 1]) / 2)} ${f1((ys[i] + ys[i + 1]) / 2)}`;\n  }\n  open += `L${f1(XS[NP - 1])} ${f1(ys[NP - 1])}`;\n  return [open, `${open}L${f1(XS[NP - 1])} ${bottom}L${f1(XS[0])} ${bottom}Z`];\n}\n\ninterface Frame {\n  back: string;\n  front: string;\n  crest: string;\n  ySurf: number;\n  hw: number;\n  causticOpacity: number;\n  floorOpacity: number;\n  haloOpacity: number;\n}\n\nfunction compose(level: number, t: number, ag: number): Frame {\n  const base = levelToY(level);\n  const hw = halfWidthAt(base);\n  // Con el cuello angosto el oleaje se amortigua; en la panza grande se nota más.\n  const widthScale = clamp(hw / 58, 0.2, 1);\n  const low = Math.min(1, level / 5);\n  const amp = (0.85 + 3.4 * ag) * widthScale * low;\n  const slosh = 4.6 * ag * widthScale * low;\n  fillWave(ysFront, base, t, amp, slosh, hw, false);\n  fillWave(ysBack, base - 1.8, t, amp * 1.15, slosh, hw, true);\n  const [, back] = wavePaths(ysBack, 250);\n  const [crest, front] = wavePaths(ysFront, 250);\n  const l = clamp(level / 100, 0, 1);\n  return {\n    back,\n    front,\n    crest,\n    ySurf: base,\n    hw,\n    causticOpacity: Math.min(1, level / 12) * 0.85,\n    floorOpacity: 0.03 + 0.62 * l,\n    haloOpacity: 0.02 + 0.22 * l,\n  };\n}\n\n/* ───────────── Burbujas ───────────── */\n\ninterface Bubble {\n  /** Posición horizontal normalizada dentro del matraz (-1 a 1). */\n  x: number;\n  /** Radio en unidades del viewBox. */\n  r: number;\n  /** Segundos que tarda en subir del fondo a la superficie. */\n  life: number;\n  /** Fase inicial del recorrido (0 a 1). */\n  p0: number;\n  /** Fase del vaivén lateral. */\n  wob: number;\n}\nconst BUBBLES: Bubble[] = [\n  { x: -0.5, r: 1.7, life: 4.6, p0: 0.12, wob: 0.4 },\n  { x: 0.34, r: 2.5, life: 5.8, p0: 0.58, wob: 1.9 },\n  { x: -0.12, r: 1.1, life: 3.7, p0: 0.31, wob: 3.1 },\n  { x: 0.66, r: 1.4, life: 4.2, p0: 0.84, wob: 0.9 },\n  { x: -0.74, r: 2.1, life: 6.4, p0: 0.47, wob: 2.6 },\n  { x: 0.08, r: 1.8, life: 5.1, p0: 0.92, wob: 4.2 },\n  { x: 0.52, r: 0.9, life: 3.3, p0: 0.2, wob: 5.0 },\n  { x: -0.34, r: 1.3, life: 4.0, p0: 0.7, wob: 1.2 },\n  { x: 0.8, r: 2.0, life: 6.0, p0: 0.38, wob: 3.8 },\n  { x: -0.62, r: 1.0, life: 3.5, p0: 0.77, wob: 2.2 },\n];\n\nfunction bubblePose(b: Bubble, p: number, t: number, ySurf: number, level: number): { tf: string; op: number } {\n  const depth = Y_BOT - 4 - ySurf;\n  if (depth < 14 || level < 4) return { tf: \"translate(0 0)\", op: 0 };\n  const y = Y_BOT - 5 - p * (depth - 3);\n  const x = 100 + b.x * halfWidthAt(y) * 0.72 + Math.sin(t * 1.7 + b.wob) * (1 + p * 1.2);\n  const s = 1 + 0.3 * p;\n  const op = Math.min(1, p / 0.1) * Math.min(1, (1 - p) / 0.12);\n  return { tf: `translate(${f1(x)} ${f1(y)}) scale(${s.toFixed(2)})`, op };\n}\n\n/* ───────────── Tiempos del modo automático ───────────── */\n\nconst T_FILL = 4.6;\nconst T_HOLD = 1.5;\nconst T_DRAIN = 2.7;\nconst T_REST = 0.8;\nconst T_LOOP = T_FILL + T_HOLD + T_DRAIN + T_REST;\nconst T_START = 1.5; // arranca ya con algo de líquido para que no abra vacío\n\nconst easeInOutSine = (x: number) => (1 - Math.cos(Math.PI * x)) / 2;\nconst easeInOutCubic = (x: number) => (x < 0.5 ? 4 * x * x * x : 1 - Math.pow(-2 * x + 2, 3) / 2);\n\nfunction autoLevel(tt: number): number {\n  const u = ((tt % T_LOOP) + T_LOOP) % T_LOOP;\n  if (u < T_FILL) return 100 * easeInOutSine(u / T_FILL);\n  if (u < T_FILL + T_HOLD) return 100;\n  if (u < T_FILL + T_HOLD + T_DRAIN) return 100 * (1 - easeInOutCubic((u - T_FILL - T_HOLD) / T_DRAIN));\n  return 0;\n}\n\n/** Matraz Erlenmeyer de vidrio que se llena de líquido con olas, burbujas y porcentaje. */\nexport function LiquidFill({\n  value,\n  color = \"#18C5DA\",\n  speed = 1,\n  showPercent = true,\n  label,\n  size = 290,\n  className = \"\",\n  style,\n}: LiquidFillProps) {\n  const uid = \"fl\" + useId().replace(/[^a-zA-Z0-9]/g, \"\");\n  const id = (n: string) => `${uid}-${n}`;\n  const url = (n: string) => `url(#${uid}-${n})`;\n\n  const initLevel = value === undefined ? autoLevel(T_START) : clamp(value, 0, 100);\n  // Cuadro inicial estable (también para SSR); después el bucle escribe los atributos por ref.\n  const [init] = useState(() => {\n    const frame = compose(initLevel, 1.3, 0);\n    const poses = BUBBLES.map((b) => bubblePose(b, b.p0, 1.3, frame.ySurf, initLevel));\n    return { frame, poses, level: initLevel };\n  });\n\n  const live = useRef({ value, speed });\n  const redraw = useRef<(() => void) | null>(null);\n\n  const rootRef = useRef<HTMLDivElement>(null);\n  const backRef = useRef<SVGPathElement>(null);\n  const frontRef = useRef<SVGPathElement>(null);\n  const crestRef = useRef<SVGPathElement>(null);\n  const causticRef = useRef<SVGEllipseElement>(null);\n  const floorRef = useRef<SVGGElement>(null);\n  const haloRef = useRef<SVGEllipseElement>(null);\n  const numRef = useRef<HTMLSpanElement>(null);\n  const bubRefs = useRef<Array<SVGGElement | null>>([]);\n\n  useEffect(() => {\n    live.current = { value, speed };\n    // En movimiento reducido no hay bucle: un cambio de valor repinta el cuadro quieto.\n    redraw.current?.();\n  }, [value, speed]);\n\n  useEffect(() => {\n    const root = rootRef.current;\n    if (!root) return;\n\n    const st = {\n      level: initLevel,\n      vel: 0,\n      ag: 0,\n      t: 1.3,\n      auto: T_START,\n      phase: BUBBLES.map((b) => b.p0),\n      shown: -1,\n      aria: -1,\n      ariaAt: 0,\n    };\n\n    const apply = (level: number) => {\n      const fr = compose(level, st.t, st.ag);\n      backRef.current?.setAttribute(\"d\", fr.back);\n      frontRef.current?.setAttribute(\"d\", fr.front);\n      crestRef.current?.setAttribute(\"d\", fr.crest);\n      const c = causticRef.current;\n      if (c) {\n        c.setAttribute(\"cx\", f1(97 - fr.hw * 0.08));\n        c.setAttribute(\"cy\", f1(fr.ySurf + 3));\n        c.setAttribute(\"rx\", f1(Math.max(fr.hw * 0.8, 4)));\n        c.setAttribute(\"opacity\", fr.causticOpacity.toFixed(2));\n      }\n      floorRef.current?.setAttribute(\"opacity\", fr.floorOpacity.toFixed(2));\n      haloRef.current?.setAttribute(\"opacity\", fr.haloOpacity.toFixed(2));\n      for (let i = 0; i < BUBBLES.length; i++) {\n        const el = bubRefs.current[i];\n        if (!el) continue;\n        const pose = bubblePose(BUBBLES[i], st.phase[i], st.t, fr.ySurf, level);\n        el.setAttribute(\"transform\", pose.tf);\n        el.setAttribute(\"opacity\", pose.op.toFixed(2));\n      }\n      const pct = Math.round(level);\n      if (pct !== st.shown) {\n        st.shown = pct;\n        if (numRef.current) numRef.current.textContent = String(pct);\n      }\n    };\n\n    const syncAria = (now: number, force: boolean) => {\n      const v = live.current.value;\n      const n = v === undefined ? Math.round(st.level) : Math.round(clamp(v, 0, 100));\n      // Sin cambiar a cada cuadro: los lectores de pantalla no necesitan 60 avisos por segundo.\n      if (n !== st.aria && (force || now - st.ariaAt > 400)) {\n        st.aria = n;\n        st.ariaAt = now;\n        root.setAttribute(\"aria-valuenow\", String(n));\n      }\n    };\n\n    let reduced = false;\n    let visible = true;\n    let raf = 0;\n    let last = 0;\n\n    const settle = () => {\n      const v = live.current.value;\n      st.level = v === undefined ? 65 : clamp(v, 0, 100);\n      st.vel = 0;\n      st.ag = 0;\n      st.t = 1.3;\n      st.phase = BUBBLES.map((b) => b.p0);\n      apply(st.level);\n      syncAria(0, true);\n    };\n\n    const frame = (now: number) => {\n      raf = requestAnimationFrame(frame);\n      const dt = last ? Math.min((now - last) / 1000, 0.05) : 0.016;\n      last = now;\n      const { value: v, speed: sp0 } = live.current;\n      const sp = clamp(sp0, 0.1, 4);\n      st.t += dt * sp;\n\n      const prev = st.level;\n      if (v === undefined) {\n        st.auto += dt * sp;\n        st.level = autoLevel(st.auto);\n        st.vel = (st.level - prev) / Math.max(dt, 0.001);\n      } else {\n        // Resorte críticamente amortiguado hacia el objetivo: arranca y frena con ease.\n        const target = clamp(v, 0, 100);\n        const smooth = 0.75 / sp;\n        const w = 2 / smooth;\n        const x = w * dt;\n        const e = 1 / (1 + x + 0.48 * x * x + 0.235 * x * x * x);\n        const change = st.level - target;\n        const tmp = (st.vel + w * change) * dt;\n        st.vel = (st.vel - w * tmp) * e;\n        st.level = clamp(target + (change + tmp) * e, 0, 100);\n        if (Math.abs(st.level - target) < 0.02 && Math.abs(st.vel) < 0.05) {\n          st.level = target;\n          st.vel = 0;\n        }\n      }\n\n      // El oleaje se agita con la velocidad del nivel y se calma solo.\n      const goal = Math.min(1, Math.abs(st.vel) / 24);\n      st.ag += (goal - st.ag) * (1 - Math.exp(-dt * (goal > st.ag ? 6 : 1.1)));\n\n      for (let i = 0; i < BUBBLES.length; i++) {\n        st.phase[i] = (st.phase[i] + (dt * sp) / BUBBLES[i].life) % 1;\n      }\n      apply(st.level);\n      syncAria(now, false);\n    };\n\n    const start = () => {\n      if (raf || reduced || !visible) return;\n      last = 0;\n      raf = requestAnimationFrame(frame);\n    };\n    const stop = () => {\n      if (raf) cancelAnimationFrame(raf);\n      raf = 0;\n    };\n\n    const mq = typeof window.matchMedia === \"function\" ? window.matchMedia(\"(prefers-reduced-motion: reduce)\") : null;\n    const onMotion = () => {\n      reduced = !!mq?.matches;\n      stop();\n      if (reduced) {\n        settle();\n        redraw.current = settle;\n      } else {\n        redraw.current = null;\n        start();\n      }\n    };\n    mq?.addEventListener(\"change\", onMotion);\n\n    let io: IntersectionObserver | null = null;\n    if (typeof IntersectionObserver !== \"undefined\") {\n      io = new IntersectionObserver((entries) => {\n        visible = entries[entries.length - 1].isIntersecting;\n        if (visible) start();\n        else stop();\n      });\n      io.observe(root);\n    }\n\n    onMotion();\n    if (!reduced) syncAria(0, true);\n\n    return () => {\n      stop();\n      redraw.current = null;\n      mq?.removeEventListener(\"change\", onMotion);\n      io?.disconnect();\n    };\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, []);\n\n  const vars = { \"--furin-liquid-fill-color\": color, \"--furin-liquid-fill-size\": `${size}px` } as CSSProperties;\n  const fr = init.frame;\n\n  return (\n    <div className={`furin-liquid-fill ${className}`} style={{ ...vars, ...style }}>\n      <div\n        ref={rootRef}\n        className=\"furin-liquid-fill__flask\"\n        role=\"progressbar\"\n        aria-label={label || \"Loading\"}\n        aria-valuemin={0}\n        aria-valuemax={100}\n        aria-valuenow={Math.round(init.level)}\n      >\n        <svg className=\"furin-liquid-fill__svg\" viewBox=\"0 0 200 260\" aria-hidden=\"true\" focusable=\"false\">\n          <defs>\n            <clipPath id={id(\"clip\")}>\n              <path d={INNER_D} />\n            </clipPath>\n            <clipPath id={id(\"wallclip\")}>\n              <path d={WALL_D} clipRule=\"evenodd\" />\n            </clipPath>\n            {/* Geometría de las olas: se actualiza una vez por cuadro y todas las capas la reutilizan */}\n            <path ref={backRef} id={id(\"wb\")} d={fr.back} />\n            <path ref={frontRef} id={id(\"wf\")} d={fr.front} />\n            <path ref={crestRef} id={id(\"wc\")} d={fr.crest} />\n\n            {/* Líquido: profundidad vertical y sombreado lateral como en un cilindro */}\n            <linearGradient id={id(\"front\")} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n              <stop offset=\"0\" className=\"furin-liquid-fill__c-hi\" />\n              <stop offset=\"0.1\" className=\"furin-liquid-fill__c-mid\" />\n              <stop offset=\"0.6\" className=\"furin-liquid-fill__c-mid2\" />\n              <stop offset=\"1\" className=\"furin-liquid-fill__c-deep\" />\n            </linearGradient>\n            <linearGradient id={id(\"back\")} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n              <stop offset=\"0\" className=\"furin-liquid-fill__c-glow\" stopOpacity=\"0.75\" />\n              <stop offset=\"1\" className=\"furin-liquid-fill__c-mid\" stopOpacity=\"0.5\" />\n            </linearGradient>\n            <linearGradient id={id(\"shade\")} x1=\"26\" y1=\"0\" x2=\"174\" y2=\"0\" gradientUnits=\"userSpaceOnUse\">\n              <stop offset=\"0\" stopColor=\"#001018\" stopOpacity=\"0.34\" />\n              <stop offset=\"0.14\" stopColor=\"#001018\" stopOpacity=\"0.04\" />\n              <stop offset=\"0.34\" stopColor=\"#fff\" stopOpacity=\"0.05\" />\n              <stop offset=\"0.5\" stopColor=\"#fff\" stopOpacity=\"0\" />\n              <stop offset=\"0.84\" stopColor=\"#001018\" stopOpacity=\"0.08\" />\n              <stop offset=\"1\" stopColor=\"#001018\" stopOpacity=\"0.4\" />\n            </linearGradient>\n            <linearGradient id={id(\"crest\")} x1=\"12\" y1=\"0\" x2=\"188\" y2=\"0\" gradientUnits=\"userSpaceOnUse\">\n              <stop offset=\"0\" stopColor=\"#fff\" stopOpacity=\"0.35\" />\n              <stop offset=\"0.3\" stopColor=\"#fff\" stopOpacity=\"1\" />\n              <stop offset=\"0.75\" stopColor=\"#fff\" stopOpacity=\"0.7\" />\n              <stop offset=\"1\" stopColor=\"#fff\" stopOpacity=\"0.3\" />\n            </linearGradient>\n            <radialGradient id={id(\"core\")} cx=\"104\" cy=\"196\" r=\"78\" gradientUnits=\"userSpaceOnUse\">\n              <stop offset=\"0\" className=\"furin-liquid-fill__c-hi\" stopOpacity=\"0.32\" />\n              <stop offset=\"0.6\" className=\"furin-liquid-fill__c-hi\" stopOpacity=\"0.08\" />\n              <stop offset=\"1\" className=\"furin-liquid-fill__c-hi\" stopOpacity=\"0\" />\n            </radialGradient>\n            <radialGradient id={id(\"caustic\")}>\n              <stop offset=\"0\" className=\"furin-liquid-fill__c-glow\" stopOpacity=\"0.9\" />\n              <stop offset=\"0.55\" className=\"furin-liquid-fill__c-glow\" stopOpacity=\"0.28\" />\n              <stop offset=\"1\" className=\"furin-liquid-fill__c-glow\" stopOpacity=\"0\" />\n            </radialGradient>\n            <radialGradient id={id(\"bubble\")} cx=\"0.5\" cy=\"0.5\" r=\"0.5\">\n              <stop offset=\"0\" stopColor=\"#fff\" stopOpacity=\"0.06\" />\n              <stop offset=\"0.6\" stopColor=\"#fff\" stopOpacity=\"0.16\" />\n              <stop offset=\"1\" stopColor=\"#fff\" stopOpacity=\"0.85\" />\n            </radialGradient>\n\n            {/* Vidrio */}\n            <linearGradient id={id(\"wall\")} x1=\"24\" y1=\"20\" x2=\"176\" y2=\"244\" gradientUnits=\"userSpaceOnUse\">\n              <stop offset=\"0\" stopColor=\"#fff\" stopOpacity=\"0.36\" />\n              <stop offset=\"0.35\" stopColor=\"#fff\" stopOpacity=\"0.1\" />\n              <stop offset=\"0.7\" stopColor=\"#fff\" stopOpacity=\"0.06\" />\n              <stop offset=\"1\" stopColor=\"#fff\" stopOpacity=\"0.22\" />\n            </linearGradient>\n            <linearGradient id={id(\"edge\")} x1=\"26\" y1=\"8\" x2=\"178\" y2=\"248\" gradientUnits=\"userSpaceOnUse\">\n              <stop offset=\"0\" stopColor=\"#fff\" stopOpacity=\"1\" />\n              <stop offset=\"0.28\" stopColor=\"#fff\" stopOpacity=\"0.4\" />\n              <stop offset=\"0.62\" stopColor=\"#fff\" stopOpacity=\"0.14\" />\n              <stop offset=\"0.88\" stopColor=\"#fff\" stopOpacity=\"0.5\" />\n              <stop offset=\"1\" stopColor=\"#fff\" stopOpacity=\"0.85\" />\n            </linearGradient>\n            <linearGradient id={id(\"edge2\")} x1=\"30\" y1=\"20\" x2=\"170\" y2=\"240\" gradientUnits=\"userSpaceOnUse\">\n              <stop offset=\"0\" stopColor=\"#fff\" stopOpacity=\"0.1\" />\n              <stop offset=\"0.5\" stopColor=\"#fff\" stopOpacity=\"0.28\" />\n              <stop offset=\"1\" stopColor=\"#fff\" stopOpacity=\"0.1\" />\n            </linearGradient>\n            <linearGradient id={id(\"inside\")} x1=\"0\" y1=\"0\" x2=\"1\" y2=\"0\">\n              <stop offset=\"0\" stopColor=\"#fff\" stopOpacity=\"0.1\" />\n              <stop offset=\"0.35\" stopColor=\"#fff\" stopOpacity=\"0.02\" />\n              <stop offset=\"0.8\" stopColor=\"#fff\" stopOpacity=\"0.03\" />\n              <stop offset=\"1\" stopColor=\"#fff\" stopOpacity=\"0.1\" />\n            </linearGradient>\n            <radialGradient id={id(\"glow\")} cx=\"72\" cy=\"150\" r=\"78\" gradientUnits=\"userSpaceOnUse\">\n              <stop offset=\"0\" stopColor=\"#fff\" stopOpacity=\"0.2\" />\n              <stop offset=\"1\" stopColor=\"#fff\" stopOpacity=\"0\" />\n            </radialGradient>\n            <linearGradient id={id(\"neck\")} x1=\"0\" y1=\"44\" x2=\"0\" y2=\"74\" gradientUnits=\"userSpaceOnUse\">\n              <stop offset=\"0\" stopColor=\"#fff\" stopOpacity=\"0\" />\n              <stop offset=\"0.25\" stopColor=\"#fff\" stopOpacity=\"0.8\" />\n              <stop offset=\"0.75\" stopColor=\"#fff\" stopOpacity=\"0.8\" />\n              <stop offset=\"1\" stopColor=\"#fff\" stopOpacity=\"0\" />\n            </linearGradient>\n            <linearGradient id={id(\"streak\")} x1=\"0\" y1=\"84\" x2=\"0\" y2=\"204\" gradientUnits=\"userSpaceOnUse\">\n              <stop offset=\"0\" stopColor=\"#fff\" stopOpacity=\"0\" />\n              <stop offset=\"0.12\" stopColor=\"#fff\" stopOpacity=\"0.95\" />\n              <stop offset=\"0.6\" stopColor=\"#fff\" stopOpacity=\"0.78\" />\n              <stop offset=\"0.9\" stopColor=\"#fff\" stopOpacity=\"0.3\" />\n              <stop offset=\"1\" stopColor=\"#fff\" stopOpacity=\"0\" />\n            </linearGradient>\n            <linearGradient id={id(\"streak2\")} x1=\"0\" y1=\"112\" x2=\"0\" y2=\"196\" gradientUnits=\"userSpaceOnUse\">\n              <stop offset=\"0\" stopColor=\"#fff\" stopOpacity=\"0\" />\n              <stop offset=\"0.3\" stopColor=\"#fff\" stopOpacity=\"0.5\" />\n              <stop offset=\"0.75\" stopColor=\"#fff\" stopOpacity=\"0.4\" />\n              <stop offset=\"1\" stopColor=\"#fff\" stopOpacity=\"0\" />\n            </linearGradient>\n            <linearGradient id={id(\"sheen\")} x1=\"0\" y1=\"110\" x2=\"0\" y2=\"228\" gradientUnits=\"userSpaceOnUse\">\n              <stop offset=\"0\" stopColor=\"#fff\" stopOpacity=\"0\" />\n              <stop offset=\"0.4\" stopColor=\"#fff\" stopOpacity=\"0.42\" />\n              <stop offset=\"1\" stopColor=\"#fff\" stopOpacity=\"0.1\" />\n            </linearGradient>\n            <linearGradient id={id(\"lip\")} x1=\"0\" y1=\"0\" x2=\"1\" y2=\"0\">\n              <stop offset=\"0\" stopColor=\"#fff\" stopOpacity=\"0.42\" />\n              <stop offset=\"0.3\" stopColor=\"#fff\" stopOpacity=\"0.1\" />\n              <stop offset=\"0.7\" stopColor=\"#fff\" stopOpacity=\"0.07\" />\n              <stop offset=\"1\" stopColor=\"#fff\" stopOpacity=\"0.3\" />\n            </linearGradient>\n\n            {/* Sombra de contacto y luz del líquido sobre la mesa */}\n            <radialGradient id={id(\"shadow\")}>\n              <stop offset=\"0\" stopColor=\"#000\" stopOpacity=\"0.75\" />\n              <stop offset=\"0.6\" stopColor=\"#000\" stopOpacity=\"0.3\" />\n              <stop offset=\"1\" stopColor=\"#000\" stopOpacity=\"0\" />\n            </radialGradient>\n            <radialGradient id={id(\"pool\")}>\n              <stop offset=\"0\" className=\"furin-liquid-fill__c-glow\" stopOpacity=\"0.85\" />\n              <stop offset=\"0.5\" className=\"furin-liquid-fill__c-mid\" stopOpacity=\"0.32\" />\n              <stop offset=\"1\" className=\"furin-liquid-fill__c-mid\" stopOpacity=\"0\" />\n            </radialGradient>\n            <radialGradient id={id(\"halo\")}>\n              <stop offset=\"0\" className=\"furin-liquid-fill__c-mid\" stopOpacity=\"0.55\" />\n              <stop offset=\"1\" className=\"furin-liquid-fill__c-mid\" stopOpacity=\"0\" />\n            </radialGradient>\n            <filter id={id(\"soft\")} x=\"-30%\" y=\"-10%\" width=\"160%\" height=\"120%\">\n              <feGaussianBlur stdDeviation=\"1.7\" />\n            </filter>\n            <filter id={id(\"soft2\")} x=\"-50%\" y=\"-50%\" width=\"200%\" height=\"200%\">\n              <feGaussianBlur stdDeviation=\"0.7\" />\n            </filter>\n          </defs>\n\n          {/* Halo del líquido, luz sobre la mesa y sombra de contacto */}\n          <ellipse ref={haloRef} cx=\"100\" cy=\"170\" rx=\"118\" ry=\"104\" fill={url(\"halo\")} opacity={fr.haloOpacity} />\n          <g ref={floorRef} opacity={fr.floorOpacity}>\n            <ellipse cx=\"108\" cy=\"248\" rx=\"92\" ry=\"11\" fill={url(\"pool\")} />\n            <ellipse cx=\"116\" cy=\"248.5\" rx=\"42\" ry=\"4.2\" fill={url(\"pool\")} />\n          </g>\n          <ellipse cx=\"100\" cy=\"246.5\" rx=\"68\" ry=\"6\" fill={url(\"shadow\")} />\n\n          {/* Interior del vidrio, ya con brillo propio */}\n          <path d={INNER_D} fill={url(\"inside\")} />\n\n          {/* Líquido recortado por el interior del matraz */}\n          <g clipPath={url(\"clip\")}>\n            <use href={`#${id(\"wb\")}`} fill={url(\"back\")} />\n            <use href={`#${id(\"wf\")}`} fill={url(\"front\")} />\n            <use href={`#${id(\"wf\")}`} fill={url(\"core\")} />\n            <use href={`#${id(\"wf\")}`} fill={url(\"shade\")} />\n            <ellipse ref={causticRef} cx=\"94\" cy={fr.ySurf + 3} rx={Math.max(fr.hw * 0.8, 4)} ry=\"7\" fill={url(\"caustic\")} opacity={fr.causticOpacity} />\n            <use href={`#${id(\"wc\")}`} fill=\"none\" stroke={url(\"crest\")} strokeWidth=\"3.2\" strokeLinecap=\"round\" opacity=\"0.38\" filter={url(\"soft2\")} />\n            <use href={`#${id(\"wc\")}`} fill=\"none\" stroke={url(\"crest\")} strokeWidth=\"1\" strokeLinecap=\"round\" opacity=\"0.92\" />\n            {BUBBLES.map((b, i) => (\n              <g\n                key={i}\n                ref={(el) => {\n                  bubRefs.current[i] = el;\n                }}\n                transform={init.poses[i].tf}\n                opacity={init.poses[i].op.toFixed(2)}\n              >\n                <circle r={b.r} fill={url(\"bubble\")} />\n                <circle cx={-b.r * 0.32} cy={-b.r * 0.34} r={Math.max(b.r * 0.26, 0.3)} fill=\"#fff\" opacity=\"0.85\" />\n              </g>\n            ))}\n          </g>\n\n          {/* Pared de vidrio: grosor visible entre el contorno exterior y el interior */}\n          <path d={WALL_D} fillRule=\"evenodd\" fill={url(\"wall\")} />\n          <use href={`#${id(\"wf\")}`} className=\"furin-liquid-fill__tint\" clipPath={url(\"wallclip\")} opacity=\"0.6\" />\n          <path d={INNER_D} fill={url(\"glow\")} clipPath={url(\"clip\")} />\n          <path d={INNER_OPEN} fill=\"none\" stroke={url(\"edge2\")} strokeWidth=\"0.8\" />\n          <path d={OUTER_OPEN} fill=\"none\" stroke={url(\"edge\")} strokeWidth=\"1.3\" strokeLinejoin=\"round\" />\n\n          {/* Boca con reborde */}\n          <rect x=\"76\" y=\"9\" width=\"48\" height=\"15\" rx=\"6\" fill={url(\"lip\")} />\n          <rect x=\"76\" y=\"9\" width=\"48\" height=\"15\" rx=\"6\" fill=\"none\" stroke={url(\"edge\")} strokeWidth=\"1.1\" />\n          <ellipse cx=\"100\" cy=\"10\" rx=\"23\" ry=\"2.9\" fill=\"#fff\" opacity=\"0.26\" />\n          <ellipse cx=\"100\" cy=\"10.4\" rx=\"16.5\" ry=\"2\" fill=\"#05080b\" opacity=\"0.5\" />\n          <path d=\"M84 21.2Q100 23.6 116 21.2\" fill=\"none\" stroke=\"#fff\" strokeWidth=\"0.7\" opacity=\"0.35\" strokeLinecap=\"round\" />\n\n          {/* Reflejos especulares */}\n          <path d={edgePath(OUTER, \"R\", 14)} fill=\"none\" stroke={url(\"sheen\")} strokeWidth=\"8\" strokeLinecap=\"round\" opacity=\"0.75\" filter={url(\"soft\")} />\n          <path d={edgePath(OUTER, \"R\", 8.5, 1)} fill=\"none\" stroke={url(\"sheen\")} strokeWidth=\"1.1\" strokeLinecap=\"round\" opacity=\"0.75\" />\n          <path d=\"M93.4 44V74\" fill=\"none\" stroke={url(\"neck\")} strokeWidth=\"2.6\" strokeLinecap=\"round\" />\n          <path d={edgePath(OUTER, \"L\", 11.5, 1)} fill=\"none\" stroke={url(\"streak\")} strokeWidth=\"3.8\" strokeLinecap=\"round\" />\n          <path d={edgePath(OUTER, \"L\", 19.5, 1)} fill=\"none\" stroke={url(\"streak2\")} strokeWidth=\"1.8\" strokeLinecap=\"round\" />\n          <ellipse cx=\"91.5\" cy=\"86\" rx=\"1.6\" ry=\"3.2\" fill=\"#fff\" opacity=\"0.9\" transform=\"rotate(-18 91.5 86)\" />\n          <path d=\"M82 13.4Q85 11.6 90 11.4\" fill=\"none\" stroke=\"#fff\" strokeWidth=\"1.5\" strokeLinecap=\"round\" opacity=\"0.85\" />\n          <path d=\"M60 241.6Q100 246.4 140 241.6\" fill=\"none\" stroke=\"#fff\" strokeWidth=\"0.9\" strokeLinecap=\"round\" opacity=\"0.28\" />\n          <path d=\"M158 236Q170 230 173 214\" fill=\"none\" stroke=\"#fff\" strokeWidth=\"1.3\" strokeLinecap=\"round\" opacity=\"0.5\" />\n        </svg>\n\n        {showPercent ? (\n          <div className=\"furin-liquid-fill__percent\" aria-hidden=\"true\">\n            <span className=\"furin-liquid-fill__figure\">\n              <span ref={numRef}>{Math.round(init.level)}</span>\n              <span className=\"furin-liquid-fill__sign\">%</span>\n            </span>\n          </div>\n        ) : null}\n      </div>\n      {label ? <div className=\"furin-liquid-fill__label\">{label}</div> : null}\n    </div>\n  );\n}\n\nexport default LiquidFill;\n",
      "type": "registry:component",
      "target": "components/furin/liquid-fill/LiquidFill.tsx"
    },
    {
      "path": "registry/liquid-fill/LiquidFill.css",
      "content": ".furin-liquid-fill {\n  --furin-liquid-fill-color: #18c5da;\n  --furin-liquid-fill-size: 290px;\n  display: inline-flex;\n  flex-direction: column;\n  align-items: center;\n  gap: calc(var(--furin-liquid-fill-size) * 0.035);\n  font-family: Geist, \"SF Pro Display\", ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", sans-serif;\n  color: #fff;\n  user-select: none;\n}\n.furin-liquid-fill__flask {\n  position: relative;\n  height: var(--furin-liquid-fill-size);\n  aspect-ratio: 200 / 260;\n  flex: none;\n}\n.furin-liquid-fill__svg {\n  display: block;\n  width: 100%;\n  height: 100%;\n  overflow: visible;\n}\n\n/* Tonos del líquido derivados del color elegido. El primer stop-color es el respaldo sin color-mix. */\n.furin-liquid-fill__c-hi { stop-color: var(--furin-liquid-fill-color); stop-color: color-mix(in oklab, var(--furin-liquid-fill-color) 70%, #fff); }\n.furin-liquid-fill__c-glow { stop-color: var(--furin-liquid-fill-color); stop-color: color-mix(in oklab, var(--furin-liquid-fill-color) 52%, #fff); }\n.furin-liquid-fill__c-mid { stop-color: var(--furin-liquid-fill-color); }\n.furin-liquid-fill__c-mid2 { stop-color: var(--furin-liquid-fill-color); stop-color: color-mix(in oklab, var(--furin-liquid-fill-color) 86%, #020b12); }\n.furin-liquid-fill__c-deep { stop-color: var(--furin-liquid-fill-color); stop-color: color-mix(in oklab, var(--furin-liquid-fill-color) 55%, #020b12); }\n\n.furin-liquid-fill__tint { fill: var(--furin-liquid-fill-color); fill: color-mix(in oklab, var(--furin-liquid-fill-color) 82%, #fff); }\n\n/* Porcentaje: sans con números tabulares y sombra suave para leerse sobre vidrio y líquido.\n   La cifra queda centrada; el signo cuelga a su derecha sin empujarla al cambiar de 2 a 3 dígitos. */\n.furin-liquid-fill__percent {\n  position: absolute;\n  left: 0;\n  right: 0;\n  top: 67%;\n  transform: translateY(-50%);\n  display: flex;\n  justify-content: center;\n  pointer-events: none;\n  line-height: 1;\n  font-weight: 650;\n  letter-spacing: -0.035em;\n  font-variant-numeric: tabular-nums;\n  text-shadow: 0 1px 1px rgba(2, 18, 28, 0.35), 0 2px 14px rgba(2, 18, 28, 0.45);\n}\n.furin-liquid-fill__figure {\n  position: relative;\n  display: inline-block;\n  font-size: calc(var(--furin-liquid-fill-size) * 0.165);\n}\n.furin-liquid-fill__sign {\n  position: absolute;\n  left: 100%;\n  top: 0.06em;\n  margin-left: 0.06em;\n  font-size: 0.46em;\n  font-weight: 600;\n  letter-spacing: 0;\n  opacity: 0.78;\n}\n.furin-liquid-fill__label {\n  font-size: 11px;\n  font-weight: 500;\n  letter-spacing: 0.16em;\n  text-transform: uppercase;\n  color: rgba(255, 255, 255, 0.55);\n  text-align: center;\n}\n",
      "type": "registry:file",
      "target": "components/furin/liquid-fill/LiquidFill.css"
    }
  ]
}
