{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "before-after-hero",
  "type": "registry:block",
  "title": "Before & After Hero",
  "description": "A hero split down the middle: drag the handle and a messy expense spreadsheet turns into a clean, matched ledger row by row, while the headline flips from a week to an afternoon.",
  "categories": [
    "block",
    "Heroes"
  ],
  "dependencies": [
    "lucide-react",
    "motion"
  ],
  "registryDependencies": [
    "utils",
    "https://coss.com/ui/r/button.json"
  ],
  "files": [
    {
      "path": "registry/devl/before-after-hero.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport {\n  ArrowRightIcon,\n  CheckIcon,\n  ChevronsLeftRightIcon,\n  Clock3Icon,\n  CopyMinusIcon,\n  FileSpreadsheetIcon,\n  MailCheckIcon,\n  ReceiptTextIcon,\n  SigmaIcon,\n} from \"lucide-react\";\nimport {\n  type AnimationPlaybackControls,\n  animate,\n  motion,\n  type Transition,\n  useInView,\n  useMotionTemplate,\n  useMotionValue,\n  useMotionValueEvent,\n  useReducedMotion,\n  useTransform,\n} from \"motion/react\";\nimport {\n  type CSSProperties,\n  type KeyboardEvent,\n  type PointerEvent,\n  type ReactNode,\n  useEffect,\n  useRef,\n  useState,\n} from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils\";\n\nfunction useReducedMotionSafe() {\n  const prefers = useReducedMotion();\n  const [mounted, setMounted] = useState(false);\n  useEffect(() => setMounted(true), []);\n  return mounted && Boolean(prefers);\n}\n\nexport type ExpenseCategory = \"Meals\" | \"Travel\" | \"Software\" | \"Shipping\" | \"Office\";\nexport type SheetMark = \"highlight\" | \"error\";\n\nexport interface ExpenseLine {\n  id: string;\n  date: string;\n  merchant: string;\n  spender?: string;\n  category: ExpenseCategory;\n  amount: number;\n  receipt: \"matched\" | \"found\" | \"duplicate\";\n  sheet: {\n    date: string;\n    description: string;\n    category?: string;\n    amount: string;\n    note?: string;\n    marks?: Partial<Record<\"category\" | \"amount\" | \"note\", SheetMark>>;\n  };\n}\n\nexport interface BeforeAfterHeroProps {\n  eyebrow?: string;\n  headline: { lead: string; before: string; after: string };\n  description?: ReactNode;\n  cta: { label: string; href?: string };\n  note?: string;\n  before: { label: string; file: string; editedBy: string; formula: string; status: string; sticky?: string };\n  after: { product: string; title: string; company: string; status: string };\n  lines: ExpenseLine[];\n  currency?: string;\n  defaultPosition?: number;\n  className?: string;\n}\n\ntype Side = \"before\" | \"after\";\n\nconst ease = [0.23, 1, 0.32, 1] as const;\nconst settle: Transition = { type: \"spring\", stiffness: 420, damping: 36 };\nconst chase: Transition = { type: \"spring\", stiffness: 560, damping: 44 };\n\nconst tones: Record<ExpenseCategory, string> = {\n  Meals: \"bg-amber-500/12 text-amber-700 dark:bg-amber-400/12 dark:text-amber-300\",\n  Travel: \"bg-sky-500/12 text-sky-700 dark:bg-sky-400/12 dark:text-sky-300\",\n  Software: \"bg-violet-500/12 text-violet-700 dark:bg-violet-400/14 dark:text-violet-300\",\n  Shipping: \"bg-rose-500/12 text-rose-700 dark:bg-rose-400/12 dark:text-rose-300\",\n  Office: \"bg-emerald-500/12 text-emerald-700 dark:bg-emerald-400/12 dark:text-emerald-300\",\n};\n\nconst columns =\n  \"grid grid-cols-[2rem_minmax(0,1fr)_5.75rem_5.25rem] @2xl/compare:grid-cols-[2.5rem_5rem_minmax(0,1fr)_9rem_7rem_11rem]\";\nconst wideOnly = \"hidden @2xl/compare:flex\";\n\nconst clamp = (value: number) => Math.min(100, Math.max(0, value));\n\nfunction SheetCell({\n  children,\n  mark,\n  selected,\n  className,\n}: {\n  children?: ReactNode;\n  mark?: SheetMark;\n  selected?: boolean;\n  className?: string;\n}) {\n  return (\n    <div\n      className={cn(\n        \"relative flex min-w-0 items-center border-r px-2 last:border-r-0\",\n        mark === \"highlight\" && \"bg-amber-300/35 dark:bg-amber-400/15\",\n        mark === \"error\" && \"bg-destructive/8 text-destructive-foreground\",\n        selected && \"outline-2 -outline-offset-2 outline-info\",\n        className,\n      )}\n    >\n      <span className=\"truncate\">{children}</span>\n      {mark === \"error\" && (\n        <span className=\"absolute top-0 right-0 size-2 bg-destructive [clip-path:polygon(0_0,100%_0,100%_100%)]\" />\n      )}\n    </div>\n  );\n}\n\nfunction SheetLayer({\n  lines,\n  before,\n}: {\n  lines: ExpenseLine[];\n  before: BeforeAfterHeroProps[\"before\"];\n}) {\n  return (\n    <div aria-hidden className=\"relative flex flex-col bg-background text-xs\">\n      <div className=\"flex h-11 shrink-0 items-center gap-2 border-b px-3\">\n        <FileSpreadsheetIcon className=\"size-4 shrink-0 text-muted-foreground\" />\n        <span className=\"truncate font-medium\">{before.file}</span>\n        <span className=\"hidden shrink-0 text-muted-foreground @3xl/compare:inline\">{before.editedBy}</span>\n        <span className=\"ms-2 hidden h-6 min-w-0 flex-1 items-center gap-2 rounded-md border bg-muted/60 px-2 font-mono text-[0.6875rem] @2xl/compare:flex\">\n          <span className=\"text-muted-foreground italic\">fx</span>\n          <span className=\"truncate\">{before.formula}</span>\n        </span>\n        <span className=\"ms-auto flex shrink-0 items-center gap-1.5 font-medium text-warning-foreground\">\n          <Clock3Icon className=\"size-3.5\" />\n          {before.status}\n        </span>\n      </div>\n      <div className={cn(columns, \"h-7 shrink-0 border-b bg-muted font-mono text-[0.625rem] text-muted-foreground\")}>\n        <span className=\"border-r\" />\n        {[\"A\", \"B\", \"C\", \"D\", \"E\"].map((letter) => (\n          <span\n            className={cn(\n              \"items-center justify-center border-r last:border-r-0\",\n              letter === \"A\" || letter === \"E\" ? wideOnly : \"flex\",\n            )}\n            key={letter}\n          >\n            {letter}\n          </span>\n        ))}\n      </div>\n      {lines.map((line, i) => (\n        <div className={cn(columns, \"h-10 shrink-0 border-b\")} key={line.id}>\n          <SheetCell className=\"justify-center bg-muted font-mono text-[0.625rem] text-muted-foreground\">{i + 1}</SheetCell>\n          <SheetCell className={cn(wideOnly, \"font-mono tabular-nums\")}>{line.sheet.date}</SheetCell>\n          <SheetCell className=\"font-mono text-[0.6875rem] uppercase\">{line.sheet.description}</SheetCell>\n          <SheetCell mark={line.sheet.marks?.category}>{line.sheet.category}</SheetCell>\n          <SheetCell className=\"justify-end font-mono tabular-nums\" mark={line.sheet.marks?.amount}>\n            {line.sheet.amount}\n          </SheetCell>\n          <SheetCell className={wideOnly} mark={line.sheet.marks?.note}>\n            {line.sheet.note}\n          </SheetCell>\n        </div>\n      ))}\n      <div className={cn(columns, \"h-10 shrink-0\")}>\n        <SheetCell className=\"justify-center bg-muted font-mono text-[0.625rem] text-muted-foreground\">\n          {lines.length + 1}\n        </SheetCell>\n        <SheetCell className={wideOnly} />\n        <SheetCell className=\"font-mono font-semibold text-[0.6875rem]\">TOTAL</SheetCell>\n        <SheetCell />\n        <SheetCell className=\"justify-end font-mono font-semibold\" mark=\"error\" selected>\n          #REF!\n        </SheetCell>\n        <SheetCell className={wideOnly} mark=\"highlight\">\n          fix before fri!!\n        </SheetCell>\n      </div>\n      {before.sticky && (\n        <div className=\"absolute top-[14.75rem] left-[18.5rem] hidden w-44 -rotate-3 rounded-sm bg-amber-200 p-3 font-medium text-[0.6875rem] text-amber-950 leading-snug shadow-md/10 @4xl/compare:block\">\n          {before.sticky}\n        </div>\n      )}\n    </div>\n  );\n}\n\nfunction LedgerLayer({\n  lines,\n  after,\n  format,\n}: {\n  lines: ExpenseLine[];\n  after: BeforeAfterHeroProps[\"after\"];\n  format: (n: number) => string;\n}) {\n  const kept = lines.filter((line) => line.receipt !== \"duplicate\");\n  const removed = lines.length - kept.length;\n  const total = kept.reduce((sum, line) => sum + line.amount, 0);\n  return (\n    <div\n      aria-hidden\n      className=\"absolute inset-0 flex flex-col bg-card text-xs [clip-path:inset(var(--pos)_0_0_0)] @2xl/compare:[clip-path:inset(0_0_0_var(--pos))]\"\n    >\n      <div className=\"flex h-11 shrink-0 items-center gap-2 border-b px-3\">\n        <span className=\"flex size-5 shrink-0 items-center justify-center rounded-md bg-primary font-semibold text-[0.625rem] text-primary-foreground\">\n          {after.product.charAt(0)}\n        </span>\n        <span className=\"truncate font-medium\">{after.title}</span>\n        <span className=\"hidden truncate text-muted-foreground @2xl/compare:inline\">{after.company}</span>\n        <span className=\"ms-auto flex shrink-0 items-center gap-1.5 font-medium text-success-foreground\">\n          <CheckIcon className=\"size-3.5\" />\n          {after.status}\n        </span>\n      </div>\n      <div className={cn(columns, \"h-7 shrink-0 border-b font-medium text-[0.6875rem] text-muted-foreground\")}>\n        <span />\n        <span className={cn(wideOnly, \"items-center px-2\")}>Date</span>\n        <span className=\"flex items-center px-2\">Merchant</span>\n        <span className=\"flex items-center px-2\">Category</span>\n        <span className=\"flex items-center justify-end px-2\">Amount</span>\n        <span className={cn(wideOnly, \"items-center px-3\")}>Receipt</span>\n      </div>\n      {lines.map((line) => {\n        const duplicate = line.receipt === \"duplicate\";\n        return (\n          <div className={cn(columns, \"h-10 shrink-0 border-b\", duplicate && \"text-muted-foreground\")} key={line.id}>\n            <span className=\"flex items-center justify-center\">\n              {duplicate ? (\n                <CopyMinusIcon className=\"size-3.5\" />\n              ) : (\n                <span className=\"flex size-4 items-center justify-center rounded-full bg-success/16 text-success-foreground\">\n                  <CheckIcon className=\"size-2.5\" strokeWidth={3} />\n                </span>\n              )}\n            </span>\n            <span className={cn(wideOnly, \"items-center px-2 text-muted-foreground tabular-nums\")}>{line.date}</span>\n            <span className=\"flex min-w-0 items-center gap-2 px-2 @3xl/compare:grid @3xl/compare:grid-cols-[1.5rem_minmax(0,17rem)_minmax(0,1fr)]\">\n              <span\n                className={cn(\n                  \"flex size-6 shrink-0 items-center justify-center rounded-md font-semibold text-[0.625rem]\",\n                  duplicate ? \"bg-muted\" : tones[line.category],\n                )}\n              >\n                {line.merchant.charAt(0)}\n              </span>\n              <span className={cn(\"truncate text-[0.8125rem]\", !duplicate && \"font-medium text-foreground\")}>\n                {line.merchant}\n              </span>\n              {line.spender && (\n                <span className=\"hidden truncate text-[0.6875rem] text-muted-foreground @3xl/compare:inline\">\n                  {line.spender}\n                </span>\n              )}\n            </span>\n            <span className=\"flex items-center px-2\">\n              {duplicate ? (\n                <span className=\"text-[0.6875rem]\">Duplicate</span>\n              ) : (\n                <span\n                  className={cn(\n                    \"inline-flex h-5 items-center rounded-full px-2 font-medium text-[0.6875rem]\",\n                    tones[line.category],\n                  )}\n                >\n                  {line.category}\n                </span>\n              )}\n            </span>\n            <span\n              className={cn(\n                \"flex items-center justify-end px-2 text-[0.8125rem] tabular-nums\",\n                duplicate ? \"line-through decoration-muted-foreground/60\" : \"font-medium text-foreground\",\n              )}\n            >\n              {format(line.amount)}\n            </span>\n            <span className={cn(wideOnly, \"items-center gap-1.5 px-3\", !duplicate && \"text-foreground\")}>\n              {line.receipt === \"matched\" && <ReceiptTextIcon className=\"size-3.5 text-success-foreground\" />}\n              {line.receipt === \"found\" && <MailCheckIcon className=\"size-3.5 text-success-foreground\" />}\n              {line.receipt === \"matched\" ? \"Receipt matched\" : line.receipt === \"found\" ? \"Found in inbox\" : \"Merged into row 2\"}\n            </span>\n          </div>\n        );\n      })}\n      <div className={cn(columns, \"h-10 shrink-0\")}>\n        <span className=\"flex items-center justify-center text-muted-foreground\">\n          <SigmaIcon className=\"size-3.5\" />\n        </span>\n        <span className={wideOnly} />\n        <span className=\"flex min-w-0 items-center gap-1.5 px-2\">\n          <span className=\"font-medium text-[0.8125rem]\">Total</span>\n          <span className=\"hidden truncate text-muted-foreground @2xl/compare:inline\">\n            {kept.length} expenses{removed > 0 ? `, ${removed} duplicate removed` : \"\"}\n          </span>\n        </span>\n        <span />\n        <span className=\"flex items-center justify-end px-2 font-semibold text-[0.8125rem] tabular-nums\">{format(total)}</span>\n        <span className={cn(wideOnly, \"items-center px-3\")}>\n          <span className=\"inline-flex h-5 items-center gap-1 rounded-full bg-success/14 px-2 font-medium text-[0.6875rem] text-success-foreground\">\n            <CheckIcon className=\"size-3\" strokeWidth={2.5} />\n            Ready to close\n          </span>\n        </span>\n      </div>\n    </div>\n  );\n}\n\nfunction Ending({ text, active, side, reduce }: { text: string; active: boolean; side: Side; reduce: boolean }) {\n  const away = side === \"before\" ? \"-0.35em\" : \"0.35em\";\n  return (\n    <motion.span\n      animate={\n        active\n          ? { opacity: 1, y: \"0em\", filter: \"blur(0px)\" }\n          : { opacity: 0, y: reduce ? \"0em\" : away, filter: reduce ? \"blur(0px)\" : \"blur(6px)\" }\n      }\n      aria-hidden={!active}\n      className={cn(\n        \"relative col-start-1 row-start-1 justify-self-start\",\n        side === \"before\" &&\n          \"underline decoration-[length:0.05em] decoration-destructive/60 decoration-wavy underline-offset-[0.22em] [text-decoration-skip-ink:none]\",\n      )}\n      initial={false}\n      transition={{ duration: active ? 0.32 : 0.2, ease }}\n    >\n      {text}\n      {side === \"after\" && (\n        <motion.span\n          animate={reduce ? { opacity: active ? 1 : 0, scaleX: 1 } : { opacity: 1, scaleX: active ? 1 : 0 }}\n          className=\"absolute inset-x-0 -bottom-[0.06em] h-[0.07em] origin-left rounded-full bg-success\"\n          initial={false}\n          transition={{ duration: active ? 0.5 : 0.15, ease, delay: active && !reduce ? 0.12 : 0 }}\n        />\n      )}\n    </motion.span>\n  );\n}\n\nexport function BeforeAfterHero({\n  eyebrow,\n  headline,\n  description,\n  cta,\n  note,\n  before,\n  after,\n  lines,\n  currency = \"USD\",\n  defaultPosition = 55,\n  className,\n}: BeforeAfterHeroProps) {\n  const reduce = useReducedMotionSafe();\n  const start = clamp(defaultPosition);\n  const containerRef = useRef<HTMLDivElement>(null);\n  const frameRef = useRef<HTMLDivElement>(null);\n  const knobRef = useRef<HTMLDivElement>(null);\n  const pos = useMotionValue(start);\n  const clamped = useTransform(pos, clamp);\n  const cssPos = useMotionTemplate`${clamped}%`;\n  const [value, setValue] = useState(Math.round(start));\n  const [side, setSide] = useState<Side>(start < 50 ? \"after\" : \"before\");\n  const [vertical, setVertical] = useState(false);\n  const [dragging, setDragging] = useState(false);\n  const [interacted, setInteracted] = useState(false);\n  const [announcement, setAnnouncement] = useState(\"\");\n  const sideRef = useRef<Side>(side);\n  const interactedRef = useRef(false);\n  const targetRef = useRef(start);\n  const motionRef = useRef<AnimationPlaybackControls | null>(null);\n  const hintRef = useRef<AnimationPlaybackControls | null>(null);\n  const dragRef = useRef<{ id: number; offset: number; chasing: boolean } | null>(null);\n  const tapRef = useRef<{ x: number; y: number } | null>(null);\n  const inView = useInView(frameRef, { once: true, amount: 0.6 });\n  const { format } = new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency });\n\n  useMotionValueEvent(clamped, \"change\", (v) => {\n    setValue(Math.round(v));\n    const current = sideRef.current;\n    const next: Side = current === \"before\" ? (v < 49 ? \"after\" : \"before\") : v > 51 ? \"before\" : \"after\";\n    if (next === current) return;\n    sideRef.current = next;\n    setSide(next);\n    if (interactedRef.current) setAnnouncement(`${headline.lead} ${next === \"before\" ? headline.before : headline.after}`);\n  });\n\n  useEffect(() => {\n    const el = containerRef.current;\n    if (!el) return;\n    const check = () => {\n      const rem = Number.parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;\n      setVertical(el.clientWidth < 42 * rem);\n    };\n    check();\n    const observer = new ResizeObserver(check);\n    observer.observe(el);\n    return () => observer.disconnect();\n  }, []);\n\n  useEffect(() => {\n    if (!inView || reduce || interactedRef.current) return;\n    const nudge = start >= 50 ? Math.min(7, 100 - start) : -Math.min(7, start);\n    const timer = window.setTimeout(() => {\n      if (interactedRef.current) return;\n      hintRef.current = animate(pos, [start, start + nudge, start - nudge * 0.18, start], {\n        duration: 1.15,\n        times: [0, 0.42, 0.78, 1],\n        ease: [\"easeInOut\", \"easeOut\", \"easeInOut\"],\n      });\n    }, 650);\n    return () => {\n      window.clearTimeout(timer);\n      hintRef.current?.stop();\n    };\n  }, [inView, reduce, pos, start]);\n\n  const wake = () => {\n    hintRef.current?.stop();\n    if (interactedRef.current) return;\n    interactedRef.current = true;\n    setInteracted(true);\n  };\n\n  const glide = (target: number, transition: Transition) => {\n    motionRef.current?.stop();\n    targetRef.current = target;\n    motionRef.current = animate(pos, target, reduce ? { duration: 0 } : transition);\n    return motionRef.current;\n  };\n\n  const percentAt = (x: number, y: number) => {\n    const rect = frameRef.current?.getBoundingClientRect();\n    if (!rect) return pos.get();\n    return clamp(vertical ? ((y - rect.top) / rect.height) * 100 : ((x - rect.left) / rect.width) * 100);\n  };\n\n  const onPointerDown = (e: PointerEvent<HTMLDivElement>) => {\n    if (e.button !== 0) return;\n    wake();\n    const grabbed = (e.target as HTMLElement).closest(\"[data-grab]\") !== null;\n    if (vertical && e.pointerType !== \"mouse\" && !grabbed) {\n      tapRef.current = { x: e.clientX, y: e.clientY };\n      return;\n    }\n    if (!knobRef.current?.contains(e.target as Node)) e.preventDefault();\n    e.currentTarget.setPointerCapture(e.pointerId);\n    const at = percentAt(e.clientX, e.clientY);\n    if (grabbed) {\n      motionRef.current?.stop();\n      dragRef.current = { id: e.pointerId, offset: at - pos.get(), chasing: false };\n    } else {\n      dragRef.current = { id: e.pointerId, offset: 0, chasing: true };\n      glide(at, chase).finished.then(() => {\n        if (dragRef.current) dragRef.current.chasing = false;\n      });\n    }\n    setDragging(true);\n  };\n\n  const onPointerMove = (e: PointerEvent<HTMLDivElement>) => {\n    const drag = dragRef.current;\n    if (!drag || drag.id !== e.pointerId) return;\n    const target = clamp(percentAt(e.clientX, e.clientY) - drag.offset);\n    if (drag.chasing && !reduce) {\n      glide(target, chase);\n      return;\n    }\n    motionRef.current?.stop();\n    targetRef.current = target;\n    pos.set(target);\n  };\n\n  const onPointerEnd = (e: PointerEvent<HTMLDivElement>) => {\n    const tap = tapRef.current;\n    if (tap) {\n      tapRef.current = null;\n      if (e.type === \"pointerup\" && Math.hypot(e.clientX - tap.x, e.clientY - tap.y) < 10) {\n        glide(percentAt(e.clientX, e.clientY), settle);\n      }\n      return;\n    }\n    const drag = dragRef.current;\n    if (!drag || drag.id !== e.pointerId) return;\n    dragRef.current = null;\n    setDragging(false);\n    const velocity = pos.getVelocity();\n    let target = drag.chasing ? targetRef.current : clamp(pos.get() + velocity * 0.12);\n    if (target < 8) target = 0;\n    else if (target > 92) target = 100;\n    glide(target, { type: \"spring\", stiffness: 300, damping: 20, velocity });\n  };\n\n  const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n    const step = e.shiftKey ? 10 : 5;\n    const page = vertical ? -20 : 20;\n    const moves: Record<string, number> = vertical\n      ? { ArrowUp: -step, ArrowLeft: -step, ArrowDown: step, ArrowRight: step, PageUp: page, PageDown: -page }\n      : { ArrowLeft: -step, ArrowDown: -step, ArrowRight: step, ArrowUp: step, PageUp: page, PageDown: -page };\n    let next: number;\n    if (e.key === \"Home\") next = 0;\n    else if (e.key === \"End\") next = 100;\n    else if (e.key in moves) next = Math.round(targetRef.current) + moves[e.key];\n    else return;\n    e.preventDefault();\n    wake();\n    glide(clamp(next), settle);\n  };\n\n  const beforeLabel = before.label;\n  const afterLabel = after.product;\n\n  return (\n    <section className={cn(\"@container/hero mx-auto w-full max-w-[1100px]\", className)}>\n      <div className=\"grid gap-6 @3xl/hero:grid-cols-[minmax(0,1fr)_minmax(0,21rem)] @3xl/hero:items-end @3xl/hero:gap-12\">\n        <div>\n          {eyebrow && <p className=\"font-medium text-muted-foreground text-sm\">{eyebrow}</p>}\n          <h1 className=\"mt-3 font-heading font-semibold text-[2.5rem] leading-[1.04] tracking-tight @lg/hero:text-5xl @3xl/hero:text-[4rem]\">\n            <span className=\"block\">{headline.lead}</span>\n            <span className=\"grid\">\n              <Ending active={side === \"before\"} reduce={reduce} side=\"before\" text={headline.before} />\n              <Ending active={side === \"after\"} reduce={reduce} side=\"after\" text={headline.after} />\n            </span>\n          </h1>\n          <p aria-live=\"polite\" className=\"sr-only\">\n            {announcement}\n          </p>\n        </div>\n        <div className=\"flex flex-col gap-5 @3xl/hero:pb-2\">\n          {description && (\n            <p className=\"text-pretty text-muted-foreground text-sm leading-relaxed @lg/hero:text-base\">{description}</p>\n          )}\n          <div className=\"flex flex-wrap items-center gap-x-4 gap-y-2\">\n            <Button\n              className=\"transition-[box-shadow,background-color,transform] duration-150 ease-out active:scale-[0.97] motion-reduce:active:scale-100\"\n              render={<a href={cta.href ?? \"#\"} />}\n              size=\"lg\"\n            >\n              {cta.label}\n              <ArrowRightIcon />\n            </Button>\n            {note && <span className=\"text-muted-foreground text-xs\">{note}</span>}\n          </div>\n        </div>\n      </div>\n\n      <div className=\"@container/compare mt-8\" ref={containerRef}>\n        <motion.div\n          className={cn(\n            \"relative cursor-ns-resize touch-auto select-none overflow-hidden rounded-2xl border bg-background shadow-xs/5 @2xl/compare:cursor-ew-resize @2xl/compare:touch-pan-y\",\n            dragging && \"cursor-grabbing @2xl/compare:cursor-grabbing\",\n          )}\n          onPointerCancel={onPointerEnd}\n          onPointerDown={onPointerDown}\n          onPointerMove={onPointerMove}\n          onPointerUp={onPointerEnd}\n          ref={frameRef}\n          style={{ \"--pos\": cssPos } as unknown as CSSProperties}\n        >\n          <SheetLayer before={before} lines={lines} />\n          <LedgerLayer after={after} format={format} lines={lines} />\n\n          <div\n            className=\"absolute inset-x-0 top-(--pos) h-0.5 -translate-y-1/2 touch-none bg-foreground/85 shadow-[0_0_0_1px_var(--background)] before:absolute before:-inset-y-3 before:inset-x-0 @2xl/compare:inset-x-auto @2xl/compare:inset-y-0 @2xl/compare:left-(--pos) @2xl/compare:h-auto @2xl/compare:w-0.5 @2xl/compare:translate-x-[-50%] @2xl/compare:translate-y-0 @2xl/compare:before:-inset-x-3 @2xl/compare:before:inset-y-0\"\n            data-grab\n          />\n\n          <motion.div\n            animate={{ scale: dragging && !reduce ? 1.12 : 1 }}\n            aria-label={`Compare ${beforeLabel.toLowerCase()} with ${afterLabel}`}\n            aria-orientation={vertical ? \"vertical\" : \"horizontal\"}\n            aria-valuemax={100}\n            aria-valuemin={0}\n            aria-valuenow={value}\n            aria-valuetext={`${beforeLabel} ${value}%, ${afterLabel} ${100 - value}%`}\n            className=\"absolute top-[clamp(1.5rem,var(--pos),calc(100%_-_1.5rem))] left-1/2 flex size-11 -translate-x-1/2 -translate-y-1/2 cursor-grab touch-none items-center justify-center rounded-full border border-foreground/20 bg-background text-foreground shadow-md/10 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background pointer-coarse:after:absolute pointer-coarse:after:-inset-1 @2xl/compare:top-1/2 @2xl/compare:left-[clamp(1.5rem,var(--pos),calc(100%_-_1.5rem))]\"\n            data-grab\n            onKeyDown={onKeyDown}\n            ref={knobRef}\n            role=\"slider\"\n            tabIndex={0}\n            transition={dragging ? { type: \"spring\", stiffness: 600, damping: 30 } : { type: \"spring\", stiffness: 520, damping: 14 }}\n          >\n            <ChevronsLeftRightIcon className=\"size-4 rotate-90 @2xl/compare:rotate-0\" />\n          </motion.div>\n\n          <span\n            aria-hidden\n            className={cn(\n              \"pointer-events-none absolute top-[clamp(1.5rem,var(--pos),calc(100%_-_1.5rem))] left-[calc(50%+2rem)] -translate-y-1/2 whitespace-nowrap rounded-full bg-foreground px-2 py-0.5 font-medium text-[0.6875rem] text-background transition-opacity duration-200 @2xl/compare:top-1/2 @2xl/compare:left-[calc(clamp(1.5rem,var(--pos),calc(100%_-_1.5rem))_-_2rem)] @2xl/compare:-translate-x-full\",\n              interacted && \"opacity-0\",\n            )}\n          >\n            Drag to compare\n          </span>\n        </motion.div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}