{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"prompt","title":"Prompt box","description":"A white card on a quiet tray, round keys, and one dark key that speaks or sends. While it answers, the tray slides out from under the card and says what it’s doing.","type":"registry:component","author":"Detent","dependencies":["motion"],"registryDependencies":["https://detentui.com/r/theme.json"],"files":[{"path":"components/detent/components/prompt/PromptBox.tsx","target":"components/detent/components/prompt/PromptBox.tsx","type":"registry:component","content":"'use client'\n\nimport { tap } from '@/components/detent/lib/feel'\nimport { useCallback, useEffect, useId, useImperativeHandle, useLayoutEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\nimport type { CSSProperties, MouseEvent as ReactMouseEvent, ReactNode, Ref } from 'react'\nimport { AnimatePresence, motion, useReducedMotion } from 'motion/react'\nimport { Check, Close, Upload } from '@/components/detent/icons'\nimport { clamp, springStep } from '@/components/detent/lib/detent'\nimport type { Body, Spring } from '@/components/detent/lib/detent'\nimport { ease, press } from '@/components/detent/lib/motion'\n\nexport type Attachment = {\n  id: string\n  name: string\n  size: number\n  type: string\n  url?: string\n  file?: File\n}\nexport type Mode = { id: string; name: string; note: string; icon?: ReactNode; level?: number; aside?: string; badge?: string }\nexport type Model = { name: string; short?: string; icon?: ReactNode }\nexport type Message = { text: string; files: Attachment[]; mode: string; model?: string; project?: string | null }\nexport type PromptHandle = { type(text: string): void; attach(files: Attachment[]): void; mode(id: string): void; send(): void; focus(): void }\nexport type Starter = { label: string; lead: string; rest?: string; prompt?: string }\n\nconst icon = (d: ReactNode) => (\n  <svg width=\"16\" height=\"16\" viewBox=\"0 0 18 18\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.4\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden className=\"shrink-0\">\n    {d}\n  </svg>\n)\nconst DEFAULT_MODES: Mode[] = [\n  { id: 'quick', name: 'Quick', badge: 'Fast', note: 'Short answers, right away', level: 1, icon: icon(<path d=\"M10.2 2.6 4.6 10h4.1l-.9 5.4 5.6-7.4H9.3z\" />) },\n  { id: 'think', name: 'Think', badge: 'Deep', note: 'Reasons it through step by step', level: 3, icon: icon(<path d=\"M9 2.6c.45 3.3 2.1 4.95 5.4 5.4-3.3.45-4.95 2.1-5.4 5.4-.45-3.3-2.1-4.95-5.4-5.4 3.3-.45 4.95-2.1 5.4-5.4Z\" />) },\n  {\n    id: 'research',\n    name: 'Research',\n    badge: 'Cited',\n    note: 'Searches and cites its sources',\n    level: 4,\n    icon: icon(\n      <>\n        <circle cx=\"9\" cy=\"9\" r=\"6.2\" />\n        <path d=\"M2.8 9h12.4M9 2.8c1.7 1.8 2.5 3.9 2.5 6.2S10.7 13.4 9 15.2C7.3 13.4 6.5 11.3 6.5 9S7.3 4.6 9 2.8Z\" />\n      </>,\n    ),\n  },\n]\n\nexport const PROMPT_MATERIAL = {\n  '--c-ground': 'light-dark(#ffffff, #1a1a1e)',\n  '--c-field': 'light-dark(#ffffff, #26262a)',\n  '--c-edge': 'light-dark(#e9e9e7, #313136)',\n  '--c-edge-on': 'light-dark(#dcdcd9, #3c3c42)',\n  '--c-key': 'light-dark(#e6e6e3, #38383d)',\n  '--c-strip': 'light-dark(#f5f5f4, #1f1f23)',\n  '--c-well': 'light-dark(#f2f2f1, #1f1f23)',\n  '--c-lift': 'light-dark(#ffffff, #3a3a3f)',\n  '--c-ink': 'light-dark(#1a1a1a, #f5f5f7)',\n  '--c-ink-2': 'light-dark(#5c5c5c, #a1a1a6)',\n  '--c-ink-3': 'light-dark(#7c7c7c, #909096)',\n  '--c-hover': 'light-dark(#f2f2f0, #2e2e33)',\n  '--c-rim': 'light-dark(rgba(0,0,0,0.07), rgba(255,255,255,0.08))',\n  '--c-send': 'var(--prompt-send, light-dark(#1d1d1f, #f5f5f7))',\n  '--c-send-ink': 'light-dark(#ffffff, #1d1d1f)',\n  '--c-shadow': 'light-dark(rgba(20,20,18,0.07), rgba(0,0,0,0.45))',\n} as CSSProperties\n\nconst LINE = 24\nconst MIN_LINES = 2\nconst MAX_LINES = 8\nconst ROW = 34\nconst PAD = 10\nconst FRAME = 18 + ROW + PAD\nconst GAP = 24\nconst REST = LINE * MIN_LINES + GAP\nconst SHELF = 44\nconst HEAD = 26\nconst PLATE = 640\nconst STRIP = 42\nexport const PROMPT_H = FRAME + REST + HEAD\nexport const PROMPT_H_BARE = FRAME + REST\nexport const PROMPT_STRIP = STRIP\n\nconst TEXT = 'text-[length:var(--p-text,17px)]! tracking-[-0.011em]'\nconst ROW_TEXT = 'text-[length:var(--p-row,16px)] tracking-[-0.006em]'\nconst HIT = \"pointer-coarse:before:absolute pointer-coarse:before:left-1/2 pointer-coarse:before:top-1/2 pointer-coarse:before:size-[44px] pointer-coarse:before:-translate-x-1/2 pointer-coarse:before:-translate-y-1/2 pointer-coarse:before:content-['']\"\nconst TAP = { whileTap: press, transition: { scale: { duration: 0.1, ease: ease.out } } }\nconst keep = (e: ReactMouseEvent) => e.preventDefault()\nconst SLOP = 10\nconst ARMS = 320\nconst STALL = 20\nconst GIVE = 160\nconst SIZE: Spring = { w: (2 * Math.PI) / 0.3, z: 1 }\nconst FAR: Spring = { w: (2 * Math.PI) / 0.44, z: 1 }\nconst MENU = { scale: { type: 'spring', bounce: 0, duration: 0.22 }, opacity: { duration: 0.12, ease: ease.out } } as const\nconst MENU_W = 244\n\nconst fromFile = (f: File): Attachment => ({\n  id: `${f.name}-${f.size}-${Math.random().toString(36).slice(2, 7)}`,\n  name: f.name,\n  size: f.size,\n  type: f.type,\n  file: f,\n  url: f.type.startsWith('image/') ? URL.createObjectURL(f) : undefined,\n})\nconst fingers = () => matchMedia('(hover: none) and (pointer: coarse)').matches\nconst thenable = (v: unknown): v is PromiseLike<unknown> => typeof (v as PromiseLike<unknown> | undefined)?.then === 'function'\nconst blank = (t: EventTarget) => !(t as Element).closest('button,a,input,textarea,label,[role^=\"menuitem\"]')\n\ntype Part = 'head' | 'files' | 'words' | 'lift'\ntype Size = Body & { t: number }\n\nexport function PromptBox({\n  onSend,\n  onStop,\n  placeholder = 'Ask anything',\n  hint,\n  label,\n  modes = DEFAULT_MODES,\n  initialMode,\n  initialFiles = [],\n  suggestions,\n  width = 420,\n  busy: working,\n  status = 'Thinking',\n  model: firstModel,\n  models,\n  onModel,\n  projects,\n  onProject,\n  onVoice,\n  onGrow,\n  sendable = true,\n  compact = false,\n  ref,\n}: {\n  onSend?: (message: Message) => Promise<unknown> | void\n  onStop?: () => void\n  placeholder?: string\n  hint?: string\n  label?: string\n  modes?: Mode[]\n  initialMode?: string\n  initialFiles?: Attachment[]\n  suggestions?: string[]\n  width?: number\n  busy?: boolean\n  status?: string\n  model?: string\n  models?: Model[]\n  onModel?: (name: string) => void\n  projects?: string[]\n  onProject?: (name: string | null) => void\n  onVoice?: () => void\n  onGrow?: (by: number) => void\n  sendable?: boolean\n  compact?: boolean\n  ref?: Ref<PromptHandle>\n}) {\n  const r = compact ? 16 : 22\n  const [text, setText] = useState('')\n  const [files, setFiles] = useState<Attachment[]>(initialFiles)\n  const [mode, setMode] = useState(initialMode ?? modes[1]?.id ?? modes[0].id)\n  const [pending, setPending] = useState(false)\n  const busy = working ?? pending\n  const [focused, setFocused] = useState(false)\n  const [drag, setDrag] = useState(false)\n  const [modelMenu, setModelMenu] = useState(false)\n  const [projectMenu, setProjectMenu] = useState(false)\n  const [model, setModel] = useState(firstModel ?? models?.[0]?.name)\n  const [project, setProject] = useState<string | null>(null)\n  const [layer, setLayer] = useState<HTMLDivElement | null>(null)\n  const [failed, setFailed] = useState(false)\n  const [sent, setSent] = useState(0)\n\n  const area = useRef<HTMLTextAreaElement>(null)\n  const ghost = useRef<HTMLTextAreaElement>(null)\n  const card = useRef<HTMLDivElement | null>(null)\n  const hang = useCallback((n: HTMLDivElement | null) => {\n    card.current = n\n    setLayer(n)\n  }, [])\n  const plate = useRef<HTMLDivElement>(null)\n  const headBox = useRef<HTMLDivElement>(null)\n  const filesBox = useRef<HTMLDivElement>(null)\n  const wordsBox = useRef<HTMLDivElement>(null)\n  const rail = useRef<HTMLDivElement>(null)\n  const sendKey = useRef<HTMLButtonElement>(null)\n  const picker = useRef<HTMLInputElement>(null)\n  const run = useRef(0)\n  const depth = useRef(0)\n  const started = useRef(0)\n  const limit = useRef(false)\n  const count = useRef(files.length)\n  const filesRef = useRef(files)\n  const last = useRef<{ text: string; files: Attachment[] } | null>(null)\n  useLayoutEffect(() => {\n    filesRef.current = files\n  })\n  useLayoutEffect(() => {\n    if (busy) started.current = performance.now()\n  }, [busy])\n  const reduce = useReducedMotion()\n  const head = !!label\n  const under = projects?.length ? STRIP : 0\n  const base = FRAME + REST + (head ? HEAD : 0) + under\n  const edge = `inset 0 0 0 1px var(${focused ? '--c-edge-on' : '--c-edge'})`\n  const tray = useRef<HTMLDivElement>(null)\n  const telling = busy || failed\n\n  const sizes = useRef<Record<Part, Size>>({\n    head: { x: head ? HEAD : 0, v: 0, t: head ? HEAD : 0 },\n    files: { x: initialFiles.length ? SHELF : 0, v: 0, t: initialFiles.length ? SHELF : 0 },\n    words: { x: REST, v: 0, t: REST },\n    lift: { x: 0, v: 0, t: 0 },\n  })\n  const loop = useRef({ raf: 0, then: 0, live: false })\n  const grew = useRef(onGrow)\n  const baseRef = useRef(base)\n  const underRef = useRef(under)\n  const still = useRef(reduce)\n  useLayoutEffect(() => {\n    grew.current = onGrow\n    baseRef.current = base\n    underRef.current = under\n    still.current = reduce\n  })\n  const paint = useCallback(() => {\n    const s = sizes.current\n    const total = FRAME + s.head.x + s.files.x + s.words.x\n    const w = s.words.t - s.words.x\n    const f = s.files.t - s.files.x\n    const h = s.head.t - s.head.x\n    if (plate.current) plate.current.style.transform = `translate3d(0,${PLATE - total}px,0)`\n    if (wordsBox.current) wordsBox.current.style.transform = `translate3d(0,${w}px,0)`\n    if (filesBox.current) {\n      filesBox.current.style.transform = `translate3d(0,${w + f}px,0)`\n      filesBox.current.style.clipPath = f > 0 ? `inset(0 0 ${f}px 0)` : ''\n    }\n    if (headBox.current) headBox.current.style.transform = `translate3d(0,${w + f + h}px,0)`\n    const up = s.lift.x\n    if (card.current) card.current.style.transform = up ? `translate3d(0,${-up}px,0)` : ''\n    if (tray.current && !underRef.current) {\n      tray.current.style.opacity = `${clamp(up / 14, 0, 1)}`\n      tray.current.style.transform = `translate3d(0,${(STRIP - up) * 0.25}px,0)`\n    }\n    grew.current?.(total + up + underRef.current - baseRef.current)\n  }, [])\n  const wake = useCallback(() => {\n    const l = loop.current\n    if (l.raf) return\n    l.then = performance.now()\n    const step = (now: number) => {\n      l.raf = 0\n      const dt = clamp((now - l.then) / 1000, 1 / 240, 0.05)\n      l.then = now\n      let moving = false\n      for (const s of Object.values(sizes.current)) {\n        if (s.x === s.t && s.v === 0) continue\n        springStep(s, s.t, Math.abs(s.t - s.x) > LINE * 2.5 ? FAR : SIZE, dt)\n        if (Math.abs(s.x - s.t) < 0.05 && Math.abs(s.v) < 1) {\n          s.x = s.t\n          s.v = 0\n        } else moving = true\n      }\n      paint()\n      if (moving) l.raf = requestAnimationFrame(step)\n    }\n    l.raf = requestAnimationFrame(step)\n  }, [paint])\n  const size = useCallback(\n    (part: Part, to: number) => {\n      const b = sizes.current[part]\n      if (b.t === to) return\n      b.t = to\n      const s = sizes.current\n      if (headBox.current) headBox.current.style.height = `${s.head.t}px`\n      if (filesBox.current) filesBox.current.style.height = `${s.files.t}px`\n      if (wordsBox.current) wordsBox.current.style.height = `${s.words.t}px`\n      if (card.current) card.current.style.height = `${FRAME + s.head.t + s.files.t + s.words.t}px`\n      if (still.current || !loop.current.live) {\n        b.x = to\n        b.v = 0\n      }\n      paint()\n      if (!still.current && loop.current.live) wake()\n    },\n    [paint, wake],\n  )\n  useEffect(() => {\n    const l = loop.current\n    return () => {\n      cancelAnimationFrame(l.raf)\n      l.raf = 0\n    }\n  }, [])\n\n  const more = () => {\n    const a = area.current\n    if (!a) return\n    a.style.setProperty('--fade-t', `${Math.min(18, a.scrollTop)}px`)\n    a.style.setProperty('--fade-b', `${Math.min(18, Math.max(0, a.scrollHeight - a.clientHeight - a.scrollTop))}px`)\n  }\n  const fit = () => {\n    const a = area.current\n    const h = ghost.current\n    if (!a || !h) return\n    const top = LINE * MAX_LINES\n    const over = a.scrollHeight > top + 2\n    const b = sizes.current.words\n    if (over && !limit.current && !still.current && a.clientHeight === top) {\n      b.v += GIVE\n      wake()\n    }\n    limit.current = over\n    if (a.clientHeight === top && a.scrollHeight > top + LINE) {\n      if (a.selectionEnd === a.value.length) a.scrollTop = a.scrollHeight\n      more()\n      return\n    }\n    h.value = a.value\n    const next = clamp(h.scrollHeight, LINE * MIN_LINES, top)\n    if (a.style.height !== `${next}px`) a.style.height = `${next}px`\n    if (a.selectionEnd === a.value.length) a.scrollTop = a.scrollHeight\n    more()\n    size('words', next + GAP)\n  }\n  const fitRef = useRef(fit)\n  useLayoutEffect(() => {\n    fitRef.current = fit\n  })\n  useLayoutEffect(() => fitRef.current(), [text])\n  useLayoutEffect(() => {\n    size('head', head ? HEAD : 0)\n    size('files', files.length ? SHELF : 0)\n  }, [head, files.length, size])\n  useLayoutEffect(() => {\n    size('lift', telling && !under ? STRIP : 0)\n  }, [telling, under, size])\n  useLayoutEffect(() => {\n    if (layer) paint()\n    loop.current.live = true\n  }, [layer, paint])\n  useEffect(() => {\n    const a = area.current\n    if (!a) return\n    let w = a.clientWidth\n    const ro = new ResizeObserver(() => {\n      if (a.clientWidth === w) return\n      w = a.clientWidth\n      fitRef.current()\n    })\n    ro.observe(a)\n    void document.fonts?.ready.then(() => fitRef.current())\n    return () => ro.disconnect()\n  }, [])\n  const edges = () => {\n    const r = rail.current\n    if (!r) return\n    r.style.setProperty('--fade-l', `${Math.min(28, r.scrollLeft)}px`)\n    r.style.setProperty('--fade-r', `${Math.min(28, Math.max(0, r.scrollWidth - r.clientWidth - r.scrollLeft))}px`)\n  }\n  useLayoutEffect(() => {\n    const r = rail.current\n    if (r && files.length > count.current && r.scrollWidth > r.clientWidth) r.scrollTo({ left: r.scrollWidth, behavior: reduce ? 'auto' : 'smooth' })\n    count.current = files.length\n    edges()\n  }, [files.length, reduce])\n  useEffect(() => () => filesRef.current.forEach((f) => f.url && URL.revokeObjectURL(f.url)), [])\n\n  const canSend = !busy && (text.trim().length > 0 || files.length > 0)\n  const offer = !text && !busy && focused && suggestions?.length ? suggestions[0] : null\n\n  const send = () => {\n    if (!canSend) {\n      if (busy && text.trim() && !reduce) sendKey.current?.animate([{ transform: 'scale(0.92)' }, { transform: 'scale(1)' }], { duration: 260, easing: 'cubic-bezier(0.2,0.9,0.25,1)' })\n      return\n    }\n    const message: Message = { text: text.trim(), files, mode, model, project }\n    last.current = { text, files }\n    setSent((n) => n + 1)\n    setFailed(false)\n    setText('')\n    setFiles([])\n    let result: unknown\n    try {\n      result = onSend?.(message)\n    } catch (e) {\n      result = Promise.reject(e)\n    }\n    if (!thenable(result)) return\n    const id = ++run.current\n    setPending(true)\n    void Promise.resolve(result).then(\n      () => {\n        if (run.current === id) setPending(false)\n      },\n      () => {\n        if (run.current !== id) return\n        setPending(false)\n        setFailed(true)\n        last.current = null\n        setText((t) => t || message.text)\n        setFiles((x) => (x.length ? x : message.files))\n      },\n    )\n  }\n  const latest = useRef(() => {})\n  useLayoutEffect(() => {\n    latest.current = send\n  })\n  useImperativeHandle(ref, () => ({ type: setText, attach: (list) => setFiles((f) => [...f, ...list]), mode: setMode, send: () => latest.current(), focus: () => area.current?.focus() }), [])\n\n  const stop = () => {\n    run.current++\n    setPending(false)\n    onStop?.()\n  }\n  const add = (list: FileList | File[]) => {\n    const next = [...list].map(fromFile)\n    if (next.length) {\n      setFailed(false)\n      setFiles((f) => [...f, ...next])\n    }\n  }\n  const remove = (id: string, byKey: boolean) => {\n    setFiles((f) => {\n      const gone = f.find((x) => x.id === id)\n      if (gone?.url) URL.revokeObjectURL(gone.url)\n      return f.filter((x) => x.id !== id)\n    })\n    if (byKey) area.current?.focus()\n  }\n  const insert = (words: string) => {\n    const el = area.current\n    if (!el) return\n    el.focus()\n    if (document.execCommand('insertText', false, words)) return\n    el.setRangeText(words, el.selectionStart, el.selectionEnd, 'end')\n    setText(el.value)\n  }\n  const chosen = models?.find((m) => m.name === model)\n  const quiet = `${ROW_TEXT} text-[var(--c-ink-2)] transition-colors ease-detent duration-150 hover:text-[var(--c-ink)]`\n  const plateAt = PLATE - (base - under) - (initialFiles.length ? SHELF : 0)\n\n  return (\n    <div className=\"@container relative\" style={{ width, maxWidth: '100%', height: base, ...PROMPT_MATERIAL, ...(compact ? { '--p-text': '15px', '--p-row': '14px' } : {}) } as CSSProperties}>\n      <div\n        ref={tray}\n        aria-hidden={!under && !telling}\n        {...(!under && !telling ? { inert: true } : {})}\n        className=\"absolute inset-x-0 bottom-0 rounded-[var(--r)] bg-[var(--c-strip)] shadow-[inset_0_0_0_1px_var(--c-edge)] will-change-transform\"\n        style={{ height: STRIP + 2 * r, opacity: under ? 1 : 0, '--r': `${r}px` } as CSSProperties}\n      >\n        <div className=\"absolute inset-x-0 bottom-0 flex items-center px-[8px]\" style={{ height: STRIP }}>\n          <AnimatePresence initial={false} mode=\"popLayout\">\n            {failed ? (\n              <Told key=\"failed\" reduce={!!reduce}>\n                <span className=\"flex size-[18px] shrink-0 items-center justify-center text-[var(--danger)]\">\n                  <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.4\" strokeLinecap=\"round\" aria-hidden>\n                    <circle cx=\"8\" cy=\"8\" r=\"6.2\" />\n                    <path d=\"M8 4.9v3.5M8 10.9v.1\" />\n                  </svg>\n                </span>\n                <span data-error role=\"status\" className=\"truncate text-[var(--c-ink)]\">\n                  Not sent. Your message is back.\n                </span>\n              </Told>\n            ) : busy ? (\n              <Told key=\"busy\" reduce={!!reduce}>\n                <span className=\"flex size-[18px] shrink-0 items-center justify-center text-[var(--c-ink-2)]\">{chosen?.icon ?? <Seat />}</span>\n                <span role=\"status\" className=\"flex min-w-0 flex-1 items-center gap-[6px]\">\n                  <AnimatePresence initial={false} mode=\"popLayout\">\n                    <motion.span key={status} className=\"truncate\" initial={{ opacity: 0, y: reduce ? 0 : 4 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: reduce ? 0 : -4 }} transition={{ duration: 0.16, ease: ease.out }}>\n                      {status}\n                    </motion.span>\n                  </AnimatePresence>\n                  <Elapsed key={status} since={started} />\n                </span>\n                <Spin still={!!reduce} />\n              </Told>\n            ) : under ? (\n              <Told key=\"project\" reduce={!!reduce}>\n                <Reach\n                  label={`Project: ${project ?? 'none'}`}\n                  items={[null, ...(projects ?? [])].map((n) => ({\n                    id: n ?? '',\n                    name: n ?? 'No project',\n                    on: n === project,\n                    run: () => {\n                      setProject(n)\n                      onProject?.(n)\n                    },\n                  }))}\n                  open={projectMenu}\n                  setOpen={setProjectMenu}\n                  layer={layer}\n                  className=\"-ml-[6px] h-[32px] min-w-0 max-w-full justify-start gap-[8px] rounded-[10px] px-[6px] text-[15px] tracking-[-0.006em] text-[var(--c-ink-2)] transition-colors ease-detent duration-150 hover:text-[var(--c-ink)]\"\n                >\n                  <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.3\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden className=\"shrink-0\">\n                    <rect x=\"2.75\" y=\"2.75\" width=\"10.5\" height=\"10.5\" rx=\"2.6\" />\n                    <path d=\"M5.6 6.1h4.8M5.6 8.9h2.8\" />\n                  </svg>\n                  <span className=\"truncate\">{project ?? 'Add to a project'}</span>\n                </Reach>\n              </Told>\n            ) : null}\n          </AnimatePresence>\n        </div>\n      </div>\n\n      <div\n        ref={hang}\n        data-prompt-box\n        className=\"absolute inset-x-0 will-change-transform\"\n        style={{ bottom: under, height: base - under + (initialFiles.length ? SHELF : 0), borderRadius: r }}\n        onKeyDown={(e) => {\n          if (e.key === 'Escape' && busy) {\n            e.preventDefault()\n            stop()\n          }\n        }}\n        onDragEnter={(e) => {\n          if (!e.dataTransfer.types.includes('Files')) return\n          depth.current++\n          setDrag(true)\n        }}\n        onDragLeave={(e) => {\n          if (!e.dataTransfer.types.includes('Files')) return\n          depth.current = Math.max(0, depth.current - 1)\n          if (!depth.current) setDrag(false)\n        }}\n        onDragOver={(e) => e.dataTransfer.types.includes('Files') && e.preventDefault()}\n        onDrop={(e) => {\n          if (!e.dataTransfer.types.includes('Files')) return\n          e.preventDefault()\n          depth.current = 0\n          setDrag(false)\n          add(e.dataTransfer.files)\n        }}\n      >\n        <div aria-hidden className=\"pointer-events-none absolute inset-0\" style={{ filter: 'drop-shadow(0 1px 1px var(--c-shadow)) drop-shadow(0 6px 14px var(--c-shadow))' }}>\n          <div className=\"absolute inset-x-0 bottom-0 overflow-clip\" style={{ height: PLATE, borderBottomLeftRadius: r, borderBottomRightRadius: r }}>\n            <div ref={plate} className=\"absolute inset-x-0 top-0 bg-[var(--c-field)] transition-shadow ease-detent duration-150 will-change-transform\" style={{ height: PLATE, transform: `translate3d(0,${plateAt}px,0)`, boxShadow: edge, borderTopLeftRadius: r, borderTopRightRadius: r }} />\n            <div className=\"absolute inset-x-0 bottom-0 h-[44px] bg-[var(--c-field)] transition-shadow ease-detent duration-150\" style={{ clipPath: 'inset(3px 0 0 0)', boxShadow: edge, borderBottomLeftRadius: r, borderBottomRightRadius: r }} />\n          </div>\n        </div>\n\n        <div className=\"relative flex h-full cursor-text flex-col rounded-[inherit]\" style={{ padding: `18px ${PAD}px ${PAD}px` }} onMouseDown={(e) => blank(e.target) && e.preventDefault()} onClick={(e) => blank(e.target) && area.current?.focus()}>\n          <div className=\"shrink-0\" style={{ clipPath: 'inset(-640px -24px 0 -24px)' }}>\n            <div ref={headBox} className=\"relative shrink-0 overflow-clip text-[13px] leading-[18px] text-[var(--c-ink-3)]\" style={{ height: head ? HEAD : 0 }}>\n              <span className=\"block truncate\">{label}</span>\n            </div>\n\n            <div ref={filesBox} className=\"relative shrink-0 overflow-clip\" style={{ height: initialFiles.length ? SHELF : 0 }}>\n              <div ref={rail} onScroll={edges} className=\"flex gap-[6px] overflow-x-auto [scrollbar-width:none]\" style={{ maskImage: 'linear-gradient(90deg, transparent, #000 var(--fade-l, 0px), #000 calc(100% - var(--fade-r, 0px)), transparent)' }}>\n                <AnimatePresence key={sent} initial={false} mode=\"popLayout\">\n                  {files.map((f) => (\n                    <Chip key={f.id} file={f} onRemove={(byKey) => remove(f.id, byKey)} />\n                  ))}\n                </AnimatePresence>\n              </div>\n            </div>\n\n            <div ref={wordsBox} className=\"relative shrink-0\" style={{ height: REST }}>\n              <span aria-hidden className={`pointer-events-none absolute inset-x-0 top-0 flex items-center gap-[8px] overflow-hidden ${TEXT} text-[var(--c-ink-3)]`} style={{ height: LINE, lineHeight: `${LINE}px`, visibility: text ? 'hidden' : 'visible' }}>\n                <motion.span key={sent} className=\"flex min-w-0 items-center gap-[8px]\" initial={sent ? { opacity: 0 } : false} animate={{ opacity: 1, transition: { duration: 0.2, ease: ease.out, delay: 0.16 } }}>\n                  <span className=\"truncate\">{busy ? 'Add a follow-up' : (offer ?? `${placeholder}${hint ? `, ${hint}` : ''}`)}</span>\n                  {offer && <span className=\"shrink-0 rounded-[6px] px-[6px] text-[13px] leading-[20px] tracking-normal shadow-[inset_0_0_0_1px_var(--c-edge-on)] pointer-coarse:hidden\">Tab</span>}\n                </motion.span>\n              </span>\n              <textarea ref={ghost} aria-hidden tabIndex={-1} readOnly rows={1} className={`invisible absolute inset-x-0 top-0 block h-0 w-full resize-none overflow-hidden ${TEXT} [scrollbar-gutter:stable]`} style={{ lineHeight: `${LINE}px` }} />\n              <textarea\n                ref={area}\n                rows={MIN_LINES}\n                value={text}\n                dir=\"auto\"\n                enterKeyHint=\"enter\"\n                aria-label={offer ? `${placeholder}. Suggestion: ${offer}, press Tab to use it` : placeholder}\n                onChange={(e) => {\n                  setText(e.target.value)\n                  last.current = null\n                  setFailed(false)\n                  setModelMenu(false)\n                  setProjectMenu(false)\n                }}\n                onScroll={more}\n                onFocus={() => setFocused(true)}\n                onBlur={() => setFocused(false)}\n                onKeyDown={(e) => {\n                  if (e.key === 'Tab' && !e.shiftKey && offer) {\n                    e.preventDefault()\n                    insert(offer)\n                  } else if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing && e.keyCode !== 229) {\n                    if (fingers() && !e.metaKey && !e.ctrlKey) return\n                    e.preventDefault()\n                    if (sendable) send()\n                  } else if ((e.metaKey || e.ctrlKey) && !e.shiftKey && e.key.toLowerCase() === 'z' && !text && last.current) {\n                    e.preventDefault()\n                    const back = last.current\n                    last.current = null\n                    setText(back.text)\n                    setFiles(back.files)\n                  }\n                }}\n                onPaste={(e) => {\n                  const d = e.clipboardData\n                  if (!d.files.length) return\n                  if (d.types.includes('text/html') && d.getData('text/plain').trim()) return\n                  e.preventDefault()\n                  add(d.files)\n                }}\n                className={`block w-full resize-none bg-transparent ${TEXT} text-[var(--c-ink)] caret-[var(--c-ink)] outline-none [scrollbar-gutter:stable] [scrollbar-width:none]`}\n                style={{ lineHeight: `${LINE}px`, height: LINE * MIN_LINES, maskImage: 'linear-gradient(180deg, transparent, #000 var(--fade-t, 0px), #000 calc(100% - var(--fade-b, 0px)), transparent)' }}\n              />\n            </div>\n          </div>\n\n          <div className=\"flex shrink-0 cursor-default items-center gap-[8px]\" style={{ height: ROW }}>\n            <Key label=\"Attach files\" onClick={() => picker.current?.click()}>\n              <path d=\"m14.6 8.6-5.5 5.5a3.6 3.6 0 0 1-5.1-5.1l5.9-5.9a2.4 2.4 0 0 1 3.4 3.4l-5.9 5.9a1.2 1.2 0 0 1-1.7-1.7l5.4-5.4\" />\n            </Key>\n            <input ref={picker} type=\"file\" multiple hidden onChange={(e) => (e.target.files && add(e.target.files), (e.target.value = ''))} />\n            <Modes modes={modes} mode={mode} onMode={setMode} />\n            {model &&\n              (models?.length ? (\n                <span className=\"flex shrink-0 items-center\">\n                  <Reach\n                    label={`Model: ${model}`}\n                    items={models.map((m) => ({\n                      id: m.name,\n                      name: m.name,\n                      icon: m.icon,\n                      on: m.name === model,\n                      run: () => {\n                        setModel(m.name)\n                        onModel?.(m.name)\n                      },\n                    }))}\n                    open={modelMenu}\n                    setOpen={setModelMenu}\n                    layer={layer}\n                    className={`h-[34px] gap-[7px] rounded-full shadow-[inset_0_0_0_1px_var(--c-key)] hover:bg-[var(--c-hover)] ${chosen?.icon ? 'w-[34px] justify-center @min-[400px]:w-auto @min-[400px]:justify-start @min-[400px]:pl-[10px] @min-[400px]:pr-[12px]' : 'pl-[10px] pr-[12px]'} ${quiet}`}\n                  >\n                    {chosen?.icon}\n                    <span className={`text-[var(--c-ink)] ${chosen?.icon ? 'hidden @min-[400px]:inline' : ''}`}>{chosen?.short ?? model}</span>\n                  </Reach>\n                </span>\n              ) : (\n                <span className={`hidden shrink-0 @min-[480px]:block ${ROW_TEXT} px-[6px] text-[var(--c-ink-2)]`}>{model}</span>\n              ))}\n            <span className=\"min-w-0 flex-1\" />\n            <SendKey\n              ref={sendKey}\n              canSend={canSend && sendable}\n              busy={busy}\n              onVoice={onVoice}\n              onSend={(byKey) => {\n                if (!sendable) return\n                send()\n                if (byKey || !canSend) area.current?.focus()\n              }}\n              onStop={stop}\n            />\n          </div>\n\n          <AnimatePresence>\n            {drag && (\n              <motion.div\n                className=\"pointer-events-none absolute inset-0 flex items-center justify-center gap-[8px] rounded-[inherit] bg-[var(--c-field)] text-[15px] text-[var(--c-ink-2)] shadow-[inset_0_0_0_1px_var(--c-edge-on)]\"\n                initial={{ opacity: 0 }}\n                animate={{ opacity: 1 }}\n                exit={{ opacity: 0 }}\n                transition={{ duration: 0.12, ease: ease.out }}\n              >\n                <Upload size={15} />\n                Drop to attach\n              </motion.div>\n            )}\n          </AnimatePresence>\n        </div>\n      </div>\n    </div>\n  )\n}\n\nexport function PromptStarters({ items, onPick, width = 420 }: { items: Starter[]; onPick: (prompt: string) => void; width?: number }) {\n  const held = useRef('')\n  useEffect(() => {\n    const key = (e: KeyboardEvent) => {\n      const t = e.target as HTMLElement | null\n      if (e.repeat && e.key === held.current) return e.preventDefault()\n      held.current = ''\n      if (e.repeat || (t && (t.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)))) return\n      const n = +e.key - 1\n      if (Number.isInteger(n) && n >= 0 && n < items.length && !e.metaKey && !e.ctrlKey && !e.altKey) {\n        e.preventDefault()\n        held.current = e.key\n        onPick(items[n].prompt ?? [items[n].lead, items[n].rest].filter(Boolean).join(' '))\n      }\n    }\n    window.addEventListener('keydown', key)\n    return () => window.removeEventListener('keydown', key)\n  }, [items, onPick])\n  return (\n    <div className=\"grid gap-px\" style={{ width, maxWidth: '100%', ...PROMPT_MATERIAL }}>\n      {items.map((s, i) => (\n        <motion.button key={s.label + s.lead} type=\"button\" {...TAP} onClick={() => onPick(s.prompt ?? [s.lead, s.rest].filter(Boolean).join(' '))} className=\"ring-focus flex items-baseline gap-[12px] rounded-[10px] py-[6px] text-left\">\n          <span className=\"tnum w-[12px] shrink-0 text-[13px] text-[var(--c-ink-3)] pointer-coarse:hidden\">{i + 1}</span>\n          <span className=\"text-[14px] leading-[20px]\">\n            <span className=\"text-[var(--c-ink)]\">{s.lead}</span>\n            {s.rest && <span className=\"text-[var(--c-ink-3)]\"> {s.rest}</span>}\n          </span>\n        </motion.button>\n      ))}\n    </div>\n  )\n}\n\nfunction Seat() {\n  return (\n    <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden className=\"shrink-0\">\n      <rect x=\"2.5\" y=\"3\" width=\"6.5\" height=\"18\" rx=\"1.2\" />\n      <path d=\"M11 3h1a9 9 0 0 1 0 18h-1z\" />\n    </svg>\n  )\n}\n\nfunction Key({ label, onClick, children }: { label: string; onClick: () => void; children: ReactNode }) {\n  return (\n    <motion.button type=\"button\" {...TAP} aria-label={label} title={label} onMouseDown={keep} onClick={onClick} className={`ring-focus relative flex shrink-0 items-center justify-center rounded-full text-[var(--c-ink-2)] shadow-[inset_0_0_0_1px_var(--c-key)] transition-colors ease-detent duration-150 hover:bg-[var(--c-hover)] hover:text-[var(--c-ink)] ${HIT}`} style={{ width: ROW, height: ROW }}>\n      <svg width=\"17\" height=\"17\" viewBox=\"0 0 18 18\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.4\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n        {children}\n      </svg>\n    </motion.button>\n  )\n}\n\nfunction Modes({ modes, mode, onMode }: { modes: Mode[]; mode: string; onMode: (id: string) => void }) {\n  const keys = useRef<(HTMLButtonElement | null)[]>([])\n  const names = useRef<HTMLSpanElement>(null)\n  const [nameWs, setNameWs] = useState(() => modes.map((m) => m.name.length * 8.6))\n  const at = Math.max(0, modes.findIndex((m) => m.id === mode))\n  useLayoutEffect(() => {\n    const n = names.current\n    if (!n) return\n    const read = () => setNameWs([...n.children].map((c) => (c as HTMLElement).offsetWidth))\n    read()\n    const ro = new ResizeObserver(read)\n    ro.observe(n)\n    void document.fonts?.ready.then(read)\n    return () => ro.disconnect()\n  }, [modes])\n  const go = (i: number) => {\n    const n = (i + modes.length) % modes.length\n    onMode(modes[n].id)\n    keys.current[n]?.focus()\n  }\n  const KEY = ROW - 4\n  const wideOf = (i: number) => (nameWs[i] ? 10 + 16 + 6 + Math.ceil(nameWs[i]) + 12 : KEY + 12)\n  const wide = wideOf(at)\n  const widthOf = (m: Mode, on: boolean, i: number) => (on || !m.icon ? wideOf(i) : KEY)\n  const left = 2 + modes.slice(0, at).reduce((sum, m, i) => sum + widthOf(m, false, i), 0)\n  const move = 'duration-300 ease-[cubic-bezier(0.2,0.9,0.25,1)] motion-reduce:transition-none'\n  return (\n    <div role=\"radiogroup\" aria-label=\"Mode\" className=\"relative flex min-w-0 shrink-0 items-center rounded-full bg-[var(--c-well)] p-[2px]\" style={{ height: ROW }}>\n      <span aria-hidden className={`pointer-events-none invisible absolute grid whitespace-nowrap @max-[380px]:hidden ${ROW_TEXT}`}>\n        <span ref={names} className=\"col-start-1 row-start-1 flex\">\n          {modes.map((m) => (\n            <span key={m.id}>{m.name}</span>\n          ))}\n        </span>\n      </span>\n      <span aria-hidden className={`pointer-events-none absolute left-0 top-[2px] rounded-full bg-[var(--c-lift)] shadow-[0_0_0_1px_var(--c-rim),0_1px_2px_var(--c-shadow)] transition-transform ease-detent ${move}`} style={{ width: wide, height: KEY, transform: `translate3d(${left}px,0,0)` }} />\n      {modes.map((m, i) => {\n        const on = i === at\n        const named = on || !m.icon\n        return (\n          <motion.button\n            key={m.id}\n            ref={(n) => {\n              keys.current[i] = n\n            }}\n            type=\"button\"\n            role=\"radio\"\n            aria-checked={on}\n            aria-label={m.name}\n            title={on ? m.note : m.name}\n            tabIndex={on ? 0 : -1}\n            {...TAP}\n            onMouseDown={keep}\n            onClick={() => onMode(m.id)}\n            onKeyDown={(e) => {\n              const step = e.key === 'ArrowRight' || e.key === 'ArrowDown' ? 1 : e.key === 'ArrowLeft' || e.key === 'ArrowUp' ? -1 : 0\n              if (!step) return\n              e.preventDefault()\n              go(i + step)\n            }}\n            className={`ring-focus relative flex h-full shrink-0 items-center justify-center gap-[6px] overflow-hidden whitespace-nowrap rounded-full ${ROW_TEXT} transition-[width,color] ease-detent ${move} ${on ? 'text-[var(--c-ink)]' : 'text-[var(--c-ink-3)] hover:text-[var(--c-ink)]'} ${HIT}`}\n            style={{ width: widthOf(m, on, i) }}\n          >\n            {m.icon && <span className=\"flex shrink-0\">{m.icon}</span>}\n            {named && <span className={`shrink-0 transition-opacity duration-200 ease-detent @max-[380px]:hidden ${on || !m.icon ? 'opacity-100' : 'opacity-0'}`}>{m.name}</span>}\n          </motion.button>\n        )\n      })}\n    </div>\n  )\n}\n\nfunction Told({ reduce, children, ref }: { reduce: boolean; children: ReactNode; ref?: Ref<HTMLDivElement> }) {\n  return (\n    <motion.div ref={ref} className=\"flex min-w-0 flex-1 items-center gap-[9px] pl-[6px] pr-[8px] text-[15px] tracking-[-0.006em] text-[var(--c-ink-2)]\" initial={{ opacity: 0, y: reduce ? 0 : 4 }} animate={{ opacity: 1, y: 0, transition: { duration: 0.2, ease: ease.out, delay: 0.06 } }} exit={{ opacity: 0, transition: { duration: 0.1, ease: ease.out } }}>\n      {children}\n    </motion.div>\n  )\n}\n\nfunction Spin({ still }: { still: boolean }) {\n  return (\n    <span className=\"mr-[6px] flex size-[18px] shrink-0 items-center justify-center text-[var(--c-ink-2)]\">\n      <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden className={still ? '' : 'animate-spin [animation-duration:900ms]'}>\n        <circle cx=\"8\" cy=\"8\" r=\"6\" stroke=\"currentColor\" strokeOpacity=\"0.2\" strokeWidth=\"1.6\" />\n        <path d=\"M8 2a6 6 0 0 1 6 6\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" />\n      </svg>\n    </span>\n  )\n}\n\nfunction Chip({ file, onRemove, ref }: { file: Attachment; onRemove: (byKey: boolean) => void; ref?: Ref<HTMLDivElement> }) {\n  return (\n    <motion.div ref={ref} layout=\"position\" data-file={file.id} className=\"flex h-[36px] max-w-[236px] shrink-0 cursor-default items-center gap-[6px] rounded-[11px] pl-[12px] pr-[4px] text-[15px] text-[var(--c-ink)] shadow-[inset_0_0_0_1px_var(--c-edge-on)]\" initial={{ opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0, transition: { duration: 0.2, ease: ease.out } }} exit={{ opacity: 0, y: 6, transition: { duration: 0.12, ease: ease.out } }}>\n      {file.url && <span className=\"size-[20px] shrink-0 rounded-[5px] bg-cover bg-center\" style={{ backgroundImage: `url(\"${file.url}\")` }} />}\n      <span className=\"min-w-0 truncate\">{file.name}</span>\n      <motion.button type=\"button\" {...TAP} aria-label={`Remove ${file.name}`} onMouseDown={keep} onClick={(e) => onRemove(e.detail === 0)} className=\"relative flex size-[28px] shrink-0 items-center justify-center rounded-full opacity-60 outline-none before:absolute before:-inset-[8px] before:content-[''] hover:opacity-100 focus-visible:opacity-100\">\n        <Close size={11} strokeWidth={2.2} />\n      </motion.button>\n    </motion.div>\n  )\n}\n\ntype Item = { id: string; name: string; badge?: string; icon?: ReactNode; on?: boolean; run: () => void }\n\nfunction Reach({ items, open, setOpen, layer, className, label, children }: { items: Item[]; open: boolean; setOpen: (v: boolean) => void; layer: HTMLElement | null; className: string; label: string; children: ReactNode }) {\n  const [hi, setHi] = useState(-1)\n  const [place, setPlace] = useState({ left: 0, bottom: 0, ox: 24 })\n  const [byKey, setByKey] = useState(false)\n  const button = useRef<HTMLButtonElement>(null)\n  const list = useRef<HTMLDivElement>(null)\n  const uid = useId()\n  const reduce = useReducedMotion()\n  const slide = useRef<{ x: number; y: number; moved: boolean } | null>(null)\n  const opening = useRef(false)\n\n  const show = (keyed: boolean) => {\n    const b = button.current\n    if (b && layer) {\n      const r = b.getBoundingClientRect()\n      const c = layer.getBoundingClientRect()\n      const k = c.width / layer.offsetWidth || 1\n      const left = clamp((r.left - c.left) / k - 4, 0, Math.max(0, layer.offsetWidth - MENU_W))\n      setPlace({ left, bottom: (c.bottom - r.top) / k + 8, ox: (r.left + r.width / 2 - c.left) / k - left })\n    }\n    setHi(keyed ? 0 : -1)\n    setByKey(keyed)\n    setOpen(true)\n  }\n  const close = (keyed: boolean) => {\n    setByKey(keyed)\n    setOpen(false)\n  }\n  const choose = (i: number, keyed: boolean) => {\n    close(keyed)\n    items[i].run()\n  }\n  const rowAt = (x: number, y: number) => {\n    const row = document.elementFromPoint(x, y)?.closest<HTMLElement>('[role^=\"menuitem\"]')\n    return row && list.current?.contains(row) ? +(row.dataset.row ?? -1) : -1\n  }\n\n  const state = useRef({ hi, n: items.length, choose, close })\n  useLayoutEffect(() => {\n    state.current = { hi, n: items.length, choose, close }\n  })\n  useEffect(() => {\n    if (!open) return\n    const away = (e: PointerEvent) => {\n      const t = e.target as Node\n      if (!button.current?.contains(t) && !list.current?.contains(t)) state.current.close(false)\n    }\n    const keys = (e: KeyboardEvent) => {\n      const { n } = state.current\n      const go = (next: (i: number) => number) => {\n        e.preventDefault()\n        e.stopPropagation()\n        setHi(next)\n      }\n      if (e.key === 'ArrowDown') go((i) => (i + 1) % n)\n      else if (e.key === 'ArrowUp') go((i) => (Math.max(i, 0) - 1 + n) % n)\n      else if (e.key === 'Home') go(() => 0)\n      else if (e.key === 'End') go(() => n - 1)\n      else if (e.key === 'Enter' || (e.key === ' ' && e.target === button.current)) {\n        e.preventDefault()\n        e.stopPropagation()\n        if (state.current.hi >= 0) state.current.choose(state.current.hi, true)\n        else state.current.close(true)\n      } else if (e.key === 'Escape') {\n        e.preventDefault()\n        e.stopPropagation()\n        state.current.close(true)\n      } else if (e.key === 'Tab') state.current.close(true)\n    }\n    document.addEventListener('pointerdown', away)\n    document.addEventListener('keydown', keys, true)\n    return () => {\n      document.removeEventListener('pointerdown', away)\n      document.removeEventListener('keydown', keys, true)\n    }\n  }, [open])\n\n  return (\n    <>\n      <motion.button\n        ref={button}\n        type=\"button\"\n        {...TAP}\n        aria-haspopup=\"menu\"\n        aria-expanded={open}\n        aria-controls={open ? `${uid}-list` : undefined}\n        aria-activedescendant={open && hi >= 0 ? `${uid}-${hi}` : undefined}\n        aria-label={label}\n        onMouseDown={keep}\n        onPointerDown={(e) => {\n          if (e.button || open) return\n          show(false)\n          opening.current = true\n          slide.current = { x: e.clientX, y: e.clientY, moved: false }\n          e.currentTarget.setPointerCapture?.(e.pointerId)\n        }}\n        onPointerMove={(e) => {\n          const s = slide.current\n          if (!s) return\n          if (!s.moved && Math.hypot(e.clientX - s.x, e.clientY - s.y) > SLOP) s.moved = true\n          if (s.moved) setHi(rowAt(e.clientX, e.clientY))\n        }}\n        onPointerUp={(e) => {\n          const s = slide.current\n          slide.current = null\n          if (!s?.moved) return\n          const row = rowAt(e.clientX, e.clientY)\n          if (row >= 0) choose(row, false)\n          else close(false)\n        }}\n        onPointerCancel={() => {\n          slide.current = null\n        }}\n        onClick={(e) => {\n          if (opening.current) {\n            opening.current = false\n            return\n          }\n          if (open) close(e.detail === 0)\n          else show(e.detail === 0)\n        }}\n        onKeyDown={(e) => {\n          if (!open && (e.key === 'ArrowUp' || e.key === 'ArrowDown')) {\n            e.preventDefault()\n            show(true)\n          }\n        }}\n        className={`ring-focus relative flex shrink-0 touch-none items-center justify-center transition-colors ease-detent duration-150 ${className} ${HIT}`}\n      >\n        {children}\n      </motion.button>\n\n      {layer &&\n        createPortal(\n          <AnimatePresence custom={byKey}>\n            {open && (\n              <motion.div\n                ref={list}\n                id={`${uid}-list`}\n                role=\"menu\"\n                aria-label={label}\n                className=\"absolute z-20 overflow-hidden rounded-[18px] bg-[var(--c-field)] p-[6px] shadow-[inset_0_0_0_1px_var(--c-edge-on),0_14px_32px_-14px_rgba(0,0,0,0.28)]\"\n                style={{ left: place.left, bottom: place.bottom, width: MENU_W, maxWidth: '100%', transformOrigin: `${place.ox}px calc(100% + 26px)` }}\n                custom={byKey}\n                variants={{\n                  away: (keyed: boolean) => (keyed ? { opacity: 0, scale: 1, transition: { duration: 0 } } : { opacity: 0, scale: reduce ? 1 : 0.97 }),\n                  here: { opacity: 1, scale: 1 },\n                }}\n                initial={byKey ? false : 'away'}\n                animate=\"here\"\n                exit=\"away\"\n                transition={MENU}\n              >\n                {items.map((m, i) => (\n                  <button\n                    key={m.id}\n                    id={`${uid}-${i}`}\n                    type=\"button\"\n                    role={m.on === undefined ? 'menuitem' : 'menuitemradio'}\n                    aria-checked={m.on}\n                    data-row={i}\n                    tabIndex={-1}\n                    onPointerEnter={() => setHi(i)}\n                    onPointerLeave={() => setHi(-1)}\n                    onMouseDown={keep}\n                    onClick={(e) => choose(i, e.detail === 0)}\n                    className={`relative flex h-[40px] w-full items-center gap-[8px] rounded-[12px] px-[12px] text-left text-[16px] text-[var(--c-ink)] outline-none ${i === hi ? 'bg-[var(--c-hover)]' : ''}`}\n                  >\n                    {m.icon}\n                    <span className=\"min-w-0 flex-1 truncate\">\n                      {m.name}\n                    </span>\n                    {m.badge && <span className=\"shrink-0 rounded-[7px] bg-[var(--c-badge)] px-[6px] text-[14px] leading-[22px] text-[var(--c-badge-ink)]\">{m.badge}</span>}\n                    {m.on && <Check size={14} strokeWidth={2.2} />}\n                  </button>\n                ))}\n              </motion.div>\n            )}\n          </AnimatePresence>,\n          layer,\n        )}\n    </>\n  )\n}\n\nfunction SendKey({ canSend, busy, onSend, onStop, onVoice, ref }: { canSend: boolean; busy: boolean; onSend: (byKey: boolean) => void; onStop: () => void; onVoice?: () => void; ref?: Ref<HTMLButtonElement> }) {\n  const voice = !!onVoice && !canSend && !busy\n  const lit = canSend || busy || voice\n  const armed = useRef(0)\n  useLayoutEffect(() => {\n    if (busy) armed.current = performance.now() + ARMS\n  }, [busy])\n  const glyph = 'transition-[opacity,transform] duration-150 ease-[cubic-bezier(0.2,0.9,0.25,1)] motion-reduce:transition-none'\n  const arrow = !voice\n  return (\n    <motion.button\n      ref={ref}\n      type=\"button\"\n      {...(lit ? TAP : {})}\n      aria-disabled={!lit}\n      aria-label={busy ? 'Stop' : voice ? 'Speak' : 'Send'}\n      onMouseDown={keep}\n      onPointerDown={() => lit && tap()}\n      onClick={(e) => {\n        if (voice) return onVoice?.()\n        if (!busy) return onSend(e.detail === 0)\n        if (performance.now() >= armed.current) onStop()\n      }}\n      className={`ring-focus relative flex shrink-0 items-center justify-center rounded-full transition-[background-color,color,box-shadow] ease-detent duration-150 aria-disabled:cursor-default ${lit ? 'bg-[var(--c-send)] text-[var(--c-send-ink)] shadow-[inset_0_1px_0_rgba(255,255,255,0.16),0_1px_2px_var(--c-shadow)]' : 'bg-[var(--c-well)] text-[var(--c-ink-3)]'} ${HIT}`}\n      style={{ width: ROW, height: ROW, backgroundImage: lit ? 'linear-gradient(180deg, rgba(255,255,255,0.12), rgba(0,0,0,0.1))' : undefined }}\n    >\n      <span aria-hidden className=\"relative block size-[16px]\">\n        <span className={`absolute inset-0 flex items-center justify-center gap-[2px] ${glyph}`} style={{ opacity: voice ? 1 : 0, transform: voice ? 'none' : 'scale(0.4, 0.6)' }}>\n          {[5, 9, 13, 9, 5].map((h, i) => (\n            <span key={i} className=\"block w-[1.6px] rounded-full bg-current\" style={{ height: h }} />\n          ))}\n        </span>\n        <span className={`absolute left-[3px] top-[3px] size-[10px] rounded-[2.5px] bg-current ${glyph}`} style={{ opacity: arrow ? 1 : 0, transform: busy ? 'scale(0.85)' : 'translateY(0.25px) scale(0.17, 1)' }} />\n        <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.9\" strokeLinecap=\"round\" strokeLinejoin=\"round\" className={`absolute inset-0 ${glyph}`} style={{ opacity: arrow && !busy ? 1 : 0, transform: busy ? 'translateY(3px) scale(0.6)' : voice ? 'translateY(2px) scale(0.7)' : 'scale(0.85)', transformOrigin: '8px 3.4px' }}>\n          <path d=\"M3.9 7.5 8 3.4l4.1 4.1\" />\n        </svg>\n      </span>\n    </motion.button>\n  )\n}\n\nfunction Elapsed({ since }: { since: { current: number } }) {\n  const [t, setT] = useState({ s: 0, quiet: 0 })\n  useEffect(() => {\n    const born = performance.now()\n    const id = window.setInterval(() => {\n      const now = performance.now()\n      const s = Math.floor((now - since.current) / 1000)\n      const quiet = Math.floor((now - born) / 1000)\n      setT((o) => (o.s === s && o.quiet === quiet ? o : { s, quiet }))\n    }, 250)\n    return () => clearInterval(id)\n  }, [since])\n  return (\n    <span className=\"tnum shrink-0\" style={{ opacity: t.s ? 1 : 0, transition: 'opacity 150ms' }}>\n      {t.s}s{t.quiet >= STALL ? ', still waiting' : ''}\n    </span>\n  )\n}\n"},{"path":"components/detent/lib/detent.ts","target":"components/detent/lib/detent.ts","type":"registry:component","content":"import { useLayoutEffect, useRef, useState } from 'react'\nimport type { KeyboardEvent, PointerEvent as ReactPointerEvent } from 'react'\nimport { useReducedMotion } from 'motion/react'\n\nexport const clamp = (n: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, n))\nexport const lerp = (a: number, b: number, t: number) => a + (b - a) * t\nexport const glide = (a: number, b: number, t: number) => (a > 0 && b > 0 ? a * Math.pow(b / a, t) : lerp(a, b, t))\n\nexport const notched = (x: number, centres: number[], reach: number, hold = 0.7) => {\n  for (const c of centres) {\n    const d = (x - c) / reach\n    if (Math.abs(d) < 1) return x - ((hold * reach) / Math.PI) * Math.sin(Math.PI * d) * ((1 + Math.cos(Math.PI * d)) / 2)\n  }\n  return x\n}\n\nexport const at = (list: number[], i: number, mix = lerp) => {\n  const a = clamp(Math.floor(i), 0, list.length - 1)\n  return mix(list[a], list[Math.min(list.length - 1, a + 1)], clamp(i - a, 0, 1))\n}\n\nexport type Spring = { w: number; z: number }\nexport type Body = { x: number; v: number }\n\nexport function springStep(b: Body, target: number, { w, z }: Spring, dt: number) {\n  const a = b.x - target\n  if (z >= 1) {\n    const e = Math.exp(-w * dt)\n    const k = b.v + w * a\n    b.x = target + (a + k * dt) * e\n    b.v = (b.v - k * w * dt) * e\n    return b\n  }\n  const wd = w * Math.sqrt(1 - z * z)\n  const e = Math.exp(-z * w * dt)\n  const c = Math.cos(wd * dt)\n  const s = Math.sin(wd * dt)\n  const B = (b.v + z * w * a) / wd\n  b.x = target + e * (a * c + B * s)\n  b.v = e * ((B * wd - z * w * a) * c - (a * wd + z * w * B) * s)\n  return b\n}\n\nconst still = (b: Body, target: number, eps: number) => Math.abs(b.x - target) < eps && Math.abs(b.v) < eps * 12\n\nconst rubber = (d: number, reach: number, s: number) => reach * (1 - 1 / (1 + (s * d) / reach))\n\nfunction tracker(window = 90) {\n  const samples: [number, number][] = []\n  return {\n    clear: () => (samples.length = 0),\n    add(t: number, x: number) {\n      samples.push([t, x])\n      while (samples.length > 2 && t - samples[0][0] > window) samples.shift()\n    },\n    read(now: number) {\n      const n = samples.length\n      if (n < 2 || now - samples[n - 1][0] > 60) return 0\n      const mt = samples.reduce((s, p) => s + p[0], 0) / n\n      const mx = samples.reduce((s, p) => s + p[1], 0) / n\n      const num = samples.reduce((s, p) => s + (p[0] - mt) * (p[1] - mx), 0)\n      const den = samples.reduce((s, p) => s + (p[0] - mt) ** 2, 0)\n      return den > 0 ? (num / den) * 1000 : 0\n    },\n  }\n}\n\nexport const feedback = (() => {\n  let audio: AudioContext | null = null\n  let last = 0\n  let asked = false\n  let on = true\n  let cancel: (() => void) | null = null\n  let holding = false\n  const open = () => {\n    cancel = null\n    audio ??= new AudioContext()\n    if (asked && audio.state === 'suspended') void audio.resume()\n  }\n  const warm = () => {\n    if (!on || audio || cancel || holding || typeof AudioContext === 'undefined') return\n    if (typeof requestIdleCallback === 'function') {\n      const id = requestIdleCallback(open, { timeout: 300 })\n      cancel = () => cancelIdleCallback(id)\n    } else {\n      const id = setTimeout(open, 60)\n      cancel = () => clearTimeout(id)\n    }\n  }\n  const letGo = () => {\n    holding = false\n    removeEventListener('pointerup', letGo)\n    removeEventListener('pointercancel', letGo)\n    warm()\n  }\n  const play = (heavy: boolean, loud: number) => {\n    if (!audio) return\n    const t = audio.currentTime\n    const tone = audio.createOscillator()\n    const gain = audio.createGain()\n    tone.frequency.setValueAtTime(heavy ? 900 : 1500, t)\n    tone.frequency.exponentialRampToValueAtTime(heavy ? 240 : 420, t + 0.014)\n    gain.gain.setValueAtTime((heavy ? 0.034 : 0.02) * loud, t)\n    gain.gain.exponentialRampToValueAtTime(0.0001, t + (heavy ? 0.03 : 0.016))\n    tone.connect(gain).connect(audio.destination)\n    tone.start(t)\n    tone.stop(t + 0.034)\n  }\n  return {\n    set(next: boolean) {\n      on = next\n      if (on) return\n      cancel?.()\n      cancel = null\n      void audio?.suspend()\n    },\n    warm,\n    wake(grab = false) {\n      if (!on) return\n      asked = true\n      if (audio) {\n        if (audio.state === 'suspended') void audio.resume()\n      } else if (!grab) warm()\n      else if (!holding && typeof AudioContext !== 'undefined') {\n        cancel?.()\n        cancel = null\n        holding = true\n        addEventListener('pointerup', letGo)\n        addEventListener('pointercancel', letGo)\n      }\n    },\n    tick(heavy = false, speed = 1) {\n      if (!on || !asked) return\n      const now = performance.now()\n      if (now - last < 34) return\n      last = now\n      if (typeof navigator !== 'undefined' && 'vibrate' in navigator) navigator.vibrate(heavy ? 10 : 4)\n      if (!audio) return\n      const loud = 0.45 + 0.55 * clamp(speed, 0, 1)\n      if (audio.state === 'running') play(heavy, loud)\n      else void audio.resume().then(() => on && play(heavy, loud))\n    },\n  }\n})()\n\nexport type FrameInfo = {\n  dt: number\n  mode: Mode\n  live: boolean\n}\nexport type Mode = 'rest' | 'held' | 'coast' | 'settle' | 'sweep'\n\nexport type DetentOptions = {\n  value: number\n  stops?: number[]\n  min?: number\n  max?: number\n  magnet?: number\n  reach?: number\n  throw?: number\n  spring?: Spring\n  catch?: Spring\n  muted?: boolean\n  reduce?: boolean\n  onFrame: (x: number, v: number, info: FrameInfo) => boolean | void\n  onStop?: (i: number) => void\n  onRest?: (x: number, i: number) => void\n}\n\nexport type Detent = ReturnType<typeof createDetent>\n\nconst SPRING: Spring = { w: 17, z: 0.92 }\nconst CATCH: Spring = { w: 24, z: 1 }\nconst MOMENTUM = 1\nconst SWIFT = 8\n\nexport function createDetent(read: () => DetentOptions) {\n  const init = read()\n  const body: Body = { x: init.value, v: 0 }\n  const residual: Body = { x: 0, v: 0 }\n  const track = tracker()\n  let mode: Mode = 'rest'\n  let hand = init.value\n  let target = init.value\n  let spring = SPRING\n  let friction = 4\n  let frame = 0\n  let then = 0\n  let feel = false\n  let stop = -1\n  let shown = init.value\n  let sweep = { from: 0, to: 0, t: 0, T: 1 }\n  let keyAt = 0\n\n  const span = () => {\n    const o = read()\n    const s = o.stops\n    return { o, s, lo: o.min ?? s?.[0] ?? -Infinity, hi: o.max ?? s?.[s.length - 1] ?? Infinity, m: o.reduce ? 0 : o.magnet ?? 0, reach: o.reach ?? ((s && s.length > 1 ? s[1] - s[0] : 1) * 0.5) }\n  }\n\n  const out = (u: number) => {\n    const { s, lo, hi, m, reach } = span()\n    if (u < lo) return lo - rubber(lo - u, reach, 1 - m)\n    if (u > hi) return hi + rubber(u - hi, reach, 1 - m)\n    if (!s || s.length < 2 || !m) return u\n    let i = 0\n    while (i < s.length - 2 && u > s[i + 1]) i++\n    const t = (u - s[i]) / (s[i + 1] - s[i])\n    return s[i] + (s[i + 1] - s[i]) * (t - (m * Math.sin(2 * Math.PI * t)) / (2 * Math.PI))\n  }\n  const slope = (u: number) => {\n    const e = 1e-4\n    return (out(u + e) - out(u - e)) / (2 * e)\n  }\n  const nearest = (x: number) => {\n    const { s, lo, hi } = span()\n    if (!s?.length) return { i: -1, value: clamp(x, lo, hi) }\n    let i = 0\n    for (let k = 1; k < s.length; k++) if (Math.abs(s[k] - x) < Math.abs(s[i] - x)) i = k\n    return { i, value: s[i] }\n  }\n\n  const start = () => {\n    if (frame || typeof requestAnimationFrame === 'undefined') return\n    then = performance.now()\n    frame = requestAnimationFrame(loop)\n  }\n\n  const land = () => {\n    mode = 'rest'\n    body.x = target\n    body.v = 0\n    feel = false\n  }\n\n  const emit = (dt: number) => {\n    const { o } = span()\n    const x = out(body.x)\n    const v = slope(body.x) * body.v\n    shown = x\n    const n = nearest(x).i\n    if (n !== stop) {\n      if (stop >= 0) {\n        o.onStop?.(n)\n        if (feel && !o.muted) feedback.tick(false, Math.abs(v) / (gap() * SWIFT))\n      }\n      stop = n\n    }\n    return o.onFrame(x, v, { dt, mode, live: mode === 'held' || mode === 'coast' })\n  }\n\n  function advance(dt: number, now: number) {\n    const { o } = span()\n    if (mode === 'held' || mode === 'sweep') {\n      if (mode === 'sweep') {\n        sweep.t = Math.min(sweep.T, sweep.t + dt)\n        const p = sweep.t / sweep.T\n        const next = lerp(sweep.from, sweep.to, p * p * p * (p * (6 * p - 15) + 10))\n        body.v = dt > 0 ? (next - hand) / dt + residual.v : body.v\n        hand = next\n      }\n      springStep(residual, 0, o.catch ?? CATCH, dt)\n      body.x = hand + residual.x\n      if (mode === 'held') body.v = track.read(now) + residual.v\n      if (mode === 'sweep' && sweep.t >= sweep.T && still(residual, 0, 1e-3)) {\n        target = sweep.to\n        land()\n        return true\n      }\n      return false\n    }\n    if (mode === 'coast') {\n      const e = Math.exp(-friction * dt)\n      body.x += (body.v / friction) * (1 - e)\n      body.v *= e\n      const left = Math.abs(target - body.x)\n      if (left < coastEnd() || Math.abs(body.v) < 0.5 * coastEnd() || Math.sign(target - body.x) !== Math.sign(body.v)) mode = 'settle'\n      return false\n    }\n    if (mode === 'settle') {\n      springStep(body, target, spring, dt)\n      if (still(body, target, settleEps())) {\n        land()\n        return true\n      }\n    }\n    return false\n  }\n  const gap = () => {\n    const { s } = span()\n    return s && s.length > 1 ? (s[s.length - 1] - s[0]) / (s.length - 1) : 1\n  }\n  const landing = (s: Spring, v: number): Spring => (Math.abs(v) > gap() * MOMENTUM ? s : { ...s, z: 1 })\n  const coastEnd = () => gap() * 0.7\n  const settleEps = () => gap() * 0.0015\n\n  function loop(now: number) {\n    frame = 0\n    const dt = clamp((now - then) / 1000, 1 / 240, 0.05)\n    then = now\n    const was = mode\n    const landed = was !== 'rest' && advance(dt, now)\n    const more = emit(dt)\n    if (landed) {\n      const { o } = span()\n      o.onRest?.(out(body.x), nearest(out(body.x)).i)\n    }\n    if (mode !== 'rest' || more) frame = requestAnimationFrame(loop)\n  }\n\n  const launch = () => {\n    const away = target - body.x\n    if (Math.abs(away) > gap() * 1.6 && Math.sign(away) === Math.sign(body.v)) {\n      friction = clamp(Math.abs(body.v / away), 2.5, 9)\n      mode = 'coast'\n    } else mode = 'settle'\n    start()\n  }\n\n  const to = (value: number, opts: { spring?: Spring; instant?: boolean; velocity?: number; feel?: boolean } = {}) => {\n    const { o, lo, hi } = span()\n    target = clamp(value, lo, hi)\n    if (opts.velocity !== undefined) body.v = opts.velocity\n    feel = !!opts.feel\n    if (opts.instant || o.reduce) {\n      land()\n      emit(0)\n      o.onRest?.(target, nearest(target).i)\n      return\n    }\n    if (mode === 'held') {\n      body.x = hand + residual.x\n      residual.x = residual.v = 0\n    }\n    spring = opts.spring ?? landing(o.spring ?? SPRING, opts.velocity ?? 0)\n    mode = 'settle'\n    start()\n  }\n\n  const api = {\n    get: () => shown,\n    place: () => body.x + (mode === 'rest' ? 0 : body.v / (span().o.catch ?? CATCH).w),\n    velocity: () => slope(body.x) * body.v,\n    mode: () => mode,\n    target: () => target,\n    nearest,\n\n    set(value: number) {\n      body.x = target = hand = value\n      body.v = residual.x = residual.v = 0\n      mode = 'rest'\n      feel = false\n      stop = -1\n      emit(0)\n      stop = nearest(shown).i\n    },\n    to,\n\n    grab(place: number, { feel: touching = true }: { feel?: boolean } = {}) {\n      const { o } = span()\n      residual.x = o.reduce ? 0 : body.x - place\n      residual.v = o.reduce ? 0 : body.v\n      hand = place\n      track.clear()\n      track.add(performance.now(), place)\n      feel = touching\n      mode = 'held'\n      start()\n    },\n    drag(place: number) {\n      if (mode !== 'held') return\n      hand = place\n      track.add(performance.now(), place)\n    },\n    release({ flick = true, home }: { flick?: boolean; home?: number } = {}) {\n      if (mode !== 'held') return\n      const { o, lo, hi } = span()\n      const flung = flick ? track.read(performance.now()) : 0\n      body.x = hand + residual.x\n      body.v = flung + residual.v\n      residual.x = residual.v = 0\n      const rest = home ?? nearest(clamp(body.x + flung * (o.throw ?? 0.16), lo, hi)).value\n      target = rest\n      spring = landing(o.spring ?? SPRING, body.v)\n      if (o.reduce) {\n        to(rest)\n        return\n      }\n      launch()\n    },\n    fling(velocity: number) {\n      const { o, lo, hi } = span()\n      const rest = nearest(clamp(body.x + velocity * (o.throw ?? 0.16), lo, hi)).value\n      if (o.reduce) return to(rest)\n      residual.x = residual.v = 0\n      body.v = velocity\n      feel = false\n      target = rest\n      spring = o.spring ?? SPRING\n      launch()\n    },\n    sweep(value: number, ms: number) {\n      const { o } = span()\n      if (o.reduce) return to(value)\n      residual.x = 0\n      residual.v = body.v\n      hand = body.x\n      sweep = { from: body.x, to: value, t: 0, T: Math.max(0.05, ms / 1000) }\n      feel = false\n      mode = 'sweep'\n      start()\n    },\n    step(by: number, repeat = false) {\n      const { o, s, lo, hi } = span()\n      const now = performance.now()\n      const quick = repeat || now - keyAt < 110\n      keyAt = now\n      if (!o.muted) feedback.wake()\n      const from = mode === 'rest' ? body.x : target\n      const next = s ? s[clamp(nearest(from).i + by, 0, s.length - 1)] : clamp(from + by, lo, hi)\n      to(next, { instant: quick, feel: !quick })\n      return next\n    },\n    wake: start,\n    dispose() {\n      cancelAnimationFrame(frame)\n      frame = 0\n    },\n  }\n  return api\n}\n\nexport function useDetent(options: Omit<DetentOptions, 'reduce'>) {\n  const reduce = !!useReducedMotion()\n  const latest = useRef<DetentOptions>({ ...options, reduce })\n  useLayoutEffect(() => {\n    latest.current = { ...options, reduce }\n  })\n  const [d] = useState(() => createDetent(() => latest.current))\n  useLayoutEffect(() => () => d.dispose(), [d])\n  return d\n}\n\nexport type DragConfig = {\n  axis?: 'x' | 'y'\n  box: () => HTMLElement | null\n  units: number\n  absolute?: (fraction: number) => number\n  hover?: boolean\n  follow?: boolean\n  onTap?: (fraction: number) => void\n  onLeave?: () => void\n  onGrab?: () => void\n  release?: () => { flick?: boolean; home?: number }\n  muted?: boolean\n}\n\nconst SLOP = { mouse: 5, touch: 10 }\n\nexport function dragProps(d: Detent, read: () => DragConfig) {\n  let press: { id: number; px: number; py: number; from: number; moved: boolean; held: boolean; caught: boolean } | null = null\n  const place = (e: ReactPointerEvent) => {\n    const c = read()\n    const r = c.box()?.getBoundingClientRect()\n    if (!r) return null\n    const horizontal = (c.axis ?? 'x') === 'x'\n    const size = (horizontal ? r.width : r.height) || 1\n    const px = horizontal ? e.clientX : e.clientY\n    return { fraction: (px - (horizontal ? r.left : r.top)) / size, px, unit: size / c.units, c }\n  }\n  const hand = (e: ReactPointerEvent) => {\n    const p = place(e)\n    if (!p || !press) return null\n    return p.c.absolute && !press.caught ? p.c.absolute(p.fraction) : press.from + (p.px - ((p.c.axis ?? 'x') === 'x' ? press.px : press.py)) / p.unit\n  }\n  const take = (e: ReactPointerEvent) => {\n    if (!press) return\n    const at = hand(e)\n    if (at === null) return\n    press.held = true\n    read().onGrab?.()\n    d.grab(at)\n  }\n  const inFlight = () => d.mode() !== 'rest' && d.mode() !== 'held' && d.mode() !== 'sweep'\n  return {\n    onPointerDown(e: ReactPointerEvent) {\n      if (e.button) return\n      const c = read()\n      if (!c.muted) feedback.wake(true)\n      e.currentTarget.setPointerCapture?.(e.pointerId)\n      press = { id: e.pointerId, px: e.clientX, py: e.clientY, from: d.place(), moved: false, held: false, caught: inFlight() && !c.follow }\n      if (e.pointerType !== 'touch' || press.caught || !c.absolute) take(e)\n    },\n    onPointerMove(e: ReactPointerEvent) {\n      const c = read()\n      if (!c.muted && e.pointerType === 'mouse') feedback.warm()\n      if (press) {\n        if (e.pointerId !== press.id) return\n        if (!press.moved && Math.hypot(e.clientX - press.px, e.clientY - press.py) > (e.pointerType === 'touch' ? SLOP.touch : SLOP.mouse)) press.moved = true\n        if (!press.held && press.moved) take(e)\n        const at = hand(e)\n        if (at !== null && press.held) d.drag(at)\n        return\n      }\n      if (!c.hover || e.pointerType !== 'mouse' || (inFlight() && !c.follow)) return\n      const p = place(e)\n      if (!p || !c.absolute) return\n      const at = c.absolute(p.fraction)\n      if (d.mode() === 'held') d.drag(at)\n      else {\n        c.onGrab?.()\n        d.grab(at, { feel: false })\n      }\n    },\n    onPointerUp(e: ReactPointerEvent) {\n      if (!press || e.pointerId !== press.id) return\n      const { moved, held } = press\n      const p = place(e)\n      const c = read()\n      press = null\n      if (!moved && c.onTap && p) {\n        if (held) d.release({ flick: false, home: d.get() })\n        c.onTap(p.fraction)\n      } else if (held) d.release(c.release?.())\n    },\n    onPointerCancel(e: ReactPointerEvent) {\n      if (!press || e.pointerId !== press.id) return\n      const { held } = press\n      press = null\n      if (held) d.release({ flick: false })\n      read().onLeave?.()\n    },\n    onPointerLeave(e: ReactPointerEvent) {\n      if (press || e.pointerType !== 'mouse') return\n      const c = read()\n      if (!c.hover) return\n      if (d.mode() === 'held') d.release({ flick: false, home: d.get() })\n      c.onLeave?.()\n    },\n  }\n}\n\nexport const stepKey = (d: Detent, e: KeyboardEvent, keys: Record<string, number> = { ArrowLeft: -1, ArrowRight: 1 }) => {\n  const by = keys[e.key]\n  if (!by) return false\n  e.preventDefault()\n  d.step(by, e.repeat)\n  return true\n}\n\nconst COLUMN = 'display:inline-block;height:1.25em;overflow:hidden;vertical-align:top'\nconst STRIP = '0123456789'\n\nexport function createRoller(el: HTMLElement, format: (n: number) => string, pad = 0, built?: (columns: HTMLElement[]) => void) {\n  let shape = ''\n  let wheels: { strip: HTMLElement; col: HTMLElement }[] = []\n  let scale = 1\n\n  const build = (s: string, digits: number) => {\n    el.textContent = ''\n    wheels = []\n    const col = () => {\n      const c = document.createElement('span')\n      c.style.cssText = COLUMN\n      const strip = document.createElement('span')\n      strip.style.cssText = 'display:block;will-change:transform'\n      strip.innerHTML = [...STRIP, '0'].map((n) => `<span style=\"display:block;height:1.25em\">${n}</span>`).join('')\n      c.append(strip)\n      el.append(c)\n      wheels.push({ strip, col: c })\n    }\n    let padded = Math.max(0, pad - digits)\n    let leading = true\n    for (const ch of s) {\n      if (/\\d/.test(ch)) {\n        if (leading) for (; padded > 0; padded--) col()\n        leading = false\n        col()\n      } else {\n        const c = document.createElement('span')\n        c.textContent = ch\n        c.style.whiteSpace = 'pre'\n        el.append(c)\n      }\n    }\n    built?.([...el.children] as HTMLElement[])\n  }\n\n  return (value: number, speed = 0) => {\n    const s = format(value)\n    const digits = s.replace(/\\D/g, '')\n    const next = s.replace(/\\d/g, '0')\n    if (next !== shape) {\n      shape = next\n      build(s, digits.length)\n    }\n    const numeric = s.replace(/[^\\d.]/g, '').replace(/\\.$/, '')\n    const shownNumber = parseFloat(numeric)\n    const decimals = numeric.includes('.') ? numeric.length - numeric.indexOf('.') - 1 : 0\n    if (shownNumber > 0) scale = Math.abs(value) / shownNumber\n    const place = Math.pow(10, -decimals) * (scale || 1)\n    const q = Math.abs(value) / place\n    const free = clamp(Math.abs(speed) / (place * 6), 0, 1)\n    const count = wheels.length\n    const whole = digits.padStart(count, '0')\n    for (let k = 0; k < count; k++) {\n      const { strip, col } = wheels[count - 1 - k]\n      const unit = Math.pow(10, k)\n      const lower = q % unit\n      const carry = k === 0 ? q - Math.floor(q) : clamp(lower - (unit - 1), 0, 1)\n      const running = (Math.floor(q / unit) % 10) + carry\n      const digit = +whole[count - 1 - k]\n      const off = ((digit - running + 15) % 10) - 5\n      const pos = (running + off * (1 - free) + 10) % 10\n      strip.style.transform = `translateY(${(-pos * 100) / 11}%)`\n      if (pad) {\n        const higher = Math.floor(q / unit)\n        const fade = k === 0 ? 1 : higher > 0 ? 1 : clamp(lower - (unit - 1), 0, 1)\n        col.style.opacity = String(fade)\n      }\n    }\n  }\n}\n\nexport const write = (el: HTMLElement | null | undefined, text: string) => {\n  if (el && el.textContent !== text) el.textContent = text\n}\n"},{"path":"components/detent/lib/feel.ts","target":"components/detent/lib/feel.ts","type":"registry:component","content":"export const tap = () => {\n  if (typeof window !== 'undefined') window.dispatchEvent(new Event('detent:tap'))\n}\n\nlet keyed = true\nif (typeof window !== 'undefined') {\n  window.addEventListener('keydown', () => void (keyed = true), true)\n  window.addEventListener('pointerdown', () => void (keyed = false), true)\n}\nexport const byKey = () => keyed\n"},{"path":"components/detent/icons/index.tsx","target":"components/detent/icons/index.tsx","type":"registry:component","content":"import type { SVGProps } from 'react'\n\ntype P = SVGProps<SVGSVGElement> & { size?: number }\n\nfunction Svg({ size = 20, children, ...rest }: P) {\n  return (\n    <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden {...rest}>\n      {children}\n    </svg>\n  )\n}\n\nexport const Close = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M7 7l10 10M17 7 7 17\" />\n  </Svg>\n)\n\nexport const Check = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M5 12.5l4.5 4.5L19 7.5\" />\n  </Svg>\n)\n\nexport const Plus = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M12 5v14M5 12h14\" />\n  </Svg>\n)\n\nexport const Bin = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"4\" y=\"4.5\" width=\"16\" height=\"3.6\" rx=\"1.8\" fill=\"currentColor\" stroke=\"none\" />\n    <path d=\"M9.5 4.5V3.8a1.3 1.3 0 0 1 1.3-1.3h2.4a1.3 1.3 0 0 1 1.3 1.3v.7\" />\n    <path d=\"M6 10.5l.8 8.4A2.2 2.2 0 0 0 9 21h6a2.2 2.2 0 0 0 2.2-2.1l.8-8.4\" />\n    <path d=\"M10.3 13v4.5M13.7 13v4.5\" />\n  </Svg>\n)\n\nexport const Undo = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M9 9h6.5a4.5 4.5 0 0 1 0 9H10\" />\n    <path d=\"M9.6 4.6 4.6 9l5 4.4z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Pause = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"6\" y=\"5\" width=\"4\" height=\"14\" rx=\"1.6\" fill=\"currentColor\" stroke=\"none\" />\n    <rect x=\"14\" y=\"5\" width=\"4\" height=\"14\" rx=\"1.6\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Upload = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M4 14.5v2.3A3.2 3.2 0 0 0 7.2 20h9.6a3.2 3.2 0 0 0 3.2-3.2v-2.3\" />\n    <path d=\"M12 15V7\" />\n    <path d=\"M12 3.2 7.6 8.2h8.8z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const FilePage = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M13.5 3H8a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3V8.5\" />\n    <path d=\"M13.5 3v3.5a2 2 0 0 0 2 2H19z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Picture = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3.5\" y=\"4.5\" width=\"17\" height=\"15\" rx=\"4\" />\n    <path d=\"M3.8 16.5 9 11.6a1.5 1.5 0 0 1 2.1 0l3.2 3 1.6-1.5a1.5 1.5 0 0 1 2.1 0l2.2 2.1V16a3.5 3.5 0 0 1-3.5 3.5H8A4 4 0 0 1 3.8 16.5z\" fill=\"currentColor\" stroke=\"none\" />\n    <circle cx=\"15.5\" cy=\"8.8\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Film = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3.5\" y=\"4.5\" width=\"17\" height=\"15\" rx=\"4\" />\n    <path d=\"M10.2 9.2v5.6a.7.7 0 0 0 1 .6l4.4-2.8a.7.7 0 0 0 0-1.2l-4.4-2.8a.7.7 0 0 0-1 .6z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Bubble = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M12 4c4.7 0 8.5 3.1 8.5 7s-3.8 7-8.5 7c-1 0-2-.1-2.9-.4L5 19.5l1.1-3.6C4.6 14.6 3.5 12.9 3.5 11c0-3.9 3.8-7 8.5-7z\" />\n    <circle cx=\"8.6\" cy=\"11\" r=\"1.15\" fill=\"currentColor\" stroke=\"none\" />\n    <circle cx=\"12\" cy=\"11\" r=\"1.15\" fill=\"currentColor\" stroke=\"none\" />\n    <circle cx=\"15.4\" cy=\"11\" r=\"1.15\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Card = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3\" y=\"5.5\" width=\"18\" height=\"13\" rx=\"3.5\" />\n    <rect x=\"3\" y=\"8.6\" width=\"18\" height=\"3\" fill=\"currentColor\" stroke=\"none\" />\n    <path d=\"M7 15h3\" />\n  </Svg>\n)\n\nexport const Bell = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M6 15.5V11a6 6 0 1 1 12 0v4.5l1.5 2H4.5z\" />\n    <path d=\"M9.6 19.5a2.6 2.6 0 0 0 4.8 0z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Ship = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M5 20h14\" />\n    <path d=\"M12 16V9\" />\n    <path d=\"M12 3.5 7 9.2h10z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Mention = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"12\" cy=\"12\" r=\"3.4\" fill=\"currentColor\" stroke=\"none\" />\n    <path d=\"M15.4 12v1.4a2.6 2.6 0 0 0 5.1.7A8.5 8.5 0 1 0 16 19.5\" />\n  </Svg>\n)\n\nexport const Calendar = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3.5\" y=\"5\" width=\"17\" height=\"15.5\" rx=\"4\" />\n    <path d=\"M3.5 9A4 4 0 0 1 7.5 5h9a4 4 0 0 1 4 4v1H3.5z\" fill=\"currentColor\" stroke=\"none\" />\n    <path d=\"M8 3v3M16 3v3\" />\n  </Svg>\n)\n\nexport const ChevronDown = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M6.5 9.5 12 15l5.5-5.5\" />\n  </Svg>\n)\n\nexport const ArrowUpRight = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M8 16 16 8\" />\n    <path d=\"M9.5 6.8h7.7v7.7z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Sun = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"12\" cy=\"12\" r=\"4.2\" fill=\"currentColor\" stroke=\"none\" />\n    {[0, 45, 90, 135, 180, 225, 270, 315].map((a) => {\n      const r = (a * Math.PI) / 180\n      return <circle key={a} cx={12 + Math.cos(r) * 8.4} cy={12 + Math.sin(r) * 8.4} r=\"1.1\" fill=\"currentColor\" stroke=\"none\" />\n    })}\n  </Svg>\n)\n\nexport const Moon = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M19.5 14.6A8 8 0 0 1 9.4 4.5a8 8 0 1 0 10.1 10.1z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Expand = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M14 4h6v6M10 20H4v-6\" />\n    <path d=\"M20 4l-6 6M4 20l6-6\" />\n  </Svg>\n)\n\nexport const Inspect = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M4 9V6.5A2.5 2.5 0 0 1 6.5 4H9M15 4h2.5A2.5 2.5 0 0 1 20 6.5V9M4 15v2.5A2.5 2.5 0 0 0 6.5 20H9\" />\n    <path d=\"M13.2 13.2l7.3 2.5-3.1 1.3-1.3 3.1z\" fill=\"currentColor\" strokeWidth={1.5} />\n  </Svg>\n)\n\nexport const Folder = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M3.5 9.5V17a3 3 0 0 0 3 3h11a3 3 0 0 0 3-3v-6.5a3 3 0 0 0-3-3h-6\" />\n    <path d=\"M3.5 7A2.5 2.5 0 0 1 6 4.5h3.2a2 2 0 0 1 1.6.8l1.5 2.2H3.5z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Copy = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"4\" y=\"4\" width=\"11\" height=\"11\" rx=\"3\" fill=\"currentColor\" stroke=\"none\" />\n    <rect x=\"9\" y=\"9\" width=\"11\" height=\"11\" rx=\"3\" fill=\"var(--icon-cutout, white)\" />\n  </Svg>\n)\n\nexport const Cookie = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M20.6 12.6a8.6 8.6 0 1 1-9.2-9.2 3 3 0 0 0 3.6 3.6 3 3 0 0 0 5.6 5.6z\" />\n    <circle cx=\"9.2\" cy=\"10.4\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\" />\n    <circle cx=\"14.5\" cy=\"15.3\" r=\"1.1\" fill=\"currentColor\" stroke=\"none\" />\n    <circle cx=\"8.8\" cy=\"15.6\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Clock = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"12\" cy=\"12\" r=\"8.5\" />\n    <path d=\"M12 7.2v5.2l3.4 2.1\" strokeWidth={2.4} />\n  </Svg>\n)\n\nexport const ArrowLeft = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M19 12H7\" />\n    <path d=\"M10.5 6.5 4.5 12l6 5.5z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Mail = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3.5\" y=\"5.5\" width=\"17\" height=\"13\" rx=\"3.5\" />\n    <path d=\"M4.4 7.6A3.5 3.5 0 0 1 7 5.5h10a3.5 3.5 0 0 1 2.6 2.1L12 13z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const ArrowUp = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M12 20v-9\" />\n    <path d=\"M12 3.8 6.6 10.2h10.8z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Stop = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"6.5\" y=\"6.5\" width=\"11\" height=\"11\" rx=\"3\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Bolt = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M13.2 3.2 5.8 13h5.6l-.6 7.8 7.4-9.8h-5.6z\" fill=\"currentColor\" strokeWidth={1.6} />\n  </Svg>\n)\n\nexport const Orbit = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M18.06 8.5A7 7 0 1 1 15.5 5.94\" />\n    <circle cx=\"16.95\" cy=\"7.05\" r=\"2.1\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Search = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"10.5\" cy=\"10.5\" r=\"6.2\" />\n    <path d=\"M14.9 17.1a1.55 1.55 0 0 1 2.2-2.2l3 3a1.55 1.55 0 0 1-2.2 2.2z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Minus = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M5 12h14\" />\n  </Svg>\n)\n\nexport const Chevrons = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M8 9.5 12 5.5l4 4M8 14.5l4 4 4-4\" />\n  </Svg>\n)\n\nexport const Pencil = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M14.5 5.5 18.5 9.5 9 19H5v-4z\" />\n    <path d=\"M16.2 3.8a2 2 0 0 1 2.8 0l1.2 1.2a2 2 0 0 1 0 2.8l-1.4 1.4-4-4z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const ArrowRight = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M5 12h12\" />\n    <path d=\"M13.5 6.5 19.5 12l-6 5.5z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Cup = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M5 8h11v6a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5z\" />\n    <path d=\"M16 10h1.5a2.5 2.5 0 0 1 0 5H16\" />\n    <path d=\"M5 8h11v3H5z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Bag = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M5.5 8h13l-1 11.2a2 2 0 0 1-2 1.8h-7a2 2 0 0 1-2-1.8z\" />\n    <path d=\"M9 11V7a3 3 0 0 1 6 0v4\" />\n    <path d=\"M5.6 8h12.8l-.25 3H5.85z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Note = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3\" y=\"6\" width=\"18\" height=\"12\" rx=\"3\" />\n    <circle cx=\"12\" cy=\"12\" r=\"2.6\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Plane = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M20.5 3.5 3.5 10.6l6.3 2.9 2.9 6.3z\" />\n    <path d=\"M20.5 3.5 9.8 13.5l2.9 6.3z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Building = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M5 21V6a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v15M16 10h2a2 2 0 0 1 2 2v9M3 21h18\" />\n    <rect x=\"8.5\" y=\"15.5\" width=\"4\" height=\"5.5\" rx=\"1\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const FolderOpen = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M3.5 16.5V7A2.5 2.5 0 0 1 6 4.5h3.2a2 2 0 0 1 1.6.8l1.5 2.2H17a2.5 2.5 0 0 1 2.5 2.5v1\" />\n    <path d=\"M3.5 7A2.5 2.5 0 0 1 6 4.5h3.2a2 2 0 0 1 1.6.8l1.5 2.2H3.5z\" fill=\"currentColor\" stroke=\"none\" />\n    <path d=\"M5.6 11.5h15a1 1 0 0 1 .96 1.27l-1.55 5.6A2.2 2.2 0 0 1 17.9 20H6.1a2.6 2.6 0 0 1-2.6-2.6v-3.8a2.1 2.1 0 0 1 2.1-2.1z\" />\n  </Svg>\n)\n\nexport const Code = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M8 7.5 3.5 12 8 16.5M16 7.5l4.5 4.5-4.5 4.5\" />\n    <path d=\"M13.2 4.6a1 1 0 0 1 1.9.6l-4.3 14.2a1 1 0 0 1-1.9-.6z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Wrench = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M15.4 3.6a4.6 4.6 0 0 0-4.3 6.1l-6.6 6.6a2.2 2.2 0 1 0 3.1 3.1l6.6-6.6a4.6 4.6 0 0 0 6.1-4.3l-2.9 2.9-2.6-.6-.6-2.6z\" />\n    <circle cx=\"6\" cy=\"17.9\" r=\"1.1\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Prompt = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M5 7.5 9.5 12 5 16.5\" />\n    <rect x=\"11.5\" y=\"15\" width=\"8\" height=\"2.4\" rx=\"1.2\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Node = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"12\" cy=\"12\" r=\"8\" />\n    <circle cx=\"12\" cy=\"12\" r=\"3.2\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Refresh = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M19.2 13.2A7.4 7.4 0 1 1 16.8 6\" />\n    <path d=\"M19.6 3.4v6.2h-6.2z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Thumb = ({ down, ...p }: P & { down?: boolean }) => (\n  <Svg {...p} style={{ transform: down ? 'scale(1, -1)' : undefined, ...p.style }}>\n    <path d=\"M8 10.5 11.5 4a1.7 1.7 0 0 1 3.1 1.2l-.7 4h5a2 2 0 0 1 2 2.4l-1.2 6.3A2 2 0 0 1 17.7 19.5H8\" />\n    <rect x=\"3\" y=\"10.5\" width=\"5\" height=\"9\" rx=\"1.6\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Chart = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M3.5 17.5 8.5 12l3.5 3.5 5-6\" />\n    <circle cx=\"19.2\" cy=\"7\" r=\"2.6\" fill=\"currentColor\" stroke=\"none\" />\n    <path d=\"M3.5 20.5h17\" />\n  </Svg>\n)\n\nexport const Table = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3.5\" y=\"4.5\" width=\"17\" height=\"15\" rx=\"3.5\" />\n    <path d=\"M3.5 8a3.5 3.5 0 0 1 3.5-3.5h10A3.5 3.5 0 0 1 20.5 8v1.5h-17z\" fill=\"currentColor\" stroke=\"none\" />\n    <path d=\"M10 9.5v10M3.5 14.5h17\" />\n  </Svg>\n)\n\nexport const Play = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M8 5.8v12.4l9.6-6.2z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Grip = (p: P) => (\n  <Svg {...p} strokeWidth={3.2}>\n    <path d=\"M9 6.5h.01M15 6.5h.01M9 12h.01M15 12h.01M9 17.5h.01M15 17.5h.01\" />\n  </Svg>\n)\n\nexport const Mic = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"9\" y=\"3\" width=\"6\" height=\"11.5\" rx=\"3\" fill=\"currentColor\" stroke=\"none\" />\n    <path d=\"M5.5 11.5a6.5 6.5 0 0 0 13 0M12 18v3\" />\n  </Svg>\n)\n\nexport const Speaker = ({ muted, ...p }: P & { muted?: boolean }) => (\n  <Svg {...p}>\n    <path d=\"M4 9.5h3.2L12 5.5v13l-4.8-4H4z\" fill=\"currentColor\" />\n    {muted ? <path d=\"M16 9.5l4.5 5M20.5 9.5l-4.5 5\" /> : <path d=\"M15.5 9a4.2 4.2 0 0 1 0 6M18.2 6.5a8 8 0 0 1 0 11\" />}\n  </Svg>\n)\n\nexport const ChevronRight = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M10 6.5l5.5 5.5-5.5 5.5\" />\n  </Svg>\n)\n\nexport const Layers = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M8 4.5h9.5A2.5 2.5 0 0 1 20 7v9.5\" />\n    <rect x=\"4\" y=\"8\" width=\"12\" height=\"12\" rx=\"2.5\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Link = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M10.5 13.5a3.5 3.5 0 0 0 5 0l3-3a3.5 3.5 0 0 0-5-5l-.8.8\" />\n    <path d=\"M13.5 10.5a3.5 3.5 0 0 0-5 0l-3 3a3.5 3.5 0 0 0 5 5l.8-.8\" />\n    <circle cx=\"12\" cy=\"12\" r=\"1.4\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const More = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"6\" cy=\"12\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\" />\n    <circle cx=\"12\" cy=\"12\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\" />\n    <circle cx=\"18\" cy=\"12\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Eye = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z\" />\n    <circle cx=\"12\" cy=\"12\" r=\"3\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const EyeOff = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M6.6 7.2C4 8.9 2.5 12 2.5 12S6 18.5 12 18.5c1.9 0 3.5-.6 4.9-1.5M10 5.7c.6-.1 1.3-.2 2-.2 6 0 9.5 6.5 9.5 6.5s-.8 1.5-2.3 3.1\" />\n    <path d=\"M4 4l16 16\" strokeWidth={2.4} />\n  </Svg>\n)\n\nexport const Alert = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"12\" cy=\"12\" r=\"9\" />\n    <path d=\"M12 7.5v5.5\" />\n    <circle cx=\"12\" cy=\"16.4\" r=\"1.25\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Spark = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"12\" cy=\"12\" r=\"9\" />\n    <path d=\"M12.8 6.5 8.6 12.6h3.1l-.6 4.9 4.3-6.2h-3.1z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Cube = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M12 3.2 19.6 7.4v9.2L12 20.8l-7.6-4.2V7.4z\" />\n    <path d=\"M12 3.2 19.6 7.4 12 11.6 4.4 7.4z\" fill=\"currentColor\" stroke=\"none\" />\n    <path d=\"M12 11.6v9.2\" />\n  </Svg>\n)\n\nexport const Plug = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M6.5 9.5h11v2.5a5.5 5.5 0 0 1-11 0z\" />\n    <path d=\"M12 17.5V21\" />\n    <rect x=\"8.2\" y=\"3\" width=\"2.2\" height=\"6\" rx=\"1.1\" fill=\"currentColor\" stroke=\"none\" />\n    <rect x=\"13.6\" y=\"3\" width=\"2.2\" height=\"6\" rx=\"1.1\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Fork = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M4 12h6\" />\n    <path d=\"M10 12c3 0 4-5.5 8.5-5.5M10 12c3 0 4 5.5 8.5 5.5\" />\n    <path d=\"M16.5 4.5l2.2 2-2.2 2M16.5 15.5l2.2 2-2.2 2\" />\n    <circle cx=\"10\" cy=\"12\" r=\"2.2\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Shield = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M12 3 19 5.8v5.4c0 4.4-3 7.9-7 9.8-4-1.9-7-5.4-7-9.8V5.8z\" />\n    <path d=\"m8.6 11.8 2.4 2.4 4.6-4.8\" strokeWidth={2.4} />\n  </Svg>\n)\n\nexport const Send = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M20.5 3.5 3.5 10.3l6.6 2.9 2.9 6.6z\" />\n    <path d=\"M20.5 3.5 10.1 13.2l2.9 6.6z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Redo = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M15 9H8.5a4.5 4.5 0 0 0 0 9H14\" />\n    <path d=\"M14.4 4.6 19.4 9l-5 4.4z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Captions = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3.5\" y=\"5.5\" width=\"17\" height=\"13\" rx=\"3.5\" />\n    <path d=\"M7.6 11.2h4.2a1.2 1.2 0 0 1 0 2.4H7.6a1.2 1.2 0 0 1 0-2.4zM7.6 14.6h8.8a1.2 1.2 0 0 1 0 2.4H7.6a1.2 1.2 0 0 1 0-2.4z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Sliders = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M4 8h16M4 16h16\" />\n    <path d=\"M9 5.2a2.8 2.8 0 1 1 0 5.6 2.8 2.8 0 0 1 0-5.6zM15 13.2a2.8 2.8 0 1 1 0 5.6 2.8 2.8 0 0 1 0-5.6z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Pip = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3.5\" y=\"5.5\" width=\"17\" height=\"13\" rx=\"3.5\" />\n    <rect x=\"11.5\" y=\"11\" width=\"6.5\" height=\"5\" rx=\"1.4\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Shrink = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M10 4v6H4M14 20v-6h6\" />\n    <path d=\"M4 4l6 6M20 20l-6-6\" />\n  </Svg>\n)\n\nexport const RotateLeft = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"9\" y=\"9.5\" width=\"11\" height=\"10.5\" rx=\"2.4\" />\n    <path d=\"M12.5 5.5H9a5 5 0 0 0-5 5v2\" />\n    <path d=\"M12.2 2.6 15.6 5.5l-3.4 2.9z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const FlipH = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M12 3.5v17\" strokeDasharray=\"2 2.6\" />\n    <path d=\"M9 7.5 3.5 17H9z\" />\n    <path d=\"M15 7.5 20.5 17H15z\" fill=\"currentColor\" />\n  </Svg>\n)\n"},{"path":"components/detent/lib/motion.ts","target":"components/detent/lib/motion.ts","type":"registry:component","content":"export const ease = {\n  out: [0.2, 0.9, 0.25, 1] as const,\n  inOut: [0.6, 0, 0.3, 1] as const,\n}\n\nexport const dur = {\n  exit: 0.12,\n  hover: 0.15,\n  enter: 0.2,\n  swap: 0.24,\n  panel: 0.34,\n}\n\nexport const spring = {\n  snappy: { type: 'spring', stiffness: 560, damping: 42, mass: 0.6 } as const,\n  smooth: { type: 'spring', bounce: 0, duration: 0.36 } as const,\n  soft: { type: 'spring', bounce: 0.12, duration: 0.5 } as const,\n  release: { type: 'spring', stiffness: 320, damping: 32 } as const,\n  move: { type: 'spring', stiffness: 420, damping: 38 } as const,\n  data: { type: 'spring', stiffness: 170, damping: 26 } as const,\n  pop: { type: 'spring', bounce: 0.3, duration: 0.4 } as const,\n}\n\nexport const appear = {\n  initial: { opacity: 0, scale: 0.96 },\n  animate: { opacity: 1, scale: 1, transition: { duration: dur.swap, ease: ease.out } },\n  exit: { opacity: 0, scale: 0.97, transition: { duration: dur.exit, ease: ease.out } },\n}\n\nexport const slide = {\n  enter: (dir: number) => ({ x: dir * 24, opacity: 0 }),\n  center: { x: 0, opacity: 1 },\n  exit: (dir: number) => ({ x: dir * -24, opacity: 0 }),\n}\n\nexport const press = { scale: 0.97 }\n\nexport const staggerFor = (count: number) => Math.min(0.04, 0.2 / Math.max(1, count))\n"}]}