{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"rewrite","title":"Rewrite","description":"Select a phrase, say how it should read, and watch it rewritten in place like a tracked change. Tab takes it.","type":"registry:component","author":"Detent","dependencies":["motion"],"registryDependencies":["https://detentui.com/r/theme.json"],"files":[{"path":"components/detent/components/rewrite/Rewrite.tsx","target":"components/detent/components/rewrite/Rewrite.tsx","type":"registry:component","content":"'use client'\n\nimport { useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from 'react'\nimport type { KeyboardEvent, Ref } from 'react'\nimport { AnimatePresence, motion, useReducedMotion } from 'motion/react'\nimport { ArrowUp, Check, Orbit, Refresh } from '@/components/detent/icons'\nimport { tap } from '@/components/detent/lib/feel'\nimport { Kbd } from '@/components/detent/ui/Kbd'\nimport { Glow, aiText, useTone } from '@/components/detent/ui/Intelligence'\nimport { Sweep } from '@/components/detent/ui/Outcome'\nimport { ease, dur, spring, press } from '@/components/detent/lib/motion'\n\ntype Phase = 'idle' | 'selected' | 'working' | 'review'\nexport type RewriteHandle = { select(start: number, end: number): void; ask(text: string): void; run(action?: string): void; accept(): void; reject(): void }\n\nconst PACE = 34\nconst BAR_W = 420\n\nconst count = (s: string) => s.trim().split(/\\s+/).filter(Boolean).length\n\nexport function Rewrite({\n  text: initial,\n  rewrite,\n  actions = ['Shorter', 'Friendlier'],\n  assistant = 'Detent',\n  onChange,\n  ref,\n}: {\n  text: string\n  rewrite: (selected: string, ask: string) => Promise<string>\n  actions?: string[]\n  assistant?: string\n  onChange?: (text: string) => void\n  ref?: Ref<RewriteHandle>\n}) {\n  const [text, setText] = useState(initial)\n  const [range, setRange] = useState<[number, number] | null>(null)\n  const [phase, setPhase] = useState<Phase>('idle')\n  const [ask, setAsk] = useState('')\n  const [asked, setAsked] = useState('')\n  const [next, setNext] = useState('')\n  const [shown, setShown] = useState(0)\n  const [landed, setLanded] = useState<{ at: number; from: number; to: number } | null>(null)\n  const [bar, setBar] = useState({ x: 0, y: 0, w: BAR_W })\n  const para = useRef<HTMLParagraphElement>(null)\n  const mark = useRef<HTMLSpanElement>(null)\n  const field = useRef<HTMLInputElement>(null)\n  const byHand = useRef(false)\n  const runId = useRef(0)\n  const reduce = useReducedMotion()\n  const tone = useTone(phase === 'working', 'inline-edit')\n\n  const before = range ? text.slice(0, range[0]) : text\n  const picked = range ? text.slice(range[0], range[1]) : ''\n  const after = range ? text.slice(range[1]) : ''\n  const words = next.split(' ')\n  const streaming = phase === 'review' && shown < words.length\n  const delta = count(next) - count(picked)\n\n  useLayoutEffect(() => {\n    const m = mark.current\n    const p = para.current\n    if (!m || !p) return\n    const w = Math.min(BAR_W, p.offsetWidth)\n    setBar({ x: Math.min(Math.max(0, m.offsetLeft - 12), Math.max(0, p.offsetWidth - w)), y: m.offsetTop + m.offsetHeight + 10, w })\n  }, [range, phase, text, shown])\n\n  useEffect(() => {\n    if (phase === 'selected' && byHand.current) field.current?.focus({ preventScroll: true })\n  }, [phase])\n\n  const select = (start: number, end: number, hand = false) => {\n    if (phase === 'working' || phase === 'review') return\n    const s = Math.max(0, Math.min(start, end))\n    const e = Math.min(text.length, Math.max(start, end))\n    if (e - s < 2) return clear()\n    byHand.current = hand\n    setRange([s, e])\n    setAsk('')\n    setPhase('selected')\n  }\n  const clear = () => {\n    runId.current++\n    setRange(null)\n    setPhase('idle')\n    setNext('')\n    setAsk('')\n  }\n  const run = async (how = ask) => {\n    if (!range || !how.trim()) return\n    tap()\n    const me = ++runId.current\n    setAsked(how.trim())\n    setPhase('working')\n    setNext('')\n    setShown(0)\n    const out = await rewrite(picked, how.trim())\n    if (runId.current !== me) return\n    setNext(out)\n    setPhase('review')\n  }\n  useEffect(() => {\n    if (phase !== 'review' || shown >= words.length) return\n    const t = setTimeout(() => setShown((n) => n + 1), reduce ? 0 : PACE)\n    return () => clearTimeout(t)\n  }, [phase, shown, words.length, reduce])\n\n  const accept = () => {\n    if (phase !== 'review' || !range || streaming) return\n    tap()\n    const updated = before + next + after\n    setText(updated)\n    setLanded({ at: Date.now(), from: range[0], to: range[0] + next.length })\n    setRange(null)\n    setPhase('idle')\n    setAsk('')\n    onChange?.(updated)\n  }\n  const reject = () => {\n    if (phase === 'idle') return\n    tap()\n    clear()\n  }\n\n  const latest = useRef({ select, run, accept, reject })\n  useLayoutEffect(() => {\n    latest.current = { select, run, accept, reject }\n  })\n  useImperativeHandle(\n    ref,\n    () => ({\n      select: (s, e) => latest.current.select(s, e),\n      ask: (t) => setAsk(t),\n      run: (a) => latest.current.run(a),\n      accept: () => latest.current.accept(),\n      reject: () => latest.current.reject(),\n    }),\n    [],\n  )\n\n  const onUp = () => {\n    const sel = window.getSelection()\n    const p = para.current\n    if (!sel || !p || sel.rangeCount === 0 || phase === 'working' || phase === 'review') return\n    const r = sel.getRangeAt(0)\n    if (!p.contains(r.startContainer) || !p.contains(r.endContainer)) return\n    const pre = document.createRange()\n    pre.selectNodeContents(p)\n    pre.setEnd(r.startContainer, r.startOffset)\n    const start = pre.toString().length\n    select(start, start + r.toString().length, true)\n    sel.removeAllRanges()\n  }\n\n  const onKey = (e: KeyboardEvent) => {\n    if (e.key === 'Tab' && phase === 'review') {\n      e.preventDefault()\n      accept()\n    } else if (e.key === 'Escape' && phase !== 'idle') {\n      e.preventDefault()\n      reject()\n    }\n  }\n\n  useEffect(() => {\n    if (!landed) return\n    const t = setTimeout(() => setLanded(null), 1800)\n    return () => clearTimeout(t)\n  }, [landed])\n  const fresh = landed && phase === 'idle' ? landed : null\n  const doing = asked.length > 28 ? 'Rewriting it your way' : `Making it ${asked.toLowerCase()}`\n\n  return (\n    <div className=\"relative\" onKeyDown={onKey}>\n      <p ref={para} onPointerUp={onUp} className=\"relative text-body leading-[27px] text-ink-2 selection:bg-[color-mix(in_oklch,var(--dt-accent)_22%,transparent)]\">\n        {fresh ? (\n          <>\n            {text.slice(0, fresh.from)}\n            <span className=\"relative rounded-[3px] text-ink transition-colors ease-detent duration-700\">\n              {text.slice(fresh.from, fresh.to)}\n              <Sweep k={fresh.at} />\n            </span>\n            {text.slice(fresh.to)}\n          </>\n        ) : range ? (\n          <>\n            {before}\n            <span ref={mark}>\n              <span\n                className={`rounded-[3px] transition-[color,background-color] ease-detent duration-200 ${\n                  phase === 'review'\n                    ? 'bg-[color-mix(in_oklch,var(--danger)_7%,transparent)] text-ink-3 line-through decoration-[color-mix(in_oklch,var(--danger)_70%,transparent)] decoration-[1.5px]'\n                    : phase === 'working'\n                      ? 'sheen'\n                      : 'bg-[color-mix(in_oklch,var(--dt-accent)_16%,transparent)] text-ink'\n                }`}\n              >\n                {picked}\n              </span>\n              {phase === 'review' && (\n                <span className=\"rounded-[3px] bg-[color-mix(in_oklch,var(--dt-accent)_12%,transparent)] text-[var(--dt-accent-ink,var(--dt-accent))]\">\n                  {' '}\n                  {words.map((w, i) => (\n                    <span key={i} className={i < shown ? (reduce ? '' : 'word-in') : 'invisible'}>\n                      {i > 0 && ' '}\n                      {w}\n                    </span>\n                  ))}\n                </span>\n              )}\n            </span>\n            {after}\n          </>\n        ) : (\n          text\n        )}\n      </p>\n\n      <AnimatePresence>\n        {range && (\n          <motion.div\n            key=\"bar\"\n            role=\"toolbar\"\n            aria-label={`Edit with ${assistant}`}\n            className=\"absolute z-10\"\n            style={{ left: bar.x, top: bar.y, width: bar.w, transformOrigin: '0% 0%' }}\n            initial={{ opacity: 0, y: -6, scale: 0.97 }}\n            animate={{ opacity: 1, y: 0, scale: 1 }}\n            exit={{ opacity: 0, y: -4, scale: 0.98, transition: { duration: dur.exit, ease: ease.out } }}\n            transition={spring.snappy}\n          >\n            <Glow on={phase === 'working'} layer=\"halo\" radius={14} tone={tone} />\n            <div className=\"relative flex h-11 items-center gap-1 rounded-[14px] bg-surface p-1 shadow-modal\">\n              <AnimatePresence initial={false} mode=\"popLayout\">\n                {phase === 'selected' && (\n                  <motion.form\n                    key=\"ask\"\n                    className=\"flex min-w-0 flex-1 items-center gap-1\"\n                    onSubmit={(e) => {\n                      e.preventDefault()\n                      run()\n                    }}\n                    initial={{ opacity: 0 }}\n                    animate={{ opacity: 1 }}\n                    exit={{ opacity: 0, transition: { duration: dur.exit, ease: ease.out } }} transition={{ duration: dur.enter, ease: ease.out }}\n                  >\n                    <span className=\"grid size-8 shrink-0 place-items-center text-[var(--dt-accent-ink,var(--dt-accent))]\">\n                      <Orbit size={16} />\n                    </span>\n                    <input\n                      ref={field}\n                      value={ask}\n                      onChange={(e) => setAsk(e.target.value)}\n                      placeholder={`Ask ${assistant} to change it`}\n                      aria-label={`Ask ${assistant} to change the selection`}\n                      className=\"h-8 min-w-0 flex-1 bg-transparent text-footnote text-ink outline-none placeholder:text-ink-3\"\n                    />\n                    {ask.trim() ? (\n                      <motion.button whileTap={press} type=\"submit\" aria-label=\"Rewrite\" className=\"ring-focus grid size-8 shrink-0 place-items-center rounded-[10px] bg-ink text-surface\">\n                        <ArrowUp size={14} strokeWidth={2.4} />\n                      </motion.button>\n                    ) : (\n                      actions.map((a) => (\n                        <motion.button whileTap={press} key={a} type=\"button\" onClick={() => run(a)} className=\"ring-focus h-8 shrink-0 rounded-[10px] bg-surface-2 px-2.5 text-footnote font-medium text-ink-2 transition-colors ease-detent hover:text-ink\">\n                          {a}\n                        </motion.button>\n                      ))\n                    )}\n                  </motion.form>\n                )}\n                {phase === 'working' && (\n                  <motion.span key=\"work\" className=\"flex flex-1 items-center gap-2 px-2 text-footnote\" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0, transition: { duration: dur.exit, ease: ease.out } }} transition={{ duration: dur.enter, ease: ease.out }}>\n                    <span className=\"grid size-6 place-items-center text-[var(--dt-accent-ink,var(--dt-accent))]\">\n                      <Orbit size={16} className=\"motion-safe:animate-spin [animation-duration:2.4s]\" />\n                    </span>\n                    <span className={`min-w-0 flex-1 truncate ${aiText(tone)}`}>{doing}</span>\n                    <motion.button whileTap={press} type=\"button\" onClick={reject} className=\"ring-focus flex h-8 items-center gap-1.5 rounded-[10px] px-2.5 text-footnote font-medium text-ink-3 hover:bg-surface-2 hover:text-ink\">\n                      Stop <Kbd>Esc</Kbd>\n                    </motion.button>\n                  </motion.span>\n                )}\n                {phase === 'review' && (\n                  <motion.span key=\"decide\" className=\"flex flex-1 items-center gap-1\" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0, transition: { duration: dur.exit, ease: ease.out } }} transition={{ duration: dur.enter, ease: ease.out }}>\n                    <span className={`tnum min-w-0 flex-1 truncate px-2 text-caption ${streaming ? 'opacity-0' : ''} transition-opacity ease-detent duration-300 ${delta < 0 ? 'text-[color-mix(in_oklch,var(--ok)_80%,var(--ink))]' : 'text-ink-3'}`}>\n                      {delta === 0 ? 'Same length' : `${delta < 0 ? '−' : '+'}${Math.abs(delta)} words`}\n                    </span>\n                    <motion.button whileTap={press} type=\"button\" aria-label=\"Try again\" title=\"Try again\" onClick={() => run(asked)} className=\"ring-focus grid size-8 place-items-center rounded-[10px] text-ink-3 hover:bg-surface-2 hover:text-ink\">\n                      <Refresh size={14} />\n                    </motion.button>\n                    <motion.button whileTap={press} type=\"button\" onClick={reject} className=\"ring-focus flex h-8 items-center gap-1.5 rounded-[10px] px-2.5 text-footnote font-medium text-ink-2 hover:bg-surface-2 hover:text-ink\">\n                      Undo <span className=\"contents @max-[420px]:hidden pointer-coarse:hidden\"><Kbd>Esc</Kbd></span>\n                    </motion.button>\n                    <motion.button whileTap={press} type=\"button\" onClick={accept} disabled={streaming} className=\"ring-focus flex h-8 items-center gap-1.5 rounded-[10px] bg-ink px-3 text-footnote font-medium text-surface transition-opacity ease-detent disabled:opacity-50\">\n                      <Check size={13} strokeWidth={2.6} /> Accept <span className=\"contents @max-[420px]:hidden pointer-coarse:hidden\"><Kbd onInk>Tab</Kbd></span>\n                    </motion.button>\n                  </motion.span>\n                )}\n              </AnimatePresence>\n              <Glow on={phase === 'working'} layer=\"ring\" radius={14} tone={tone} />\n            </div>\n          </motion.div>\n        )}\n      </AnimatePresence>\n      <p className=\"sr-only\" aria-live=\"polite\">\n        {phase === 'working' ? `${assistant} is rewriting the selection` : phase === 'review' && !streaming ? `Suggestion ready: ${next}. Press Tab to accept or Escape to undo.` : ''}\n      </p>\n    </div>\n  )\n}\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/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/ui/Kbd.tsx","target":"components/detent/ui/Kbd.tsx","type":"registry:component","content":"'use client'\n\nfunction Return() {\n  return (\n    <svg width={12} height={12} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2.25} strokeLinecap=\"round\" strokeLinejoin=\"round\" role=\"img\" aria-label=\"Return\">\n      <path d=\"M18.5 5.5V11a3 3 0 0 1-3 3H5.5M10 9.5 5.5 14l4.5 4.5\" />\n    </svg>\n  )\n}\n\nexport function keyLabel(text: string) {\n  return text\n    .split(/(↵)/)\n    .filter(Boolean)\n    .map((part, i) => (part === '↵' ? <Return key={i} /> : part))\n}\n\nexport function Kbd({ children, onInk = false }: { children: string; onInk?: boolean }) {\n  return (\n    <kbd\n      className={`inline-flex pointer-coarse:hidden h-5 min-w-5 items-center justify-center gap-px rounded-chip px-1 font-sans text-caption font-medium leading-none ${\n        onInk ? 'bg-[color-mix(in_oklch,var(--surface)_16%,transparent)] text-[color-mix(in_oklch,var(--surface)_72%,transparent)]' : 'bg-surface-2 text-ink-2'\n      }`}\n    >\n      {keyLabel(children)}\n    </kbd>\n  )\n}\n"},{"path":"components/detent/ui/Intelligence.tsx","target":"components/detent/ui/Intelligence.tsx","type":"registry:component","content":"'use client'\n\nimport { useLayoutEffect, useRef, useState } from 'react'\nimport { AnimatePresence, motion } from 'motion/react'\nimport type { MotionStyle } from 'motion/react'\nimport { ease } from '@/components/detent/lib/motion'\n\nexport type Tone = 'loud' | 'quiet'\n\nconst ended = new Map<string, number>()\n\nexport function useTone(on: boolean, surface: string, rest = 120_000): Tone {\n  const [tone, setTone] = useState<Tone>('loud')\n  const was = useRef(false)\n  useLayoutEffect(() => {\n    if (on && !was.current) {\n      const last = ended.get(surface)\n      setTone(last === undefined || performance.now() - last > rest ? 'loud' : 'quiet')\n    }\n    if (!on && was.current) ended.set(surface, performance.now())\n    was.current = on\n    return () => {\n      if (was.current) ended.set(surface, performance.now())\n    }\n  }, [on, surface, rest])\n  return tone\n}\n\nexport function Glow({\n  on,\n  layer,\n  radius,\n  style,\n  className = '',\n  tone = 'loud',\n}: {\n  on: boolean\n  layer: 'halo' | 'ring'\n  radius: number | string\n  style?: MotionStyle\n  className?: string\n  tone?: Tone\n}) {\n  return (\n    <AnimatePresence>\n      {on && !(layer === 'halo' && tone === 'quiet') && (\n        <motion.span\n          aria-hidden\n          className={`${layer === 'halo' ? 'ai-halo' : 'ai-ring'} ${tone === 'quiet' ? 'ai-quiet' : ''} ${className}`}\n          style={{ borderRadius: radius, ...style }}\n          initial={{ opacity: 0 }}\n          animate={{ opacity: 1, transition: { duration: 0.5, ease: ease.out } }}\n          exit={{ opacity: 0, transition: { duration: 0.9, ease: [0.4, 0, 0.2, 1] } }}\n        />\n      )}\n    </AnimatePresence>\n  )\n}\n\nconst INKS = ['var(--ai-ink-1)', 'var(--ai-ink-2)', 'var(--ai-ink-3)', 'var(--ai-ink-4)']\n\nexport const aiInk = (t: number) => {\n  const x = Math.min(0.9999, Math.max(0, t)) * (INKS.length - 1)\n  const k = Math.floor(x)\n  const f = Math.round((x - k) * 100)\n  return `color-mix(in oklch, ${INKS[k]} ${100 - f}%, ${INKS[k + 1]})`\n}\n\nexport const aiWord = (n: number) => INKS[n % INKS.length]\n\nexport const aiText = (tone: Tone) => (tone === 'loud' ? 'ai-text' : 'ai-text ai-quiet')\nexport const aiWords = (tone: Tone) => (tone === 'loud' ? 'word-in ai-warm' : 'word-in')\n"},{"path":"components/detent/ui/Outcome.tsx","target":"components/detent/ui/Outcome.tsx","type":"registry:component","content":"'use client'\n\nimport { AnimatePresence, motion } from 'motion/react'\nimport { ease } from '@/components/detent/lib/motion'\n\nexport function Bloom({ k, color = 'var(--ok)', radius, spread = 12, delay = 0 }: { k: string | number | null; color?: string; radius: number | string; spread?: number; delay?: number }) {\n  if (k === null) return null\n  return <span key={k} aria-hidden className=\"bloom pointer-events-none absolute inset-0\" style={{ borderRadius: radius, animationDelay: `${delay}s`, ['--bloom' as string]: color, ['--bloom-spread' as string]: `${spread}px` }} />\n}\n\nexport function DrawnCheck({ size = 13, delay = 0.12, strokeWidth = 3 }: { size?: number; delay?: number; strokeWidth?: number }) {\n  return (\n    <svg aria-hidden width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={strokeWidth} strokeLinecap=\"round\" strokeLinejoin=\"round\">\n      <motion.path d=\"M5 12.5l4.5 4.5L19 7.5\" initial={{ pathLength: 0 }} animate={{ pathLength: 1 }} transition={{ duration: 0.32, ease: ease.out, delay }} />\n    </svg>\n  )\n}\n\nexport function Sweep({ k, color = 'var(--ok)', delay = 0, axis = 'x' }: { k: string | number | null; color?: string; delay?: number; axis?: 'x' | 'y' }) {\n  const across = axis === 'x'\n  const band = (deg: number) => `linear-gradient(${deg}deg, transparent 15%, color-mix(in oklch, ${color} 26%, transparent) 42%, color-mix(in oklch, ${color} 40%, rgb(255 255 255 / 0.5)) 50%, color-mix(in oklch, ${color} 26%, transparent) 58%, transparent 85%)`\n  return (\n    <span aria-hidden className=\"pointer-events-none absolute inset-0 overflow-hidden motion-reduce:hidden\" style={{ borderRadius: 'inherit' }}>\n      <AnimatePresence>\n        {k !== null && (\n          <motion.span\n            key={k}\n            className={across ? 'absolute inset-y-0 left-0 w-1/2' : 'absolute inset-x-0 top-0 h-1/2'}\n            style={{ background: band(across ? 100 : 180) }}\n            initial={across ? { x: '-110%' } : { y: '-110%' }}\n            animate={across ? { x: '230%' } : { y: '230%' }}\n            exit={{ opacity: 0 }}\n            transition={{ duration: across ? 0.85 : 0.9, ease: ease.inOut, delay }}\n          />\n        )}\n      </AnimatePresence>\n    </span>\n  )\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"}]}