{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "auth-glass",
  "title": "Auth: Liquid Glass",
  "description": "A clear glass pane over dusk waves, with the sun setting behind its rim.",
  "dependencies": [
    "lucide-react",
    "motion"
  ],
  "registryDependencies": [
    "utils",
    "@animate-ui/icons-check",
    "@animate-ui/icons-fingerprint",
    "@animate-ui/icons-loader-circle"
  ],
  "files": [
    {
      "path": "components/blocks/auth-glass.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Check } from \"@/components/animate-ui/icons/check\"\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\"\n\nimport {\n  AfterglowMark,\n  Field,\n  GitHubMark,\n  GoogleMark,\n  SubmitLabel,\n  checkEmail,\n  useSubmit,\n  type Provider,\n} from \"@/components/ui/auth-parts\"\nimport { LiquidGlass } from \"@/components/ui/liquid-glass\"\nimport { cn } from \"@/lib/utils\"\n\ntype Credentials = { email: string; password: string }\n\ntype AuthGlassProps = {\n  onSubmit?: (values: Credentials) => Promise<void> | void\n  onProvider?: (provider: Provider) => void\n  /** what the glass sits on; defaults to layered dusk waves */\n  background?: React.ReactNode\n  className?: string\n}\n\n// back to front: each wave is lit along its crest and darker below\nconst waves = [\n  \"M0 330C260 270 470 280 720 330S1190 420 1440 320V900H0Z\",\n  \"M0 450C300 380 560 400 820 460S1250 530 1440 430V900H0Z\",\n  \"M0 560C250 500 590 590 900 545S1290 480 1440 540V900H0Z\",\n  \"M0 670C320 630 650 700 960 655S1320 610 1440 660V900H0Z\",\n  \"M0 790C360 745 760 800 1100 765S1390 755 1440 775V900H0Z\",\n]\n\nfunction Waves() {\n  // unique gradient ids, so two scenes on one page don't share them\n  const id = React.useId().replace(/[^\\w-]/g, \"\")\n  return (\n    <svg\n      aria-hidden\n      viewBox=\"0 0 1440 900\"\n      preserveAspectRatio=\"xMidYMid slice\"\n      className={cn(\n        \"absolute inset-0 -z-10 size-full\",\n        \"[--sky-1:oklch(0.9_0.03_260)] [--sky-2:oklch(0.93_0.04_320)] [--w1:oklch(0.82_0.07_295)] [--w2:oklch(0.85_0.08_345)] [--w3:oklch(0.9_0.08_65)] [--w4:oklch(0.74_0.08_315)] [--w5:oklch(0.6_0.07_290)]\",\n        \"dark:[--sky-1:oklch(0.13_0.035_275)] dark:[--sky-2:oklch(0.22_0.06_300)] dark:[--w1:oklch(0.36_0.11_295)] dark:[--w2:oklch(0.5_0.13_340)] dark:[--w3:oklch(0.7_0.12_50)] dark:[--w4:oklch(0.28_0.08_315)] dark:[--w5:oklch(0.15_0.035_285)]\"\n      )}\n    >\n      <defs>\n        <linearGradient id={`${id}-sky`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n          <stop offset=\"0\" style={{ stopColor: \"var(--sky-1)\" }} />\n          <stop offset=\"1\" style={{ stopColor: \"var(--sky-2)\" }} />\n        </linearGradient>\n        <linearGradient id={`${id}-sun`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n          <stop offset=\"0\" stopColor=\"oklch(0.97 0.05 90)\" />\n          <stop offset=\"1\" stopColor=\"oklch(0.8 0.14 50)\" />\n        </linearGradient>\n        <radialGradient id={`${id}-halo`}>\n          <stop offset=\"0.45\" stopColor=\"oklch(0.85 0.12 60)\" stopOpacity={0.35} />\n          <stop offset=\"1\" stopColor=\"oklch(0.85 0.12 60)\" stopOpacity={0} />\n        </radialGradient>\n        {waves.map((_, i) => (\n          <linearGradient key={i} id={`${id}-wave-${i}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n            <stop offset=\"0\" style={{ stopColor: `color-mix(in oklch, var(--w${i + 1}), white 14%)` }} />\n            <stop offset=\"0.3\" style={{ stopColor: `var(--w${i + 1})` }} />\n            <stop offset=\"1\" style={{ stopColor: `color-mix(in oklch, var(--w${i + 1}), black 45%)` }} />\n          </linearGradient>\n        ))}\n      </defs>\n      <rect width=\"1440\" height=\"900\" fill={`url(#${id}-sky)`} />\n      {/* the sun sets just behind the pane's edge, where the rim bends it */}\n      <circle cx=\"935\" cy=\"300\" r=\"260\" fill={`url(#${id}-halo)`} />\n      <circle cx=\"935\" cy=\"300\" r=\"112\" fill={`url(#${id}-sun)`} />\n      {waves.map((d, i) => (\n        <g key={i}>\n          <path d={d} fill={`url(#${id}-wave-${i})`} />\n          {/* a thin lit crest along the top of each wave */}\n          <path d={d.slice(0, d.indexOf(\"V\"))} fill=\"none\" stroke=\"white\" strokeOpacity={0.28} strokeWidth={1.5} />\n        </g>\n      ))}\n    </svg>\n  )\n}\n\nconst well =\n  \"h-11 rounded-[14px] border-foreground/12 bg-foreground/[0.06] shadow-[inset_0_1px_2px_oklch(0_0_0/18%)] focus-within:border-foreground/30 focus-within:ring-foreground/10\"\n\nconst quiet =\n  \"inline-flex h-11 cursor-pointer items-center justify-center gap-2 rounded-full border border-foreground/12 bg-foreground/[0.06] text-[13px] font-medium shadow-[inset_0_1px_0_oklch(1_0_0/18%)] transition-[background-color,scale] duration-150 ease-out motion-reduce:transition-none outline-none hover:bg-foreground/[0.1] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground/40 motion-safe:active:scale-[0.98] [&_svg]:size-4\"\n\n// a pane of clear glass over dusk waves; its curved rim bends the crests behind it\nexport function AuthGlass({ onSubmit, onProvider, background, className }: AuthGlassProps) {\n  const reduceMotion = useReducedMotion()\n  const { status, error, run } = useSubmit(onSubmit)\n  const [errors, setErrors] = React.useState<{ email?: string; password?: string }>({})\n\n  function handleSubmit(event: React.FormEvent<HTMLFormElement>) {\n    event.preventDefault()\n    const data = new FormData(event.currentTarget)\n    const email = String(data.get(\"email\") ?? \"\")\n    const password = String(data.get(\"password\") ?? \"\")\n    const next = {\n      email: checkEmail(email),\n      password: password ? undefined : \"Enter your password.\",\n    }\n    setErrors(next)\n    if (next.email || next.password) return\n    run({ email: email.trim(), password })\n  }\n\n  const swap = {\n    initial: reduceMotion ? { opacity: 0 } : { opacity: 0, scale: 0.97, filter: \"blur(4px)\" },\n    animate: { opacity: 1, scale: 1, filter: \"blur(0px)\" },\n    exit: { opacity: 0, transition: { duration: 0.12 } },\n    transition: { duration: 0.3, ease: [0.22, 1, 0.36, 1] as const },\n  }\n\n  return (\n    <div\n      className={cn(\n        \"relative isolate flex min-h-[44rem] w-full items-center justify-center overflow-hidden px-6 py-16 text-foreground\",\n        className\n      )}\n    >\n      {background ?? <Waves />}\n\n      <LiquidGlass\n        className=\"w-full max-w-[22rem] rounded-[30px] p-8\"\n        bezel={30}\n        frost={4}\n        tint=\"color-mix(in oklch, var(--background) 55%, transparent)\"\n      >\n        <AnimatePresence mode=\"wait\" initial={false}>\n          {status === \"done\" ? (\n            <motion.div key=\"done\" className=\"flex flex-col items-center py-16 text-center\" {...swap}>\n              <span className=\"grid size-12 place-items-center rounded-full bg-foreground text-background shadow-[0_8px_20px_-8px_oklch(0_0_0/50%)]\">\n                <Check animate aria-hidden className=\"size-5\" strokeWidth={2.5} />\n              </span>\n              <p className=\"mt-5 text-[22px] font-medium tracking-[-0.02em]\">You&rsquo;re in</p>\n              <p className=\"mt-1.5 text-[13px] text-foreground/65\">Opening your workspace…</p>\n            </motion.div>\n          ) : (\n            <motion.div key=\"form\" className=\"flex flex-col\" {...swap}>\n              <div className=\"flex flex-col items-center text-center\">\n                <span className=\"grid size-12 place-items-center rounded-[16px] border border-foreground/12 bg-foreground/[0.07] shadow-[inset_0_1px_0_oklch(1_0_0/25%),0_8px_20px_-10px_oklch(0_0_0/40%)] [&_svg]:size-6\">\n                  <AfterglowMark />\n                </span>\n                <h1 className=\"mt-5 text-[22px] font-medium tracking-[-0.02em]\">Sign in to Afterglow</h1>\n                <p className=\"mt-1.5 text-[13px] text-foreground/65\">Welcome back. Pick up where you left off.</p>\n              </div>\n\n              <div className=\"mt-7 grid grid-cols-2 gap-2.5\">\n                <button type=\"button\" className={quiet} onClick={() => onProvider?.(\"google\")}>\n                  <GoogleMark />\n                  Google\n                </button>\n                <button type=\"button\" className={quiet} onClick={() => onProvider?.(\"github\")}>\n                  <GitHubMark />\n                  GitHub\n                </button>\n              </div>\n\n              <div className=\"my-6 flex items-center gap-3 text-xs text-foreground/50\">\n                <span className=\"h-px flex-1 bg-foreground/12\" />\n                or\n                <span className=\"h-px flex-1 bg-foreground/12\" />\n              </div>\n\n              <form noValidate onSubmit={handleSubmit} className=\"flex flex-col gap-4\">\n                <Field\n                  label=\"Email\"\n                  name=\"email\"\n                  type=\"email\"\n                  autoComplete=\"email\"\n                  placeholder=\"you@company.com\"\n                  error={errors.email}\n                  boxClassName={well}\n                  labelClassName=\"text-[13px] font-normal text-foreground/70\"\n                />\n                <Field\n                  label=\"Password\"\n                  name=\"password\"\n                  type=\"password\"\n                  autoComplete=\"current-password\"\n                  error={errors.password}\n                  boxClassName={well}\n                  labelClassName=\"text-[13px] font-normal text-foreground/70\"\n                  aside={\n                    <a href=\"#\" className=\"text-xs text-foreground/60 transition-colors duration-150 hover:text-foreground\">\n                      Forgot?\n                    </a>\n                  }\n                />\n                {error && (\n                  <p role=\"alert\" className=\"text-center text-xs text-foreground/80\">\n                    {error}\n                  </p>\n                )}\n                <button\n                  type=\"submit\"\n                  disabled={status === \"loading\"}\n                  className=\"mt-1 h-11 cursor-pointer rounded-full bg-foreground text-sm font-medium text-background shadow-[0_10px_24px_-10px_oklch(0_0_0/55%),inset_0_1px_0_oklch(1_0_0/20%)] transition-[scale] duration-150 ease-out motion-reduce:transition-none outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground/50 motion-safe:enabled:active:scale-[0.98]\"\n                >\n                  <SubmitLabel loading={status === \"loading\"}>Sign in</SubmitLabel>\n                </button>\n              </form>\n\n              <p className=\"mt-6 text-center text-[13px] text-foreground/65\">\n                New here?{\" \"}\n                <a href=\"#\" className=\"text-foreground transition-opacity duration-150 hover:opacity-80\">\n                  Create an account\n                </a>\n              </p>\n            </motion.div>\n          )}\n        </AnimatePresence>\n      </LiquidGlass>\n    </div>\n  )\n}\n",
      "type": "registry:block",
      "target": "components/blocks/auth-glass.tsx"
    },
    {
      "path": "components/ui/liquid-glass.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport {\n  isMotionValue,\n  motion,\n  useMotionValue,\n  useTransform,\n  type MotionValue,\n} from \"motion/react\"\n\nimport { ringMask } from \"@/lib/afterglow\"\nimport { cn } from \"@/lib/utils\"\n\n/*\n * Liquid glass: a pane that bends whatever sits behind it, like Apple's\n * Liquid Glass. The rim is a curved lens, so content near the edges is\n * pulled inward, while the flat middle stays clear.\n *\n * Refraction is an SVG displacement map used as a backdrop-filter, which only\n * Chromium supports. Other browsers get a frosted fallback with the same rim.\n */\n\nconst SAMPLES = 128\nconst INDEX_OF_REFRACTION = 1.5\n\n// convex squircle: flat in the middle, rounding off toward the rim\nconst surface = (x: number) => Math.pow(1 - Math.pow(1 - x, 4), 0.25)\n\n// how far a straight-down ray is bent sideways at each point across the rim\nfunction rimProfile(bezel: number) {\n  const profile = new Float32Array(SAMPLES)\n  for (let i = 0; i < SAMPLES; i++) {\n    const x = i / (SAMPLES - 1)\n    const a = Math.max(x - 0.001, 0)\n    const b = Math.min(x + 0.001, 1)\n    const slope = (surface(b) - surface(a)) / (b - a)\n    const incident = Math.atan(slope)\n    const refracted = Math.asin(Math.sin(incident) / INDEX_OF_REFRACTION)\n    const thickness = bezel * (0.25 + surface(x))\n    profile[i] = thickness * Math.tan(incident - refracted)\n  }\n  return profile\n}\n\ntype DisplacementMap = { url: string; scale: number }\nconst maps = new Map<string, DisplacementMap>()\n\nfunction displacementMap(\n  width: number,\n  height: number,\n  radius: number,\n  bezel: number,\n  magnify: number\n): DisplacementMap {\n  const key = [width, height, radius, bezel, magnify].join(\":\")\n  const cached = maps.get(key)\n  if (cached) return cached\n\n  const profile = rimProfile(bezel)\n  const dx = new Float32Array(width * height)\n  const dy = new Float32Array(width * height)\n  let max = 0\n\n  for (let j = 0; j < height; j++) {\n    for (let i = 0; i < width; i++) {\n      // signed distance to a rounded rectangle, and the outward normal\n      const px = i + 0.5 - width / 2\n      const py = j + 0.5 - height / 2\n      const qx = Math.abs(px) - width / 2 + radius\n      const qy = Math.abs(py) - height / 2 + radius\n      const inside =\n        -(Math.hypot(Math.max(qx, 0), Math.max(qy, 0)) +\n          Math.min(Math.max(qx, qy), 0) -\n          radius)\n      let nx = 0\n      let ny = 0\n      if (qx > 0 && qy > 0) {\n        const length = Math.hypot(qx, qy) || 1\n        nx = (qx / length) * Math.sign(px)\n        ny = (qy / length) * Math.sign(py)\n      } else if (qx > qy) nx = Math.sign(px)\n      else ny = Math.sign(py)\n\n      let x = -px * magnify\n      let y = -py * magnify\n      if (inside >= 0 && inside < bezel) {\n        // sample inward, so the rim shows what's just inside the edge\n        const shift = profile[Math.round((inside / bezel) * (SAMPLES - 1))]\n        x -= nx * shift\n        y -= ny * shift\n      }\n      const k = j * width + i\n      dx[k] = x\n      dy[k] = y\n      max = Math.max(max, Math.abs(x), Math.abs(y))\n    }\n  }\n\n  const canvas = document.createElement(\"canvas\")\n  canvas.width = width\n  canvas.height = height\n  const context = canvas.getContext(\"2d\")\n  if (!context) return { url: \"\", scale: 0 }\n  const image = context.createImageData(width, height)\n  for (let k = 0; k < width * height; k++) {\n    // 128 is \"no shift\"; red moves along x, green along y\n    image.data[k * 4] = 128 + (dx[k] / (max || 1)) * 127\n    image.data[k * 4 + 1] = 128 + (dy[k] / (max || 1)) * 127\n    image.data[k * 4 + 2] = 128\n    image.data[k * 4 + 3] = 255\n  }\n  context.putImageData(image, 0, 0)\n\n  const map = { url: canvas.toDataURL(), scale: max * 2 }\n  if (maps.size > 48) maps.delete(maps.keys().next().value!)\n  maps.set(key, map)\n  return map\n}\n\n// only Chromium can use an SVG filter as a backdrop-filter\nfunction canRefract() {\n  const nav = navigator as Navigator & {\n    userAgentData?: { brands: { brand: string }[] }\n  }\n  if (nav.userAgentData) {\n    return nav.userAgentData.brands.some((b) => b.brand === \"Chromium\")\n  }\n  return /Chrome\\/\\d+/.test(nav.userAgent) && !/Firefox|FxiOS/.test(nav.userAgent)\n}\n\nconst noopSubscribe = () => () => {}\n\nfunction useCanRefract() {\n  return React.useSyncExternalStore(noopSubscribe, canRefract, () => false)\n}\n\ntype LiquidGlassProps = React.ComponentProps<\"div\"> & {\n  /** width of the curved rim in px, defaults to the corner radius (max 24) */\n  bezel?: number\n  /** 0 is flat glass, 1 is the full lens; pass a motion value to animate it */\n  refraction?: number | MotionValue<number>\n  /** zooms the middle like a magnifier, 0 to 0.3 */\n  magnify?: number\n  /** blur behind the glass in px */\n  frost?: number\n  /** a color mixed over the glass, e.g. for a tinted primary button */\n  tint?: string\n  /**\n   * fades the whole pane in and out. Never fade a parent of liquid glass\n   * instead: an ancestor with opacity cuts the glass off from what's behind it.\n   */\n  presence?: number | MotionValue<number>\n}\n\nfunction LiquidGlass({\n  bezel,\n  refraction = 1,\n  magnify = 0,\n  frost = 1,\n  tint,\n  presence = 1,\n  className,\n  children,\n  ...props\n}: LiquidGlassProps) {\n  const ref = React.useRef<HTMLDivElement>(null)\n  const displaceRef = React.useRef<SVGFEDisplacementMapElement>(null)\n  const id = `liquid-${React.useId().replace(/[^a-zA-Z0-9_-]/g, \"\")}`\n  const canRefractHere = useCanRefract()\n  // A fixed zero opts out of SVG backdrop sampling entirely. Native frosting avoids\n  // clipped-backdrop seams when flat panes overlap and change stacking order.\n  // Motion values still keep the map ready so they can animate away from zero.\n  const refract = canRefractHere && (typeof refraction !== \"number\" || refraction > 0)\n  const [shape, setShape] = React.useState<{ w: number; h: number; r: number }>()\n  // the scale last written to the filter, so a no-op resize can put it back\n  const applied = React.useRef(0)\n\n  React.useEffect(() => {\n    const node = ref.current\n    if (!node || !refract) return\n    const measure = () => {\n      const w = Math.round(node.offsetWidth)\n      const h = Math.round(node.offsetHeight)\n      const raw = getComputedStyle(node).borderTopLeftRadius\n      const value = parseFloat(raw) || 0\n      const r = Math.round(\n        Math.min(raw.endsWith(\"%\") ? (value / 100) * Math.min(w, h) : value, w / 2, h / 2)\n      )\n      setShape((prev) => {\n        if (prev?.w === w && prev.h === h && prev.r === r) {\n          displaceRef.current?.setAttribute(\"scale\", String(applied.current))\n          return prev\n        }\n        return { w, h, r }\n      })\n    }\n    // measure right away, then wait for resizing to settle before rebuilding the map\n    let first = true\n    let frame = 0\n    let timer = 0\n    const observer = new ResizeObserver(() => {\n      if (first) {\n        first = false\n        measure()\n        return\n      }\n      // until the new map is ready, the old one would bend the wrong pixels\n      displaceRef.current?.setAttribute(\"scale\", \"0\")\n      window.clearTimeout(timer)\n      timer = window.setTimeout(() => {\n        frame = requestAnimationFrame(measure)\n      }, 100)\n    })\n    observer.observe(node)\n    return () => {\n      observer.disconnect()\n      window.clearTimeout(timer)\n      cancelAnimationFrame(frame)\n    }\n  }, [refract])\n\n  const map = React.useMemo(() => {\n    if (!refract || !shape || shape.w < 2 || shape.h < 2) return undefined\n    const rim = Math.max(1, Math.min(bezel ?? Math.min(shape.r, 24), shape.w / 2, shape.h / 2))\n    return displacementMap(shape.w, shape.h, shape.r, Math.round(rim), magnify)\n  }, [bezel, magnify, refract, shape])\n\n  // animate refraction by scaling the filter, without rebuilding the map\n  React.useEffect(() => {\n    if (!map) return\n    const apply = (v: number) => {\n      applied.current = map.scale * v\n      displaceRef.current?.setAttribute(\"scale\", String(applied.current))\n    }\n    if (typeof refraction === \"number\") {\n      apply(refraction)\n      return\n    }\n    apply(refraction.get())\n    return refraction.on(\"change\", apply)\n  }, [map, refraction])\n\n  const ownPresence = useMotionValue(isMotionValue(presence) ? 1 : presence)\n  const visible = isMotionValue(presence) ? presence : ownPresence\n  React.useEffect(() => {\n    if (!isMotionValue(presence)) ownPresence.set(presence)\n  }, [ownPresence, presence])\n  const rimOpacity = useTransform(visible, (v) => v * 0.95)\n\n  const strength = isMotionValue(refraction) ? refraction.get() : refraction\n  const backdrop = map\n    ? `url(#${id})`\n    : `blur(${Math.max(frost, 10)}px) saturate(1.6)`\n\n  return (\n    <div\n      ref={ref}\n      data-slot=\"liquid-glass\"\n      // no isolation here: an isolated parent cuts the glass off from the scene\n      // behind it in Chrome. Layers stack in source order, and direct children\n      // are made relative so they sit on top (wrap an absolute child to keep it).\n      className={cn(\"relative [&>:where(:not([data-glass-layer]))]:relative\", className)}\n      {...props}\n    >\n      {map && (\n        <svg data-glass-layer aria-hidden width=\"0\" height=\"0\" className=\"pointer-events-none absolute\">\n          <filter id={id} colorInterpolationFilters=\"sRGB\">\n            <feGaussianBlur in=\"SourceGraphic\" stdDeviation={frost} result=\"frost\" />\n            <feImage\n              href={map.url}\n              x=\"0\"\n              y=\"0\"\n              width={shape?.w}\n              height={shape?.h}\n              preserveAspectRatio=\"none\"\n              result=\"map\"\n            />\n            <feDisplacementMap\n              ref={displaceRef}\n              in=\"frost\"\n              in2=\"map\"\n              scale={map.scale * strength}\n              xChannelSelector=\"R\"\n              yChannelSelector=\"G\"\n              result=\"bent\"\n            />\n            {/* glass makes what's behind it a little brighter and more vivid */}\n            <feColorMatrix in=\"bent\" type=\"saturate\" values=\"1.45\" result=\"vivid\" />\n            <feComponentTransfer in=\"vivid\">\n              <feFuncR type=\"linear\" slope=\"1.05\" />\n              <feFuncG type=\"linear\" slope=\"1.05\" />\n              <feFuncB type=\"linear\" slope=\"1.05\" />\n            </feComponentTransfer>\n          </filter>\n        </svg>\n      )}\n      <motion.div\n        data-glass-layer\n        aria-hidden\n        className=\"pointer-events-none absolute inset-0 rounded-[inherit] shadow-[0_10px_30px_-10px_var(--liquid-shadow),0_2px_8px_-2px_var(--liquid-shadow)]\"\n        style={{ opacity: visible }}\n      />\n      <motion.div\n        data-glass-layer\n        aria-hidden\n        className=\"pointer-events-none absolute inset-0 rounded-[inherit]\"\n        style={{\n          backdropFilter: backdrop,\n          WebkitBackdropFilter: backdrop,\n          opacity: visible,\n        }}\n      />\n      {/* tint, heavier when there's no refraction so text stays legible */}\n      <motion.div\n        data-glass-layer\n        aria-hidden\n        className={cn(\n          \"pointer-events-none absolute inset-0 rounded-[inherit] bg-(--liquid-tint)\",\n          !map && \"bg-(--liquid-fallback)\"\n        )}\n        style={tint ? { background: tint, opacity: visible } : { opacity: visible }}\n      />\n      {/* volume: light gathers inside the top edge, shade settles along the bottom */}\n      <motion.div\n        data-glass-layer\n        aria-hidden\n        className=\"pointer-events-none absolute inset-0 rounded-[inherit] shadow-[inset_0_1px_16px_-4px_var(--liquid-glow),inset_0_-12px_20px_-14px_var(--liquid-shade)]\"\n        style={{ opacity: visible }}\n      />\n      {/* rim light: bright where the light comes from (top left), softer opposite */}\n      <motion.div\n        data-glass-layer\n        aria-hidden\n        className=\"pointer-events-none absolute inset-0 rounded-[inherit] shadow-[inset_0_0_0_0.5px_var(--liquid-edge),inset_1px_1.5px_1px_-1px_var(--liquid-rim),inset_-1px_-1.5px_1px_-1px_color-mix(in_oklch,var(--liquid-rim)_45%,transparent)]\"\n        style={{ opacity: visible }}\n      />\n      <motion.div\n        data-glass-layer\n        aria-hidden\n        className=\"pointer-events-none absolute inset-0 rounded-[inherit] p-px\"\n        style={{\n          ...ringMask,\n          background:\n            \"conic-gradient(from 300deg, var(--liquid-rim), transparent 70deg, transparent 110deg, color-mix(in oklch, var(--liquid-rim) 55%, transparent) 180deg, transparent 250deg, transparent 290deg, var(--liquid-rim))\",\n          opacity: rimOpacity,\n        }}\n      />\n      {children}\n    </div>\n  )\n}\n\nexport { LiquidGlass, useCanRefract, type LiquidGlassProps }\n",
      "type": "registry:ui"
    },
    {
      "path": "components/ui/auth-parts.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Eye, EyeOff, KeyRound } from \"lucide-react\"\nimport { AnimateIcon } from \"@/components/animate-ui/icons/icon\"\nimport { Fingerprint } from \"@/components/animate-ui/icons/fingerprint\"\nimport { LoaderCircle as Loader2 } from \"@/components/animate-ui/icons/loader-circle\"\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\"\n\nimport { cn } from \"@/lib/utils\"\n\n/* Shared pieces for the auth blocks: brand marks, provider buttons, fields,\n   a divider and a small hook that runs a submit with loading and error states. */\n\nfunction GoogleMark({ mono = false, ...props }: React.ComponentProps<\"svg\"> & { mono?: boolean }) {\n  // mono draws the G in the current text color, for quiet monochrome buttons\n  const fill = (color: string) => (mono ? \"currentColor\" : color)\n  return (\n    <svg viewBox=\"0 0 24 24\" aria-hidden {...props}>\n      <path fill={fill(\"#4285F4\")} d=\"M23.5 12.27c0-.85-.08-1.67-.22-2.45H12v4.64h6.45a5.52 5.52 0 0 1-2.4 3.62v3h3.88c2.27-2.09 3.57-5.17 3.57-8.81Z\" />\n      <path fill={fill(\"#34A853\")} d=\"M12 24c3.24 0 5.96-1.07 7.94-2.92l-3.88-3c-1.07.72-2.45 1.15-4.06 1.15-3.12 0-5.77-2.11-6.71-4.95H1.28v3.1A12 12 0 0 0 12 24Z\" />\n      <path fill={fill(\"#FBBC05\")} d=\"M5.29 14.28a7.2 7.2 0 0 1 0-4.56v-3.1H1.28a12 12 0 0 0 0 10.76l4.01-3.1Z\" />\n      <path fill={fill(\"#EA4335\")} d=\"M12 4.77c1.76 0 3.34.61 4.59 1.8l3.44-3.44A11.97 11.97 0 0 0 12 0 12 12 0 0 0 1.28 6.62l4.01 3.1C6.23 6.88 8.88 4.77 12 4.77Z\" />\n    </svg>\n  )\n}\n\n// the afterglow mark: a sun setting on the horizon, centered in its 24px box\nfunction AfterglowMark(props: React.ComponentProps<\"svg\">) {\n  return (\n    <svg viewBox=\"0 0 24 24\" aria-hidden {...props}>\n      <path d=\"M5.5 11a6.5 6.5 0 0 1 13 0Z\" fill=\"currentColor\" />\n      <path d=\"M3 14h18M7 18h10\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" />\n    </svg>\n  )\n}\n\nfunction GitHubMark(props: React.ComponentProps<\"svg\">) {\n  return (\n    <svg viewBox=\"0 0 16 16\" aria-hidden fill=\"currentColor\" {...props}>\n      <path d=\"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8Z\" />\n    </svg>\n  )\n}\n\nconst providers = {\n  google: { label: \"Google\", icon: <GoogleMark /> },\n  github: { label: \"GitHub\", icon: <GitHubMark /> },\n  sso: { label: \"SSO\", icon: <KeyRound /> },\n  passkey: { label: \"passkey\", icon: <Fingerprint aria-hidden /> },\n}\n\ntype Provider = keyof typeof providers\n\ntype ProviderButtonProps = Omit<React.ComponentProps<\"button\">, \"children\"> & {\n  provider: Provider\n  /** \"Continue with\", \"Log in with\"… */\n  verb?: string\n  /** a small \"Last used\" badge in the corner */\n  lastUsed?: boolean\n}\n\nfunction ProviderButton({\n  provider,\n  verb = \"Continue with\",\n  lastUsed,\n  className,\n  type = \"button\",\n  ...props\n}: ProviderButtonProps) {\n  const { label, icon } = providers[provider]\n  return (\n    <AnimateIcon animateOnHover asChild>\n      <button\n        type={type}\n        className={cn(\n          \"relative inline-flex h-10 w-full cursor-pointer items-center justify-center gap-2.5 rounded-lg border bg-background/60 px-4 text-sm font-medium transition-[background-color,scale] duration-150 ease-out motion-reduce:transition-none outline-none hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring motion-safe:enabled:active:scale-[0.98] disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0\",\n          className\n        )}\n        {...props}\n      >\n        {icon}\n        <span>{verb ? `${verb} ${label}` : label}</span>\n        {lastUsed && (\n          <span className=\"absolute -top-2 right-2 rounded-full border bg-card px-1.5 py-px text-[10px] font-medium text-muted-foreground\">\n            Last used\n          </span>\n        )}\n      </button>\n    </AnimateIcon>\n  )\n}\n\nfunction Divider({ children = \"or\", className }: { children?: React.ReactNode; className?: string }) {\n  return (\n    <div className={cn(\"flex items-center gap-3 text-xs text-muted-foreground\", className)}>\n      <span className=\"h-px flex-1 bg-border\" />\n      {children}\n      <span className=\"h-px flex-1 bg-border\" />\n    </div>\n  )\n}\n\ntype FieldProps = Omit<React.ComponentProps<\"input\">, \"size\"> & {\n  label: string\n  /** shown under the field and announced by screen readers */\n  error?: string\n  /** a link or action placed at the end of the label row, e.g. \"Forgot?\" */\n  aside?: React.ReactNode\n  /** classes for the input's box, so each theme can style it */\n  boxClassName?: string\n  labelClassName?: string\n}\n\nfunction Field({\n  label,\n  error,\n  aside,\n  type = \"text\",\n  className,\n  boxClassName,\n  labelClassName,\n  id,\n  ...props\n}: FieldProps) {\n  const autoId = React.useId()\n  const inputId = id ?? autoId\n  const errorId = `${inputId}-error`\n  const [reveal, setReveal] = React.useState(false)\n  const password = type === \"password\"\n\n  return (\n    <div className={cn(\"flex flex-col gap-1.5\", className)}>\n      <div className=\"flex items-center justify-between\">\n        <label htmlFor={inputId} className={cn(\"text-sm font-medium\", labelClassName)}>\n          {label}\n        </label>\n        {aside}\n      </div>\n      <div\n        className={cn(\n          \"flex h-10 items-center rounded-lg border bg-background/60 px-3 transition-[border-color,box-shadow] duration-150 focus-within:border-foreground/40 focus-within:ring-3 focus-within:ring-foreground/10\",\n          error && \"border-glow-2/70 focus-within:border-glow-2 focus-within:ring-glow-2/15\",\n          boxClassName\n        )}\n      >\n        <input\n          id={inputId}\n          type={password && reveal ? \"text\" : type}\n          aria-invalid={error ? true : undefined}\n          aria-describedby={error ? errorId : undefined}\n          className=\"h-full min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground/70\"\n          {...props}\n        />\n        {password && (\n          <button\n            type=\"button\"\n            aria-label={reveal ? \"Hide password\" : \"Show password\"}\n            aria-pressed={reveal}\n            onClick={() => setReveal((v) => !v)}\n            className=\"-mr-1 grid size-7 cursor-pointer place-items-center rounded-md text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/60 [&_svg]:size-4\"\n          >\n            {reveal ? <EyeOff /> : <Eye />}\n          </button>\n        )}\n      </div>\n      <AnimatePresence initial={false}>\n        {error && (\n          <motion.p\n            id={errorId}\n            className=\"text-xs text-glow-2\"\n            initial={{ opacity: 0, height: 0 }}\n            animate={{ opacity: 1, height: \"auto\" }}\n            exit={{ opacity: 0, height: 0 }}\n            transition={{ duration: 0.15 }}\n          >\n            {error}\n          </motion.p>\n        )}\n      </AnimatePresence>\n    </div>\n  )\n}\n\ntype Status = \"idle\" | \"loading\" | \"done\"\n\n/**\n * Runs an async submit with loading and error states. The block calls\n * `run(values)`; your `onSubmit` does the real work and throws to show an error.\n */\nfunction useSubmit<T>(onSubmit?: (values: T) => Promise<void> | void) {\n  const [status, setStatus] = React.useState<Status>(\"idle\")\n  const [error, setError] = React.useState<string>()\n\n  async function run(values: T) {\n    setError(undefined)\n    setStatus(\"loading\")\n    try {\n      await onSubmit?.(values)\n      setStatus(\"done\")\n    } catch (reason) {\n      setError(reason instanceof Error ? reason.message : \"Something went wrong. Try again.\")\n      setStatus(\"idle\")\n    }\n  }\n\n  return { status, error, setError, run, reset: () => setStatus(\"idle\") }\n}\n\n// a label that swaps to a spinner while the form is busy\nfunction SubmitLabel({ loading, children }: { loading: boolean; children: React.ReactNode }) {\n  const reduceMotion = useReducedMotion()\n  return (\n    <span className=\"grid place-items-center\">\n      <AnimatePresence initial={false} mode=\"popLayout\">\n        <motion.span\n          key={loading ? \"loading\" : \"label\"}\n          className=\"col-start-1 row-start-1 inline-flex items-center gap-2\"\n          initial={reduceMotion ? { opacity: 0 } : { opacity: 0, scale: 0.25, filter: \"blur(4px)\" }}\n          animate={{ opacity: 1, scale: 1, filter: \"blur(0px)\" }}\n          exit={reduceMotion ? { opacity: 0 } : { opacity: 0, scale: 0.25, filter: \"blur(4px)\" }}\n          transition={{ type: \"spring\", duration: 0.3, bounce: 0 }}\n        >\n          {loading ? <Loader2 className=\"size-4 animate-spin\" aria-label=\"Loading\" /> : children}\n        </motion.span>\n      </AnimatePresence>\n    </span>\n  )\n}\n\nconst EMAIL = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/\n\nfunction checkEmail(value: string) {\n  if (!value.trim()) return \"Enter your email address.\"\n  if (!EMAIL.test(value.trim())) return \"That doesn't look like an email address.\"\n  return undefined\n}\n\nexport {\n  AfterglowMark,\n  Divider,\n  Field,\n  GitHubMark,\n  GoogleMark,\n  ProviderButton,\n  SubmitLabel,\n  checkEmail,\n  useSubmit,\n  type FieldProps,\n  type Provider,\n  type ProviderButtonProps,\n}\n",
      "type": "registry:ui"
    },
    {
      "path": "lib/afterglow.ts",
      "content": "import type { CSSProperties } from \"react\"\nimport type { TargetAndTransition, Transition } from \"motion/react\"\n\n// shared spring presets, every component picks from these\nexport const springs = {\n  snappy: { stiffness: 520, damping: 34, mass: 0.6 },\n  soft: { stiffness: 260, damping: 26, mass: 0.8 },\n  glide: { stiffness: 120, damping: 20, mass: 1 },\n} as const\n\nexport type SpringName = keyof typeof springs\n\nexport function spring(name: SpringName): Transition {\n  return { type: \"spring\", ...springs[name] }\n}\n\n// how a glow fades once its source moves away: slow, with a long tail\nexport const afterglow = {\n  linger: 0.9,\n  ease: [0.22, 1, 0.36, 1],\n} as const satisfies { linger: number; ease: Transition[\"ease\"] }\n\n// paints only the padding ring of an element, used for glowing borders\nexport const ringMask: CSSProperties = {\n  WebkitMask:\n    \"linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)\",\n  WebkitMaskComposite: \"xor\",\n  mask: \"linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)\",\n  maskComposite: \"exclude\",\n}\n\n// small icon gestures, played when a control is pressed or selected\nexport const iconGestures = {\n  pop: { scale: [1, 1.2, 1] },\n  ring: { rotate: [0, -18, 14, -9, 4, 0], scale: [1, 1.12, 1] },\n  // a gear looks the same after half a turn, so it can rest there and snap back unseen\n  turn: { rotate: [0, 180], scale: [1, 1.12, 1] },\n  hop: { y: [0, -3, 0], scale: [1, 1.1, 1] },\n  nudge: { x: [0, 2.5, 0], scale: [1, 1.1, 1] },\n} satisfies Record<string, TargetAndTransition>\n\nexport type IconGesture = keyof typeof iconGestures\n\n// leaving a gesture is instant: every gesture already ends at, or looks like, its resting pose\nexport const iconRest: TargetAndTransition = { scale: 1, rotate: 0, x: 0, y: 0, transition: { duration: 0 } }\n",
      "type": "registry:lib"
    }
  ],
  "cssVars": {
    "theme": {
      "color-glow": "var(--glow)",
      "color-glow-foreground": "var(--glow-foreground)",
      "color-glow-2": "var(--glow-2)",
      "color-glow-3": "var(--glow-3)",
      "color-glass": "var(--glass)",
      "color-gloss-highlight": "var(--gloss-highlight)",
      "shadow-gloss": "inset 0 1px 0 0 var(--gloss-highlight), inset 0 -1px 0 0 var(--gloss-shade), 0 0 0 1px var(--gloss-edge), 0 1px 2px 0 var(--gloss-depth), 0 4px 12px -4px var(--gloss-depth)",
      "shadow-glass": "inset 0 1px 0 0 var(--gloss-highlight), inset 0 -10px 24px -18px var(--gloss-shade), inset 0 0 0 1px var(--gloss-edge), 0 2px 6px -1px var(--gloss-depth), 0 18px 40px -12px var(--gloss-depth)",
      "shadow-well": "inset 0 1px 3px 0 var(--gloss-depth), inset 0 0 0 1px var(--gloss-edge), 0 1px 0 0 var(--gloss-highlight)"
    },
    "light": {
      "glow": "oklch(0.7 0.19 45)",
      "glow-foreground": "oklch(0.22 0.05 40)",
      "glow-2": "oklch(0.64 0.22 12)",
      "glow-3": "oklch(0.56 0.21 300)",
      "glass": "oklch(1 0 0 / 55%)",
      "gloss-highlight": "oklch(1 0 0 / 95%)",
      "gloss-shade": "oklch(0.3 0.03 285 / 10%)",
      "gloss-depth": "oklch(0.32 0.03 285 / 20%)",
      "gloss-edge": "oklch(0.22 0.02 285 / 10%)",
      "liquid-tint": "oklch(1 0 0 / 18%)",
      "liquid-fallback": "oklch(1 0 0 / 55%)",
      "liquid-rim": "oklch(1 0 0 / 95%)",
      "liquid-edge": "oklch(0.2 0.02 285 / 10%)",
      "liquid-shadow": "oklch(0.22 0.02 285 / 26%)",
      "liquid-glow": "oklch(1 0 0 / 55%)",
      "liquid-shade": "oklch(0.25 0.03 285 / 14%)"
    },
    "dark": {
      "glow": "oklch(0.8 0.16 55)",
      "glow-foreground": "oklch(0.22 0.05 40)",
      "glow-2": "oklch(0.7 0.2 15)",
      "glow-3": "oklch(0.65 0.2 300)",
      "glass": "oklch(0.19 0 0 / 55%)",
      "gloss-highlight": "oklch(1 0 0 / 16%)",
      "gloss-shade": "oklch(0 0 0 / 30%)",
      "gloss-depth": "oklch(0.04 0 0 / 60%)",
      "gloss-edge": "oklch(1 0 0 / 9%)",
      "liquid-tint": "oklch(0.2 0 0 / 22%)",
      "liquid-fallback": "oklch(0.2 0 0 / 45%)",
      "liquid-rim": "oklch(1 0 0 / 60%)",
      "liquid-edge": "oklch(1 0 0 / 10%)",
      "liquid-shadow": "oklch(0 0 0 / 50%)",
      "liquid-glow": "oklch(1 0 0 / 24%)",
      "liquid-shade": "oklch(0 0 0 / 28%)"
    }
  },
  "type": "registry:block"
}