@constructive-io/ui 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/{ai-B7XNnqYL.js → ai-4JrVVL3q.js} +311 -213
  2. package/dist/ai-4JrVVL3q.js.map +1 -0
  3. package/dist/{ai-DJ-YPj8c.cjs → ai-B08ufcbD.cjs} +309 -211
  4. package/dist/ai-B08ufcbD.cjs.map +1 -0
  5. package/dist/components/ai/index.cjs +1 -1
  6. package/dist/components/ai/index.d.cts +1 -1
  7. package/dist/components/ai/index.d.ts +1 -1
  8. package/dist/components/ai/index.js +1 -1
  9. package/dist/components/autocomplete.cjs +1 -1
  10. package/dist/components/autocomplete.js +1 -1
  11. package/dist/components/badge.d.cts +4 -4
  12. package/dist/components/badge.d.ts +4 -4
  13. package/dist/components/button-group.d.cts +1 -1
  14. package/dist/components/button-group.d.ts +1 -1
  15. package/dist/components/button.cjs +3 -3
  16. package/dist/components/button.cjs.map +1 -1
  17. package/dist/components/button.d.cts +2 -2
  18. package/dist/components/button.d.ts +2 -2
  19. package/dist/components/button.js +3 -3
  20. package/dist/components/button.js.map +1 -1
  21. package/dist/components/card.d.cts +1 -1
  22. package/dist/components/card.d.ts +1 -1
  23. package/dist/components/collapsible.cjs +1 -1
  24. package/dist/components/collapsible.cjs.map +1 -1
  25. package/dist/components/collapsible.js +1 -1
  26. package/dist/components/collapsible.js.map +1 -1
  27. package/dist/components/combobox.cjs +1 -1
  28. package/dist/components/combobox.js +1 -1
  29. package/dist/components/command.cjs +8 -3
  30. package/dist/components/command.cjs.map +1 -1
  31. package/dist/components/command.d.cts +4 -1
  32. package/dist/components/command.d.ts +4 -1
  33. package/dist/components/command.js +8 -3
  34. package/dist/components/command.js.map +1 -1
  35. package/dist/components/dropdown-menu.cjs +2 -2
  36. package/dist/components/dropdown-menu.cjs.map +1 -1
  37. package/dist/components/dropdown-menu.js +2 -2
  38. package/dist/components/dropdown-menu.js.map +1 -1
  39. package/dist/components/field.d.cts +1 -1
  40. package/dist/components/field.d.ts +1 -1
  41. package/dist/components/input-otp.cjs +1 -1
  42. package/dist/components/input-otp.js +1 -1
  43. package/dist/components/multi-select.cjs +1 -1
  44. package/dist/components/multi-select.js +1 -1
  45. package/dist/components/popover.cjs +7 -0
  46. package/dist/components/popover.cjs.map +1 -1
  47. package/dist/components/popover.d.cts +7 -1
  48. package/dist/components/popover.d.ts +7 -1
  49. package/dist/components/popover.js +7 -1
  50. package/dist/components/popover.js.map +1 -1
  51. package/dist/components/select.cjs +1 -1
  52. package/dist/components/select.js +1 -1
  53. package/dist/components/sidebar.d.cts +1 -1
  54. package/dist/components/sidebar.d.ts +1 -1
  55. package/dist/components/tabs.cjs +5 -2
  56. package/dist/components/tabs.cjs.map +1 -1
  57. package/dist/components/tabs.js +5 -2
  58. package/dist/components/tabs.js.map +1 -1
  59. package/dist/components/toggle-group.cjs +1 -1
  60. package/dist/components/toggle-group.js +1 -1
  61. package/dist/components/toggle.d.cts +1 -1
  62. package/dist/components/toggle.d.ts +1 -1
  63. package/dist/components/workspace-kit/index.cjs +51 -21
  64. package/dist/components/workspace-kit/index.cjs.map +1 -1
  65. package/dist/components/workspace-kit/index.d.cts +18 -6
  66. package/dist/components/workspace-kit/index.d.ts +18 -6
  67. package/dist/components/workspace-kit/index.js +51 -21
  68. package/dist/components/workspace-kit/index.js.map +1 -1
  69. package/dist/{fluid-highlight-DxWeZ7iu.js → fluid-highlight-CNELHV8o.js} +26 -11
  70. package/dist/fluid-highlight-CNELHV8o.js.map +1 -0
  71. package/dist/{fluid-highlight-AW-OITqJ.cjs → fluid-highlight-YWFRZXsw.cjs} +30 -9
  72. package/dist/fluid-highlight-YWFRZXsw.cjs.map +1 -0
  73. package/dist/{index-z3LqQ5L5.d.ts → index-Cluc_xc5.d.ts} +23 -14
  74. package/dist/{index-CiO-3M_X.d.cts → index-DXoG0ghv.d.cts} +23 -14
  75. package/dist/index.cjs +1 -1
  76. package/dist/index.d.cts +3 -3
  77. package/dist/index.d.ts +3 -3
  78. package/dist/index.js +1 -1
  79. package/dist/{theme-DTTTlylA.d.ts → theme-CKpIa4Fj.d.cts} +42 -26
  80. package/dist/{theme-DTTTlylA.d.cts → theme-CKpIa4Fj.d.ts} +42 -26
  81. package/dist/theme-dials-config.d.cts +1 -1
  82. package/dist/theme-dials-config.d.ts +1 -1
  83. package/dist/theme-presets.d.cts +1 -1
  84. package/dist/theme-presets.d.ts +1 -1
  85. package/dist/{theme-tuning-TJ76tnxZ.d.cts → theme-tuning-CTOHSrsh.d.cts} +2 -2
  86. package/dist/{theme-tuning-DjgDvV8V.d.ts → theme-tuning-DOko6Pmy.d.ts} +2 -2
  87. package/dist/theme-tuning.d.cts +1 -1
  88. package/dist/theme-tuning.d.ts +1 -1
  89. package/dist/theme.cjs +28 -22
  90. package/dist/theme.cjs.map +1 -1
  91. package/dist/theme.d.cts +1 -1
  92. package/dist/theme.d.ts +1 -1
  93. package/dist/theme.js +28 -22
  94. package/dist/theme.js.map +1 -1
  95. package/package.json +5 -2
  96. package/src/styles/globals.css +43 -25
  97. package/dist/ai-B7XNnqYL.js.map +0 -1
  98. package/dist/ai-DJ-YPj8c.cjs.map +0 -1
  99. package/dist/fluid-highlight-AW-OITqJ.cjs.map +0 -1
  100. package/dist/fluid-highlight-DxWeZ7iu.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai-DJ-YPj8c.cjs","names":["cn","formatElapsed","React","cn","React","TooltipProvider","cn","Tooltip","TooltipTrigger","TooltipContent","React","cn","cn","Avatar","AvatarImage","AvatarFallback","TooltipProvider","Tooltip","TooltipTrigger","TooltipContent","python","rust","go","java","c","css","diff","React","cn","Button","Check","Copy","ChevronDown","React","cn","React","cn","cn","ArrowDown","Alert","cn","AlertTitle","AlertDescription","React","Collapsible","cn","CollapsibleTrigger","Brain","ChevronDown","CollapsiblePanel","React","cn","Collapsible","CollapsibleTrigger","Sparkles","ChevronDown","CollapsiblePanel","Globe","Check","Loader2","Terminal","FileCode2","STATUS_LABEL","Collapsible","cn","CollapsibleTrigger","ChevronDown","CollapsiblePanel","Check","CircleDashed","X","Circle","Loader2","Settings2","CheckCircle2","CircleX","Wrench","cn","ChevronDown","Collapsible","CollapsibleTrigger","CollapsiblePanel","React","cn","Check","Button","X","ArrowUp","React","FileText","cn","ExternalLink","Tooltip","TooltipTrigger","TooltipContent","React","React","cn","React","TooltipProvider","cn","Check","Copy","RefreshCw","ThumbsUp","ThumbsDown","Tooltip","TooltipTrigger","Button","TooltipContent","cn","React","cn","React","cn","cn","Collapsible","CollapsibleTrigger","ListChecks","ChevronDown","CollapsiblePanel","Check","CircleDashed","Circle","React","Tooltip","TooltipTrigger","cn","TooltipContent","Loader2","Check","X","Button","RotateCcw","ChevronDown","cn","Collapsible","CollapsibleTrigger","CollapsiblePanel","cn","FileText","Badge","React","cn","Collapsible","CollapsibleTrigger","ChevronDown","CollapsiblePanel","Check","Button","React","cn","Button","Paperclip","Upload","X","React","cn","cn","cn","BookOpen","Check","Spinner","React","cn","cn","cn","Gauge","TriangleAlert","X","cn","Check","Kbd","React","CommandItem","Popover","PopoverTrigger","ChevronDown","PopoverContent","Command","CommandInput","Tooltip","TooltipTrigger","CircleDollarSign","TooltipContent","CommandList","CommandEmpty","CommandGroup","cn","Spinner","CircleAlert","FileText","X","CircleHelp","cn","React","CircleCheck","Button","cn","Check","Button","cn","Collapsible","CollapsibleTrigger","ChevronRight","Bot","CollapsiblePanel","Check","Button"],"sources":["../src/components/ai/text-shimmer.tsx","../src/components/ai/agent-loader.tsx","../src/components/ai/prompt-input.tsx","../src/components/ai/use-throttled-text.ts","../src/components/ai/markdown.tsx","../src/components/ai/message.tsx","../src/components/ai/code-block.tsx","../src/components/ai/response-stream.tsx","../src/components/ai/chat-container.tsx","../src/components/ai/scroll-button.tsx","../src/components/ai/system-message.tsx","../src/components/ai/format-duration.ts","../src/components/ai/reasoning.tsx","../src/components/ai/thinking-trace.tsx","../src/components/ai/steps.tsx","../src/components/ai/types.ts","../src/components/ai/tool.tsx","../src/components/ai/approval-card.tsx","../src/components/ai/use-image-failed.ts","../src/components/ai/source.tsx","../src/components/ai/line-diff.ts","../src/components/ai/inline-diff.tsx","../src/components/ai/feedback-bar.tsx","../src/components/ai/prompt-suggestion.tsx","../src/components/ai/streaming-text.tsx","../src/components/ai/diff-table.tsx","../src/components/ai/plan-tracker.tsx","../src/components/ai/context-ring.tsx","../src/components/ai/task-row.tsx","../src/components/ai/context-card.tsx","../src/components/ai/recommendation-card.tsx","../src/components/ai/file-upload.tsx","../src/components/ai/image.tsx","../src/components/ai/mark-tile.tsx","../src/components/ai/tool-trace.tsx","../src/components/ai/thinking-status.tsx","../src/components/ai/prompt-input-tray.tsx","../src/components/ai/usage-notice.tsx","../src/components/ai/model-selector.tsx","../src/components/ai/prompt-input-attachment.tsx","../src/components/ai/ask-card.tsx","../src/components/ai/connect-prompt.tsx","../src/components/ai/agent-draft-card.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\n\ntype TextShimmerProps = React.ComponentProps<'span'> & {\n\t/** When false, renders static muted text (useful after a stream settles). */\n\tactive?: boolean;\n};\n\n/**\n * Sweeping-gradient status text for in-flight agent states.\n * CSS-only animation so it does not re-render on a timer.\n */\nfunction TextShimmer({ className, active = true, children, ...props }: TextShimmerProps) {\n\treturn (\n\t\t<span\n\t\t\tdata-slot=\"text-shimmer\"\n\t\t\tdata-active={active ? 'true' : 'false'}\n\t\t\tclassName={cn(\n\t\t\t\t'inline-block font-medium',\n\t\t\t\tactive\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t// The sweep runs toward the page colour: a light sheen over grey text in light mode, and a bright\n\t\t\t\t\t\t\t// glint over dim text in dark. Sweeping toward `foreground` in light only darkened the text a step,\n\t\t\t\t\t\t\t// which next to normal labels read as no motion at all.\n\t\t\t\t\t\t\t'bg-[linear-gradient(90deg,var(--muted-foreground)_35%,color-mix(in_oklab,var(--muted-foreground),var(--background)_55%)_50%,var(--muted-foreground)_65%)]',\n\t\t\t\t\t\t\t'dark:bg-[linear-gradient(90deg,var(--muted-foreground)_35%,var(--foreground)_50%,var(--muted-foreground)_65%)]',\n\t\t\t\t\t\t\t'bg-size-[200%_100%] bg-clip-text text-transparent',\n\t\t\t\t\t\t\t'animate-[ai-shimmer-text_1.4s_linear_infinite]',\n\t\t\t\t\t\t\t'motion-reduce:animate-none motion-reduce:bg-none motion-reduce:text-muted-foreground',\n\t\t\t\t\t\t]\n\t\t\t\t\t: 'text-muted-foreground',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</span>\n\t);\n}\n\nexport { TextShimmer };\nexport type { TextShimmerProps };\n","'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { TextShimmer } from './text-shimmer';\n\nconst REDUCED_MOTION_QUERY = '(prefers-reduced-motion: reduce)';\n\nfunction subscribeToReducedMotion(onStoreChange: () => void) {\n\tif (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {\n\t\treturn () => {};\n\t}\n\tconst mediaQuery = window.matchMedia(REDUCED_MOTION_QUERY);\n\tmediaQuery.addEventListener('change', onStoreChange);\n\treturn () => mediaQuery.removeEventListener('change', onStoreChange);\n}\n\nfunction getReducedMotionSnapshot() {\n\treturn typeof window === 'undefined' || typeof window.matchMedia !== 'function'\n\t\t? true\n\t\t: window.matchMedia(REDUCED_MOTION_QUERY).matches;\n}\n\n/** Chevron wavefront across a 3×3 grid (Drive / Dots). */\nconst chevronDelays = Array.from({ length: 9 }, (_, i) => {\n\tconst r = Math.floor(i / 3);\n\tconst c = i % 3;\n\treturn (c + Math.abs(r - 1)) * 90;\n});\n\nconst ORBIT_ORDER = [0, 1, 2, 5, 8, 7, 6, 3];\nconst orbitDelays = Array.from({ length: 9 }, (_, i) => {\n\tconst k = ORBIT_ORDER.indexOf(i);\n\treturn k === -1 ? null : k * 110;\n});\n\ntype PixelVariant = 'drive' | 'dots' | 'orbit';\n\nconst PIXEL_PATTERNS: Record<\n\tPixelVariant,\n\t{ delays: (number | null)[]; durationMs: number; round: boolean }\n> = {\n\tdrive: { delays: chevronDelays, durationMs: 650, round: false },\n\tdots: { delays: chevronDelays, durationMs: 650, round: true },\n\torbit: { delays: orbitDelays, durationMs: 950, round: false },\n};\n\ntype SimpleVariant =\n\t| 'circular'\n\t| 'bounce-dots'\n\t| 'typing'\n\t| 'wave'\n\t| 'pulse-dot'\n\t| 'text-shimmer'\n\t| 'loading-dots';\n\ntype AgentLoaderVariant = PixelVariant | SimpleVariant;\n\ntype AgentLoaderProps = {\n\tvariant?: AgentLoaderVariant;\n\t/** Status label (pixel + text variants). */\n\tlabel?: string;\n\t/** Show a live elapsed timer next to the pixel loader. */\n\tshowElapsed?: boolean;\n\t/** When provided, use this elapsed ms instead of an internal clock. */\n\telapsedMs?: number;\n\tsize?: 'sm' | 'md' | 'lg';\n\tclassName?: string;\n\ttext?: string;\n};\n\nfunction formatElapsed(totalSeconds: number): string {\n\tif (totalSeconds < 60) return `${totalSeconds.toFixed(1)}s`;\n\tconst minutes = Math.floor(totalSeconds / 60);\n\tconst seconds = totalSeconds % 60;\n\treturn `${minutes}m ${seconds.toFixed(1)}s`;\n}\n\nfunction useElapsedSeconds(enabled: boolean, controlledMs?: number) {\n\tconst [ticks, setTicks] = React.useState(0);\n\tReact.useEffect(() => {\n\t\tif (!enabled || controlledMs !== undefined) return;\n\t\tconst id = window.setInterval(() => setTicks((value) => value + 1), 100);\n\t\treturn () => window.clearInterval(id);\n\t}, [enabled, controlledMs]);\n\tif (controlledMs !== undefined) return controlledMs / 1000;\n\treturn ticks / 10;\n}\n\nfunction PixelGrid({\n\tvariant,\n\treducedMotion,\n}: {\n\tvariant: PixelVariant;\n\treducedMotion: boolean;\n}) {\n\tconst { delays, durationMs, round } = PIXEL_PATTERNS[variant];\n\treturn (\n\t\t<span aria-hidden className=\"grid grid-cols-[repeat(3,4px)] gap-[1.5px]\">\n\t\t\t{delays.map((delay, index) => (\n\t\t\t\t<span\n\t\t\t\t\tkey={index}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'size-1 bg-foreground',\n\t\t\t\t\t\tround ? 'rounded-full' : 'rounded-[1px]',\n\t\t\t\t\t)}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\topacity: delay === null ? 0.07 : 0.15,\n\t\t\t\t\t\tanimation:\n\t\t\t\t\t\t\treducedMotion || delay === null\n\t\t\t\t\t\t\t\t? 'none'\n\t\t\t\t\t\t\t\t: `ai-pixel-on ${durationMs}ms ease-in-out ${delay}ms infinite`,\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</span>\n\t);\n}\n\nfunction sizeClass(size: 'sm' | 'md' | 'lg') {\n\treturn { sm: 'size-4', md: 'size-5', lg: 'size-6' }[size];\n}\n\nfunction CircularLoader({ size, className }: { size: 'sm' | 'md' | 'lg'; className?: string }) {\n\treturn (\n\t\t<span\n\t\t\tclassName={cn(\n\t\t\t\t'inline-block animate-spin rounded-full border-2 border-primary border-t-transparent motion-reduce:animate-none',\n\t\t\t\tsizeClass(size),\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\taria-hidden\n\t\t/>\n\t);\n}\n\nfunction DotsBounce({ size, className }: { size: 'sm' | 'md' | 'lg'; className?: string }) {\n\tconst dot = { sm: 'size-1.5', md: 'size-2', lg: 'size-2.5' }[size];\n\treturn (\n\t\t<span className={cn('inline-flex items-center gap-1', className)} aria-hidden>\n\t\t\t{[0, 1, 2].map((i) => (\n\t\t\t\t<span\n\t\t\t\t\tkey={i}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'rounded-full bg-primary animate-[ai-bounce-dots_1.4s_ease-in-out_infinite] motion-reduce:animate-none',\n\t\t\t\t\t\tdot,\n\t\t\t\t\t)}\n\t\t\t\t\tstyle={{ animationDelay: `${i * 160}ms` }}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</span>\n\t);\n}\n\nfunction TypingLoader({ size, className }: { size: 'sm' | 'md' | 'lg'; className?: string }) {\n\tconst dot = { sm: 'size-1', md: 'size-1.5', lg: 'size-2' }[size];\n\treturn (\n\t\t<span className={cn('inline-flex items-center gap-1', className)} aria-hidden>\n\t\t\t{[0, 1, 2].map((i) => (\n\t\t\t\t<span\n\t\t\t\t\tkey={i}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'rounded-full bg-primary animate-[ai-typing_1s_infinite] motion-reduce:animate-none',\n\t\t\t\t\t\tdot,\n\t\t\t\t\t)}\n\t\t\t\t\tstyle={{ animationDelay: `${i * 250}ms` }}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</span>\n\t);\n}\n\nfunction WaveLoader({ size, className }: { size: 'sm' | 'md' | 'lg'; className?: string }) {\n\tconst heights = {\n\t\tsm: ['6px', '9px', '12px', '9px', '6px'],\n\t\tmd: ['8px', '12px', '16px', '12px', '8px'],\n\t\tlg: ['10px', '15px', '20px', '15px', '10px'],\n\t}[size];\n\treturn (\n\t\t<span className={cn('inline-flex items-center gap-0.5', sizeClass(size), className)} aria-hidden>\n\t\t\t{heights.map((height, i) => (\n\t\t\t\t<span\n\t\t\t\t\tkey={i}\n\t\t\t\t\tclassName=\"w-0.5 rounded-full bg-primary animate-[ai-wave_1s_ease-in-out_infinite] motion-reduce:animate-none\"\n\t\t\t\t\tstyle={{ height, animationDelay: `${i * 100}ms` }}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</span>\n\t);\n}\n\nfunction PulseDot({ size, className }: { size: 'sm' | 'md' | 'lg'; className?: string }) {\n\tconst dot = { sm: 'size-1', md: 'size-2', lg: 'size-3' }[size];\n\treturn (\n\t\t<span\n\t\t\tclassName={cn(\n\t\t\t\t'inline-block rounded-full bg-primary animate-[ai-pulse-dot_1.2s_ease-in-out_infinite] motion-reduce:animate-none',\n\t\t\t\tdot,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\taria-hidden\n\t\t/>\n\t);\n}\n\n/**\n * Agent loading indicator. Pixel variants (drive / dots / orbit) give the\n * agent a distinct presence; simple variants cover common chat spinners.\n */\nfunction AgentLoader({\n\tvariant = 'drive',\n\tlabel = 'Working',\n\tshowElapsed = true,\n\telapsedMs,\n\tsize = 'md',\n\tclassName,\n\ttext,\n}: AgentLoaderProps) {\n\tconst reducedMotion = React.useSyncExternalStore(\n\t\tsubscribeToReducedMotion,\n\t\tgetReducedMotionSnapshot,\n\t\t() => true,\n\t);\n\tconst isPixel = variant === 'drive' || variant === 'dots' || variant === 'orbit';\n\tconst elapsed = useElapsedSeconds(isPixel && showElapsed, elapsedMs);\n\tconst statusText = text ?? label;\n\n\tif (isPixel) {\n\t\treturn (\n\t\t\t<span\n\t\t\t\tdata-slot=\"agent-loader\"\n\t\t\t\tdata-variant={variant}\n\t\t\t\trole=\"status\"\n\t\t\t\taria-live=\"polite\"\n\t\t\t\tclassName={cn('inline-flex w-fit items-center gap-2.5', className)}\n\t\t\t>\n\t\t\t\t<PixelGrid variant={variant} reducedMotion={reducedMotion} />\n\t\t\t\t<TextShimmer className=\"text-[0.8125rem]\">{statusText}</TextShimmer>\n\t\t\t\t{showElapsed ? (\n\t\t\t\t\t<span className=\"font-mono text-xs tabular-nums text-muted-foreground\">\n\t\t\t\t\t\t{formatElapsed(elapsed)}\n\t\t\t\t\t</span>\n\t\t\t\t) : null}\n\t\t\t\t<span className=\"sr-only\">\n\t\t\t\t\t{statusText}\n\t\t\t\t\t{showElapsed ? `, ${formatElapsed(elapsed)}` : ''}\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t);\n\t}\n\n\tif (variant === 'text-shimmer') {\n\t\treturn (\n\t\t\t<span data-slot=\"agent-loader\" role=\"status\" className={cn('inline-flex', className)}>\n\t\t\t\t<TextShimmer className={cn(size === 'sm' && 'text-xs', size === 'lg' && 'text-base')}>\n\t\t\t\t\t{statusText}\n\t\t\t\t</TextShimmer>\n\t\t\t</span>\n\t\t);\n\t}\n\n\tif (variant === 'loading-dots') {\n\t\treturn (\n\t\t\t<span\n\t\t\t\tdata-slot=\"agent-loader\"\n\t\t\t\trole=\"status\"\n\t\t\t\tclassName={cn('inline-flex items-center gap-0.5 font-medium text-link', className)}\n\t\t\t>\n\t\t\t\t<span className={cn(size === 'sm' && 'text-xs', size === 'md' && 'text-sm', size === 'lg' && 'text-base')}>\n\t\t\t\t\t{statusText}\n\t\t\t\t</span>\n\t\t\t\t<span aria-hidden className=\"inline-flex\">\n\t\t\t\t\t{[0, 1, 2].map((i) => (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tkey={i}\n\t\t\t\t\t\t\tclassName=\"animate-[ai-loading-dots_1.4s_infinite] motion-reduce:animate-none\"\n\t\t\t\t\t\t\tstyle={{ animationDelay: `${(i + 1) * 0.2}s` }}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t.\n\t\t\t\t\t\t</span>\n\t\t\t\t\t))}\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t);\n\t}\n\n\tconst indicator =\n\t\tvariant === 'circular' ? (\n\t\t\t<CircularLoader size={size} />\n\t\t) : variant === 'bounce-dots' ? (\n\t\t\t<DotsBounce size={size} />\n\t\t) : variant === 'typing' ? (\n\t\t\t<TypingLoader size={size} />\n\t\t) : variant === 'wave' ? (\n\t\t\t<WaveLoader size={size} />\n\t\t) : (\n\t\t\t<PulseDot size={size} />\n\t\t);\n\n\treturn (\n\t\t<span\n\t\t\tdata-slot=\"agent-loader\"\n\t\t\tdata-variant={variant}\n\t\t\trole=\"status\"\n\t\t\taria-live=\"polite\"\n\t\t\tclassName={cn('inline-flex items-center gap-2', className)}\n\t\t>\n\t\t\t{indicator}\n\t\t\t{statusText ? <span className=\"sr-only\">{statusText}</span> : <span className=\"sr-only\">Loading</span>}\n\t\t</span>\n\t);\n}\n\n/** @deprecated Prefer AgentLoader — alias kept for prompt-kit familiarity. */\nconst Loader = AgentLoader;\n\nexport { AgentLoader, Loader };\nexport type { AgentLoaderProps, AgentLoaderVariant, PixelVariant, SimpleVariant };\n","'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport {\n\tTooltip,\n\tTooltipContent,\n\tTooltipProvider,\n\tTooltipTrigger,\n} from '../tooltip';\n\ntype PromptInputContextValue = {\n\tisLoading: boolean;\n\tvalue: string;\n\tsetValue: (value: string) => void;\n\tmaxHeight: number | string;\n\tonSubmit?: () => void;\n\tdisabled?: boolean;\n\ttextareaRef: React.RefObject<HTMLTextAreaElement | null>;\n};\n\nconst PromptInputContext = React.createContext<PromptInputContextValue | null>(null);\n\nfunction usePromptInput() {\n\tconst context = React.useContext(PromptInputContext);\n\tif (!context) {\n\t\tthrow new Error('PromptInput compound parts must be used within <PromptInput>.');\n\t}\n\treturn context;\n}\n\ntype PromptInputProps = React.ComponentProps<'div'> & {\n\tisLoading?: boolean;\n\tvalue?: string;\n\tonValueChange?: (value: string) => void;\n\tmaxHeight?: number | string;\n\tonSubmit?: () => void;\n\tdisabled?: boolean;\n\t/** Visual shell. `default` uses Constructive radius; `pill` is more rounded. */\n\tshape?: 'default' | 'pill';\n};\n\n/**\n * Compound chat composer shell. Host owns submit/streaming; this owns layout,\n * autosize context, and action slots.\n */\nfunction PromptInput({\n\tclassName,\n\tisLoading = false,\n\tmaxHeight = 240,\n\tvalue,\n\tonValueChange,\n\tonSubmit,\n\tchildren,\n\tdisabled = false,\n\tshape = 'default',\n\tonClick,\n\t...props\n}: PromptInputProps) {\n\tconst [internalValue, setInternalValue] = React.useState(value ?? '');\n\tconst textareaRef = React.useRef<HTMLTextAreaElement>(null);\n\n\tReact.useEffect(() => {\n\t\tif (value !== undefined) setInternalValue(value);\n\t}, [value]);\n\n\tconst handleChange = React.useCallback(\n\t\t(next: string) => {\n\t\t\tsetInternalValue(next);\n\t\t\tonValueChange?.(next);\n\t\t},\n\t\t[onValueChange],\n\t);\n\n\tconst handleClick: React.MouseEventHandler<HTMLDivElement> = (event) => {\n\t\tif (!disabled) textareaRef.current?.focus();\n\t\tonClick?.(event);\n\t};\n\n\treturn (\n\t\t<TooltipProvider>\n\t\t\t<PromptInputContext.Provider\n\t\t\t\tvalue={{\n\t\t\t\t\tisLoading,\n\t\t\t\t\tvalue: value ?? internalValue,\n\t\t\t\t\tsetValue: onValueChange ?? handleChange,\n\t\t\t\t\tmaxHeight,\n\t\t\t\t\tonSubmit,\n\t\t\t\t\tdisabled: disabled || isLoading,\n\t\t\t\t\ttextareaRef,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tdata-slot=\"prompt-input\"\n\t\t\t\t\tdata-shape={shape}\n\t\t\t\t\tdata-loading={isLoading ? 'true' : 'false'}\n\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'cursor-text border border-input bg-background p-2 shadow-xs',\n\t\t\t\t\t\t'transition-shadow focus-within:border-ring/60 focus-within:ring-[3px] focus-within:ring-ring/35',\n\t\t\t\t\t\tshape === 'pill' ? 'rounded-3xl' : 'rounded-lg',\n\t\t\t\t\t\tdisabled && 'cursor-not-allowed opacity-60',\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t</PromptInputContext.Provider>\n\t\t</TooltipProvider>\n\t);\n}\n\ntype PromptInputTextareaProps = Omit<React.ComponentProps<'textarea'>, 'value' | 'onChange'> & {\n\tdisableAutosize?: boolean;\n};\n\nfunction PromptInputTextarea({\n\tclassName,\n\tonKeyDown,\n\tdisableAutosize = false,\n\t...props\n}: PromptInputTextareaProps) {\n\tconst { value, setValue, maxHeight, onSubmit, disabled, textareaRef } = usePromptInput();\n\n\tconst adjustHeight = React.useCallback(\n\t\t(element: HTMLTextAreaElement | null) => {\n\t\t\tif (!element || disableAutosize) return;\n\t\t\telement.style.height = 'auto';\n\t\t\tif (typeof maxHeight === 'number') {\n\t\t\t\telement.style.height = `${Math.min(element.scrollHeight, maxHeight)}px`;\n\t\t\t} else {\n\t\t\t\telement.style.height = `min(${element.scrollHeight}px, ${maxHeight})`;\n\t\t\t}\n\t\t},\n\t\t[disableAutosize, maxHeight],\n\t);\n\n\tconst setRefs = React.useCallback(\n\t\t(element: HTMLTextAreaElement | null) => {\n\t\t\ttextareaRef.current = element;\n\t\t\tadjustHeight(element);\n\t\t},\n\t\t[adjustHeight, textareaRef],\n\t);\n\n\tReact.useLayoutEffect(() => {\n\t\tadjustHeight(textareaRef.current);\n\t}, [adjustHeight, textareaRef, value]);\n\n\tconst handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n\t\tif (event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing) {\n\t\t\tevent.preventDefault();\n\t\t\tonSubmit?.();\n\t\t}\n\t\tonKeyDown?.(event);\n\t};\n\n\treturn (\n\t\t<textarea\n\t\t\tref={setRefs}\n\t\t\tdata-slot=\"prompt-input-textarea\"\n\t\t\tvalue={value}\n\t\t\tonChange={(event) => {\n\t\t\t\tadjustHeight(event.target);\n\t\t\t\tsetValue(event.target.value);\n\t\t\t}}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tdisabled={disabled}\n\t\t\trows={1}\n\t\t\tclassName={cn(\n\t\t\t\t'min-h-11 w-full resize-none border-none bg-transparent px-2 py-1.5 text-sm outline-none pointer-coarse:text-base',\n\t\t\t\t'placeholder:text-subtle-foreground disabled:cursor-not-allowed',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\ntype PromptInputActionsProps = React.ComponentProps<'div'>;\n\nfunction PromptInputActions({ className, ...props }: PromptInputActionsProps) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"prompt-input-actions\"\n\t\t\tclassName={cn('flex items-center gap-1.5 px-1', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\ntype PromptInputActionProps = {\n\ttooltip: React.ReactNode;\n\tside?: 'top' | 'bottom' | 'left' | 'right';\n\tchildren: React.ReactNode;\n\tclassName?: string;\n} & Omit<React.ComponentProps<typeof Tooltip>, 'children'>;\n\nfunction PromptInputAction({\n\ttooltip,\n\tchildren,\n\tclassName,\n\tside = 'top',\n\t...props\n}: PromptInputActionProps) {\n\tconst { disabled } = usePromptInput();\n\treturn (\n\t\t<Tooltip {...props}>\n\t\t\t<TooltipTrigger\n\t\t\t\tasChild\n\t\t\t\t// Keep focus on the textarea when interacting with actions.\n\t\t\t\tonClick={(event) => event.stopPropagation()}\n\t\t\t\tdisabled={disabled}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</TooltipTrigger>\n\t\t\t<TooltipContent side={side} className={className}>\n\t\t\t\t{tooltip}\n\t\t\t</TooltipContent>\n\t\t</Tooltip>\n\t);\n}\n\ntype PromptInputBodyProps = React.ComponentProps<'div'>;\n\nfunction PromptInputBody({ className, ...props }: PromptInputBodyProps) {\n\treturn (\n\t\t<div data-slot=\"prompt-input-body\" className={cn('flex min-w-0 flex-col gap-1', className)} {...props} />\n\t);\n}\n\nexport {\n\tPromptInput,\n\tPromptInputTextarea,\n\tPromptInputActions,\n\tPromptInputAction,\n\tPromptInputBody,\n\tusePromptInput,\n};\nexport type {\n\tPromptInputProps,\n\tPromptInputTextareaProps,\n\tPromptInputActionsProps,\n\tPromptInputActionProps,\n\tPromptInputBodyProps,\n};\n","'use client';\n\nimport { useEffect, useRef, useState } from 'react';\n\n/** Default stream throttle (~15fps) — bounds markdown re-parse cost. */\nexport const STREAM_THROTTLE_MS = 66;\n\n/**\n * Throttle `text` updates while `streaming` is true; flush immediately when\n * streaming ends so settled content is never delayed.\n */\nexport function useThrottledText(text: string, streaming: boolean, intervalMs = STREAM_THROTTLE_MS): string {\n\tconst [throttled, setThrottled] = useState(text);\n\tconst latest = useRef(text);\n\tlatest.current = text;\n\tconst lastFlush = useRef(0);\n\tconst timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n\tuseEffect(() => {\n\t\tif (!streaming) {\n\t\t\tif (timer.current) {\n\t\t\t\tclearTimeout(timer.current);\n\t\t\t\ttimer.current = null;\n\t\t\t}\n\t\t\tsetThrottled((prev) => (prev === text ? prev : text));\n\t\t\treturn;\n\t\t}\n\n\t\tconst now = Date.now();\n\t\tconst elapsed = now - lastFlush.current;\n\t\tif (elapsed >= intervalMs) {\n\t\t\tlastFlush.current = now;\n\t\t\tsetThrottled(text);\n\t\t} else if (timer.current == null) {\n\t\t\ttimer.current = setTimeout(() => {\n\t\t\t\ttimer.current = null;\n\t\t\t\tlastFlush.current = Date.now();\n\t\t\t\tsetThrottled(latest.current);\n\t\t\t}, intervalMs - elapsed);\n\t\t}\n\t}, [text, streaming, intervalMs]);\n\n\tuseEffect(\n\t\t() => () => {\n\t\t\tif (timer.current) clearTimeout(timer.current);\n\t\t},\n\t\t[],\n\t);\n\n\treturn throttled;\n}\n","'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { useThrottledText } from './use-throttled-text';\n\ntype MarkdownProps = React.ComponentProps<'div'> & {\n\tchildren: string;\n\t/** Throttle re-renders while tokens arrive. */\n\tstreaming?: boolean;\n};\n\nfunction escapeHtml(value: string): string {\n\treturn value\n\t\t.replace(/&/g, '&amp;')\n\t\t.replace(/</g, '&lt;')\n\t\t.replace(/>/g, '&gt;')\n\t\t.replace(/\"/g, '&quot;')\n\t\t.replace(/'/g, '&#39;');\n}\n\n/**\n * `*` starts emphasis only in front of text, at the start of a word, and ends\n * it only right after text. That keeps `A * B * C`, `src/**\\/*.test.ts` and\n * `*.md files` as the characters the writer typed instead of eating them.\n *\n * The text between the markers cannot contain the marker itself (`**` for\n * strong, `***` for both), so an opener that never finds its closer gives up at\n * the next marker instead of scanning to the end of the line: a long line of\n * unmatched `**` takes time in proportion to its length, not its square.\n */\nconst STRONG_EM = /(?<![\\w*])\\*\\*\\*(?=[^\\s*])((?:[^*\\n]|\\*(?!\\*\\*))*?[^\\s*])\\*\\*\\*(?![\\w*])/g;\nconst STRONG = /(?<![\\w*])\\*\\*(?=[^\\s*])((?:[^*\\n]|\\*(?!\\*))*?[^\\s*])\\*\\*(?![\\w*])/g;\nconst EM = /(?<![\\w*])\\*(?=[^\\s*])([^\\n*]*?[^\\s*])\\*(?![\\w*])/g;\n\n/**\n * Lightweight markdown → HTML without hard deps.\n * Handles paragraphs (consecutive lines stay together, joined with line\n * breaks), headings, bold, italic, inline code, fenced code, links, lists.\n * Tables and footnotes are outside this subset: hosts that need full GFM wrap\n * their own marked+DOMPurify pipeline.\n */\nfunction renderBasicMarkdown(source: string): string {\n\tconst fences: string[] = [];\n\tlet text = source.replace(/```([\\w-]*)\\n?([\\s\\S]*?)```/g, (_match, lang: string, code: string) => {\n\t\tconst index = fences.length;\n\t\tconst language = lang ? ` data-language=\"${escapeHtml(lang)}\"` : '';\n\t\tfences.push(\n\t\t\t`<pre class=\"ai-md-pre\" data-slot=\"markdown-pre\"${language}><code>${escapeHtml(code.replace(/\\n$/, ''))}</code></pre>`,\n\t\t);\n\t\treturn `\\u0000FENCE${index}\\u0000`;\n\t});\n\n\ttext = escapeHtml(text);\n\n\t// Inline code is set aside so emphasis markers inside it stay literal.\n\tconst spans: string[] = [];\n\ttext = text.replace(/`([^`\\n]+)`/g, (_match, code: string) => {\n\t\tspans.push(`<code class=\"ai-md-code\">${code}</code>`);\n\t\treturn `\\u0001CODE${spans.length - 1}\\u0001`;\n\t});\n\ttext = text.replace(STRONG_EM, '<strong><em>$1</em></strong>');\n\ttext = text.replace(STRONG, '<strong>$1</strong>');\n\ttext = text.replace(EM, '<em>$1</em>');\n\ttext = text.replace(/\\u0001CODE(\\d+)\\u0001/g, (_match, index: string) => spans[Number(index)] ?? '');\n\ttext = text.replace(\n\t\t/\\[([^\\]]+)\\]\\((https?:\\/\\/[^\\s)]+)\\)/g,\n\t\t'<a href=\"$2\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ai-md-link\">$1</a>',\n\t);\n\n\tconst lines = text.split('\\n');\n\tconst html: string[] = [];\n\tlet listOpen: 'ul' | 'ol' | null = null;\n\n\tconst closeList = () => {\n\t\tif (listOpen) {\n\t\t\thtml.push(`</${listOpen}>`);\n\t\t\tlistOpen = null;\n\t\t}\n\t};\n\n\t// Consecutive plain lines are one paragraph, so a line break the writer typed is kept and a blank line is what starts the next paragraph.\n\tlet paragraph: string[] = [];\n\tconst flushParagraph = () => {\n\t\tif (paragraph.length > 0) {\n\t\t\thtml.push(`<p class=\"ai-md-p\">${paragraph.join('<br>')}</p>`);\n\t\t\tparagraph = [];\n\t\t}\n\t};\n\n\tfor (const line of lines) {\n\t\tconst unordered = line.match(/^[-*]\\s+(.+)$/);\n\t\tconst ordered = line.match(/^\\d+\\.\\s+(.+)$/);\n\t\tconst heading = line.match(/^(#{1,6})\\s+(.+)$/);\n\n\t\tif (unordered) {\n\t\t\tflushParagraph();\n\t\t\tif (listOpen !== 'ul') {\n\t\t\t\tcloseList();\n\t\t\t\thtml.push('<ul class=\"ai-md-list\">');\n\t\t\t\tlistOpen = 'ul';\n\t\t\t}\n\t\t\thtml.push(`<li>${unordered[1]}</li>`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (ordered) {\n\t\t\tflushParagraph();\n\t\t\tif (listOpen !== 'ol') {\n\t\t\t\tcloseList();\n\t\t\t\thtml.push('<ol class=\"ai-md-list\">');\n\t\t\t\tlistOpen = 'ol';\n\t\t\t}\n\t\t\thtml.push(`<li>${ordered[1]}</li>`);\n\t\t\tcontinue;\n\t\t}\n\n\t\tcloseList();\n\n\t\tif (heading) {\n\t\t\tflushParagraph();\n\t\t\tconst level = heading[1].length;\n\t\t\thtml.push(`<h${level} class=\"ai-md-h\">${heading[2]}</h${level}>`);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (line.trim() === '') {\n\t\t\tflushParagraph();\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (line.includes('\\u0000FENCE')) {\n\t\t\tflushParagraph();\n\t\t\thtml.push(line.replace(/\\u0000FENCE(\\d+)\\u0000/g, (_m, i) => fences[Number(i)] ?? ''));\n\t\t\tcontinue;\n\t\t}\n\n\t\tparagraph.push(line);\n\t}\n\tflushParagraph();\n\tcloseList();\n\n\treturn html\n\t\t.join('\\n')\n\t\t.replace(/\\u0000FENCE(\\d+)\\u0000/g, (_m, i) => fences[Number(i)] ?? '');\n}\n\n/**\n * Markdown renderer for assistant messages. Throttles while streaming.\n * Uses a zero-dependency subset suitable for most agent replies; swap for a\n * host-level marked pipeline when you need tables/footnotes.\n */\nfunction Markdown({ className, children, streaming = false, ...props }: MarkdownProps) {\n\tconst text = useThrottledText(children, streaming);\n\tconst html = React.useMemo(() => renderBasicMarkdown(text), [text]);\n\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"markdown\"\n\t\t\tdata-streaming={streaming ? 'true' : 'false'}\n\t\t\tclassName={cn(\n\t\t\t\t'ai-markdown max-w-none space-y-3 text-sm leading-relaxed text-foreground [overflow-wrap:anywhere]',\n\t\t\t\t'[&_.ai-md-p]:my-0',\n\t\t\t\t'[&_.ai-md-h]:font-semibold',\n\t\t\t\t'[&_h1.ai-md-h]:text-lg [&_h2.ai-md-h]:text-base [&_h3.ai-md-h]:text-sm [&_h4.ai-md-h]:text-sm [&_h5.ai-md-h]:text-[0.8125rem] [&_h6.ai-md-h]:text-xs',\n\t\t\t\t'[&_.ai-md-list]:my-1 [&_.ai-md-list]:list-disc [&_.ai-md-list]:space-y-1 [&_.ai-md-list]:ps-5',\n\t\t\t\t'[&_ol.ai-md-list]:list-decimal',\n\t\t\t\t'[&_.ai-md-code]:rounded-md [&_.ai-md-code]:bg-muted [&_.ai-md-code]:px-1 [&_.ai-md-code]:py-0.5 [&_.ai-md-code]:font-mono [&_.ai-md-code]:text-[0.85em]',\n\t\t\t\t'[&_.ai-md-pre]:overflow-x-auto [&_.ai-md-pre]:rounded-lg [&_.ai-md-pre]:border [&_.ai-md-pre]:border-border [&_.ai-md-pre]:bg-muted/50 [&_.ai-md-pre]:p-3 [&_.ai-md-pre]:font-mono [&_.ai-md-pre]:text-xs',\n\t\t\t\t'[&_.ai-md-link]:text-link [&_.ai-md-link]:underline-offset-2 hover:[&_.ai-md-link]:underline',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t// Content is escaped + controlled template — not host HTML.\n\t\t\tdangerouslySetInnerHTML={{ __html: html }}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Markdown, renderBasicMarkdown };\nexport type { MarkdownProps };\n","'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Avatar, AvatarFallback, AvatarImage } from '../avatar';\nimport {\n\tTooltip,\n\tTooltipContent,\n\tTooltipProvider,\n\tTooltipTrigger,\n} from '../tooltip';\nimport { Markdown } from './markdown';\n\ntype MessageProps = React.ComponentProps<'div'> & {\n\t/** Visual role for default density / alignment helpers. */\n\tfrom?: 'user' | 'assistant' | 'system';\n};\n\nfunction Message({ className, from, ...props }: MessageProps) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"message\"\n\t\t\tdata-from={from}\n\t\t\tclassName={cn(\n\t\t\t\t'flex w-full gap-3',\n\t\t\t\tfrom === 'user' &&\n\t\t\t\t\t'justify-end [&_[data-slot=message-content]]:rounded-2xl [&_[data-slot=message-content]]:bg-secondary [&_[data-slot=message-content]]:px-3 [&_[data-slot=message-content]]:py-2',\n\t\t\t\tfrom === 'assistant' && 'justify-start',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\ntype MessageAvatarProps = {\n\tsrc?: string;\n\talt?: string;\n\tfallback?: string;\n\tclassName?: string;\n\tdelay?: number;\n};\n\nfunction MessageAvatar({ src, alt = '', fallback, className, delay }: MessageAvatarProps) {\n\treturn (\n\t\t<Avatar className={cn('size-8 shrink-0', className)} data-slot=\"message-avatar\">\n\t\t\t{src ? <AvatarImage src={src} alt={alt} /> : null}\n\t\t\t{fallback ? <AvatarFallback delay={delay}>{fallback}</AvatarFallback> : null}\n\t\t</Avatar>\n\t);\n}\n\ntype MessageContentProps = React.ComponentProps<'div'> & {\n\tmarkdown?: boolean;\n\t/** While true, markdown re-renders are throttled (see Markdown). */\n\tstreaming?: boolean;\n};\n\nfunction MessageContent({\n\tclassName,\n\tmarkdown = false,\n\tstreaming = false,\n\tchildren,\n\t...props\n}: MessageContentProps) {\n\t// Plain text keeps the line breaks it was typed with, and an unbroken URL wraps inside the bubble.\n\tconst contentClassName = cn(\n\t\t'min-w-0 max-w-[min(100%,42rem)] text-sm leading-relaxed text-foreground [overflow-wrap:anywhere]',\n\t\ttypeof children === 'string' && !markdown && 'whitespace-pre-wrap',\n\t\tclassName,\n\t);\n\n\tif (markdown && typeof children === 'string') {\n\t\treturn (\n\t\t\t<Markdown\n\t\t\t\tdata-slot=\"message-content\"\n\t\t\t\tstreaming={streaming}\n\t\t\t\tclassName={contentClassName}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</Markdown>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div data-slot=\"message-content\" className={contentClassName} {...props}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n\ntype MessageActionsProps = React.ComponentProps<'div'>;\n\nfunction MessageActions({ className, ...props }: MessageActionsProps) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"message-actions\"\n\t\t\tclassName={cn('flex items-center gap-1 text-muted-foreground', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\ntype MessageActionProps = {\n\ttooltip: React.ReactNode;\n\tside?: 'top' | 'bottom' | 'left' | 'right';\n\tchildren: React.ReactNode;\n\tclassName?: string;\n} & Omit<React.ComponentProps<typeof Tooltip>, 'children'>;\n\nfunction MessageAction({\n\ttooltip,\n\tchildren,\n\tclassName,\n\tside = 'top',\n\t...props\n}: MessageActionProps) {\n\treturn (\n\t\t<TooltipProvider>\n\t\t\t<Tooltip {...props}>\n\t\t\t\t<TooltipTrigger asChild>{children}</TooltipTrigger>\n\t\t\t\t<TooltipContent side={side} className={className}>\n\t\t\t\t\t{tooltip}\n\t\t\t\t</TooltipContent>\n\t\t\t</Tooltip>\n\t\t</TooltipProvider>\n\t);\n}\n\nexport { Message, MessageAvatar, MessageContent, MessageActions, MessageAction };\nexport type {\n\tMessageProps,\n\tMessageAvatarProps,\n\tMessageContentProps,\n\tMessageActionsProps,\n\tMessageActionProps,\n};\n","'use client';\n\nimport { Check, ChevronDown, Copy } from 'lucide-react';\nimport * as React from 'react';\nimport { highlight } from 'sugar-high';\nimport { c, css, diff, go, java, python, rust } from 'sugar-high/presets';\n\nimport { cn } from '../../lib/utils';\nimport { Button } from '../button';\n\n/** Default visible lines before the expand control appears. */\nconst DEFAULT_COLLAPSED_LINES = 12;\n/** Approx. line box for text-xs + leading-relaxed (+ padding slack). */\nconst LINE_BOX_PX = 20;\n/** Vertical padding inside the pre (p-3 = 12px × 2). */\nconst PRE_PAD_Y = 24;\n\ntype CodeBlockProps = React.ComponentProps<'div'> & {\n\tcode: string;\n\tlanguage?: string;\n\t/** Optional filename shown in the header. */\n\tfilename?: string;\n\t/** Show the copy control (default true). */\n\tshowCopy?: boolean;\n\t/**\n\t * Syntax highlighting via sugar-high (~1 kB). Default true.\n\t * Disable for ultra-hot streaming paths if the host re-highlights later.\n\t */\n\thighlight?: boolean;\n\t/**\n\t * Max lines shown while collapsed. Pass `false` to always show full code.\n\t * Default 12. Collapse only engages when the source is longer.\n\t */\n\tmaxCollapsedLines?: number | false;\n\t/**\n\t * When expanded, cap height and scroll inside the block.\n\t * Pass `false` for fully unconstrained height. Default ~28rem / 70vh.\n\t */\n\tmaxExpandedHeight?: string | false;\n\t/** Controlled expand state. */\n\texpanded?: boolean;\n\t/** Uncontrolled initial expand. Default false. */\n\tdefaultExpanded?: boolean;\n\tonExpandedChange?: (expanded: boolean) => void;\n\t/** Reveal code line-by-line for demos / progressive stream. */\n\tstreamingLines?: boolean;\n\t/** Lines revealed per tick when streamingLines is true. */\n\tlineIntervalMs?: number;\n};\n\n/** Map common language labels to sugar-high presets (JS/TS/JSX is the default). */\nfunction optionsForLanguage(language?: string) {\n\tif (!language) return undefined;\n\tconst key = language.toLowerCase().trim();\n\tswitch (key) {\n\t\tcase 'ts':\n\t\tcase 'tsx':\n\t\tcase 'typescript':\n\t\tcase 'js':\n\t\tcase 'jsx':\n\t\tcase 'javascript':\n\t\tcase 'mjs':\n\t\tcase 'cjs':\n\t\t\treturn undefined;\n\t\tcase 'py':\n\t\tcase 'python':\n\t\t\treturn python;\n\t\tcase 'rs':\n\t\tcase 'rust':\n\t\t\treturn rust;\n\t\tcase 'go':\n\t\tcase 'golang':\n\t\t\treturn go;\n\t\tcase 'java':\n\t\t\treturn java;\n\t\tcase 'c':\n\t\tcase 'h':\n\t\tcase 'cpp':\n\t\tcase 'c++':\n\t\tcase 'cxx':\n\t\tcase 'cc':\n\t\t\treturn c;\n\t\tcase 'css':\n\t\tcase 'scss':\n\t\tcase 'less':\n\t\t\treturn css;\n\t\tcase 'diff':\n\t\tcase 'patch':\n\t\t\treturn diff;\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\n/**\n * Agent code surface with lightweight sugar-high highlighting, elegant header,\n * copy action, and collapse/expand for long sources.\n */\nfunction CodeBlock({\n\tcode,\n\tlanguage,\n\tfilename,\n\tshowCopy = true,\n\thighlight: highlightEnabled = true,\n\tmaxCollapsedLines = DEFAULT_COLLAPSED_LINES,\n\tmaxExpandedHeight = 'min(28rem, 70vh)',\n\texpanded: expandedProp,\n\tdefaultExpanded = false,\n\tonExpandedChange,\n\tstreamingLines = false,\n\tlineIntervalMs = 240,\n\tclassName,\n\t...props\n}: CodeBlockProps) {\n\tconst [copied, setCopied] = React.useState(false);\n\tconst [uncontrolledExpanded, setUncontrolledExpanded] = React.useState(defaultExpanded);\n\tconst expanded = expandedProp ?? uncontrolledExpanded;\n\n\tconst setExpanded = React.useCallback(\n\t\t(next: boolean) => {\n\t\t\tif (expandedProp === undefined) setUncontrolledExpanded(next);\n\t\t\tonExpandedChange?.(next);\n\t\t},\n\t\t[expandedProp, onExpandedChange],\n\t);\n\n\tconst lines = React.useMemo(() => code.replace(/\\n$/, '').split('\\n'), [code]);\n\tconst lineCount = lines.length === 1 && lines[0] === '' ? 0 : lines.length;\n\n\tconst [visibleCount, setVisibleCount] = React.useState(streamingLines ? 0 : lines.length);\n\n\tReact.useEffect(() => {\n\t\tif (!streamingLines) {\n\t\t\tsetVisibleCount(lines.length);\n\t\t\treturn;\n\t\t}\n\t\tsetVisibleCount(0);\n\t\tif (lines.length === 0) return;\n\t\tconst id = window.setInterval(() => {\n\t\t\tsetVisibleCount((count) => {\n\t\t\t\tif (count >= lines.length) {\n\t\t\t\t\twindow.clearInterval(id);\n\t\t\t\t\treturn count;\n\t\t\t\t}\n\t\t\t\treturn count + 1;\n\t\t\t});\n\t\t}, lineIntervalMs);\n\t\treturn () => window.clearInterval(id);\n\t}, [streamingLines, lines, lineIntervalMs, code]);\n\n\tconst visible = streamingLines ? lines.slice(0, visibleCount).join('\\n') : code;\n\n\tconst highlightedHtml = React.useMemo(() => {\n\t\tif (!highlightEnabled || !visible) return null;\n\t\ttry {\n\t\t\treturn highlight(visible, optionsForLanguage(language));\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}, [visible, language, highlightEnabled]);\n\n\tconst handleCopy = React.useCallback(async () => {\n\t\ttry {\n\t\t\tawait navigator.clipboard.writeText(code);\n\t\t\tsetCopied(true);\n\t\t\twindow.setTimeout(() => setCopied(false), 1500);\n\t\t} catch {\n\t\t\t// Clipboard can fail in non-secure contexts; stay quiet.\n\t\t}\n\t}, [code]);\n\n\tconst collapsible =\n\t\tmaxCollapsedLines !== false && lineCount > maxCollapsedLines && !streamingLines;\n\tconst isCollapsed = collapsible && !expanded;\n\tconst hiddenLineCount = collapsible ? Math.max(0, lineCount - maxCollapsedLines) : 0;\n\n\tconst collapsedMaxHeight =\n\t\tmaxCollapsedLines === false\n\t\t\t? undefined\n\t\t\t: PRE_PAD_Y + maxCollapsedLines * LINE_BOX_PX;\n\n\tconst hasHeader = Boolean(filename || language || showCopy);\n\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"code-block\"\n\t\t\tdata-language={language || undefined}\n\t\t\tdata-expanded={collapsible ? expanded : undefined}\n\t\t\tclassName={cn(\n\t\t\t\t'overflow-hidden rounded-lg border border-border bg-muted/40 text-sm',\n\t\t\t\t// sugar-high token colors (light defaults; dark overrides below)\n\t\t\t\t'[--sh-class:oklch(0.48_0.12_250)] [--sh-identifier:var(--foreground)] [--sh-sign:var(--muted-foreground)]',\n\t\t\t\t'[--sh-property:oklch(0.48_0.11_230)] [--sh-entity:oklch(0.48_0.1_175)] [--sh-jsxliterals:oklch(0.5_0.14_290)]',\n\t\t\t\t'[--sh-string:oklch(0.48_0.1_160)] [--sh-keyword:oklch(0.52_0.16_25)] [--sh-comment:var(--muted-foreground)]',\n\t\t\t\t'[--sh-space:transparent] [--sh-break:transparent]',\n\t\t\t\t'dark:[--sh-class:oklch(0.78_0.1_250)] dark:[--sh-identifier:oklch(0.93_0_0)]',\n\t\t\t\t'dark:[--sh-sign:oklch(0.68_0.02_286)] dark:[--sh-property:oklch(0.78_0.1_230)]',\n\t\t\t\t'dark:[--sh-entity:oklch(0.78_0.1_175)] dark:[--sh-jsxliterals:oklch(0.8_0.12_290)]',\n\t\t\t\t'dark:[--sh-string:oklch(0.78_0.1_160)] dark:[--sh-keyword:oklch(0.78_0.14_25)]',\n\t\t\t\t'dark:[--sh-comment:oklch(0.62_0.02_286)]',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{hasHeader ? (\n\t\t\t\t<div\n\t\t\t\t\tdata-slot=\"code-block-header\"\n\t\t\t\t\tclassName=\"flex items-center gap-2 border-b border-border bg-muted/50 px-2.5 py-1.5\"\n\t\t\t\t>\n\t\t\t\t\t<div className=\"flex min-w-0 flex-1 items-center gap-2\">\n\t\t\t\t\t\t{filename ? (\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tdata-slot=\"code-block-filename\"\n\t\t\t\t\t\t\t\tclassName=\"min-w-0 truncate font-mono text-[0.75rem] text-foreground/80\"\n\t\t\t\t\t\t\t\ttitle={filename}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{filename}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) : language ? (\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tdata-slot=\"code-block-language\"\n\t\t\t\t\t\t\t\tclassName=\"min-w-0 truncate font-mono text-[0.75rem] text-foreground/80\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{language}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) : null}\n\n\t\t\t\t\t\t{filename && language ? (\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tdata-slot=\"code-block-language\"\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t'inline-flex shrink-0 items-center rounded-md px-1.5 py-0.5',\n\t\t\t\t\t\t\t\t\t'border border-border bg-background/50',\n\t\t\t\t\t\t\t\t\t'font-sans text-[0.625rem] font-medium tracking-wide text-muted-foreground uppercase',\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{language}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) : null}\n\n\t\t\t\t\t\t{/* Quiet line count when long enough to collapse */}\n\t\t\t\t\t\t{collapsible ? (\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tdata-slot=\"code-block-meta\"\n\t\t\t\t\t\t\t\tclassName=\"hidden shrink-0 font-sans text-[0.6875rem] tabular-nums text-muted-foreground/70 sm:inline\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{lineCount} lines\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{showCopy ? (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\tsize=\"icon-xs\"\n\t\t\t\t\t\t\tclassName=\"shrink-0 text-muted-foreground hover:text-foreground\"\n\t\t\t\t\t\t\taria-label={copied ? 'Copied' : 'Copy code'}\n\t\t\t\t\t\t\tonClick={handleCopy}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{copied ? <Check className=\"size-3.5\" /> : <Copy className=\"size-3.5\" />}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) : null}\n\t\t\t\t</div>\n\t\t\t) : null}\n\n\t\t\t{/* Body: constrained height + optional fade when collapsed */}\n\t\t\t<div data-slot=\"code-block-body\" className=\"relative\">\n\t\t\t\t<pre\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'overflow-x-auto p-3 font-mono text-xs leading-relaxed text-foreground',\n\t\t\t\t\t\t'[&_.sh__line]:block',\n\t\t\t\t\t\t// Soft height transition when toggling expand\n\t\t\t\t\t\t'transition-[max-height] duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\t\tisCollapsed && 'overflow-y-hidden',\n\t\t\t\t\t\t!isCollapsed && maxExpandedHeight !== false && collapsible && 'overflow-y-auto',\n\t\t\t\t\t)}\n\t\t\t\t\tstyle={\n\t\t\t\t\t\tisCollapsed\n\t\t\t\t\t\t\t? { maxHeight: collapsedMaxHeight }\n\t\t\t\t\t\t\t: collapsible && maxExpandedHeight !== false\n\t\t\t\t\t\t\t\t? { maxHeight: maxExpandedHeight }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{highlightedHtml ? (\n\t\t\t\t\t\t<code\n\t\t\t\t\t\t\t// sugar-high escapes token text and emits only its own span markup\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={{ __html: highlightedHtml }}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<code>{visible}</code>\n\t\t\t\t\t)}\n\t\t\t\t</pre>\n\n\t\t\t\t{/* Fade into the expand control so the cut isn’t harsh */}\n\t\t\t\t{isCollapsed ? (\n\t\t\t\t\t<div\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\tdata-slot=\"code-block-fade\"\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'pointer-events-none absolute inset-x-0 bottom-0 h-16',\n\t\t\t\t\t\t\t'bg-linear-to-t from-muted/95 via-muted/55 to-transparent',\n\t\t\t\t\t\t\t// Match the soft code surface in light/dark\n\t\t\t\t\t\t\t'dark:from-muted/90 dark:via-muted/50',\n\t\t\t\t\t\t)}\n\t\t\t\t\t/>\n\t\t\t\t) : null}\n\t\t\t</div>\n\n\t\t\t{collapsible ? (\n\t\t\t\t<div\n\t\t\t\t\tdata-slot=\"code-block-footer\"\n\t\t\t\t\tclassName=\"border-t border-border bg-muted/40\"\n\t\t\t\t>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tdata-slot=\"code-block-expand\"\n\t\t\t\t\t\taria-expanded={expanded}\n\t\t\t\t\t\tonClick={() => setExpanded(!expanded)}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'flex w-full items-center justify-center gap-1.5 px-3 py-2',\n\t\t\t\t\t\t\t'text-[0.75rem] font-medium text-muted-foreground',\n\t\t\t\t\t\t\t'outline-none transition-[color,background-color,border-color,text-decoration-color,fill,stroke,box-shadow] duration-(--duration-moderate)',\n\t\t\t\t\t\t\t'hover:bg-muted/70 hover:text-foreground',\n\t\t\t\t\t\t\t'focus-visible:bg-muted/70 focus-visible:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:ring-inset',\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{expanded\n\t\t\t\t\t\t\t\t? 'Show less'\n\t\t\t\t\t\t\t\t: hiddenLineCount === 1\n\t\t\t\t\t\t\t\t\t? 'Show 1 more line'\n\t\t\t\t\t\t\t\t\t: `Show ${hiddenLineCount} more lines`}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<ChevronDown\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t'size-3.5 opacity-70 transition-transform duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\t\t\t\texpanded && 'rotate-180',\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t/>\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t</div>\n\t);\n}\n\nexport { CodeBlock };\nexport type { CodeBlockProps };\n","'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Markdown } from './markdown';\n\ntype ResponseStreamMode = 'typewriter' | 'fade';\n\ntype ResponseStreamProps = {\n\ttext: string;\n\t/** Client-side reveal for fixtures/demos. Real hosts should stream tokens into `text`. */\n\tmode?: ResponseStreamMode;\n\t/** Characters per tick for typewriter mode. */\n\tspeed?: number;\n\tclassName?: string;\n\t/** Render as markdown once revealed. */\n\tmarkdown?: boolean;\n\tonComplete?: () => void;\n};\n\n/**\n * Progressive text reveal for demos and offline fixtures.\n * Production streaming should feed tokens into Markdown/MessageContent instead.\n */\nfunction ResponseStream({\n\ttext,\n\tmode = 'typewriter',\n\tspeed = 2,\n\tclassName,\n\tmarkdown = false,\n\tonComplete,\n}: ResponseStreamProps) {\n\tconst [cursor, setCursor] = React.useState(0);\n\tconst completeRef = React.useRef(onComplete);\n\tcompleteRef.current = onComplete;\n\n\tReact.useEffect(() => {\n\t\tsetCursor(0);\n\t}, [text]);\n\n\tReact.useEffect(() => {\n\t\tif (cursor >= text.length) {\n\t\t\tcompleteRef.current?.();\n\t\t\treturn;\n\t\t}\n\t\tconst id = window.setTimeout(() => {\n\t\t\tsetCursor((value) => Math.min(text.length, value + Math.max(1, speed)));\n\t\t}, mode === 'fade' ? 16 : 18);\n\t\treturn () => window.clearTimeout(id);\n\t}, [cursor, text, speed, mode]);\n\n\tconst visible = text.slice(0, cursor);\n\tconst streaming = cursor < text.length;\n\n\tif (markdown) {\n\t\treturn (\n\t\t\t<Markdown streaming={streaming} className={className}>\n\t\t\t\t{visible}\n\t\t\t</Markdown>\n\t\t);\n\t}\n\n\treturn (\n\t\t<span\n\t\t\tdata-slot=\"response-stream\"\n\t\t\tdata-streaming={streaming ? 'true' : 'false'}\n\t\t\tclassName={cn(\n\t\t\t\t'whitespace-pre-wrap text-sm leading-relaxed text-foreground',\n\t\t\t\tmode === 'fade' && streaming && 'animate-[fade-in_200ms_ease-out]',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t{visible}\n\t\t\t{streaming ? (\n\t\t\t\t<span\n\t\t\t\t\taria-hidden\n\t\t\t\t\tclassName=\"ms-0.5 inline-block h-3.5 w-px translate-y-0.5 bg-foreground/70 animate-pulse motion-reduce:animate-none\"\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t</span>\n\t);\n}\n\nexport { ResponseStream };\nexport type { ResponseStreamProps, ResponseStreamMode };\n","'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\n\ntype ChatContainerContextValue = {\n\tscrollRef: React.RefObject<HTMLDivElement | null>;\n\tisAtBottom: boolean;\n\tscrollToBottom: (behavior?: ScrollBehavior) => void;\n};\n\nconst ChatContainerContext = React.createContext<ChatContainerContextValue | null>(null);\n\nfunction useChatContainer() {\n\tconst context = React.useContext(ChatContainerContext);\n\tif (!context) {\n\t\tthrow new Error('useChatContainer must be used within ChatContainer.');\n\t}\n\treturn context;\n}\n\ntype ChatContainerProps = React.ComponentProps<'div'> & {\n\t/** Pixels from the bottom that still count as \"pinned\". */\n\tbottomThreshold?: number;\n\t/** Auto-follow new content while pinned to the bottom. */\n\tautoScroll?: boolean;\n};\n\n/**\n * Scroll region for chat transcripts with stick-to-bottom tracking.\n * Pair with ScrollButton for jump-to-latest.\n */\nfunction ChatContainer({\n\tclassName,\n\tchildren,\n\tbottomThreshold = 48,\n\tautoScroll = true,\n\t...props\n}: ChatContainerProps) {\n\tconst scrollRef = React.useRef<HTMLDivElement>(null);\n\tconst [isAtBottom, setIsAtBottom] = React.useState(true);\n\tconst isAtBottomRef = React.useRef(true);\n\n\tconst scrollToBottom = React.useCallback((behavior: ScrollBehavior = 'smooth') => {\n\t\tconst node = scrollRef.current;\n\t\tif (!node) return;\n\t\tnode.scrollTo({ top: node.scrollHeight, behavior });\n\t}, []);\n\n\tconst updatePinned = React.useCallback(() => {\n\t\tconst node = scrollRef.current;\n\t\tif (!node) return;\n\t\tconst distance = node.scrollHeight - node.scrollTop - node.clientHeight;\n\t\tconst pinned = distance <= bottomThreshold;\n\t\tisAtBottomRef.current = pinned;\n\t\tsetIsAtBottom(pinned);\n\t}, [bottomThreshold]);\n\n\tReact.useEffect(() => {\n\t\tconst node = scrollRef.current;\n\t\tif (!node) return;\n\t\tupdatePinned();\n\t\tnode.addEventListener('scroll', updatePinned, { passive: true });\n\t\tconst observer = new ResizeObserver(() => {\n\t\t\tif (autoScroll && isAtBottomRef.current) {\n\t\t\t\tnode.scrollTop = node.scrollHeight;\n\t\t\t}\n\t\t\tupdatePinned();\n\t\t});\n\t\tobserver.observe(node);\n\t\tif (node.firstElementChild) observer.observe(node.firstElementChild);\n\t\treturn () => {\n\t\t\tnode.removeEventListener('scroll', updatePinned);\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [autoScroll, updatePinned]);\n\n\t// Follow content growth while pinned.\n\tReact.useLayoutEffect(() => {\n\t\tif (!autoScroll || !isAtBottomRef.current) return;\n\t\tconst node = scrollRef.current;\n\t\tif (!node) return;\n\t\tnode.scrollTop = node.scrollHeight;\n\t});\n\n\treturn (\n\t\t<ChatContainerContext.Provider value={{ scrollRef, isAtBottom, scrollToBottom }}>\n\t\t\t<div\n\t\t\t\tref={scrollRef}\n\t\t\t\tdata-slot=\"chat-container\"\n\t\t\t\tdata-at-bottom={isAtBottom ? 'true' : 'false'}\n\t\t\t\tclassName={cn('relative min-h-0 flex-1 overflow-y-auto overscroll-contain', className)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</ChatContainerContext.Provider>\n\t);\n}\n\ntype ChatContainerContentProps = React.ComponentProps<'div'>;\n\nfunction ChatContainerContent({ className, ...props }: ChatContainerContentProps) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"chat-container-content\"\n\t\t\tclassName={cn('mx-auto flex w-full max-w-2xl flex-col gap-4 px-4 py-6', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { ChatContainer, ChatContainerContent, useChatContainer };\nexport type { ChatContainerProps, ChatContainerContentProps };\n","'use client';\n\nimport { ArrowDown } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { useChatContainer } from './chat-container';\n\ntype ScrollButtonProps = Omit<React.ComponentProps<'button'>, 'children'> & {\n\t/** Override visibility; defaults to !isAtBottom from ChatContainer. */\n\tvisible?: boolean;\n\t/** Accessible name (also used if a visible label is shown later). */\n\tlabel?: string;\n};\n\n/**\n * Floating jump-to-latest control. Appears when the transcript is scrolled up.\n * Must render inside ChatContainer (reads pin state via context).\n *\n * Visual: single soft ring + ambient shadow — not the outline Button chrome\n * (which stacks border + inset pseudo and reads as a double border).\n */\nfunction ScrollButton({\n\tclassName,\n\tvisible,\n\tlabel = 'Scroll to latest',\n\tonClick,\n\ttype = 'button',\n\t...props\n}: ScrollButtonProps) {\n\tconst { isAtBottom, scrollToBottom } = useChatContainer();\n\tconst show = visible ?? !isAtBottom;\n\n\tif (!show) return null;\n\n\treturn (\n\t\t<button\n\t\t\ttype={type}\n\t\t\taria-label={label}\n\t\t\tdata-slot=\"scroll-button\"\n\t\t\tclassName={cn(\n\t\t\t\t'absolute bottom-4 left-1/2 z-10 flex size-9 -translate-x-1/2 items-center justify-center',\n\t\t\t\t// Single ring — no pseudo inset, no outline Button double-edge\n\t\t\t\t'rounded-full border border-border bg-background/95 text-muted-foreground',\n\t\t\t\t'shadow-lg backdrop-blur-md',\n\t\t\t\t'dark:border-border dark:bg-card/90 dark:shadow-black/40',\n\t\t\t\t// Interaction\n\t\t\t\t'outline-none transition-[transform,background-color,color,box-shadow,border-color] duration-(--duration-moderate) ease-out',\n\t\t\t\t'hover:border-border hover:bg-accent hover:text-foreground hover:shadow-lg',\n\t\t\t\t'focus-visible:ring-[3px] focus-visible:ring-ring/50',\n\t\t\t\t'motion-safe:active:scale-[0.96]',\n\t\t\t\t// Enter\n\t\t\t\t'animate-[fade-in_150ms_ease-out] motion-reduce:animate-none',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tonClick={(event) => {\n\t\t\t\tscrollToBottom('smooth');\n\t\t\t\tonClick?.(event);\n\t\t\t}}\n\t\t\t{...props}\n\t\t>\n\t\t\t<ArrowDown className=\"size-4 opacity-90\" aria-hidden />\n\t\t</button>\n\t);\n}\n\nexport { ScrollButton };\nexport type { ScrollButtonProps };\n","'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Alert, AlertDescription, AlertTitle } from '../alert';\n\ntype SystemMessageProps = React.ComponentProps<typeof Alert> & {\n\ttitle?: React.ReactNode;\n};\n\n/**\n * Banner-style notice for app-injected transcript messages (errors, hints).\n * Not an assistant reply — keep it visually distinct via Alert variants.\n */\nfunction SystemMessage({\n\tclassName,\n\ttitle,\n\tvariant = 'info',\n\tchildren,\n\t...props\n}: SystemMessageProps) {\n\treturn (\n\t\t<Alert\n\t\t\tdata-slot=\"system-message\"\n\t\t\tvariant={variant}\n\t\t\tclassName={cn('text-start', className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{title ? <AlertTitle>{title}</AlertTitle> : null}\n\t\t\t{children ? <AlertDescription>{children}</AlertDescription> : null}\n\t\t</Alert>\n\t);\n}\n\nexport { SystemMessage };\nexport type { SystemMessageProps };\n","/** Format elapsed ms for \"Thought for …\" / \"Worked for …\" labels. */\nexport function formatDuration(ms: number): string {\n\t// Round before choosing the unit, so 999.6 ms is \"1.0s\" rather than \"1000ms\" and 9.96 seconds is \"10s\" rather than \"10.0s\".\n\tconst wholeMs = Math.round(ms);\n\tif (wholeMs < 1000) return `${Math.max(1, wholeMs)}ms`;\n\tconst seconds = ms / 1000;\n\tconst tenths = Math.round(seconds * 10) / 10;\n\tif (tenths < 10) return `${tenths.toFixed(1)}s`;\n\t// Round once, then split, so 59.6 seconds is \"1m\" rather than \"60s\" and an hour reads \"1h\" rather than \"60m\".\n\tconst total = Math.round(seconds);\n\tif (total < 60) return `${total}s`;\n\tconst hours = Math.floor(total / 3600);\n\tconst minutes = Math.floor((total % 3600) / 60);\n\tconst rem = total % 60;\n\tif (hours > 0) return minutes === 0 ? `${hours}h` : `${hours}h ${minutes}m`;\n\treturn rem === 0 ? `${minutes}m` : `${minutes}m ${rem}s`;\n}\n","'use client';\n\nimport { Brain, ChevronDown } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Collapsible, CollapsiblePanel, CollapsibleTrigger } from '../collapsible';\nimport { formatDuration } from './format-duration';\nimport { Markdown } from './markdown';\nimport { TextShimmer } from './text-shimmer';\n\ntype ReasoningProps = {\n\tchildren?: React.ReactNode;\n\t/** Raw thinking text; used when children are omitted. */\n\tcontent?: string;\n\tisStreaming?: boolean;\n\t/** Elapsed thinking time in ms (settled). */\n\tdurationMs?: number | null;\n\topen?: boolean;\n\tonOpenChange?: (open: boolean) => void;\n\t/** Render content as markdown. */\n\tmarkdown?: boolean;\n\tclassName?: string;\n\t/** Override trigger label while streaming. */\n\tstreamingLabel?: string;\n\t/** Override settled label when no duration. */\n\tdoneLabel?: string;\n};\n\n/**\n * Collapsible model reasoning / thinking block.\n * Auto-opens while streaming; auto-collapses when settled unless the user toggled.\n */\nfunction Reasoning({\n\tchildren,\n\tcontent,\n\tisStreaming = false,\n\tdurationMs = null,\n\topen: openProp,\n\tonOpenChange,\n\tmarkdown = false,\n\tclassName,\n\tstreamingLabel = 'Thinking…',\n\tdoneLabel = 'Thought',\n}: ReasoningProps) {\n\tconst [internalOpen, setInternalOpen] = React.useState(isStreaming);\n\tconst userToggled = React.useRef(false);\n\tconst prevStreaming = React.useRef(isStreaming);\n\tconst controlled = openProp !== undefined;\n\tconst open = controlled ? openProp : internalOpen;\n\n\tconst setOpen = React.useCallback(\n\t\t(next: boolean) => {\n\t\t\tif (!controlled) setInternalOpen(next);\n\t\t\tonOpenChange?.(next);\n\t\t},\n\t\t[controlled, onOpenChange],\n\t);\n\n\tReact.useEffect(() => {\n\t\tconst was = prevStreaming.current;\n\t\tprevStreaming.current = isStreaming;\n\t\tif (!was && isStreaming) {\n\t\t\tuserToggled.current = false;\n\t\t\tif (!controlled) setInternalOpen(true);\n\t\t\tonOpenChange?.(true);\n\t\t} else if (was && !isStreaming && !userToggled.current) {\n\t\t\tif (!controlled) setInternalOpen(false);\n\t\t\tonOpenChange?.(false);\n\t\t}\n\t}, [isStreaming, controlled, onOpenChange]);\n\n\tconst body = children ?? content ?? '';\n\tconst empty = typeof body === 'string' ? body.trim().length === 0 : !body;\n\tif (empty && !isStreaming) return null;\n\n\tconst duration =\n\t\tdurationMs != null && durationMs > 0 ? formatDuration(durationMs) : null;\n\tconst label = isStreaming\n\t\t? streamingLabel\n\t\t: duration\n\t\t\t? `Thought for ${duration}`\n\t\t\t: doneLabel;\n\n\treturn (\n\t\t<Collapsible\n\t\t\topen={open}\n\t\t\tonOpenChange={(next) => {\n\t\t\t\tif (isStreaming) userToggled.current = true;\n\t\t\t\tsetOpen(next);\n\t\t\t}}\n\t\t\tclassName={cn('w-full', className)}\n\t\t\tdata-slot=\"reasoning\"\n\t\t>\n\t\t\t<CollapsibleTrigger\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'group flex w-fit max-w-full items-center gap-1.5 rounded-md px-1.5 py-1.5 text-start text-[0.8125rem]',\n\t\t\t\t\t'text-muted-foreground transition-[box-shadow] duration-(--duration-moderate) hover:bg-accent hover:text-foreground',\n\t\t\t\t\t'focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50',\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<Brain className=\"size-3.5 shrink-0 opacity-80\" />\n\t\t\t\t{isStreaming ? (\n\t\t\t\t\t<TextShimmer className=\"text-[0.8125rem] font-medium tabular-nums\">{label}</TextShimmer>\n\t\t\t\t) : (\n\t\t\t\t\t<span className=\"font-medium tabular-nums\">{label}</span>\n\t\t\t\t)}\n\t\t\t\t<ChevronDown\n\t\t\t\t\tdata-slot=\"collapsible-icon\"\n\t\t\t\t\tclassName=\"size-3.5 shrink-0 opacity-60 transition-transform duration-(--duration-slow)\"\n\t\t\t\t/>\n\t\t\t</CollapsibleTrigger>\n\t\t\t<CollapsiblePanel innerClassName=\"py-0\">\n\t\t\t\t<div className=\"my-1 ms-1.5 border-s border-border/70 py-1 ps-3\">\n\t\t\t\t\t{markdown && typeof body === 'string' ? (\n\t\t\t\t\t\t<Markdown\n\t\t\t\t\t\t\tstreaming={isStreaming}\n\t\t\t\t\t\t\tclassName=\"text-[0.8125rem] text-muted-foreground\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{body}\n\t\t\t\t\t\t</Markdown>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<div className=\"whitespace-pre-wrap text-[0.8125rem] leading-relaxed text-muted-foreground\">\n\t\t\t\t\t\t\t{body}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</CollapsiblePanel>\n\t\t</Collapsible>\n\t);\n}\n\ntype ThinkingBarProps = {\n\tclassName?: string;\n\ttext?: string;\n\tonStop?: () => void;\n\tstopLabel?: string;\n\tonClick?: () => void;\n};\n\n/** Compact “Thinking…” line with optional stop action (prompt-kit style). */\nfunction ThinkingBar({\n\tclassName,\n\ttext = 'Thinking',\n\tonStop,\n\tstopLabel = 'Answer now',\n\tonClick,\n}: ThinkingBarProps) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"thinking-bar\"\n\t\t\tclassName={cn('flex w-full items-center justify-between gap-3', className)}\n\t\t>\n\t\t\t{onClick ? (\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonClick={onClick}\n\t\t\t\t\tclassName=\"flex items-center gap-1 text-sm transition-opacity duration-(--duration-moderate) hover:opacity-80\"\n\t\t\t\t>\n\t\t\t\t\t<TextShimmer className=\"font-medium\">{text}</TextShimmer>\n\t\t\t\t\t<ChevronDown className=\"size-4 -rotate-90 text-muted-foreground\" />\n\t\t\t\t</button>\n\t\t\t) : (\n\t\t\t\t<TextShimmer className=\"cursor-default font-medium\">{text}</TextShimmer>\n\t\t\t)}\n\t\t\t{onStop ? (\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonClick={onStop}\n\t\t\t\t\tclassName=\"border-b border-dotted border-muted-foreground/50 text-sm text-muted-foreground transition-[color,background-color,border-color,text-decoration-color,fill,stroke,box-shadow] duration-(--duration-moderate) hover:border-foreground hover:text-foreground\"\n\t\t\t\t>\n\t\t\t\t\t{stopLabel}\n\t\t\t\t</button>\n\t\t\t) : null}\n\t\t</div>\n\t);\n}\n\nexport { Reasoning, ThinkingBar };\nexport type { ReasoningProps, ThinkingBarProps };\n","'use client';\n\nimport { Check, ChevronDown, FileCode2, Globe, Loader2, Sparkles, Terminal } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Collapsible, CollapsiblePanel, CollapsibleTrigger } from '../collapsible';\nimport { formatDuration } from './format-duration';\nimport { TextShimmer } from './text-shimmer';\n\ntype ThinkingTraceMode = 'steps' | 'reasoning' | 'search' | 'coding';\n\ntype ThinkingTraceRow = {\n\tprimary: string;\n\tsecondary?: string;\n\tmono?: boolean;\n\thref?: string;\n\tadd?: number;\n\tdel?: number;\n};\n\ntype ThinkingTraceProps = {\n\tmode?: ThinkingTraceMode;\n\t/** Active header while working. */\n\tactiveLabel?: string;\n\t/** Settled header (overridden by durationMs when set). */\n\tdoneLabel?: string;\n\tdurationMs?: number | null;\n\tisStreaming?: boolean;\n\trows: ThinkingTraceRow[];\n\t/** Optional search query shown in search mode. */\n\tquery?: string;\n\topen?: boolean;\n\tonOpenChange?: (open: boolean) => void;\n\tclassName?: string;\n\t/** How many rows are visible while streaming (progressive reveal). */\n\tvisibleCount?: number;\n};\n\n/**\n * Expandable agent trace with mode variants.\n * Production hosts pass rows + streaming; demos can drive visibleCount.\n */\nfunction ThinkingTrace({\n\tmode = 'steps',\n\tactiveLabel,\n\tdoneLabel,\n\tdurationMs = null,\n\tisStreaming = false,\n\trows,\n\tquery,\n\topen: openProp,\n\tonOpenChange,\n\tclassName,\n\tvisibleCount,\n}: ThinkingTraceProps) {\n\tconst defaults = MODE_DEFAULTS[mode];\n\tconst [internalOpen, setInternalOpen] = React.useState(isStreaming);\n\tconst userToggled = React.useRef(false);\n\tconst prevStreaming = React.useRef(isStreaming);\n\tconst controlled = openProp !== undefined;\n\tconst open = controlled ? openProp : internalOpen;\n\n\tReact.useEffect(() => {\n\t\tconst was = prevStreaming.current;\n\t\tprevStreaming.current = isStreaming;\n\t\tif (!was && isStreaming) {\n\t\t\tuserToggled.current = false;\n\t\t\tif (!controlled) setInternalOpen(true);\n\t\t} else if (was && !isStreaming && !userToggled.current) {\n\t\t\tif (!controlled) setInternalOpen(false);\n\t\t}\n\t}, [isStreaming, controlled]);\n\n\tconst setOpen = (next: boolean) => {\n\t\tif (isStreaming) userToggled.current = true;\n\t\tif (!controlled) setInternalOpen(next);\n\t\tonOpenChange?.(next);\n\t};\n\n\tconst count = visibleCount ?? rows.length;\n\tconst shown = rows.slice(0, Math.max(0, count));\n\tconst duration = durationMs != null && durationMs > 0 ? formatDuration(durationMs) : null;\n\tconst workingLabel = activeLabel ?? defaults.active;\n\tconst settledLabel =\n\t\tdoneLabel ??\n\t\t(duration ? `${defaults.donePrefix} ${duration}` : defaults.done);\n\n\treturn (\n\t\t<div data-slot=\"thinking-trace\" data-mode={mode} className={cn('flex w-full flex-col', className)}>\n\t\t\t<Collapsible open={open} onOpenChange={setOpen}>\n\t\t\t\t<CollapsibleTrigger\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'group -mx-1.5 flex w-fit items-center gap-2 rounded-md px-1.5 py-1.5 text-start',\n\t\t\t\t\t\t'hover:bg-accent',\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t<Sparkles\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'size-3.5 shrink-0',\n\t\t\t\t\t\t\tisStreaming ? 'text-muted-foreground' : 'text-muted-foreground/70',\n\t\t\t\t\t\t)}\n\t\t\t\t\t/>\n\t\t\t\t\t{isStreaming ? (\n\t\t\t\t\t\t<TextShimmer className=\"text-[0.8125rem] font-medium whitespace-nowrap\">\n\t\t\t\t\t\t\t{workingLabel}\n\t\t\t\t\t\t</TextShimmer>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<span className=\"text-[0.8125rem] font-medium whitespace-nowrap text-muted-foreground animate-[fade-in_350ms_ease-out_both] motion-reduce:animate-none\">\n\t\t\t\t\t\t\t{settledLabel}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t\t<ChevronDown data-slot=\"collapsible-icon\" className=\"size-3.5 text-muted-foreground/60\" />\n\t\t\t\t</CollapsibleTrigger>\n\n\t\t\t\t<CollapsiblePanel innerClassName=\"py-0\">\n\t\t\t\t\t<div className=\"relative mt-1 ms-1.5 border-s border-border/70 ps-3\">\n\t\t\t\t\t\t{mode === 'search' && query ? (\n\t\t\t\t\t\t\t<div className=\"mb-2 flex items-center gap-1.5 text-[0.75rem] text-muted-foreground\">\n\t\t\t\t\t\t\t\t<Globe className=\"size-3 shrink-0\" />\n\t\t\t\t\t\t\t\t<span title={query} className=\"truncate font-mono\">{query}</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t<ul className=\"flex flex-col gap-1.5\">\n\t\t\t\t\t\t\t{shown.map((row, index) => {\n\t\t\t\t\t\t\t\tconst settled = !isStreaming || index < shown.length - 1 || count >= rows.length;\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<li\n\t\t\t\t\t\t\t\t\t\tkey={`${row.primary}-${index}`}\n\t\t\t\t\t\t\t\t\t\tclassName=\"flex min-w-0 items-start gap-2 text-[0.8125rem] animate-[ai-fade-up_300ms_cubic-bezier(0.23,1,0.32,1)_both] motion-reduce:animate-none\"\n\t\t\t\t\t\t\t\t\t\tstyle={{ animationDelay: `${Math.min(index, 6) * 40}ms` }}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<span className=\"mt-0.5 shrink-0\">\n\t\t\t\t\t\t\t\t\t\t\t{settled ? (\n\t\t\t\t\t\t\t\t\t\t\t\tmode === 'coding' ? (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<RowIcon mono={row.mono} primary={row.primary} />\n\t\t\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Check className=\"size-3 text-muted-foreground/70\" />\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t\t<Loader2 className=\"size-3 animate-spin text-muted-foreground motion-reduce:animate-none\" />\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t<div className=\"min-w-0 flex-1\">\n\t\t\t\t\t\t\t\t\t\t\t{row.href ? (\n\t\t\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\t\t\thref={row.href}\n\t\t\t\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t\t\t\t\trel=\"noreferrer noopener\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"font-medium text-foreground underline-offset-2 hover:underline\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{row.primary}\n\t\t\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'text-foreground',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trow.mono && 'font-mono text-[0.75rem]',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmode === 'reasoning' && 'text-muted-foreground',\n\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{row.primary}\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t{row.secondary ? (\n\t\t\t\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'ms-1.5 text-muted-foreground',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trow.mono && 'font-mono text-[0.75rem]',\n\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{row.secondary}\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t\t\t{(row.add != null || row.del != null) && (\n\t\t\t\t\t\t\t\t\t\t\t\t<span className=\"ms-1.5 font-mono text-[0.6875rem] tabular-nums\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t{row.add != null ? (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span className=\"text-success\">+{row.add}</span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t\t\t\t\t{row.del != null ? (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span className=\"ms-1 text-destructive\">-{row.del}</span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</div>\n\t\t\t\t</CollapsiblePanel>\n\t\t\t</Collapsible>\n\t\t</div>\n\t);\n}\n\nfunction RowIcon({ mono, primary }: { mono?: boolean; primary: string }) {\n\tconst p = primary.toLowerCase();\n\tif (p.startsWith('run') || p.startsWith('bash')) {\n\t\treturn <Terminal className=\"size-3 text-muted-foreground\" />;\n\t}\n\tif (p.startsWith('read') || p.startsWith('edit') || p.startsWith('write') || mono) {\n\t\treturn <FileCode2 className=\"size-3 text-muted-foreground\" />;\n\t}\n\treturn <Check className=\"size-3 text-muted-foreground/70\" />;\n}\n\nconst MODE_DEFAULTS: Record<\n\tThinkingTraceMode,\n\t{ active: string; done: string; donePrefix: string }\n> = {\n\tsteps: { active: 'Thinking', done: 'Thought', donePrefix: 'Thought for' },\n\treasoning: { active: 'Thinking', done: 'Thought', donePrefix: 'Thought for' },\n\tsearch: { active: 'Searching the web', done: 'Searched the web', donePrefix: 'Searched for' },\n\tcoding: { active: 'Running tools', done: 'Ran tools', donePrefix: 'Ran tools for' },\n};\n\nexport { ThinkingTrace };\nexport type { ThinkingTraceProps, ThinkingTraceMode, ThinkingTraceRow };\n","'use client';\n\nimport { Check, ChevronDown, Circle, CircleDashed, X } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Collapsible, CollapsiblePanel, CollapsibleTrigger } from '../collapsible';\n\n/**\n * Marker box (px). Icons are size-3.5 (14px); the box is slightly larger.\n * Odd rail keeps the 1px connector on an integer left: (RAIL - 1) / 2.\n */\nconst RAIL = 15;\n/** Air between icon edge and the vertical segment (px). */\nconst GAP = 6;\n/** Minimum visible connector length between short title-only steps (px). */\nconst MIN_SEGMENT = 12;\n\ntype StepStatus = 'pending' | 'running' | 'done' | 'error';\n\nconst STATUS_LABEL: Record<StepStatus, string> = {\n\tpending: 'Pending',\n\trunning: 'In progress',\n\tdone: 'Completed',\n\terror: 'Failed',\n};\n\ntype StepsProps = {\n\tchildren: React.ReactNode;\n\tclassName?: string;\n\topen?: boolean;\n\tonOpenChange?: (open: boolean) => void;\n\tdefaultOpen?: boolean;\n\t/** Header label when collapsed/expanded. */\n\ttitle?: React.ReactNode;\n};\n\n/**\n * Quiet timeline with gapped segments (not a continuous spine through icons):\n *\n * ```\n * ✓\n * ↕ GAP\n * │ ≥ MIN_SEGMENT\n * ↕ GAP\n * ◌\n * ```\n *\n * Each step (except last) draws its own connector. The rail enforces a minimum\n * height so short title-only steps still show a readable segment.\n */\nfunction Steps({\n\tchildren,\n\tclassName,\n\topen,\n\tonOpenChange,\n\tdefaultOpen = true,\n\ttitle = 'Steps',\n}: StepsProps) {\n\treturn (\n\t\t<Collapsible\n\t\t\topen={open}\n\t\t\tdefaultOpen={defaultOpen}\n\t\t\tonOpenChange={onOpenChange}\n\t\t\tclassName={cn('w-full min-w-0', className)}\n\t\t\tdata-slot=\"steps\"\n\t\t>\n\t\t\t<CollapsibleTrigger\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'group flex w-fit max-w-full items-center gap-1.5 rounded-md px-1.5 py-1.5 text-[0.8125rem]',\n\t\t\t\t\t'text-muted-foreground hover:bg-accent hover:text-foreground',\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<span className=\"min-w-0 truncate font-medium\">{title}</span>\n\t\t\t\t<ChevronDown\n\t\t\t\t\tdata-slot=\"collapsible-icon\"\n\t\t\t\t\tclassName=\"size-3.5 shrink-0 opacity-60\"\n\t\t\t\t/>\n\t\t\t</CollapsibleTrigger>\n\t\t\t<CollapsiblePanel innerClassName=\"py-1.5\">\n\t\t\t\t<ol className=\"flex min-w-0 flex-col\" data-slot=\"steps-list\">\n\t\t\t\t\t{children}\n\t\t\t\t</ol>\n\t\t\t</CollapsiblePanel>\n\t\t</Collapsible>\n\t);\n}\n\ntype StepProps = {\n\tchildren?: React.ReactNode;\n\ttitle: React.ReactNode;\n\tdescription?: React.ReactNode;\n\tstatus?: StepStatus;\n\tclassName?: string;\n};\n\n/**\n * Status as stroke icons only — no filled disks, no translucent glow.\n * Matches PlanTracker: Check / CircleDashed / Circle / X.\n */\nfunction StepMarker({ status }: { status: StepStatus }) {\n\treturn (\n\t\t<span\n\t\t\tdata-slot=\"step-marker\"\n\t\t\tclassName=\"relative z-10 flex shrink-0 items-center justify-center rounded-full bg-background\"\n\t\t\tstyle={{ width: RAIL, height: RAIL }}\n\t\t\taria-hidden\n\t\t>\n\t\t\t{status === 'done' ? (\n\t\t\t\t<Check className=\"size-3.5 text-success\" strokeWidth={2.5} />\n\t\t\t) : status === 'running' ? (\n\t\t\t\t<CircleDashed\n\t\t\t\t\tclassName=\"size-3.5 animate-spin text-primary motion-reduce:animate-none\"\n\t\t\t\t\tstrokeWidth={2}\n\t\t\t\t/>\n\t\t\t) : status === 'error' ? (\n\t\t\t\t<X className=\"size-3.5 text-destructive\" strokeWidth={2.5} />\n\t\t\t) : (\n\t\t\t\t<Circle className=\"size-3.5 text-muted-foreground/40\" strokeWidth={1.75} />\n\t\t\t)}\n\t\t</span>\n\t);\n}\n\nfunction Step({ children, title, description, status = 'pending', className }: StepProps) {\n\treturn (\n\t\t<li\n\t\t\tdata-slot=\"step\"\n\t\t\tdata-status={status}\n\t\t\taria-current={status === 'running' ? 'step' : undefined}\n\t\t\tclassName={cn('group/step relative flex min-w-0 items-stretch gap-2.5', className)}\n\t\t>\n\t\t\t{/*\n\t\t\t * Rail stretches with content. Non-last min-height =\n\t\t\t * RAIL + GAP + MIN_SEGMENT + GAP (15+6+12+6 = 39) so short\n\t\t\t * title-only steps still show a readable connector.\n\t\t\t * Keep min-h values in sync with RAIL / GAP / MIN_SEGMENT.\n\t\t\t */}\n\t\t\t<div\n\t\t\t\tdata-slot=\"step-rail\"\n\t\t\t\tclassName=\"relative flex min-h-[39px] shrink-0 flex-col items-center group-last/step:min-h-[15px]\"\n\t\t\t\tstyle={{ width: RAIL }}\n\t\t\t>\n\t\t\t\t<StepMarker status={status} />\n\n\t\t\t\t{/*\n\t\t\t\t * Segment: starts GAP below this icon, ends GAP above the next icon.\n\t\t\t\t * Hidden on the last step.\n\t\t\t\t */}\n\t\t\t\t<span\n\t\t\t\t\taria-hidden\n\t\t\t\t\tdata-slot=\"step-connector\"\n\t\t\t\t\tclassName=\"pointer-events-none absolute w-px bg-border group-last/step:hidden\"\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tleft: (RAIL - 1) / 2,\n\t\t\t\t\t\ttop: RAIL + GAP,\n\t\t\t\t\t\tbottom: GAP,\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t</div>\n\n\t\t\t<div\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'min-w-0 flex-1 text-[0.8125rem]',\n\t\t\t\t\t// Space between steps lives on content; last step has none\n\t\t\t\t\t'pb-3.5 group-last/step:pb-0',\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t// Line box = RAIL so the first line shares the marker’s vertical band;\n\t\t\t\t\t\t// wrapped lines grow downward without shifting that first line.\n\t\t\t\t\t\t'break-words font-medium',\n\t\t\t\t\t\tstatus === 'running' && 'text-foreground',\n\t\t\t\t\t\tstatus === 'done' && 'text-muted-foreground',\n\t\t\t\t\t\tstatus === 'pending' && 'text-muted-foreground/80',\n\t\t\t\t\t\tstatus === 'error' && 'text-destructive',\n\t\t\t\t\t)}\n\t\t\t\t\tstyle={{ minHeight: RAIL, lineHeight: `${RAIL}px` }}\n\t\t\t\t>\n\t\t\t\t\t<span className=\"sr-only\">{STATUS_LABEL[status]}: </span>\n\t\t\t\t\t{title}\n\t\t\t\t</div>\n\t\t\t\t{description ? (\n\t\t\t\t\t<div className=\"mt-1 break-words text-[0.75rem] leading-snug text-muted-foreground\">\n\t\t\t\t\t\t{description}\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t\t{children ? (\n\t\t\t\t\t<div\n\t\t\t\t\t\tdata-slot=\"step-body\"\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'mt-1.5 min-w-0 break-words text-[0.75rem] leading-snug text-muted-foreground',\n\t\t\t\t\t\t\t// Nested pre/code from agent output\n\t\t\t\t\t\t\t'[&_pre]:mt-1.5 [&_pre]:max-w-full [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:border [&_pre]:border-border [&_pre]:bg-muted/40 [&_pre]:p-2 [&_pre]:font-mono [&_pre]:text-[0.6875rem] [&_pre]:leading-relaxed',\n\t\t\t\t\t\t\t'[&_code]:rounded-sm [&_code]:bg-muted/50 [&_code]:px-1 [&_code]:py-px [&_code]:font-mono [&_code]:text-[0.71875rem]',\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t</li>\n\t);\n}\n\n/** Alias for prompt-kit chain-of-thought naming. */\nconst ChainOfThought = Steps;\nconst ChainOfThoughtStep = Step;\n\nexport { Steps, Step, ChainOfThought, ChainOfThoughtStep };\nexport type { StepsProps, StepProps, StepStatus };\n","/** Shared presentation types for agent surfaces (host-runtime agnostic). */\n\nexport type ToolStatus =\n\t| 'pending'\n\t| 'running'\n\t| 'success'\n\t| 'error'\n\t| 'aborted'\n\t// AI SDK–style part states\n\t| 'input-streaming'\n\t| 'input-available'\n\t| 'output-available'\n\t| 'output-error';\n\nexport type NormalizedToolStatus = 'pending' | 'running' | 'success' | 'error' | 'aborted';\n\nexport function normalizeToolStatus(status: ToolStatus | string | undefined): NormalizedToolStatus {\n\tswitch (status) {\n\t\tcase 'input-streaming':\n\t\tcase 'pending':\n\t\t\treturn 'pending';\n\t\tcase 'input-available':\n\t\tcase 'running':\n\t\t\treturn 'running';\n\t\tcase 'output-available':\n\t\tcase 'success':\n\t\t\treturn 'success';\n\t\tcase 'output-error':\n\t\tcase 'error':\n\t\t\treturn 'error';\n\t\tcase 'aborted':\n\t\t\treturn 'aborted';\n\t\tdefault:\n\t\t\treturn 'pending';\n\t}\n}\n\nexport type PlanStepStatus = 'pending' | 'in_progress' | 'done';\n\nexport type PlanStep = {\n\tlabel: string;\n\tstatus: PlanStepStatus;\n};\n\nexport type Plan = {\n\tsteps: PlanStep[];\n};\n\nexport type ContextUsage = {\n\t/** null while recomputing after compaction */\n\ttokens: number | null;\n\tpercent?: number | null;\n\tcontextWindow: number;\n};\n\nexport type DiffFileChip = {\n\tfile: string;\n\tadd?: number;\n\tdel?: number;\n};\n\nexport type InlineDiffSource = {\n\tbefore: string;\n\tafter: string;\n\tfileName?: string;\n};\n","'use client';\n\nimport {\n\tCheckCircle2,\n\tChevronDown,\n\tCircleX,\n\tLoader2,\n\tSettings2,\n\tWrench,\n} from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Collapsible, CollapsiblePanel, CollapsibleTrigger } from '../collapsible';\nimport {\n\tnormalizeToolStatus,\n\ttype DiffFileChip,\n\ttype ToolStatus,\n} from './types';\n\ntype ToolVariant = 'card' | 'chip' | 'row';\n\ntype ToolProps = {\n\tname: string;\n\tstatus?: ToolStatus | string;\n\t/** Short summary / path chip (e.g. file name). */\n\tsummary?: React.ReactNode;\n\tinput?: unknown;\n\toutput?: unknown;\n\terrorText?: string;\n\t/** Compact detail lines for chip/row expand. */\n\tdetail?: Array<{ text: string; tone?: 'add' | 'default' }>;\n\tdiff?: DiffFileChip | DiffFileChip[];\n\tvariant?: ToolVariant;\n\tdefaultOpen?: boolean;\n\topen?: boolean;\n\tonOpenChange?: (open: boolean) => void;\n\tclassName?: string;\n\tchildren?: React.ReactNode;\n};\n\nfunction formatValue(value: unknown): string {\n\tif (value === null) return 'null';\n\tif (value === undefined) return 'undefined';\n\tif (typeof value === 'string') return value;\n\ttry {\n\t\treturn JSON.stringify(value, null, 2);\n\t} catch {\n\t\treturn String(value);\n\t}\n}\n\nfunction StatusIcon({ status }: { status: ReturnType<typeof normalizeToolStatus> }) {\n\tswitch (status) {\n\t\tcase 'pending':\n\t\t\treturn <Loader2 className=\"size-3.5 animate-spin text-info motion-reduce:animate-none\" />;\n\t\tcase 'running':\n\t\t\treturn <Settings2 className=\"size-3.5 text-warning\" />;\n\t\tcase 'success':\n\t\t\treturn <CheckCircle2 className=\"size-3.5 text-success\" />;\n\t\tcase 'error':\n\t\t\treturn <CircleX className=\"size-3.5 text-destructive\" />;\n\t\tcase 'aborted':\n\t\t\treturn <Wrench className=\"size-3.5 text-muted-foreground\" />;\n\t}\n}\n\nfunction statusBadge(status: ReturnType<typeof normalizeToolStatus>) {\n\tconst map = {\n\t\tpending: { label: 'Queued', className: 'bg-info/10 text-info border-info/20' },\n\t\trunning: { label: 'Running', className: 'bg-warning/10 text-warning border-warning/25' },\n\t\tsuccess: { label: 'Done', className: 'bg-success/10 text-success border-success/20' },\n\t\terror: { label: 'Error', className: 'bg-destructive/10 text-destructive border-destructive/20' },\n\t\taborted: { label: 'Stopped', className: 'bg-muted text-muted-foreground border-border' },\n\t} as const;\n\treturn map[status];\n}\n\n/**\n * Tool call presentation in card, chip, or compact row density.\n */\nfunction Tool({\n\tname,\n\tstatus: statusProp = 'pending',\n\tsummary,\n\tinput,\n\toutput,\n\terrorText,\n\tdetail,\n\tdiff,\n\tvariant = 'row',\n\tdefaultOpen = false,\n\topen,\n\tonOpenChange,\n\tclassName,\n\tchildren,\n}: ToolProps) {\n\tconst status = normalizeToolStatus(statusProp);\n\tconst diffs = diff ? (Array.isArray(diff) ? diff : [diff]) : [];\n\tconst hasBody =\n\t\tBoolean(children) ||\n\t\tBoolean(detail?.length) ||\n\t\tinput !== undefined ||\n\t\toutput !== undefined ||\n\t\tBoolean(errorText) ||\n\t\tdiffs.length > 0;\n\n\tif (variant === 'chip') {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tdata-slot=\"tool\"\n\t\t\t\tdata-variant=\"chip\"\n\t\t\t\tdata-status={status}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted/40 px-2 py-1 text-[0.75rem]',\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<StatusIcon status={status} />\n\t\t\t\t<span title={name} className=\"max-w-[9rem] shrink-0 truncate font-medium text-foreground\">\n\t\t\t\t\t{name}\n\t\t\t\t</span>\n\t\t\t\t{summary ? (\n\t\t\t\t\t<span className=\"min-w-0 truncate font-mono text-muted-foreground\">{summary}</span>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t);\n\t}\n\n\tconst trigger = (\n\t\t<span\n\t\t\tclassName={cn(\n\t\t\t\t'flex min-w-0 max-w-full items-center gap-1.5 text-[0.8125rem] text-muted-foreground',\n\t\t\t\tvariant === 'card' && 'w-full justify-between font-normal',\n\t\t\t)}\n\t\t>\n\t\t\t<span className=\"flex min-w-0 items-center gap-1.5\">\n\t\t\t\t<StatusIcon status={status} />\n\t\t\t\t{/* The name and summary share what is left and truncate; the status badge keeps its full width. */}\n\t\t\t\t<span title={name} className=\"max-w-[45%] shrink-0 truncate font-medium text-foreground/90\">\n\t\t\t\t\t{name}\n\t\t\t\t</span>\n\t\t\t\t{summary ? (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'min-w-0 truncate rounded-md bg-muted px-1.5 py-0.5 font-mono text-[0.71875rem] text-muted-foreground',\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{summary}\n\t\t\t\t\t</span>\n\t\t\t\t) : null}\n\t\t\t\t{variant === 'card' ? (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'shrink-0 rounded-full border px-2 py-0.5 text-[0.6875rem] font-medium',\n\t\t\t\t\t\t\tstatusBadge(status).className,\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{statusBadge(status).label}\n\t\t\t\t\t</span>\n\t\t\t\t) : null}\n\t\t\t</span>\n\t\t\t{hasBody ? (\n\t\t\t\t<ChevronDown\n\t\t\t\t\tdata-slot=\"collapsible-icon\"\n\t\t\t\t\tclassName=\"size-3.5 shrink-0 opacity-0 transition-[opacity,transform] duration-(--duration-moderate) group-hover/tool:opacity-100 group-data-[panel-open]/collapsible:opacity-100\"\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t</span>\n\t);\n\n\tif (!hasBody) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tdata-slot=\"tool\"\n\t\t\t\tdata-variant={variant}\n\t\t\t\tdata-status={status}\n\t\t\t\tclassName={cn('flex w-full items-center py-0.5 text-start', className)}\n\t\t\t>\n\t\t\t\t{trigger}\n\t\t\t</div>\n\t\t);\n\t}\n\n\tconst body = (\n\t\t<div className=\"space-y-2 text-[0.78125rem]\">\n\t\t\t{children}\n\t\t\t{detail?.map((line, i) => (\n\t\t\t\t<div\n\t\t\t\t\tkey={i}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'font-mono leading-relaxed text-muted-foreground [overflow-wrap:anywhere]',\n\t\t\t\t\t\tline.tone === 'add' && 'text-success',\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{line.text}\n\t\t\t\t</div>\n\t\t\t))}\n\t\t\t{input !== undefined ? (\n\t\t\t\t<section>\n\t\t\t\t\t<h4 className=\"mb-1 text-xs font-medium text-muted-foreground\">Input</h4>\n\t\t\t\t\t<pre className=\"max-h-40 overflow-auto rounded-md border border-border bg-background p-2 font-mono text-[0.71875rem] leading-relaxed\">\n\t\t\t\t\t\t{formatValue(input)}\n\t\t\t\t\t</pre>\n\t\t\t\t</section>\n\t\t\t) : null}\n\t\t\t{output !== undefined ? (\n\t\t\t\t<section>\n\t\t\t\t\t<h4 className=\"mb-1 text-xs font-medium text-muted-foreground\">Output</h4>\n\t\t\t\t\t<pre className=\"max-h-48 overflow-auto rounded-md border border-border bg-background p-2 font-mono text-[0.71875rem] leading-relaxed\">\n\t\t\t\t\t\t{formatValue(output)}\n\t\t\t\t\t</pre>\n\t\t\t\t</section>\n\t\t\t) : null}\n\t\t\t{errorText ? (\n\t\t\t\t<section className=\"rounded-md border border-destructive/30 bg-destructive/8 p-2 text-destructive [overflow-wrap:anywhere]\">\n\t\t\t\t\t{errorText}\n\t\t\t\t</section>\n\t\t\t) : null}\n\t\t\t{diffs.length > 0 ? (\n\t\t\t\t<div className=\"flex flex-wrap gap-1.5 pt-0.5\">\n\t\t\t\t\t{diffs.map((d) => (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tkey={d.file}\n\t\t\t\t\t\t\tclassName=\"inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted/50 px-1.5 py-0.5 font-mono text-[0.6875rem]\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span title={d.file} className=\"min-w-0 break-all text-foreground\">\n\t\t\t\t\t\t\t\t{d.file}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{d.add != null ? <span className=\"shrink-0 text-success\">+{d.add}</span> : null}\n\t\t\t\t\t\t\t{d.del != null ? <span className=\"shrink-0 text-destructive\">-{d.del}</span> : null}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t</div>\n\t);\n\n\tif (variant === 'card') {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tdata-slot=\"tool\"\n\t\t\t\tdata-variant=\"card\"\n\t\t\t\tdata-status={status}\n\t\t\t\tclassName={cn('overflow-hidden rounded-lg border border-border', className)}\n\t\t\t>\n\t\t\t\t<Collapsible open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange} className=\"group/tool group/collapsible\">\n\t\t\t\t\t<CollapsibleTrigger className=\"w-full bg-background px-3 py-2.5 hover:bg-accent/40\">\n\t\t\t\t\t\t{trigger}\n\t\t\t\t\t</CollapsibleTrigger>\n\t\t\t\t\t<CollapsiblePanel className=\"border-t border-border\" innerClassName=\"px-3 py-2\">\n\t\t\t\t\t\t{body}\n\t\t\t\t\t</CollapsiblePanel>\n\t\t\t\t</Collapsible>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// row (Beautiful tool-chips density)\n\treturn (\n\t\t<div data-slot=\"tool\" data-variant=\"row\" data-status={status} className={cn('flex flex-col', className)}>\n\t\t\t<Collapsible\n\t\t\t\topen={open}\n\t\t\t\tdefaultOpen={defaultOpen}\n\t\t\t\tonOpenChange={onOpenChange}\n\t\t\t\tclassName=\"group/tool group/collapsible\"\n\t\t\t>\n\t\t\t\t<CollapsibleTrigger\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'group/row -mx-1 flex min-h-8 w-[calc(100%+0.5rem)] min-w-0 items-center gap-2 rounded-md px-1 py-1 text-start',\n\t\t\t\t\t\t'hover:bg-accent',\n\t\t\t\t\t\t'pointer-coarse:min-h-11',\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{trigger}\n\t\t\t\t</CollapsibleTrigger>\n\t\t\t\t<CollapsiblePanel innerClassName=\"py-1 ps-5\">\n\t\t\t\t\t{body}\n\t\t\t\t</CollapsiblePanel>\n\t\t\t</Collapsible>\n\t\t</div>\n\t);\n}\n\ntype ToolGroupProps = {\n\t/** e.g. \"4 tool calls, 2 messages\" */\n\tlabel: React.ReactNode;\n\tchildren: React.ReactNode;\n\tdefaultOpen?: boolean;\n\tclassName?: string;\n};\n\nfunction ToolGroup({ label, children, defaultOpen = true, className }: ToolGroupProps) {\n\treturn (\n\t\t<div data-slot=\"tool-group\" className={cn('w-full max-w-md', className)}>\n\t\t\t<Collapsible defaultOpen={defaultOpen} className=\"group/collapsible\">\n\t\t\t\t<CollapsibleTrigger\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'-mx-1.5 flex w-fit items-center gap-1.5 rounded-md px-1.5 py-1.5 text-[0.78125rem]',\n\t\t\t\t\t\t'text-muted-foreground hover:bg-accent hover:text-foreground',\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t<ChevronDown data-slot=\"collapsible-icon\" className=\"size-3\" />\n\t\t\t\t\t<span className=\"tabular-nums\">{label}</span>\n\t\t\t\t</CollapsibleTrigger>\n\t\t\t\t<CollapsiblePanel innerClassName=\"py-1\">\n\t\t\t\t\t<div className=\"mt-0.5 flex flex-col gap-1\">{children}</div>\n\t\t\t\t</CollapsiblePanel>\n\t\t\t</Collapsible>\n\t\t</div>\n\t);\n}\n\nexport { Tool, ToolGroup, StatusIcon };\nexport type { ToolProps, ToolVariant, ToolGroupProps };\n","'use client';\n\nimport { ArrowUp, Check, X } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Button } from '../button';\n\ntype ApprovalOption = {\n\tid: string;\n\tlabel: React.ReactNode;\n\tdescription?: React.ReactNode;\n};\n\ntype ApprovalQuestion = {\n\tid: string;\n\tprompt: React.ReactNode;\n\ttype?: 'single' | 'multiple';\n\toptions: ApprovalOption[];\n};\n\ntype ApprovalCardProps = {\n\t/** Single-shot confirm (desktop tool-confirm style). */\n\ttitle?: React.ReactNode;\n\tdescription?: React.ReactNode;\n\t/** Multi-step questions (Beautiful approval). */\n\tquestions?: ApprovalQuestion[];\n\tconfirmLabel?: string;\n\tskipLabel?: string;\n\tdestructive?: boolean;\n\t/** Preview node under the title (tables, diffs, etc.). */\n\tpreview?: React.ReactNode;\n\tonConfirm?: (payload: { answers?: Record<string, string[]> }) => void;\n\tonSkip?: () => void;\n\tonDismiss?: () => void;\n\tclassName?: string;\n\t/** Controlled sent state for demos. */\n\tdefaultSent?: boolean;\n};\n\n/**\n * Human-in-the-loop approval: simple confirm/skip or multi-question flow.\n */\nfunction ApprovalCard({\n\ttitle,\n\tdescription,\n\tquestions,\n\tconfirmLabel = 'Confirm',\n\tskipLabel = 'Skip',\n\tdestructive = false,\n\tpreview,\n\tonConfirm,\n\tonSkip,\n\tonDismiss,\n\tclassName,\n\tdefaultSent = false,\n}: ApprovalCardProps) {\n\tconst multi = Boolean(questions?.length);\n\tconst [qi, setQi] = React.useState(0);\n\tconst [answers, setAnswers] = React.useState<Record<string, string[]>>({});\n\tconst [sent, setSent] = React.useState(defaultSent);\n\n\tconst question = multi ? questions![qi] : null;\n\tconst selected = question ? (answers[question.id] ?? []) : [];\n\tconst last = multi ? qi === questions!.length - 1 : true;\n\n\tconst toggleOption = (optionId: string) => {\n\t\tif (!question) return;\n\t\tconst type = question.type ?? 'single';\n\t\tsetAnswers((prev) => {\n\t\t\tconst current = prev[question.id] ?? [];\n\t\t\tconst next =\n\t\t\t\ttype === 'single'\n\t\t\t\t\t? [optionId]\n\t\t\t\t\t: current.includes(optionId)\n\t\t\t\t\t\t? current.filter((id) => id !== optionId)\n\t\t\t\t\t\t: [...current, optionId];\n\t\t\treturn { ...prev, [question.id]: next };\n\t\t});\n\t\tif ((question.type ?? 'single') === 'single') {\n\t\t\twindow.setTimeout(() => {\n\t\t\t\tif (last) {\n\t\t\t\t\tsetSent(true);\n\t\t\t\t\tonConfirm?.({\n\t\t\t\t\t\tanswers: {\n\t\t\t\t\t\t\t...answers,\n\t\t\t\t\t\t\t[question.id]: [optionId],\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tsetQi((i) => i + 1);\n\t\t\t\t}\n\t\t\t}, 280);\n\t\t}\n\t};\n\n\tconst submitMulti = () => {\n\t\tif (!question) return;\n\t\tif (last) {\n\t\t\tsetSent(true);\n\t\t\tonConfirm?.({ answers });\n\t\t} else {\n\t\t\tsetQi((i) => i + 1);\n\t\t}\n\t};\n\n\tif (sent) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tdata-slot=\"approval-card\"\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'flex min-h-28 w-full max-w-sm flex-col items-center justify-center gap-2 rounded-lg bg-card p-4 shadow-card',\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<span className=\"flex size-6 items-center justify-center rounded-full bg-success text-white animate-[ai-fade-up_300ms_cubic-bezier(0.23,1,0.32,1)_both]\">\n\t\t\t\t\t<Check className=\"size-3.5\" strokeWidth={3} />\n\t\t\t\t</span>\n\t\t\t\t<span className=\"text-[0.8125rem] font-medium text-foreground\">Approved</span>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Simple confirm (desktop tool-confirm)\n\tif (!multi) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tdata-slot=\"approval-card\"\n\t\t\t\tdata-destructive={destructive ? 'true' : 'false'}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'w-full max-w-md overflow-hidden rounded-lg bg-card shadow-card',\n\t\t\t\t\tdestructive ? 'border-destructive/35' : 'border-border',\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<div className=\"flex items-start justify-between gap-2 px-3 pt-3\">\n\t\t\t\t\t<div className=\"min-w-0 space-y-1\">\n\t\t\t\t\t\t{title ? (\n\t\t\t\t\t\t\t<div className=\"text-[0.8125rem] font-medium text-pretty text-foreground [overflow-wrap:anywhere]\">{title}</div>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t{description ? (\n\t\t\t\t\t\t\t<div className=\"text-xs text-pretty text-muted-foreground [overflow-wrap:anywhere]\">{description}</div>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t</div>\n\t\t\t\t\t{onDismiss ? (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\tsize=\"icon-xs\"\n\t\t\t\t\t\t\taria-label=\"Dismiss\"\n\t\t\t\t\t\t\tonClick={onDismiss}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<X className=\"size-3.5\" />\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) : null}\n\t\t\t\t</div>\n\t\t\t\t{preview ? <div className=\"min-w-0 overflow-x-auto px-3 pt-2 [overflow-wrap:anywhere]\">{preview}</div> : null}\n\t\t\t\t<div className=\"flex flex-wrap items-center justify-end gap-1.5 px-3 py-2.5\">\n\t\t\t\t\t{onSkip ? (\n\t\t\t\t\t\t<Button type=\"button\" variant=\"ghost\" size=\"sm\" wrap onClick={onSkip}>\n\t\t\t\t\t\t\t{skipLabel}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) : null}\n\t\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\twrap\n\t\t\t\t\t\tvariant={destructive ? 'destructive' : 'default'}\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tsetSent(true);\n\t\t\t\t\t\t\tonConfirm?.({});\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{confirmLabel}\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Multi-question flow\n\tconst progress = questions!.map((_, i) => i <= qi);\n\tconst canAdvance = selected.length > 0;\n\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"approval-card\"\n\t\t\tclassName={cn(\n\t\t\t\t'w-full max-w-sm overflow-hidden rounded-lg shadow-card',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t<div\n\t\t\t\tkey={question!.id}\n\t\t\t\tclassName=\"p-3 animate-[ai-fade-up_300ms_cubic-bezier(0.23,1,0.32,1)_both] motion-reduce:animate-none\"\n\t\t\t>\n\t\t\t\t<div className=\"flex items-start justify-between gap-2\">\n\t\t\t\t\t<div className=\"min-w-0 text-[0.8125rem] font-medium text-pretty text-foreground [overflow-wrap:anywhere]\">{question!.prompt}</div>\n\t\t\t\t\t<div className=\"flex shrink-0 items-center gap-1\">\n\t\t\t\t\t\t{/* Progress pills */}\n\t\t\t\t\t\t<div className=\"flex items-center gap-0.5\" aria-hidden>\n\t\t\t\t\t\t\t{progress.map((on, i) => (\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tkey={i}\n\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t'h-1 rounded-full transition-[width,background-color] duration-(--duration-slow)',\n\t\t\t\t\t\t\t\t\t\ton ? 'w-3 bg-primary' : 'w-1.5 bg-border',\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{onDismiss ? (\n\t\t\t\t\t\t\t<Button type=\"button\" variant=\"ghost\" size=\"icon-xs\" aria-label=\"Dismiss\" onClick={onDismiss}>\n\t\t\t\t\t\t\t\t<X className=\"size-3.5\" />\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"mt-2 flex flex-col gap-0.5\">\n\t\t\t\t\t{question!.options.map((option) => {\n\t\t\t\t\t\tconst on = selected.includes(option.id);\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tkey={option.id}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\taria-pressed={on}\n\t\t\t\t\t\t\t\tonClick={() => toggleOption(option.id)}\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t// card rounded-lg + p-3 → option rows use rounded-md (concentric)\n\t\t\t\t\t\t\t\t\t'-mx-1.5 flex min-h-10 items-start gap-2 rounded-md px-1.5 py-1.5 text-start text-[0.8125rem]',\n\t\t\t\t\t\t\t\t\t'transition-[box-shadow] duration-(--duration-moderate) hover:bg-accent',\n\t\t\t\t\t\t\t\t\t'focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50',\n\t\t\t\t\t\t\t\t\ton && 'bg-accent',\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t'mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border',\n\t\t\t\t\t\t\t\t\t\ton ? 'border-primary bg-primary text-primary-foreground' : 'border-border',\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{on ? <Check className=\"size-2.5\" strokeWidth={3} /> : null}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<span className=\"min-w-0\">\n\t\t\t\t\t\t\t\t\t<span className=\"font-medium text-foreground [overflow-wrap:anywhere]\">{option.label}</span>\n\t\t\t\t\t\t\t\t\t{option.description ? (\n\t\t\t\t\t\t\t\t\t\t<span className=\"mt-0.5 block text-xs text-muted-foreground [overflow-wrap:anywhere]\">{option.description}</span>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t);\n\t\t\t\t\t})}\n\t\t\t\t</div>\n\t\t\t\t{(question!.type === 'multiple' || !last) && (\n\t\t\t\t\t<div className=\"mt-2 flex justify-end\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\t\taria-label={last ? confirmLabel : 'Next'}\n\t\t\t\t\t\t\tdisabled={!canAdvance}\n\t\t\t\t\t\t\tonClick={submitMulti}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ArrowUp className=\"size-4\" />\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport { ApprovalCard };\nexport type { ApprovalCardProps, ApprovalQuestion, ApprovalOption };\n","'use client';\n\nimport * as React from 'react';\n\n/**\n * Whether an `<img>` failed to load, for a fallback such as initials or an icon.\n *\n * `onError` alone misses an image that failed before React was listening: a\n * server-rendered page can hydrate after the browser has already given up on a\n * dead URL, and that `error` event is never replayed. So the ref also checks the\n * element when it mounts. A finished image with no pixels either failed or is an\n * SVG without an intrinsic size (which reports a natural width of 0 as well), and\n * `decode()` tells the two apart; a browser without it counts the image as failed.\n *\n * `failed` stays set for the life of the component that calls the hook, so key\n * that component by the image address and a new address gets a fresh attempt:\n *\n * ```tsx\n * function Photo({ src, fallback }: { src: string; fallback: React.ReactNode }) {\n * const { failed, ref, onError } = useImageFailed();\n * return failed ? fallback : <img ref={ref} src={src} onError={onError} alt=\"\" />;\n * }\n * // <Photo key={url} src={url} fallback={<Initials />} />\n * ```\n */\nexport function useImageFailed() {\n\tconst [failed, setFailed] = React.useState(false);\n\tconst onError = React.useCallback(() => setFailed(true), []);\n\tconst ref = React.useCallback((image: HTMLImageElement | null) => {\n\t\tif (!image || !image.complete || image.naturalWidth > 0) return;\n\t\tif (typeof image.decode !== 'function') setFailed(true);\n\t\telse image.decode().catch(() => setFailed(true));\n\t}, []);\n\treturn { failed, ref, onError };\n}\n","'use client';\n\nimport { ExternalLink, FileText } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip';\nimport { useImageFailed } from './use-image-failed';\n\ntype SourceProps = {\n\thref?: string;\n\ttitle: string;\n\tdescription?: string;\n\tfavicon?: string;\n\tdomain?: string;\n\t/** Shows the title instead of the host. `Sources` sets it when several chips share a host. */\n\tshowTitle?: boolean;\n\tclassName?: string;\n};\n\n/** The site's icon, or a document glyph when there is none or it does not load. */\nfunction SourceFavicon({ src }: { src?: string }) {\n\tconst { failed, ref, onError } = useImageFailed();\n\treturn src && !failed ? (\n\t\t// eslint-disable-next-line @next/next/no-img-element\n\t\t<img\n\t\t\tref={ref}\n\t\t\tsrc={src}\n\t\t\talt=\"\"\n\t\t\tonError={onError}\n\t\t\tclassName=\"size-3.5 rounded-sm outline outline-1 outline-black/10 dark:outline-white/10\"\n\t\t/>\n\t) : (\n\t\t<FileText className=\"size-3 shrink-0 opacity-70\" />\n\t);\n}\n\nfunction Source({ href, title, description, favicon, domain, showTitle = false, className }: SourceProps) {\n\tconst host = domain ?? (href ? safeHost(href) : undefined);\n\tconst label = showTitle ? title : (host ?? title);\n\tconst content = (\n\t\t<span\n\t\t\tdata-slot=\"source\"\n\t\t\tclassName={cn(\n\t\t\t\t'inline-flex max-w-full items-center gap-1.5 rounded-full border border-border bg-muted/50 px-2 py-1.5 text-[0.75rem]',\n\t\t\t\t'text-muted-foreground hover:bg-accent hover:text-foreground',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t<SourceFavicon key={favicon} src={favicon} />\n\t\t\t<span title={label} className=\"min-w-0 truncate font-medium\">{label}</span>\n\t\t\t{href ? <ExternalLink className=\"size-3 shrink-0 opacity-50\" /> : null}\n\t\t</span>\n\t);\n\n\tconst chip = href ? (\n\t\t<a href={href} target=\"_blank\" rel=\"noreferrer noopener\" className=\"inline-flex max-w-full\">\n\t\t\t{content}\n\t\t</a>\n\t) : (\n\t\tcontent\n\t);\n\n\tif (!description && title === label) return chip;\n\n\treturn (\n\t\t<Tooltip>\n\t\t\t<TooltipTrigger asChild>{chip}</TooltipTrigger>\n\t\t\t<TooltipContent side=\"top\" className=\"max-w-xs\">\n\t\t\t\t<div className=\"space-y-0.5\">\n\t\t\t\t\t<div className=\"font-medium\">{title}</div>\n\t\t\t\t\t{description ? <div className=\"text-xs opacity-90\">{description}</div> : null}\n\t\t\t\t\t{href ? <div title={href} className=\"truncate font-mono text-[0.625rem] opacity-70\">{href}</div> : null}\n\t\t\t\t</div>\n\t\t\t</TooltipContent>\n\t\t</Tooltip>\n\t);\n}\n\ntype SourcesProps = {\n\tchildren: React.ReactNode;\n\tclassName?: string;\n\tlabel?: React.ReactNode;\n};\n\nfunction Sources({ children, className, label }: SourcesProps) {\n\t// Chips from one site would all read the same host, so those show their titles instead.\n\tconst hostOf = (props: SourceProps) => props.domain ?? (props.href ? safeHost(props.href) : undefined) ?? props.title;\n\tconst counts = new Map<string, number>();\n\tfor (const child of React.Children.toArray(children)) {\n\t\tif (React.isValidElement<SourceProps>(child) && child.type === Source) counts.set(hostOf(child.props), (counts.get(hostOf(child.props)) ?? 0) + 1);\n\t}\n\tconst shown = React.Children.map(children, (child) =>\n\t\tReact.isValidElement<SourceProps>(child) && child.type === Source && (counts.get(hostOf(child.props)) ?? 0) > 1 ? React.cloneElement(child, { showTitle: true }) : child,\n\t);\n\treturn (\n\t\t<div data-slot=\"sources\" className={cn('flex flex-col gap-1.5', className)}>\n\t\t\t{label ? (\n\t\t\t\t<div className=\"text-[0.6875rem] font-medium text-muted-foreground\">\n\t\t\t\t\t{label}\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t<div className=\"flex flex-wrap gap-1.5\">{shown}</div>\n\t\t</div>\n\t);\n}\n\nfunction safeHost(url: string): string | undefined {\n\ttry {\n\t\treturn new URL(url).hostname.replace(/^www\\./, '');\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nexport { Source, Sources };\nexport type { SourceProps, SourcesProps };\n","export type DiffLine = { type: 'context' | 'add' | 'del'; text: string };\n\n/** How much work a comparison may do before it settles for a coarser answer. */\nexport type DiffLimits = {\n\t/** Largest table (lines before times lines after) the exact comparison fills: 4 bytes a cell. */\n\tmaxCells: number;\n\t/** Most edits (removed plus added lines) the bounded comparison follows. */\n\tmaxEdits: number;\n\t/** Most steps (diagonals visited plus lines compared) the bounded comparison takes. */\n\tmaxWork: number;\n};\n\nexport const DIFF_LIMITS: DiffLimits = { maxCells: 4_000_000, maxEdits: 2_000, maxWork: 8_000_000 };\n\nconst context = (text: string): DiffLine => ({ type: 'context', text });\nconst added = (text: string): DiffLine => ({ type: 'add', text });\nconst removed = (text: string): DiffLine => ({ type: 'del', text });\n\n/** Longest-common-subsequence diff of two line lists, in order. Cost is the product of the lengths. */\nfunction exactDiff(a: string[], b: string[]): DiffLine[] {\n\tconst cols = b.length + 1;\n\t// table[i][j] is the length of the longest common subsequence of a[i..] and b[j..].\n\tconst table = new Uint32Array((a.length + 1) * cols);\n\tfor (let i = a.length - 1; i >= 0; i--) {\n\t\tfor (let j = b.length - 1; j >= 0; j--) {\n\t\t\ttable[i * cols + j] = a[i] === b[j] ? table[(i + 1) * cols + j + 1]! + 1 : Math.max(table[(i + 1) * cols + j]!, table[i * cols + j + 1]!);\n\t\t}\n\t}\n\n\tconst lines: DiffLine[] = [];\n\tlet i = 0;\n\tlet j = 0;\n\twhile (i < a.length && j < b.length) {\n\t\tif (a[i] === b[j]) {\n\t\t\tlines.push(context(a[i]!));\n\t\t\ti += 1;\n\t\t\tj += 1;\n\t\t} else if (table[(i + 1) * cols + j]! >= table[i * cols + j + 1]!) {\n\t\t\tlines.push(removed(a[i]!));\n\t\t\ti += 1;\n\t\t} else {\n\t\t\tlines.push(added(b[j]!));\n\t\t\tj += 1;\n\t\t}\n\t}\n\tfor (; i < a.length; i++) lines.push(removed(a[i]!));\n\tfor (; j < b.length; j++) lines.push(added(b[j]!));\n\treturn lines;\n}\n\n/** Within each run of changes, every removal comes before every addition, as the exact comparison writes them. */\nfunction removalsFirst(lines: DiffLine[]): DiffLine[] {\n\tconst ordered: DiffLine[] = [];\n\tlet dropped: DiffLine[] = [];\n\tlet gained: DiffLine[] = [];\n\tconst flush = () => {\n\t\tfor (const line of dropped) ordered.push(line);\n\t\tfor (const line of gained) ordered.push(line);\n\t\tdropped = [];\n\t\tgained = [];\n\t};\n\tfor (const line of lines) {\n\t\tif (line.type === 'context') {\n\t\t\tflush();\n\t\t\tordered.push(line);\n\t\t} else if (line.type === 'del') dropped.push(line);\n\t\telse gained.push(line);\n\t}\n\tflush();\n\treturn ordered;\n}\n\n/**\n * Shortest edit script by Myers' greedy search, which takes time proportional\n * to the lines times the number of edits rather than to the product of the\n * lengths, so a few edits in a long file stay cheap however far apart they are.\n * Gives up (`null`) when more than `maxEdits` edits or `maxWork` steps are needed.\n */\nfunction boundedDiff(a: string[], b: string[], { maxEdits, maxWork }: DiffLimits): DiffLine[] | null {\n\tconst n = a.length;\n\tconst m = b.length;\n\tconst limit = Math.min(n + m, maxEdits);\n\tconst offset = limit + 1;\n\t// furthest[offset + k] is how far along `a` the best path with the edits so far reaches on diagonal k (x - y).\n\tconst furthest = new Int32Array(2 * limit + 3);\n\t// trace[d] keeps `furthest` as it was before the d-th round, for diagonals -d..d, to walk the path back.\n\tconst trace: Int32Array[] = [];\n\tlet work = 0;\n\tfor (let d = 0; d <= limit; d++) {\n\t\ttrace.push(furthest.slice(offset - d, offset + d + 1));\n\t\tfor (let k = -d; k <= d; k += 2) {\n\t\t\tlet x = k === -d || (k !== d && furthest[offset + k - 1]! < furthest[offset + k + 1]!) ? furthest[offset + k + 1]! : furthest[offset + k - 1]! + 1;\n\t\t\tlet y = x - k;\n\t\t\tconst start = x;\n\t\t\twhile (x < n && y < m && a[x] === b[y]) {\n\t\t\t\tx += 1;\n\t\t\t\ty += 1;\n\t\t\t}\n\t\t\twork += 1 + x - start;\n\t\t\tfurthest[offset + k] = x;\n\t\t\tif (x >= n && y >= m) return removalsFirst(walkBack(a, b, trace, d));\n\t\t\tif (work > maxWork) return null;\n\t\t}\n\t}\n\treturn null;\n}\n\n/** The path of a finished search, from the end back to the start, as lines in order. */\nfunction walkBack(a: string[], b: string[], trace: Int32Array[], edits: number): DiffLine[] {\n\tconst lines: DiffLine[] = [];\n\tlet x = a.length;\n\tlet y = b.length;\n\tfor (let d = edits; d >= 0; d--) {\n\t\tconst before = trace[d]!;\n\t\tconst k = x - y;\n\t\tlet fromAbove = false;\n\t\tlet previousX = 0;\n\t\tlet previousY = 0;\n\t\tif (d > 0) {\n\t\t\tfromAbove = k === -d || (k !== d && before[k - 1 + d]! < before[k + 1 + d]!);\n\t\t\tconst previousK = fromAbove ? k + 1 : k - 1;\n\t\t\tpreviousX = before[previousK + d]!;\n\t\t\tpreviousY = previousX - previousK;\n\t\t}\n\t\twhile (x > previousX && y > previousY) {\n\t\t\tlines.push(context(a[x - 1]!));\n\t\t\tx -= 1;\n\t\t\ty -= 1;\n\t\t}\n\t\tif (d > 0) lines.push(fromAbove ? added(b[y - 1]!) : removed(a[x - 1]!));\n\t\tx = previousX;\n\t\ty = previousY;\n\t}\n\treturn lines.reverse();\n}\n\n/** The part of two line lists between their common head and tail, compared as exactly as `limits` allow. */\nfunction diffMiddle(a: string[], b: string[], limits: DiffLimits): DiffLine[] {\n\tif (a.length === 0) return b.map(added);\n\tif (b.length === 0) return a.map(removed);\n\tif (a.length * b.length <= limits.maxCells) return exactDiff(a, b);\n\t// Too big for a table: follow the edits instead, and only when even that is too much show the block as removed then added.\n\treturn boundedDiff(a, b, limits) ?? [...a.map(removed), ...b.map(added)];\n}\n\n/**\n * Line diff between two line lists, in order: unchanged lines as `context`,\n * removed lines as `del`, new lines as `add`. The common head and tail are\n * trimmed first, so a small edit to a long file stays cheap, and a line that\n * also appears elsewhere is matched by position, so a repeated line is shown as\n * added or removed rather than hidden.\n */\nexport function diffLines(before: string[], after: string[], limits: DiffLimits = DIFF_LIMITS): DiffLine[] {\n\tlet head = 0;\n\twhile (head < before.length && head < after.length && before[head] === after[head]) head += 1;\n\tlet tailBefore = before.length;\n\tlet tailAfter = after.length;\n\twhile (tailBefore > head && tailAfter > head && before[tailBefore - 1] === after[tailAfter - 1]) {\n\t\ttailBefore -= 1;\n\t\ttailAfter -= 1;\n\t}\n\treturn [...before.slice(0, head).map(context), ...diffMiddle(before.slice(head, tailBefore), after.slice(head, tailAfter), limits), ...before.slice(tailBefore).map(context)];\n}\n","'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { type DiffLine, diffLines } from './line-diff';\nimport type { InlineDiffSource } from './types';\n\ntype InlineDiffProps = {\n\tsource: InlineDiffSource;\n\tclassName?: string;\n\t/** Max lines shown before collapse. */\n\tmaxLines?: number;\n};\n\n/** Unchanged lines kept on each side of a change. */\nconst CONTEXT_LINES = 2;\n\n/**\n * Line diff between two texts, in order: unchanged lines as `context`, removed\n * lines as `del`, new lines as `add`. A line that also appears elsewhere is\n * matched by position, so a repeated line is shown as added or removed rather\n * than hidden. The common head and tail are trimmed before the comparison, and\n * a long file is compared by its edits rather than by a table of every pair of\n * lines, so a few edits stay cheap however far apart they are.\n */\nfunction lineDiff(before: string, after: string): DiffLine[] {\n\treturn diffLines(before.split('\\n'), after.split('\\n'));\n}\n\ntype DiffRow = DiffLine | { type: 'gap'; count: number };\n\n/** Keeps `CONTEXT_LINES` unchanged lines around each change and folds longer unchanged runs into one gap row. */\nfunction withContext(lines: DiffLine[]): DiffRow[] {\n\tif (lines.every((line) => line.type === 'context')) return lines;\n\tconst keep = lines.map(() => false);\n\tlines.forEach((line, index) => {\n\t\tif (line.type === 'context') return;\n\t\tfor (let near = Math.max(0, index - CONTEXT_LINES); near <= Math.min(lines.length - 1, index + CONTEXT_LINES); near++) keep[near] = true;\n\t});\n\tconst rows: DiffRow[] = [];\n\tlet skipped = 0;\n\tconst flush = (index: number) => {\n\t\tif (skipped === 1) rows.push(lines[index - 1]!);\n\t\telse if (skipped > 1) rows.push({ type: 'gap', count: skipped });\n\t\tskipped = 0;\n\t};\n\tlines.forEach((line, index) => {\n\t\tif (keep[index]) {\n\t\t\tflush(index);\n\t\t\trows.push(line);\n\t\t} else {\n\t\t\tskipped += 1;\n\t\t}\n\t});\n\tflush(lines.length);\n\treturn rows;\n}\n\nfunction InlineDiff({ source, className, maxLines = 40 }: InlineDiffProps) {\n\tconst lines = React.useMemo(\n\t\t() => withContext(lineDiff(source.before, source.after)),\n\t\t[source.before, source.after],\n\t);\n\tconst visible = lines.slice(0, maxLines);\n\tconst hidden = lines.length - visible.length;\n\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"inline-diff\"\n\t\t\tclassName={cn(\n\t\t\t\t'overflow-hidden rounded-lg border border-border bg-muted/30 font-mono text-[0.71875rem] leading-relaxed',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t{source.fileName ? (\n\t\t\t\t<div title={source.fileName} className=\"border-b border-border bg-muted/50 px-2.5 py-1 text-xs break-all text-muted-foreground\">\n\t\t\t\t\t{source.fileName}\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t<pre className=\"overflow-x-auto p-0\">\n\t\t\t\t{visible.map((line, i) =>\n\t\t\t\t\tline.type === 'gap' ? (\n\t\t\t\t\t\t<div key={i} className=\"px-2.5 py-0.5 text-center text-[0.6875rem] text-subtle-foreground select-none\">\n\t\t\t\t\t\t\t{line.count} unchanged {line.count === 1 ? 'line' : 'lines'}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={i}\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t'flex gap-2 px-2.5 py-0.5',\n\t\t\t\t\t\t\t\tline.type === 'add' && 'bg-success/10 text-success',\n\t\t\t\t\t\t\t\tline.type === 'del' && 'bg-destructive/10 text-destructive',\n\t\t\t\t\t\t\t\tline.type === 'context' && 'text-muted-foreground',\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span className=\"w-3 shrink-0 select-none opacity-70\">\n\t\t\t\t\t\t\t\t{line.type === 'add' ? '+' : line.type === 'del' ? '-' : ' '}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"min-w-0 whitespace-pre-wrap break-all\">{line.text || ' '}</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t),\n\t\t\t\t)}\n\t\t\t</pre>\n\t\t\t{hidden > 0 ? (\n\t\t\t\t<div className=\"border-t border-border px-2.5 py-1 text-[0.6875rem] text-muted-foreground\">\n\t\t\t\t\t+{hidden} more lines\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t</div>\n\t);\n}\n\nexport { InlineDiff, lineDiff };\nexport type { InlineDiffProps };\n","'use client';\n\nimport { Check, Copy, RefreshCw, ThumbsDown, ThumbsUp } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Button } from '../button';\nimport {\n\tTooltip,\n\tTooltipContent,\n\tTooltipProvider,\n\tTooltipTrigger,\n} from '../tooltip';\n\ntype FeedbackValue = 'up' | 'down' | null;\n\ntype FeedbackBarProps = {\n\tclassName?: string;\n\tonCopy?: () => void | Promise<void>;\n\tonRegenerate?: () => void;\n\tonFeedback?: (value: FeedbackValue) => void;\n\tcopyText?: string;\n\tshowCopy?: boolean;\n\tshowRegenerate?: boolean;\n\tshowFeedback?: boolean;\n};\n\n/**\n * Message action row: copy, regenerate, thumbs.\n */\nfunction FeedbackBar({\n\tclassName,\n\tonCopy,\n\tonRegenerate,\n\tonFeedback,\n\tcopyText,\n\tshowCopy = true,\n\tshowRegenerate = true,\n\tshowFeedback = true,\n}: FeedbackBarProps) {\n\tconst [copied, setCopied] = React.useState(false);\n\tconst [feedback, setFeedback] = React.useState<FeedbackValue>(null);\n\n\tconst handleCopy = async () => {\n\t\ttry {\n\t\t\tif (copyText) await navigator.clipboard.writeText(copyText);\n\t\t\tawait onCopy?.();\n\t\t\tsetCopied(true);\n\t\t\twindow.setTimeout(() => setCopied(false), 1500);\n\t\t} catch {\n\t\t\t// ignore\n\t\t}\n\t};\n\n\tconst setFb = (value: FeedbackValue) => {\n\t\tconst next = feedback === value ? null : value;\n\t\tsetFeedback(next);\n\t\tonFeedback?.(next);\n\t};\n\n\treturn (\n\t\t<TooltipProvider>\n\t\t\t<div\n\t\t\t\tdata-slot=\"feedback-bar\"\n\t\t\t\tclassName={cn('flex items-center gap-2 text-muted-foreground', className)}\n\t\t\t>\n\t\t\t\t{showCopy ? (\n\t\t\t\t\t<Action tip={copied ? 'Copied' : 'Copy'} onClick={handleCopy} label={copied ? 'Copied' : 'Copy'}>\n\t\t\t\t\t\t{copied ? <Check className=\"size-3.5\" /> : <Copy className=\"size-3.5\" />}\n\t\t\t\t\t</Action>\n\t\t\t\t) : null}\n\t\t\t\t{showRegenerate && onRegenerate ? (\n\t\t\t\t\t<Action tip=\"Regenerate\" onClick={onRegenerate} label=\"Regenerate\">\n\t\t\t\t\t\t<RefreshCw className=\"size-3.5\" />\n\t\t\t\t\t</Action>\n\t\t\t\t) : null}\n\t\t\t\t{showFeedback ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Action\n\t\t\t\t\t\t\ttip=\"Good response\"\n\t\t\t\t\t\t\tonClick={() => setFb('up')}\n\t\t\t\t\t\t\tlabel=\"Good response\"\n\t\t\t\t\t\t\tactive={feedback === 'up'}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ThumbsUp className=\"size-3.5\" />\n\t\t\t\t\t\t</Action>\n\t\t\t\t\t\t<Action\n\t\t\t\t\t\t\ttip=\"Bad response\"\n\t\t\t\t\t\t\tonClick={() => setFb('down')}\n\t\t\t\t\t\t\tlabel=\"Bad response\"\n\t\t\t\t\t\t\tactive={feedback === 'down'}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ThumbsDown className=\"size-3.5\" />\n\t\t\t\t\t\t</Action>\n\t\t\t\t\t</>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t</TooltipProvider>\n\t);\n}\n\nfunction Action({\n\ttip,\n\tchildren,\n\tonClick,\n\tlabel,\n\tactive,\n}: {\n\ttip: string;\n\tchildren: React.ReactNode;\n\tonClick?: () => void;\n\tlabel: string;\n\tactive?: boolean;\n}) {\n\treturn (\n\t\t<Tooltip>\n\t\t\t<TooltipTrigger asChild>\n\t\t\t\t<Button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\tsize=\"icon-xs\"\n\t\t\t\t\taria-label={label}\n\t\t\t\t\taria-pressed={active}\n\t\t\t\t\tonClick={onClick}\n\t\t\t\t\tclassName={cn(active && 'bg-accent text-foreground')}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</Button>\n\t\t\t</TooltipTrigger>\n\t\t\t<TooltipContent side=\"bottom\">{tip}</TooltipContent>\n\t\t</Tooltip>\n\t);\n}\n\nexport { FeedbackBar };\nexport type { FeedbackBarProps, FeedbackValue };\n","'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\n\ntype PromptSuggestionProps = {\n\tchildren: React.ReactNode;\n\tonClick?: () => void;\n\tclassName?: string;\n};\n\nfunction PromptSuggestion({ children, onClick, className }: PromptSuggestionProps) {\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tdata-slot=\"prompt-suggestion\"\n\t\t\tonClick={onClick}\n\t\t\tclassName={cn(\n\t\t\t\t'inline-flex max-w-full items-center rounded-full border border-border bg-background px-3 py-1.5',\n\t\t\t\t'text-start text-[0.8125rem] text-foreground shadow-xs',\n\t\t\t\t'transition-[background-color,box-shadow,transform] duration-(--duration-moderate) ease-out',\n\t\t\t\t'hover:bg-accent hover:shadow-card',\n\t\t\t\t'motion-safe:active:scale-[0.98]',\n\t\t\t\t'focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t<span className=\"min-w-0 truncate\">{children}</span>\n\t\t</button>\n\t);\n}\n\ntype PromptSuggestionsProps = {\n\tchildren: React.ReactNode;\n\tclassName?: string;\n\tlabel?: React.ReactNode;\n};\n\nfunction PromptSuggestions({ children, className, label = 'Follow-ups' }: PromptSuggestionsProps) {\n\treturn (\n\t\t<div data-slot=\"prompt-suggestions\" className={cn('flex flex-col gap-2', className)}>\n\t\t\t{label ? (\n\t\t\t\t<div className=\"text-[0.75rem] font-medium text-muted-foreground\">{label}</div>\n\t\t\t) : null}\n\t\t\t<div className=\"flex flex-wrap gap-1.5\">{children}</div>\n\t\t</div>\n\t);\n}\n\nexport { PromptSuggestion, PromptSuggestions };\nexport type { PromptSuggestionProps, PromptSuggestionsProps };\n","'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { FeedbackBar } from './feedback-bar';\nimport { PromptSuggestion, PromptSuggestions } from './prompt-suggestion';\nimport { Source, Sources } from './source';\n\ntype StreamToken =\n\t| { type: 'text'; text: string }\n\t| { type: 'cite'; id: string };\n\ntype StreamingTextSource = {\n\tid: string;\n\ttitle: string;\n\thref?: string;\n\tdescription?: string;\n};\n\ntype StreamingTextProps = {\n\t/** Full text to reveal (word/token based). */\n\ttext?: string;\n\t/** Structured tokens with inline citations. */\n\ttokens?: StreamToken[];\n\tsources?: StreamingTextSource[];\n\tfollowUps?: string[];\n\tonFollowUp?: (text: string) => void;\n\t/** When true, reveals progressively; when false, shows all. */\n\tstreaming?: boolean;\n\t/** ms per word while streaming client-side. Hosts should prefer real token props. */\n\twordIntervalMs?: number;\n\tshowActions?: boolean;\n\tonCopy?: () => void;\n\tclassName?: string;\n};\n\n/**\n * Streamed answer with blur-resolve words, citation chips, actions, follow-ups.\n * For production, drive `streaming` + full `text` from the host; the interval\n * path is for demos when tokens arrive as a finished string.\n */\nfunction StreamingText({\n\ttext = '',\n\ttokens,\n\tsources = [],\n\tfollowUps = [],\n\tonFollowUp,\n\tstreaming = true,\n\twordIntervalMs = 48,\n\tshowActions = true,\n\tonCopy,\n\tclassName,\n}: StreamingTextProps) {\n\tconst words = React.useMemo(() => {\n\t\tif (tokens) return null;\n\t\treturn text.split(/(\\s+)/).filter(Boolean);\n\t}, [text, tokens]);\n\n\tconst total = tokens?.length ?? words?.length ?? 0;\n\tconst [visible, setVisible] = React.useState(streaming ? 0 : Number.MAX_SAFE_INTEGER);\n\n\tReact.useEffect(() => {\n\t\tif (!streaming) {\n\t\t\tsetVisible(Number.MAX_SAFE_INTEGER);\n\t\t\treturn;\n\t\t}\n\t\tsetVisible(0);\n\t\tif (total === 0) return;\n\t\tconst id = window.setInterval(() => {\n\t\t\tsetVisible((v) => {\n\t\t\t\tif (v >= total) {\n\t\t\t\t\twindow.clearInterval(id);\n\t\t\t\t\treturn v;\n\t\t\t\t}\n\t\t\t\treturn v + 1;\n\t\t\t});\n\t\t}, wordIntervalMs);\n\t\treturn () => window.clearInterval(id);\n\t}, [streaming, tokens, words, wordIntervalMs, text, total]);\n\n\tconst done = !streaming || visible >= total;\n\t/** Blur only the newest token while still revealing — not after the run settles. */\n\tconst revealing = streaming && visible < total;\n\n\treturn (\n\t\t<div data-slot=\"streaming-text\" className={cn('flex w-full flex-col gap-3', className)}>\n\t\t\t<div className=\"text-[0.8125rem] leading-relaxed text-pretty text-foreground\">\n\t\t\t\t{tokens\n\t\t\t\t\t? tokens.slice(0, visible).map((tok, i) => {\n\t\t\t\t\t\t\tif (tok.type === 'cite') {\n\t\t\t\t\t\t\t\tconst src = sources.find((s) => s.id === tok.id);\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<sup key={i} className=\"mx-0.5\">\n\t\t\t\t\t\t\t\t\t\t<Source\n\t\t\t\t\t\t\t\t\t\t\ttitle={src?.title ?? tok.id}\n\t\t\t\t\t\t\t\t\t\t\thref={src?.href}\n\t\t\t\t\t\t\t\t\t\t\tdescription={src?.description}\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"align-super text-[0.625rem]\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</sup>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tkey={i}\n\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t'transition-[filter,opacity] duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\t\t\t\t\t\ti === visible - 1 && revealing\n\t\t\t\t\t\t\t\t\t\t\t? 'opacity-90 blur-[2px] motion-reduce:blur-0'\n\t\t\t\t\t\t\t\t\t\t\t: 'opacity-100 blur-0',\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{tok.text}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})\n\t\t\t\t\t: words?.slice(0, visible).map((w, i) => (\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tkey={i}\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t'transition-[filter,opacity] duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\t\t\t\t\ti === visible - 1 && revealing && !/^\\s+$/.test(w)\n\t\t\t\t\t\t\t\t\t\t? 'opacity-90 blur-[2px] motion-reduce:blur-0'\n\t\t\t\t\t\t\t\t\t\t: 'opacity-100 blur-0',\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{w}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t))}\n\t\t\t</div>\n\n\t\t\t{sources.length > 0 && done ? (\n\t\t\t\t<Sources label={`${sources.length} sources`}>\n\t\t\t\t\t{sources.map((s) => (\n\t\t\t\t\t\t<Source key={s.id} title={s.title} href={s.href} description={s.description} />\n\t\t\t\t\t))}\n\t\t\t\t</Sources>\n\t\t\t) : null}\n\n\t\t\t{showActions && done ? (\n\t\t\t\t<FeedbackBar copyText={text} onCopy={onCopy} showRegenerate={false} />\n\t\t\t) : null}\n\n\t\t\t{followUps.length > 0 && done ? (\n\t\t\t\t<PromptSuggestions>\n\t\t\t\t\t{followUps.map((f) => (\n\t\t\t\t\t\t<PromptSuggestion key={f} onClick={() => onFollowUp?.(f)}>\n\t\t\t\t\t\t\t{f}\n\t\t\t\t\t\t</PromptSuggestion>\n\t\t\t\t\t))}\n\t\t\t\t</PromptSuggestions>\n\t\t\t) : null}\n\t\t</div>\n\t);\n}\n\nexport { StreamingText };\nexport type { StreamingTextProps, StreamingTextSource, StreamToken };\n","'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\n\ntype DiffTableColumn<T> = {\n\tid: string;\n\theader: React.ReactNode;\n\t/** Cell render for base rows. */\n\tcell: (row: T) => React.ReactNode;\n\t/** Optional mono / width hint. */\n\tclassName?: string;\n};\n\ntype DiffTableRowBase = {\n\tid: string;\n\t/** Mark for removal highlight. */\n\tremoved?: boolean;\n};\n\ntype DiffTableAddedRow = {\n\tid: string;\n\tcells: React.ReactNode[];\n};\n\ntype DiffTableProps<T extends DiffTableRowBase> = {\n\ttitle?: React.ReactNode;\n\tcolumns: DiffTableColumn<T>[];\n\trows: T[];\n\t/** Rows that appear as green additions. */\n\taddedRows?: DiffTableAddedRow[];\n\t/**\n\t * When true, play a simple enter animation (removed tint → added row).\n\t * Hosts that drive state live should leave this false.\n\t */\n\tanimate?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Table of proposed AI edits: removed rows tint destructive, added rows tint success.\n */\nfunction DiffTable<T extends DiffTableRowBase>({\n\ttitle = 'Proposed changes',\n\tcolumns,\n\trows,\n\taddedRows = [],\n\tanimate = false,\n\tclassName,\n}: DiffTableProps<T>) {\n\tconst [stage, setStage] = React.useState(animate ? 0 : 2);\n\n\tReact.useEffect(() => {\n\t\tif (!animate) {\n\t\t\tsetStage(2);\n\t\t\treturn;\n\t\t}\n\t\tsetStage(0);\n\t\tconst t1 = window.setTimeout(() => setStage(1), 500);\n\t\tconst t2 = window.setTimeout(() => setStage(2), 1100);\n\t\treturn () => {\n\t\t\twindow.clearTimeout(t1);\n\t\t\twindow.clearTimeout(t2);\n\t\t};\n\t}, [animate, rows, addedRows]);\n\n\tconst showRemovedTint = stage >= 1;\n\tconst showAdded = stage >= 2 && addedRows.length > 0;\n\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"diff-table\"\n\t\t\tclassName={cn(\n\t\t\t\t'w-full overflow-hidden rounded-lg bg-card shadow-card',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t{title ? (\n\t\t\t\t<div className=\"flex items-center justify-between border-b border-border px-3 py-2\">\n\t\t\t\t\t<span className=\"text-[0.78125rem] font-medium text-foreground\">{title}</span>\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t<div className=\"overflow-x-auto\">\n\t\t\t\t<table className=\"w-full border-collapse text-start text-[0.8125rem]\">\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr className=\"border-b border-border\">\n\t\t\t\t\t\t\t{columns.map((col) => (\n\t\t\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t\t\tkey={col.id}\n\t\t\t\t\t\t\t\t\tscope=\"col\"\n\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t'px-3 py-2 text-[0.75rem] font-medium text-muted-foreground',\n\t\t\t\t\t\t\t\t\t\tcol.className,\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{col.header}\n\t\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t{rows.map((row) => {\n\t\t\t\t\t\t\tconst out = Boolean(row.removed && showRemovedTint);\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<tr\n\t\t\t\t\t\t\t\t\tkey={row.id}\n\t\t\t\t\t\t\t\t\tdata-removed={out ? 'true' : undefined}\n\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t'border-b border-border last:border-0',\n\t\t\t\t\t\t\t\t\t\t'transition-colors duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\t\t\t\t\t\tout && 'bg-destructive/8',\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{columns.map((col, colIndex) => (\n\t\t\t\t\t\t\t\t\t\t<td\n\t\t\t\t\t\t\t\t\t\t\tkey={col.id}\n\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t'px-3 py-2 align-middle transition-colors duration-(--duration-slow) motion-reduce:transition-none',\n\t\t\t\t\t\t\t\t\t\t\t\tout && 'text-destructive',\n\t\t\t\t\t\t\t\t\t\t\t\tout && colIndex > 0 && 'line-through decoration-destructive/50',\n\t\t\t\t\t\t\t\t\t\t\t\t!out && colIndex === 0 && 'font-medium text-foreground',\n\t\t\t\t\t\t\t\t\t\t\t\t!out && colIndex > 0 && 'text-muted-foreground',\n\t\t\t\t\t\t\t\t\t\t\t\tcol.className,\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{col.cell(row)}\n\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})}\n\t\t\t\t\t\t{addedRows.map((row) => (\n\t\t\t\t\t\t\t<tr key={row.id} className=\"border-0\">\n\t\t\t\t\t\t\t\t<td colSpan={columns.length} className=\"p-0\">\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t'grid transition-[grid-template-rows,opacity] duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\t\t\t\t\t\t\tshowAdded ? 'grid-rows-[1fr] opacity-100' : 'grid-rows-[0fr] opacity-0',\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<div className=\"overflow-hidden bg-success/8\">\n\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"grid items-center border-t border-border\"\n\t\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\t\tgridTemplateColumns: `repeat(${columns.length}, minmax(0, 1fr))`,\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{row.cells.map((cell, i) => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={i}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'min-w-0 px-3 py-2 text-success [overflow-wrap:anywhere]',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ti === 0 && 'font-medium',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{cell}\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</tbody>\n\t\t\t\t</table>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport { DiffTable };\nexport type { DiffTableProps, DiffTableColumn, DiffTableRowBase, DiffTableAddedRow };\n","'use client';\n\nimport { Check, ChevronDown, Circle, CircleDashed, ListChecks } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Collapsible, CollapsiblePanel, CollapsibleTrigger } from '../collapsible';\nimport type { Plan, PlanStep } from './types';\n\ntype PlanTrackerProps = {\n\tplan?: Plan | null;\n\tstreaming?: boolean;\n\tclassName?: string;\n\t/** Flush bottom corners when stacked on a composer. */\n\tflushBottom?: boolean;\n\tdefaultOpen?: boolean;\n\topen?: boolean;\n\tonOpenChange?: (open: boolean) => void;\n};\n\n/**\n * Live agent plan checklist, typically pinned above the composer.\n */\nfunction PlanTracker({\n\tplan,\n\tstreaming = false,\n\tclassName,\n\tflushBottom = true,\n\tdefaultOpen = false,\n\topen,\n\tonOpenChange,\n}: PlanTrackerProps) {\n\tif (!plan || plan.steps.length === 0) return null;\n\n\tconst total = plan.steps.length;\n\tconst done = plan.steps.filter((s) => s.status === 'done').length;\n\tconst complete = done === total;\n\tconst activeIndex = plan.steps.findIndex((s) => s.status === 'in_progress');\n\tconst focusIndex =\n\t\tactiveIndex >= 0\n\t\t\t? activeIndex\n\t\t\t: streaming\n\t\t\t\t? plan.steps.findIndex((s) => s.status === 'pending')\n\t\t\t\t: -1;\n\tconst focusStep = focusIndex >= 0 ? plan.steps[focusIndex] : null;\n\n\treturn (\n\t\t<div data-slot=\"plan-tracker\" className={cn('w-full', className)}>\n\t\t\t<Collapsible open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange} className=\"group/collapsible\">\n\t\t\t\t<div\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'border border-input bg-muted/40',\n\t\t\t\t\t\tflushBottom ? 'rounded-t-lg border-b-0' : 'rounded-lg',\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t<CollapsibleTrigger\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'group flex w-full items-center gap-1.5 px-3 py-2 text-start text-[0.8125rem]',\n\t\t\t\t\t\t\t'text-muted-foreground hover:text-foreground',\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ListChecks className=\"size-3.5 shrink-0\" />\n\t\t\t\t\t\t{complete ? (\n\t\t\t\t\t\t\t<span className=\"min-w-0 flex-1 truncate font-medium tabular-nums\">{`${total}/${total} done`}</span>\n\t\t\t\t\t\t) : focusStep ? (\n\t\t\t\t\t\t\t<span className=\"min-w-0 flex-1 truncate font-medium\">\n\t\t\t\t\t\t\t\t<span className=\"me-1.5 font-mono text-[0.75rem] font-normal tabular-nums text-muted-foreground/60\">\n\t\t\t\t\t\t\t\t\t{focusIndex + 1}/{total}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t{focusStep.label}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<span className=\"min-w-0 flex-1 truncate font-medium\">{`${done}/${total} steps`}</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<ChevronDown\n\t\t\t\t\t\t\tdata-slot=\"collapsible-icon\"\n\t\t\t\t\t\t\tclassName=\"size-3.5 shrink-0 text-muted-foreground/60\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</CollapsibleTrigger>\n\t\t\t\t\t<CollapsiblePanel innerClassName=\"py-0\">\n\t\t\t\t\t\t<ul className=\"max-h-48 overflow-y-auto px-2 pb-1\">\n\t\t\t\t\t\t\t{plan.steps.map((step, i) => (\n\t\t\t\t\t\t\t\t<PlanRow key={`${step.label}-${i}`} step={step} />\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</CollapsiblePanel>\n\t\t\t\t</div>\n\t\t\t</Collapsible>\n\t\t</div>\n\t);\n}\n\nfunction PlanRow({ step }: { step: PlanStep }) {\n\treturn (\n\t\t<li className=\"flex items-center gap-2 rounded-md px-1.5 py-1 text-[0.8125rem]\">\n\t\t\t<StepIcon status={step.status} />\n\t\t\t<span\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'min-w-0 flex-1 truncate',\n\t\t\t\t\tstep.status === 'done' ? 'text-muted-foreground line-through' : 'text-foreground',\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{step.label}\n\t\t\t</span>\n\t\t</li>\n\t);\n}\n\nfunction StepIcon({ status }: { status: PlanStep['status'] }) {\n\tif (status === 'done') return <Check className=\"size-3.5 shrink-0 text-success\" />;\n\tif (status === 'in_progress') {\n\t\treturn <CircleDashed className=\"size-3.5 shrink-0 text-foreground/70\" />;\n\t}\n\treturn <Circle className=\"size-3.5 shrink-0 text-muted-foreground/40\" />;\n}\n\nexport { PlanTracker };\nexport type { PlanTrackerProps };\n","'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip';\nimport type { ContextUsage } from './types';\n\ntype ContextRingProps = {\n\tusage?: ContextUsage | null;\n\t/** Drawn diameter in px. Default 24. */\n\tsize?: number;\n\t/**\n\t * Kept for API compatibility. Scales bar thickness and length.\n\t * Default 2.\n\t */\n\tstroke?: number;\n\tclassName?: string;\n};\n\nconst compactNumber = new Intl.NumberFormat('en-US', { notation: 'compact', maximumFractionDigits: 1 });\n\n/** `1048576` is \"1M\", `999500` is \"999.5K\" and `9960` is \"10K\": rounding rolls up to the next unit instead of printing \"1000K\" or \"10.0K\". */\nfunction formatCompact(n: number): string {\n\treturn Number.isFinite(n) ? compactNumber.format(n) : String(n);\n}\n\ntype MeterTone = 'idle' | 'ok' | 'warn' | 'critical' | 'recomputing';\n\nfunction meterTone(pct: number, recomputing: boolean, hasUsage: boolean): MeterTone {\n\tif (!hasUsage) return 'idle';\n\tif (recomputing) return 'recomputing';\n\tif (pct >= 95) return 'critical';\n\tif (pct >= 80) return 'warn';\n\treturn 'ok';\n}\n\nfunction toneStroke(tone: MeterTone): string {\n\tswitch (tone) {\n\t\tcase 'critical':\n\t\t\treturn 'var(--destructive)';\n\t\tcase 'warn':\n\t\t\treturn 'var(--warning)';\n\t\tcase 'recomputing':\n\t\t\treturn 'var(--muted-foreground)';\n\t\tcase 'ok':\n\t\t\treturn 'var(--primary)';\n\t\tdefault:\n\t\t\treturn 'var(--border)';\n\t}\n}\n\n/**\n * Snap to fixed decimals so SVG attrs match across SSR and client.\n * Raw Math.cos/sin floats can differ by a ULP between Node and the browser,\n * which React reports as a hydration mismatch on line/circle coordinates.\n */\nfunction snap(n: number, digits = 3): number {\n\tconst f = 10 ** digits;\n\treturn Math.round(n * f) / f;\n}\n\n/** Polar point; 0% is 12 o'clock, clockwise. */\nfunction polar(cx: number, cy: number, r: number, pct: number) {\n\tconst rad = (pct / 100) * Math.PI * 2 - Math.PI / 2;\n\treturn {\n\t\tx: snap(cx + r * Math.cos(rad)),\n\t\ty: snap(cy + r * Math.sin(rad)),\n\t};\n}\n\n/**\n * Compact context-window meter: linear segmented bar, bent into a ring.\n * Filled ticks glow; remaining ticks stay quiet.\n */\nfunction ContextRing({ usage, size = 24, stroke = 2, className }: ContextRingProps) {\n\tconst uid = React.useId().replace(/:/g, '');\n\tconst center = size / 2;\n\tconst glowPad = snap(Math.max(4, size * 0.18));\n\tconst recomputing = !!usage && usage.tokens === null;\n\t// Without a reported percent, the ring still reads the tokens against the window rather than sitting empty beside a tooltip with real numbers.\n\tconst reported = usage?.percent ?? (usage && usage.tokens !== null && usage.contextWindow > 0 ? (usage.tokens / usage.contextWindow) * 100 : null);\n\tconst pct = reported != null ? Math.max(0, Math.min(100, reported)) : 0;\n\tconst tone = meterTone(pct, recomputing, !!usage);\n\tconst color = toneStroke(tone);\n\tconst hit = Math.max(size, 32);\n\n\t// Dense tick ring — denser at larger sizes, still readable at 24px.\n\tconst tickCount = size >= 36 ? 40 : size >= 28 ? 32 : 28;\n\tconst barLen = snap(Math.max(3.2, size * 0.18));\n\tconst barWidth = snap(Math.max(1.15, Math.min(1.75, stroke * 0.72)));\n\tconst rOuter = snap(size / 2 - glowPad * 0.15);\n\tconst rInner = snap(rOuter - barLen);\n\tconst filledCount = usage ? Math.round((pct / 100) * tickCount) : 0;\n\tconst blurStd = snap(Math.max(1.4, size * 0.06));\n\n\tconst glowId = `ctx-bar-glow-${uid}`;\n\n\tlet tooltip: string;\n\tif (!usage) tooltip = 'No usage yet';\n\telse if (usage.tokens === null) tooltip = 'Recomputing after compaction…';\n\telse {\n\t\t// The ring stops at full, but the label says how far past the window the context is.\n\t\ttooltip = `${Math.round(Math.max(0, reported ?? 0))}% used · ${formatCompact(usage.tokens)} / ${formatCompact(usage.contextWindow)}`;\n\t}\n\n\treturn (\n\t\t<Tooltip>\n\t\t\t<TooltipTrigger asChild>\n\t\t\t\t<span\n\t\t\t\t\tdata-slot=\"context-ring\"\n\t\t\t\t\tdata-tone={tone}\n\t\t\t\t\taria-label={tooltip}\n\t\t\t\t\tclassName={cn('inline-flex items-center justify-center', className)}\n\t\t\t\t\tstyle={{ width: hit, height: hit }}\n\t\t\t\t>\n\t\t\t\t\t<svg\n\t\t\t\t\t\twidth={size}\n\t\t\t\t\t\theight={size}\n\t\t\t\t\t\tviewBox={`${-glowPad} ${-glowPad} ${size + glowPad * 2} ${size + glowPad * 2}`}\n\t\t\t\t\t\tclassName={cn(recomputing && 'motion-safe:animate-pulse')}\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t>\n\t\t\t\t\t\t<defs>\n\t\t\t\t\t\t\t<filter\n\t\t\t\t\t\t\t\tid={glowId}\n\t\t\t\t\t\t\t\tx=\"-120%\"\n\t\t\t\t\t\t\t\ty=\"-120%\"\n\t\t\t\t\t\t\t\twidth=\"340%\"\n\t\t\t\t\t\t\t\theight=\"340%\"\n\t\t\t\t\t\t\t\tcolorInterpolationFilters=\"sRGB\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<feGaussianBlur stdDeviation={blurStd} result=\"blur\" />\n\t\t\t\t\t\t\t\t<feColorMatrix\n\t\t\t\t\t\t\t\t\tin=\"blur\"\n\t\t\t\t\t\t\t\t\ttype=\"matrix\"\n\t\t\t\t\t\t\t\t\tvalues=\"1 0 0 0 0\n\t\t\t\t\t\t\t\t\t 0 1 0 0 0\n\t\t\t\t\t\t\t\t\t 0 0 1 0 0\n\t\t\t\t\t\t\t\t\t 0 0 0 0.75 0\"\n\t\t\t\t\t\t\t\t\tresult=\"glow\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<feMerge>\n\t\t\t\t\t\t\t\t\t<feMergeNode in=\"glow\" />\n\t\t\t\t\t\t\t\t\t<feMergeNode in=\"SourceGraphic\" />\n\t\t\t\t\t\t\t\t</feMerge>\n\t\t\t\t\t\t\t</filter>\n\t\t\t\t\t\t</defs>\n\n\t\t\t\t\t\t{Array.from({ length: tickCount }, (_, i) => {\n\t\t\t\t\t\t\tconst t = ((i + 0.5) / tickCount) * 100;\n\t\t\t\t\t\t\tconst filled = i < filledCount;\n\t\t\t\t\t\t\tconst isFrontier = filled && i === filledCount - 1;\n\t\t\t\t\t\t\tconst outer = polar(center, center, rOuter, t);\n\t\t\t\t\t\t\tconst inner = polar(center, center, rInner, t);\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<line\n\t\t\t\t\t\t\t\t\tkey={i}\n\t\t\t\t\t\t\t\t\tx1={inner.x}\n\t\t\t\t\t\t\t\t\ty1={inner.y}\n\t\t\t\t\t\t\t\t\tx2={outer.x}\n\t\t\t\t\t\t\t\t\ty2={outer.y}\n\t\t\t\t\t\t\t\t\tstroke={filled ? color : 'var(--border)'}\n\t\t\t\t\t\t\t\t\tstrokeWidth={barWidth}\n\t\t\t\t\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\t\t\t\t\topacity={\n\t\t\t\t\t\t\t\t\t\tfilled\n\t\t\t\t\t\t\t\t\t\t\t? recomputing\n\t\t\t\t\t\t\t\t\t\t\t\t? 0.55\n\t\t\t\t\t\t\t\t\t\t\t\t: isFrontier\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 0.92\n\t\t\t\t\t\t\t\t\t\t\t: usage\n\t\t\t\t\t\t\t\t\t\t\t\t? 0.38\n\t\t\t\t\t\t\t\t\t\t\t\t: 0.28\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tfilter={filled ? `url(#${glowId})` : undefined}\n\t\t\t\t\t\t\t\t\tclassName=\"transition-[stroke,opacity] duration-(--duration-slow) ease-out\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})}\n\t\t\t\t\t</svg>\n\t\t\t\t</span>\n\t\t\t</TooltipTrigger>\n\t\t\t<TooltipContent side=\"top\" className=\"tabular-nums\">\n\t\t\t\t{tooltip}\n\t\t\t</TooltipContent>\n\t\t</Tooltip>\n\t);\n}\n\nexport { ContextRing, formatCompact };\nexport type { ContextRingProps };\n","'use client';\n\nimport { Check, ChevronDown, Loader2, RotateCcw, X } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Button } from '../button';\nimport { Collapsible, CollapsiblePanel, CollapsibleTrigger } from '../collapsible';\n\ntype TaskStatus = 'pending' | 'running' | 'completed' | 'failed';\n\ntype TaskDetail = {\n\tlabel: React.ReactNode;\n\tmeta?: React.ReactNode;\n};\n\ntype TaskRowProps = {\n\tlabel: React.ReactNode;\n\tmeta?: React.ReactNode;\n\tstatus: TaskStatus;\n\t/** 0–100 while running. */\n\tprogress?: number;\n\tdetails?: TaskDetail[];\n\tonRetry?: () => void;\n\tclassName?: string;\n\tdefaultOpen?: boolean;\n\t/** Stagger index for enter animation. */\n\tindex?: number;\n};\n\nfunction TaskRow({\n\tlabel,\n\tmeta,\n\tstatus,\n\tprogress,\n\tdetails,\n\tonRetry,\n\tclassName,\n\tdefaultOpen = false,\n\tindex = 0,\n}: TaskRowProps) {\n\tconst hasDetails = Boolean(details?.length);\n\n\tconst badge = (\n\t\t<span className=\"relative flex size-6 shrink-0 items-center justify-center\">\n\t\t\t{status === 'running' ? (\n\t\t\t\t<>\n\t\t\t\t\t<svg width=\"24\" height=\"24\" className=\"absolute inset-0 animate-spin motion-reduce:animate-none\" style={{ animationDuration: '1.1s' }}>\n\t\t\t\t\t\t<circle cx=\"12\" cy=\"12\" r=\"10\" fill=\"none\" stroke=\"var(--border)\" strokeWidth=\"2\" />\n\t\t\t\t\t\t<circle\n\t\t\t\t\t\t\tcx=\"12\"\n\t\t\t\t\t\t\tcy=\"12\"\n\t\t\t\t\t\t\tr=\"10\"\n\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\tstroke=\"var(--muted-foreground)\"\n\t\t\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\t\t\tstrokeDasharray={`${2 * Math.PI * 10 * 0.28} ${2 * Math.PI * 10 * 0.72}`}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</svg>\n\t\t\t\t\t{progress != null ? (\n\t\t\t\t\t\t<span className=\"relative text-[0.625rem] font-semibold tabular-nums text-foreground\">\n\t\t\t\t\t\t\t{Math.round(Math.max(0, Math.min(100, progress)))}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Loader2 className=\"relative size-3 animate-spin text-muted-foreground motion-reduce:animate-none\" />\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t) : status === 'completed' ? (\n\t\t\t\t<span className=\"flex size-5 items-center justify-center rounded-full bg-success text-white\">\n\t\t\t\t\t<Check className=\"size-3\" strokeWidth={3} />\n\t\t\t\t</span>\n\t\t\t) : status === 'failed' ? (\n\t\t\t\t<span className=\"flex size-5 items-center justify-center rounded-full bg-destructive text-white\">\n\t\t\t\t\t<X className=\"size-3\" strokeWidth={3} />\n\t\t\t\t</span>\n\t\t\t) : (\n\t\t\t\t<span className=\"size-5 rounded-full border border-border\" />\n\t\t\t)}\n\t\t</span>\n\t);\n\n\tconst pill =\n\t\tstatus === 'completed' ? (\n\t\t\t<span className=\"inline-flex h-5 items-center rounded-full bg-success/10 px-2 text-[0.71875rem] font-medium text-success\">\n\t\t\t\tCompleted\n\t\t\t</span>\n\t\t) : status === 'failed' ? (\n\t\t\t<span className=\"inline-flex items-center gap-1\">\n\t\t\t\t<span className=\"inline-flex h-5 items-center rounded-full bg-destructive/10 px-2 text-[0.71875rem] font-medium text-destructive\">\n\t\t\t\t\tFailed\n\t\t\t\t</span>\n\t\t\t\t{onRetry ? (\n\t\t\t\t\t<Button type=\"button\" variant=\"ghost\" size=\"icon-xs\" aria-label=\"Retry\" onClick={onRetry}>\n\t\t\t\t\t\t<RotateCcw className=\"size-3\" />\n\t\t\t\t\t</Button>\n\t\t\t\t) : null}\n\t\t\t</span>\n\t\t) : null;\n\n\tconst header = (\n\t\t<div className=\"flex min-w-0 flex-1 items-center gap-2.5\">\n\t\t\t{badge}\n\t\t\t<div className=\"min-w-0 flex-1\">\n\t\t\t\t<div title={typeof label === 'string' ? label : undefined} className=\"truncate text-[0.8125rem] font-medium text-foreground\">\n\t\t\t\t\t{label}\n\t\t\t\t</div>\n\t\t\t\t{meta ? (\n\t\t\t\t\t<div title={typeof meta === 'string' ? meta : undefined} className=\"truncate text-[0.75rem] text-muted-foreground\">\n\t\t\t\t\t\t{meta}\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t\t{pill}\n\t\t\t{hasDetails ? (\n\t\t\t\t<ChevronDown data-slot=\"collapsible-icon\" className=\"size-3.5 shrink-0 text-muted-foreground/60\" />\n\t\t\t) : null}\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"task-row\"\n\t\t\tdata-status={status}\n\t\t\tclassName={cn(\n\t\t\t\t'rounded-lg bg-card px-2.5 py-2 shadow-card',\n\t\t\t\t'animate-[ai-fade-up_300ms_cubic-bezier(0.23,1,0.32,1)_both] motion-reduce:animate-none',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tstyle={{ animationDelay: `${index * 80}ms` }}\n\t\t>\n\t\t\t{hasDetails ? (\n\t\t\t\t<Collapsible defaultOpen={defaultOpen} className=\"group/collapsible\">\n\t\t\t\t\t<CollapsibleTrigger className=\"w-full text-start\">{header}</CollapsibleTrigger>\n\t\t\t\t\t<CollapsiblePanel innerClassName=\"py-1.5 ps-8\">\n\t\t\t\t\t\t<ul className=\"space-y-1\">\n\t\t\t\t\t\t\t{details!.map((d, i) => (\n\t\t\t\t\t\t\t\t<li key={i} className=\"flex items-center justify-between gap-2 text-[0.75rem]\">\n\t\t\t\t\t\t\t\t\t<span className=\"min-w-0 text-muted-foreground [overflow-wrap:anywhere]\">{d.label}</span>\n\t\t\t\t\t\t\t\t\t{d.meta ? (\n\t\t\t\t\t\t\t\t\t\t<span className=\"max-w-[55%] min-w-0 text-end font-mono tabular-nums text-muted-foreground/80 [overflow-wrap:anywhere]\">{d.meta}</span>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</CollapsiblePanel>\n\t\t\t\t</Collapsible>\n\t\t\t) : (\n\t\t\t\theader\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\ntype TaskListProps = {\n\tchildren: React.ReactNode;\n\tclassName?: string;\n};\n\nfunction TaskList({ children, className }: TaskListProps) {\n\treturn (\n\t\t<div data-slot=\"task-list\" className={cn('flex flex-col gap-2', className)}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n\nexport { TaskRow, TaskList };\nexport type { TaskRowProps, TaskStatus, TaskDetail, TaskListProps };\n","'use client';\n\nimport { FileText } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Badge } from '../badge';\n\ntype ContextCardProps = {\n\ttitle: React.ReactNode;\n\tbody: React.ReactNode;\n\t/** Character count or size label. */\n\tmeta?: React.ReactNode;\n\t/** Source kind badge (PDF, CSV, …). */\n\tsourceType?: string;\n\tsourceName?: React.ReactNode;\n\tclassName?: string;\n\tindex?: number;\n};\n\nfunction ContextCard({\n\ttitle,\n\tbody,\n\tmeta,\n\tsourceType,\n\tsourceName,\n\tclassName,\n\tindex = 0,\n}: ContextCardProps) {\n\treturn (\n\t\t<article\n\t\t\tdata-slot=\"context-card\"\n\t\t\tclassName={cn(\n\t\t\t\t'rounded-lg bg-card p-3 shadow-card',\n\t\t\t\t'animate-[ai-fade-up_300ms_cubic-bezier(0.23,1,0.32,1)_both] motion-reduce:animate-none',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tstyle={{ animationDelay: `${index * 60}ms` }}\n\t\t>\n\t\t\t<div className=\"flex items-start justify-between gap-2\">\n\t\t\t\t<h3 className=\"min-w-0 text-[0.8125rem] font-medium text-balance text-foreground [overflow-wrap:anywhere]\">{title}</h3>\n\t\t\t\t{meta ? (\n\t\t\t\t\t<span className=\"shrink-0 text-[0.6875rem] tabular-nums text-muted-foreground\">{meta}</span>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t\t<p className=\"mt-1.5 text-[0.8125rem] text-pretty leading-relaxed text-muted-foreground [overflow-wrap:anywhere]\">{body}</p>\n\t\t\t{(sourceType || sourceName) && (\n\t\t\t\t<div className=\"mt-2.5 flex flex-wrap items-center gap-x-1.5 gap-y-1 text-[0.75rem] text-muted-foreground\">\n\t\t\t\t\t<FileText className=\"size-3 shrink-0 opacity-70\" />\n\t\t\t\t\t{sourceType ? (\n\t\t\t\t\t\t<Badge variant=\"secondary\" className=\"h-5 px-1.5 text-[0.625rem] font-medium\">\n\t\t\t\t\t\t\t{sourceType}\n\t\t\t\t\t\t</Badge>\n\t\t\t\t\t) : null}\n\t\t\t\t\t{sourceName ? (\n\t\t\t\t\t\t<span title={typeof sourceName === 'string' ? sourceName : undefined} className=\"max-w-full min-w-0 truncate\">\n\t\t\t\t\t\t\t{sourceName}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : null}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</article>\n\t);\n}\n\ntype ContextCardsProps = {\n\tchildren: React.ReactNode;\n\tclassName?: string;\n\tlabel?: React.ReactNode;\n\tcount?: number;\n};\n\nfunction ContextCards({ children, className, label = 'Chunks', count }: ContextCardsProps) {\n\treturn (\n\t\t<div data-slot=\"context-cards\" className={cn('flex flex-col gap-2', className)}>\n\t\t\t<div className=\"flex items-center gap-2 text-[0.75rem] text-muted-foreground\">\n\t\t\t\t<span className=\"font-medium\">{label}</span>\n\t\t\t\t{count != null ? (\n\t\t\t\t\t<span className=\"tabular-nums text-muted-foreground/70\">{count}</span>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t\t<div className=\"flex flex-col gap-2\">{children}</div>\n\t\t</div>\n\t);\n}\n\nexport { ContextCard, ContextCards };\nexport type { ContextCardProps, ContextCardsProps };\n","'use client';\n\nimport { Check, ChevronDown } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Button } from '../button';\nimport { Collapsible, CollapsiblePanel, CollapsibleTrigger } from '../collapsible';\n\ntype RecommendationOption = {\n\tid: string;\n\tlabel: React.ReactNode;\n\tdescription?: React.ReactNode;\n\t/** e.g. \"Needs review\" */\n\tbadge?: React.ReactNode;\n};\n\ntype RecommendationCardProps = {\n\ttitle?: React.ReactNode;\n\t/** Primary recommendation body (supports mono spans via children). */\n\tbody: React.ReactNode;\n\t/** 0–1 confidence */\n\tconfidence?: number;\n\tconfidenceLabel?: React.ReactNode;\n\talternatives?: RecommendationOption[];\n\tacceptLabel?: string;\n\tonAccept?: (optionId: string) => void;\n\tclassName?: string;\n\t/** Controlled selected option id. */\n\tselectedId?: string;\n\tdefaultSelectedId?: string;\n};\n\n/**\n * Agent suggestion with confidence meter and optional alternatives drawer.\n */\nfunction RecommendationCard({\n\ttitle = 'Recommendation',\n\tbody,\n\tconfidence,\n\tconfidenceLabel,\n\talternatives = [],\n\tacceptLabel = 'Accept',\n\tonAccept,\n\tclassName,\n\tselectedId: selectedProp,\n\tdefaultSelectedId,\n}: RecommendationCardProps) {\n\tconst [internalId, setInternalId] = React.useState(\n\t\tdefaultSelectedId ?? alternatives[0]?.id ?? 'primary',\n\t);\n\tconst selectedId = selectedProp ?? internalId;\n\tconst selectedAlt = alternatives.find((a) => a.id === selectedId);\n\n\tconst displayBody = selectedAlt?.description ?? body;\n\tconst pct = confidence != null ? Math.round(Math.max(0, Math.min(1, confidence)) * 100) : null;\n\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"recommendation-card\"\n\t\t\tclassName={cn(\n\t\t\t\t'w-full max-w-md overflow-hidden rounded-lg bg-card shadow-card',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t<div className=\"space-y-3 p-3\">\n\t\t\t\t<div className=\"text-[0.75rem] font-medium text-muted-foreground\">{title}</div>\n\t\t\t\t<div className=\"text-[0.8125rem] text-pretty leading-relaxed text-foreground [overflow-wrap:anywhere]\">{displayBody}</div>\n\n\t\t\t\t{pct != null ? (\n\t\t\t\t\t<div className=\"space-y-1\">\n\t\t\t\t\t\t<div className=\"flex items-center justify-between text-[0.6875rem] text-muted-foreground\">\n\t\t\t\t\t\t\t<span>{confidenceLabel ?? 'Confidence'}</span>\n\t\t\t\t\t\t\t<span className=\"tabular-nums font-medium text-foreground\">{pct}%</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"h-1.5 overflow-hidden rounded-full bg-muted\">\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName=\"h-full origin-left rounded-full bg-primary rtl:origin-right transition-transform duration-(--duration-slow) ease-out motion-reduce:transition-none\"\n\t\t\t\t\t\t\t\tstyle={{ transform: `scaleX(${pct / 100})` }}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\n\t\t\t\t{alternatives.length > 0 ? (\n\t\t\t\t\t<Collapsible className=\"group/collapsible\">\n\t\t\t\t\t\t<CollapsibleTrigger\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t// outer card is rounded-lg + p-3 → inner uses rounded-md for concentric radii\n\t\t\t\t\t\t\t\t'flex w-full items-center justify-between rounded-md border border-border px-2.5 py-1.5 text-[0.78125rem]',\n\t\t\t\t\t\t\t\t'text-muted-foreground hover:bg-accent hover:text-foreground',\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>Other options</span>\n\t\t\t\t\t\t\t<ChevronDown data-slot=\"collapsible-icon\" className=\"size-3.5\" />\n\t\t\t\t\t\t</CollapsibleTrigger>\n\t\t\t\t\t\t<CollapsiblePanel innerClassName=\"py-1.5\">\n\t\t\t\t\t\t\t<ul className=\"flex flex-col gap-0.5\">\n\t\t\t\t\t\t\t\t{alternatives.map((opt) => {\n\t\t\t\t\t\t\t\t\tconst on = opt.id === selectedId;\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<li key={opt.id}>\n\t\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\t\taria-pressed={on}\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetInternalId(opt.id);\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-start text-[0.8125rem]',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'hover:bg-accent',\n\t\t\t\t\t\t\t\t\t\t\t\t\ton && 'bg-accent',\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ton ? 'border-primary bg-primary text-primary-foreground' : 'border-border',\n\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{on ? <Check className=\"size-2.5\" strokeWidth={3} /> : null}\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t\t<span className=\"min-w-0 flex-1\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span className=\"font-medium text-foreground [overflow-wrap:anywhere]\">{opt.label}</span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{opt.badge ? (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span className=\"ms-1.5 text-[0.6875rem] text-muted-foreground\">{opt.badge}</span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t</CollapsiblePanel>\n\t\t\t\t\t</Collapsible>\n\t\t\t\t) : null}\n\n\t\t\t\t<div className=\"flex flex-wrap justify-end\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\twrap\n\t\t\t\t\t\tonClick={() => onAccept?.(selectedId)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{acceptLabel}\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport { RecommendationCard };\nexport type { RecommendationCardProps, RecommendationOption };\n","'use client';\n\nimport { Paperclip, Upload, X } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Button } from '../button';\n\ntype FileUploadProps = {\n\tfiles?: File[];\n\tonFilesChange?: (files: File[]) => void;\n\tmultiple?: boolean;\n\taccept?: string;\n\tdisabled?: boolean;\n\tclassName?: string;\n\t/** `compact` renders a single-row dropzone; `button` renders a trigger only. */\n\tvariant?: 'dropzone' | 'compact' | 'button';\n\tchildren?: React.ReactNode;\n};\n\n/**\n * Drag-and-drop / file picker for chat attachments.\n */\nfunction FileUpload({\n\tfiles: filesProp,\n\tonFilesChange,\n\tmultiple = true,\n\taccept,\n\tdisabled,\n\tclassName,\n\tvariant = 'dropzone',\n\tchildren,\n}: FileUploadProps) {\n\tconst [internal, setInternal] = React.useState<File[]>([]);\n\tconst [dragging, setDragging] = React.useState(false);\n\tconst inputRef = React.useRef<HTMLInputElement>(null);\n\tconst files = filesProp ?? internal;\n\n\tconst setFiles = (next: File[]) => {\n\t\tsetInternal(next);\n\t\tonFilesChange?.(next);\n\t};\n\n\tconst addFiles = (list: FileList | File[]) => {\n\t\tconst incoming = Array.from(list);\n\t\tsetFiles(multiple ? [...files, ...incoming] : incoming.slice(0, 1));\n\t};\n\n\tconst removeAt = (index: number) => {\n\t\tsetFiles(files.filter((_, i) => i !== index));\n\t};\n\n\tconst onDrop = (event: React.DragEvent) => {\n\t\tevent.preventDefault();\n\t\tsetDragging(false);\n\t\tif (disabled || !event.dataTransfer.files?.length) return;\n\t\taddFiles(event.dataTransfer.files);\n\t};\n\n\tif (variant === 'button') {\n\t\treturn (\n\t\t\t<div data-slot=\"file-upload\" className={cn('inline-flex', className)}>\n\t\t\t\t<input\n\t\t\t\t\tref={inputRef}\n\t\t\t\t\ttype=\"file\"\n\t\t\t\t\tclassName=\"sr-only\"\n\t\t\t\t\tmultiple={multiple}\n\t\t\t\t\taccept={accept}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\tif (e.target.files) addFiles(e.target.files);\n\t\t\t\t\t\te.target.value = '';\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t\t{children ?? (\n\t\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\taria-label=\"Attach files\"\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tonClick={() => inputRef.current?.click()}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Paperclip className=\"size-4\" />\n\t\t\t\t\t</Button>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div data-slot=\"file-upload\" className={cn('w-full space-y-2', className)}>\n\t\t\t<input\n\t\t\t\tref={inputRef}\n\t\t\t\ttype=\"file\"\n\t\t\t\tclassName=\"sr-only\"\n\t\t\t\tmultiple={multiple}\n\t\t\t\taccept={accept}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tonChange={(e) => {\n\t\t\t\t\tif (e.target.files) addFiles(e.target.files);\n\t\t\t\t\te.target.value = '';\n\t\t\t\t}}\n\t\t\t/>\n\t\t\t<div\n\t\t\t\trole=\"button\"\n\t\t\t\ttabIndex={disabled ? -1 : 0}\n\t\t\t\tonKeyDown={(e) => {\n\t\t\t\t\tif (e.key === 'Enter' || e.key === ' ') {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tinputRef.current?.click();\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\tonClick={() => !disabled && inputRef.current?.click()}\n\t\t\t\tonDragEnter={(e) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tsetDragging(true);\n\t\t\t\t}}\n\t\t\t\tonDragOver={(e) => e.preventDefault()}\n\t\t\t\tonDragLeave={() => setDragging(false)}\n\t\t\t\tonDrop={onDrop}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'flex cursor-pointer items-center justify-center gap-2 rounded-lg border border-dashed px-4 text-center',\n\t\t\t\t\t'transition-colors duration-(--duration-moderate)',\n\t\t\t\t\tvariant === 'compact' ? 'flex-row rounded-md py-3' : 'flex-col py-6',\n\t\t\t\t\tdragging ? 'border-primary bg-primary/5' : 'border-border bg-muted/30 hover:bg-muted/50',\n\t\t\t\t\tdisabled && 'pointer-events-none opacity-60',\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<Upload className={cn('text-muted-foreground', variant === 'compact' ? 'size-4' : 'size-5')} />\n\t\t\t\t<div className=\"text-[0.8125rem] font-medium text-foreground\">Drop files or click to upload</div>\n\t\t\t\t{variant === 'compact' ? null : (\n\t\t\t\t\t<div className=\"text-xs text-muted-foreground\">\n\t\t\t\t\t\t{multiple ? 'Multiple files supported' : 'Single file'}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t\t{files.length > 0 ? (\n\t\t\t\t<ul className=\"flex flex-col gap-1\">\n\t\t\t\t\t{files.map((file, i) => (\n\t\t\t\t\t\t<li\n\t\t\t\t\t\t\tkey={`${file.name}-${i}`}\n\t\t\t\t\t\t\tclassName=\"flex items-center gap-2 rounded-md border border-border bg-card px-2 py-1.5 text-[0.78125rem]\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Paperclip className=\"size-3.5 shrink-0 text-muted-foreground\" />\n\t\t\t\t\t\t\t<span title={file.name} className=\"min-w-0 flex-1 truncate font-medium\">{file.name}</span>\n\t\t\t\t\t\t\t<span className=\"shrink-0 tabular-nums text-muted-foreground\">\n\t\t\t\t\t\t\t\t{formatBytes(file.size)}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\tsize=\"icon-xs\"\n\t\t\t\t\t\t\t\taria-label={`Remove ${file.name}`}\n\t\t\t\t\t\t\t\tonClick={() => removeAt(i)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<X className=\"size-3.5\" />\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t))}\n\t\t\t\t</ul>\n\t\t\t) : null}\n\t\t</div>\n\t);\n}\n\nfunction formatBytes(n: number): string {\n\tif (n < 1024) return `${n} B`;\n\tif (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;\n\treturn `${(n / (1024 * 1024)).toFixed(1)} MB`;\n}\n\nexport { FileUpload };\nexport type { FileUploadProps };\n","'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\n\ntype AiImageProps = Omit<React.ComponentProps<'img'>, 'src'> & {\n\t/** Base64 payload without data-url prefix, or full data URL. */\n\tdata?: string;\n\tmimeType?: string;\n\tsrc?: string;\n\t/** Bytes as Uint8Array. */\n\tbytes?: Uint8Array;\n};\n\n/**\n * Display AI-generated or user-uploaded images from base64 / bytes / URL.\n */\nfunction AiImage({\n\tdata,\n\tmimeType = 'image/png',\n\tsrc,\n\tbytes,\n\talt = '',\n\tclassName,\n\t...props\n}: AiImageProps) {\n\tconst resolved = React.useMemo(() => {\n\t\tif (src) return src;\n\t\tif (data) {\n\t\t\tif (data.startsWith('data:')) return data;\n\t\t\treturn `data:${mimeType};base64,${data}`;\n\t\t}\n\t\tif (bytes) {\n\t\t\tlet binary = '';\n\t\t\tbytes.forEach((b) => {\n\t\t\t\tbinary += String.fromCharCode(b);\n\t\t\t});\n\t\t\treturn `data:${mimeType};base64,${btoa(binary)}`;\n\t\t}\n\t\treturn undefined;\n\t}, [src, data, bytes, mimeType]);\n\n\tif (!resolved) return null;\n\n\treturn (\n\t\t// eslint-disable-next-line @next/next/no-img-element\n\t\t<img\n\t\t\tdata-slot=\"ai-image\"\n\t\t\tsrc={resolved}\n\t\t\talt={alt}\n\t\t\tclassName={cn(\n\t\t\t\t'max-h-80 max-w-full rounded-lg object-contain',\n\t\t\t\t'outline outline-1 -outline-offset-1 outline-black/10 dark:outline-white/10',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { AiImage };\nexport type { AiImageProps };\n","import * as React from 'react';\n\nimport { cn } from '../../lib/utils';\n\ntype MarkTileProps = React.ComponentProps<'span'> & {\n\t/** 16px (trace rows), 24px (lists), or 32px (prompts and dialogs). */\n\tsize?: 'xs' | 'sm' | 'md';\n};\n\nconst SIZE = {\n\txs: 'size-4 rounded-[5px] text-[0.5625rem] [&_svg:not([class*=size-])]:size-2.5',\n\tsm: 'size-6 rounded-md text-[0.6875rem] [&_svg:not([class*=size-])]:size-3.5',\n\tmd: 'size-8 rounded-lg text-sm [&_svg:not([class*=size-])]:size-4',\n} as const;\n\n/**\n * Square tile that frames an app mark or glyph. The edge is an inset outline\n * rather than a border, so pale marks keep a shape on any surface without the\n * tile growing.\n */\nfunction MarkTile({ size = 'xs', className, children, ...props }: MarkTileProps) {\n\treturn (\n\t\t<span\n\t\t\taria-hidden=\"true\"\n\t\t\tdata-slot=\"mark-tile\"\n\t\t\tclassName={cn(\n\t\t\t\t'grid shrink-0 place-items-center overflow-hidden bg-card leading-none text-muted-foreground',\n\t\t\t\t'outline-1 -outline-offset-1 outline-black/10 dark:outline-white/10',\n\t\t\t\tSIZE[size],\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</span>\n\t);\n}\n\n/**\n * Enter treatment for icons that appear on a state change (a check replacing a\n * spinner, a settled chip). Uses `@starting-style` so it needs no keyframes.\n */\nconst iconEnterClass =\n\t'transition-[opacity,scale,filter] duration-300 ease-[cubic-bezier(0.2,0,0,1)] starting:scale-25 starting:opacity-0 starting:blur-[4px] motion-reduce:transition-none';\n\nexport { MarkTile, iconEnterClass };\nexport type { MarkTileProps };\n","'use client';\n\nimport { BookOpen, Check } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Spinner } from '../spinner';\nimport { iconEnterClass, MarkTile } from './mark-tile';\n\ntype ToolTraceStatus = 'pending' | 'running' | 'done';\n\ntype ToolTraceStep = {\n\tid: string;\n\tlabel: React.ReactNode;\n\t/** Brand or tool mark rendered inside a 16px tile. */\n\ticon?: React.ReactNode;\n\tstatus?: ToolTraceStatus;\n};\n\ntype ToolTraceProps = React.ComponentProps<'ol'> & {\n\t/** Group heading, e.g. \"Read tools\". */\n\ttitle?: React.ReactNode;\n\t/** Heading glyph; defaults to an open book. */\n\ticon?: React.ReactNode;\n\tsteps: ToolTraceStep[];\n};\n\nconst STATUS_LABEL: Record<ToolTraceStatus, string> = {\n\tpending: 'Queued',\n\trunning: 'Running',\n\tdone: 'Done',\n};\n\n/** Delay between rows as a trace enters, so it reads top to bottom. */\nconst ROW_STAGGER_MS = 80;\n\n/**\n * Quiet tool-call trace: a heading row followed by one row per call, joined by\n * short connectors. Each row morphs from spinner to check as the call settles.\n */\nfunction ToolTrace({ title = 'Read tools', icon, steps, className, ...props }: ToolTraceProps) {\n\treturn (\n\t\t<ol data-slot=\"tool-trace\" className={cn('flex flex-col gap-2', className)} {...props}>\n\t\t\t<li className=\"flex h-7 items-center gap-2\">\n\t\t\t\t<MarkTile>{icon ?? <BookOpen />}</MarkTile>\n\t\t\t\t<span className=\"text-[0.8125rem] text-foreground\">{title}</span>\n\t\t\t</li>\n\t\t\t{steps.map((step, index) => {\n\t\t\t\tconst status = step.status ?? 'done';\n\t\t\t\treturn (\n\t\t\t\t\t<li\n\t\t\t\t\t\tkey={step.id}\n\t\t\t\t\t\tdata-status={status}\n\t\t\t\t\t\tstyle={{ animationDelay: `${(index + 1) * ROW_STAGGER_MS}ms` }}\n\t\t\t\t\t\tclassName=\"relative flex h-7 animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] items-center gap-2 motion-reduce:animate-none\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span aria-hidden=\"true\" className=\"absolute -top-2 left-2 h-2 w-px -translate-x-1/2 bg-subtle-foreground/35\" />\n\t\t\t\t\t\t<span className=\"grid size-4 shrink-0 place-items-center text-subtle-foreground\">\n\t\t\t\t\t\t\t{status === 'done' ? (\n\t\t\t\t\t\t\t\t<Check aria-hidden=\"true\" className={cn('size-3', iconEnterClass)} strokeWidth={2} />\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Spinner aria-hidden=\"true\" role={undefined} className=\"size-3.5\" strokeWidth={1.5} />\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<span className=\"sr-only\">{STATUS_LABEL[status]}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{step.icon ? <MarkTile className=\"text-foreground\">{step.icon}</MarkTile> : null}\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t'truncate text-[0.8125rem]',\n\t\t\t\t\t\t\t\tstatus === 'running' ? 'text-foreground' : 'text-muted-foreground',\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{step.label}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</li>\n\t\t\t\t);\n\t\t\t})}\n\t\t</ol>\n\t);\n}\n\nexport { ToolTrace };\nexport type { ToolTraceProps, ToolTraceStep, ToolTraceStatus };\n","'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { formatCompact } from './context-ring';\n\ntype ThinkingStatusProps = Omit<React.ComponentProps<'div'>, 'children'> & {\n\tlabel?: React.ReactNode;\n\t/** Seconds already elapsed when the status mounts. */\n\telapsedSeconds?: number;\n\t/** Token count already spent when the status mounts. */\n\ttokens?: number;\n\t/**\n\t * When true (default), the timer counts up from `elapsedSeconds` every\n\t * second. Pass false to render exactly the host's `elapsedSeconds` / `tokens`.\n\t */\n\tlive?: boolean;\n\t/** Simulated token growth per tick for demos; the host normally streams real counts. */\n\ttokensPerTick?: number;\n};\n\nfunction formatElapsed(totalSeconds: number) {\n\tconst minutes = Math.floor(totalSeconds / 60);\n\tconst seconds = totalSeconds % 60;\n\treturn minutes > 0 ? `${minutes}m ${seconds}s` : `${seconds}s`;\n}\n\nfunction ThinkingGlyph() {\n\treturn (\n\t\t<span aria-hidden=\"true\" className=\"grid size-4 grid-cols-3 place-items-center gap-px p-0.5\">\n\t\t\t{Array.from({ length: 9 }, (_, index) => (\n\t\t\t\t<span\n\t\t\t\t\tkey={index}\n\t\t\t\t\tclassName=\"size-[3px] rounded-full bg-muted-foreground animate-[ai-pulse-dot_1.2s_ease-in-out_infinite] motion-reduce:animate-none\"\n\t\t\t\t\tstyle={{ animationDelay: `${((index * 5) % 9) * 110}ms` }}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</span>\n\t);\n}\n\n/**\n * Compact in-flight status: pulsing glyph, label, elapsed time, and token\n * spend. Digits are tabular so the row never jitters while it ticks.\n */\nfunction ThinkingStatus({\n\tlabel = 'Thinking',\n\telapsedSeconds = 0,\n\ttokens,\n\tlive = true,\n\ttokensPerTick = 0,\n\tclassName,\n\t...props\n}: ThinkingStatusProps) {\n\t// Only the growth since mount lives in state; the host's values stay the source of truth.\n\tconst [ticks, setTicks] = React.useState({ seconds: 0, tokens: 0 });\n\n\tReact.useEffect(() => {\n\t\tif (!live) return;\n\t\tconst id = window.setInterval(() => {\n\t\t\tsetTicks((current) => ({\n\t\t\t\tseconds: current.seconds + 1,\n\t\t\t\ttokens: current.tokens + (tokensPerTick ? Math.round(tokensPerTick * (0.6 + Math.random() * 0.8)) : 0),\n\t\t\t}));\n\t\t}, 1000);\n\t\treturn () => window.clearInterval(id);\n\t}, [live, tokensPerTick]);\n\n\tconst seconds = elapsedSeconds + (live ? ticks.seconds : 0);\n\tconst spent = (tokens ?? 0) + (live ? ticks.tokens : 0);\n\n\treturn (\n\t\t<div\n\t\t\trole=\"status\"\n\t\t\taria-live=\"polite\"\n\t\t\tdata-slot=\"thinking-status\"\n\t\t\tclassName={cn('flex h-7 items-center gap-2 text-[0.8125rem]', className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<ThinkingGlyph />\n\t\t\t<span className=\"text-muted-foreground\">{label}</span>\n\t\t\t<span aria-hidden=\"true\" className=\"flex items-center gap-1.5 text-subtle-foreground tabular-nums\">\n\t\t\t\t<span>{formatElapsed(seconds)}</span>\n\t\t\t\t{tokens !== undefined ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<span aria-hidden=\"true\" className=\"size-0.5 rounded-full bg-current\" />\n\t\t\t\t\t\t<span>{formatCompact(spent)} tokens</span>\n\t\t\t\t\t</>\n\t\t\t\t) : null}\n\t\t\t</span>\n\t\t</div>\n\t);\n}\n\nexport { ThinkingStatus, formatElapsed };\nexport type { ThinkingStatusProps };\n","import * as React from 'react';\n\nimport { cn } from '../../lib/utils';\n\ntype PromptInputTrayTone = 'neutral' | 'info' | 'warning' | 'danger';\n\nconst TONE_COLOR: Record<PromptInputTrayTone, string> = {\n\tneutral: 'var(--muted-foreground)',\n\tinfo: 'var(--info)',\n\twarning: 'var(--warning)',\n\tdanger: 'var(--destructive)',\n};\n\ntype PromptInputTrayProps = Omit<React.ComponentProps<'div'>, 'children'> & {\n\ttone?: PromptInputTrayTone;\n\t/** Row above the composer: usage, errors, a reply target, the active agent. */\n\theader?: React.ReactNode;\n\t/** Row below the composer: disclaimers, keyboard hints, sync status. */\n\tfooter?: React.ReactNode;\n\t/** Usually a `PromptInput`. */\n\tchildren: React.ReactNode;\n};\n\n/**\n * Tinted shell that docks status rows onto a composer so the two read as one\n * surface. The tray is 18px with a 4px inset, so the composer inside is\n * rounded to 14px (concentric). Tone tints the tray, its edge, and the icon in\n * each row; text stays at full contrast. Renders the composer alone when there\n * is nothing to dock.\n */\nfunction PromptInputTray({ tone = 'neutral', header, footer, children, className, style, ...props }: PromptInputTrayProps) {\n\tif (!header && !footer) return <>{children}</>;\n\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"prompt-input-tray\"\n\t\t\tdata-tone={tone}\n\t\t\tstyle={{ '--tray-tone': TONE_COLOR[tone], ...style } as React.CSSProperties}\n\t\t\tclassName={cn(\n\t\t\t\t'flex flex-col rounded-[18px] p-1',\n\t\t\t\t'bg-[color-mix(in_oklab,var(--tray-tone)_8%,var(--card))] dark:bg-[color-mix(in_oklab,var(--tray-tone)_13%,var(--card))]',\n\t\t\t\t'shadow-[inset_0_0_0_1px_color-mix(in_oklab,var(--tray-tone)_22%,transparent)]',\n\t\t\t\t'[&_[data-slot=prompt-input]]:rounded-[14px] [&_[data-slot=prompt-input]]:bg-card',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{header ? <div data-slot=\"prompt-input-tray-header\">{header}</div> : null}\n\t\t\t{children}\n\t\t\t{footer ? <div data-slot=\"prompt-input-tray-footer\">{footer}</div> : null}\n\t\t</div>\n\t);\n}\n\ntype PromptInputTrayRowProps = Omit<React.ComponentProps<'div'>, 'children'> & {\n\ticon?: React.ReactNode;\n\tchildren: React.ReactNode;\n\t/** Trailing controls, e.g. an action link or a dismiss button. */\n\tactions?: React.ReactNode;\n};\n\n/** One line inside a tray: tone-colored icon, text, and trailing actions. */\nfunction PromptInputTrayRow({ icon, children, actions, className, ...props }: PromptInputTrayRowProps) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"prompt-input-tray-row\"\n\t\t\tclassName={cn('flex min-h-8 items-center gap-2 px-2.5 py-1 text-[0.8125rem] text-foreground', className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{icon ? (\n\t\t\t\t<span\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tclassName=\"grid size-4 shrink-0 place-items-center text-[color-mix(in_oklab,var(--tray-tone,var(--muted-foreground)),var(--foreground)_20%)] [&_svg]:size-3.5\"\n\t\t\t\t>\n\t\t\t\t\t{icon}\n\t\t\t\t</span>\n\t\t\t) : null}\n\t\t\t<div className=\"min-w-0 flex-1 text-pretty\">{children}</div>\n\t\t\t{actions ? <div className=\"flex shrink-0 items-center gap-1\">{actions}</div> : null}\n\t\t</div>\n\t);\n}\n\nexport { PromptInputTray, PromptInputTrayRow };\nexport type { PromptInputTrayProps, PromptInputTrayRowProps, PromptInputTrayTone };\n","'use client';\n\nimport { Gauge, TriangleAlert, X } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { PromptInputTrayRow, type PromptInputTrayTone } from './prompt-input-tray';\n\n/** Tray tone for a budget share: calm below 75%, warning to 90%, danger beyond. */\nfunction usageTone(percent: number): PromptInputTrayTone {\n\tif (percent >= 90) return 'danger';\n\tif (percent >= 75) return 'warning';\n\treturn 'info';\n}\n\ntype UsageNoticeProps = Omit<React.ComponentProps<'div'>, 'children'> & {\n\t/** Share of the plan budget already spent, 0-100. */\n\tpercent: number;\n\t/** Overrides the default \"You've used N% of your tokens.\" sentence. */\n\tmessage?: React.ReactNode;\n\tactionLabel?: React.ReactNode;\n\tactionHref?: string;\n\tonAction?: () => void;\n\tonDismiss?: () => void;\n};\n\nconst linkClass =\n\t'rounded-sm font-medium text-link underline-offset-2 outline-none hover:underline focus-visible:ring-[3px] focus-visible:ring-ring/50';\n\n/**\n * Plan-budget line for the header of a `PromptInputTray`:\n *\n * ```tsx\n * <PromptInputTray tone={usageTone(80)} header={<UsageNotice percent={80} onDismiss={dismiss} />}>\n * <PromptInput … />\n * </PromptInputTray>\n * ```\n */\nfunction UsageNotice({ percent, message, actionLabel = 'View usage', actionHref, onAction, onDismiss, ...props }: UsageNoticeProps) {\n\tconst tone = usageTone(percent);\n\tconst action = actionHref ? (\n\t\t<a className={linkClass} href={actionHref} onClick={onAction}>\n\t\t\t{actionLabel}\n\t\t</a>\n\t) : onAction ? (\n\t\t<button type=\"button\" className={cn(linkClass, 'cursor-pointer')} onClick={onAction}>\n\t\t\t{actionLabel}\n\t\t</button>\n\t) : null;\n\n\treturn (\n\t\t<PromptInputTrayRow\n\t\t\tdata-slot=\"usage-notice\"\n\t\t\tdata-tone={tone}\n\t\t\ticon={tone === 'info' ? <Gauge /> : <TriangleAlert />}\n\t\t\tactions={\n\t\t\t\tonDismiss ? (\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\taria-label=\"Dismiss\"\n\t\t\t\t\t\tonClick={onDismiss}\n\t\t\t\t\t\tclassName=\"relative grid size-6 shrink-0 cursor-pointer place-items-center rounded-md text-muted-foreground outline-none before:absolute before:-inset-2 hover:bg-overlay-hover hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 pointer-coarse:before:-inset-2.5\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<X aria-hidden=\"true\" className=\"size-3.5\" />\n\t\t\t\t\t</button>\n\t\t\t\t) : null\n\t\t\t}\n\t\t\t{...props}\n\t\t>\n\t\t\t<p>\n\t\t\t\t{message ?? (\n\t\t\t\t\t<>\n\t\t\t\t\t\tYou&apos;ve used <span className=\"tabular-nums\">{Math.round(percent)}%</span> of your tokens.\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t\t{action ? <> {action}</> : null}\n\t\t\t</p>\n\t\t</PromptInputTrayRow>\n\t);\n}\n\nexport { UsageNotice, usageTone };\nexport type { UsageNoticeProps };\n","'use client';\n\nimport { Check, ChevronDown, CircleDollarSign } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from '../command';\nimport { Kbd } from '../kbd';\nimport { Popover, PopoverContent, PopoverTrigger } from '../popover';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip';\nimport { formatCompact } from './context-ring';\nimport { MarkTile } from './mark-tile';\n\n/** Prices in currency units per one million tokens. */\ntype AiModelPricing = {\n\tinput: number;\n\toutput: number;\n\tcachedInput?: number;\n\t/** ISO 4217 code. Defaults to USD. */\n\tcurrency?: string;\n};\n\ntype AiModelLevel = {\n\tid: string;\n\t/** Short name shown beside the model, e.g. \"Medium\" or \"High thinking\". */\n\tlabel: string;\n\tdescription?: string;\n\t/** Overrides the model's pricing when this level bills differently. */\n\tpricing?: AiModelPricing;\n};\n\ntype AiModelTag = 'new' | 'free' | 'beta' | 'preview' | 'deprecated';\n\ntype AiModel = {\n\tid: string;\n\tname: string;\n\t/** Provider or family name; used for grouping and search. */\n\tprovider: string;\n\t/** Provider mark or model glyph. */\n\ticon?: React.ReactNode;\n\tdescription?: string;\n\t/** Reasoning or effort levels, in ascending order. */\n\tlevels?: AiModelLevel[];\n\tdefaultLevel?: string;\n\tpricing?: AiModelPricing;\n\tcontextWindow?: number;\n\ttags?: AiModelTag[];\n\tdisabled?: boolean;\n\t/** Why the model can't be chosen, e.g. \"Requires the Team plan\". */\n\tdisabledReason?: string;\n};\n\ntype ModelSelection = { modelId: string; levelId?: string };\n\ntype ModelSelectorProps = {\n\tmodels: AiModel[];\n\tvalue: ModelSelection;\n\tonValueChange: (value: ModelSelection) => void;\n\t/** Routers or defaults listed first, without a heading (e.g. \"Auto\"). */\n\tpinnedIds?: string[];\n\trecentIds?: string[];\n\trecommendedIds?: string[];\n\t/** How cost appears in each row. `meter` shows relative cost; `price` shows input and output per million. */\n\tpriceDisplay?: 'meter' | 'price' | 'none';\n\t/** Lets people switch between meter and price from the search row. Defaults to true when any model has pricing. */\n\tallowPriceToggle?: boolean;\n\tdisabled?: boolean;\n\talign?: 'start' | 'center' | 'end';\n\tside?: 'top' | 'bottom';\n\ttriggerClassName?: string;\n\tcontentClassName?: string;\n\t/** Accessible label prefix for the trigger. Defaults to \"Model\". */\n\tlabel?: string;\n};\n\nconst TAG_LABEL: Record<AiModelTag, string> = {\n\tnew: 'New',\n\tfree: 'Free',\n\tbeta: 'Beta',\n\tpreview: 'Preview',\n\tdeprecated: 'Deprecated',\n};\n\nfunction levelOf(model: AiModel, levelId: string | undefined) {\n\treturn model.levels?.find((level) => level.id === levelId) ?? model.levels?.find((level) => level.id === model.defaultLevel) ?? model.levels?.[0];\n}\n\nfunction pricingOf(model: AiModel, level: AiModelLevel | undefined) {\n\treturn level?.pricing ?? model.pricing;\n}\n\nfunction formatPrice(amount: number, currency = 'USD') {\n\treturn new Intl.NumberFormat('en-US', {\n\t\tstyle: 'currency',\n\t\tcurrency,\n\t\tminimumFractionDigits: Number.isInteger(amount) ? 0 : 2,\n\t\tmaximumFractionDigits: amount > 0 && amount < 1 ? 3 : 2,\n\t}).format(amount);\n}\n\nfunction formatTokens(tokens: number) {\n\treturn formatCompact(tokens);\n}\n\n/** Blended cost used to rank models on the meter: output weighted 3:1, as in typical chat traffic. */\nfunction blendedCost(pricing: AiModelPricing | undefined) {\n\treturn pricing ? (pricing.input + pricing.output * 3) / 4 : 0;\n}\n\nfunction isFree(pricing: AiModelPricing | undefined) {\n\treturn pricing !== undefined && pricing.input === 0 && pricing.output === 0;\n}\n\n/** Number of blocks in the cost indicator. */\nconst COST_TIERS = 4;\n\n/** Maps a log-scaled cost share (0-1) to 1-4 blocks. Free models get 0. */\nfunction costTier(share: number, free: boolean) {\n\tif (free) return 0;\n\treturn Math.min(COST_TIERS, Math.max(1, Math.ceil(share * COST_TIERS)));\n}\n\n/**\n * Relative cost as a row of building blocks: one to four filled in the accent\n * color, stepping up in height like a stack being built. Discrete tiers read\n * faster than a continuous bar and keep the list calm while scanning.\n */\nfunction CostBlocks({ tier }: { tier: number }) {\n\treturn (\n\t\t<span role=\"img\" aria-label={`Cost tier ${tier} of ${COST_TIERS}`} className=\"flex h-3 shrink-0 items-end gap-[3px]\">\n\t\t\t{Array.from({ length: COST_TIERS }, (_, index) => (\n\t\t\t\t<span\n\t\t\t\t\tkey={index}\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'w-1.5 rounded-[1.5px]',\n\t\t\t\t\t\tindex < tier ? 'bg-primary' : 'bg-[color-mix(in_oklab,currentColor_14%,transparent)]',\n\t\t\t\t\t)}\n\t\t\t\t\tstyle={{ height: `${6 + index * 2}px` }}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</span>\n\t);\n}\n\nfunction PriceText({ pricing }: { pricing: AiModelPricing }) {\n\treturn (\n\t\t<span className=\"text-xs text-muted-foreground tabular-nums\">\n\t\t\t{formatPrice(pricing.input, pricing.currency)}\n\t\t\t<span className=\"text-subtle-foreground\"> / </span>\n\t\t\t{formatPrice(pricing.output, pricing.currency)}\n\t\t</span>\n\t);\n}\n\n/** Tags shown on a model row before the rest collapse into a count. */\nconst MAX_ROW_TAGS = 2;\n\nfunction Tag({ tag }: { tag: AiModelTag }) {\n\treturn (\n\t\t<span\n\t\t\tclassName={cn(\n\t\t\t\t'shrink-0 text-xs font-medium',\n\t\t\t\ttag === 'deprecated' ? 'text-muted-foreground line-through' : 'text-link',\n\t\t\t)}\n\t\t>\n\t\t\t{TAG_LABEL[tag]}\n\t\t</span>\n\t);\n}\n\nfunction ModelGlyph({ model }: { model: AiModel }) {\n\treturn (\n\t\t<MarkTile className=\"text-foreground\">{model.icon ?? <span className=\"font-semibold\">{model.provider.charAt(0)}</span>}</MarkTile>\n\t);\n}\n\n/** A model's reasoning levels as a stacked menu: one row each, with its description and a check on the current one. */\nfunction LevelMenu({\n\tmodel,\n\tlevelId,\n\tonPick,\n}: {\n\tmodel: AiModel;\n\tlevelId: string | undefined;\n\tonPick: (levelId: string) => void;\n}) {\n\tif (!model.levels?.length) {\n\t\treturn <p className=\"px-2 py-1.5 text-xs text-muted-foreground\">One mode, no reasoning levels</p>;\n\t}\n\treturn (\n\t\t<div role=\"radiogroup\" aria-label={`${model.name} reasoning level`} className=\"flex flex-col gap-px\">\n\t\t\t{model.levels.map((level) => {\n\t\t\t\tconst checked = level.id === levelId;\n\t\t\t\treturn (\n\t\t\t\t\t<button\n\t\t\t\t\t\tkey={level.id}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\trole=\"radio\"\n\t\t\t\t\t\taria-checked={checked}\n\t\t\t\t\t\tonMouseDown={(event) => event.preventDefault()}\n\t\t\t\t\t\tonClick={() => onPick(level.id)}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'flex min-h-8 w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-start outline-none pointer-coarse:min-h-11',\n\t\t\t\t\t\t\t'hover:bg-overlay-hover focus-visible:ring-[3px] focus-visible:ring-ring/50',\n\t\t\t\t\t\t\tchecked && 'bg-overlay-hover',\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"flex min-w-0 flex-1 flex-col\">\n\t\t\t\t\t\t\t<span className={cn('text-[0.8125rem]', checked ? 'font-medium text-foreground' : 'text-foreground/85')}>{level.label}</span>\n\t\t\t\t\t\t\t{level.description ? <span className=\"text-xs text-muted-foreground\">{level.description}</span> : null}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<Check aria-hidden=\"true\" className={cn('size-3.5 shrink-0 text-foreground', checked ? 'opacity-100' : 'opacity-0')} />\n\t\t\t\t\t</button>\n\t\t\t\t);\n\t\t\t})}\n\t\t</div>\n\t);\n}\n\n/**\n * The side card for the active model: what it is, its reasoning levels as a\n * menu, and its prices. It opens beside the list like a submenu, so the list\n * never changes size while moving through it.\n */\nfunction ModelDetails({\n\tmodel,\n\tlevelId,\n\tonPickLevel,\n}: {\n\tmodel: AiModel;\n\tlevelId: string | undefined;\n\tonPickLevel: (levelId: string) => void;\n}) {\n\tconst level = levelOf(model, levelId);\n\tconst pricing = pricingOf(model, level);\n\tconst free = isFree(pricing);\n\tconst price = (amount: number | undefined) =>\n\t\tfree ? 'Free' : amount === undefined || !pricing ? '—' : formatPrice(amount, pricing.currency);\n\tconst facts = [\n\t\t{ label: 'Input /1M', value: price(pricing?.input) },\n\t\t{ label: 'Output /1M', value: price(pricing?.output) },\n\t\t{ label: 'Cached /1M', value: free ? 'Free' : price(pricing?.cachedInput) },\n\t\t{ label: 'Context', value: model.contextWindow ? formatTokens(model.contextWindow) : '—' },\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"flex items-center gap-2 px-3 pt-3 pb-2\">\n\t\t\t\t<ModelGlyph model={model} />\n\t\t\t\t<div className=\"min-w-0\">\n\t\t\t\t\t<p title={model.name} className=\"truncate text-[0.8125rem] font-medium text-foreground\">{model.name}</p>\n\t\t\t\t\t<p title={model.description ?? model.provider} className=\"truncate text-xs text-muted-foreground\">{model.description ?? model.provider}</p>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div className=\"px-1 pb-1\">\n\t\t\t\t<LevelMenu model={model} levelId={level?.id} onPick={onPickLevel} />\n\t\t\t</div>\n\t\t\t<dl className=\"grid grid-cols-2 gap-x-3 gap-y-2 border-t border-border px-3 py-2.5\">\n\t\t\t\t{facts.map((fact) => (\n\t\t\t\t\t<div key={fact.label} className=\"min-w-0\">\n\t\t\t\t\t\t<dt className=\"truncate text-[0.6875rem] leading-4 text-muted-foreground\">{fact.label}</dt>\n\t\t\t\t\t\t<dd className=\"truncate text-xs leading-4 text-foreground tabular-nums\">{fact.value}</dd>\n\t\t\t\t\t</div>\n\t\t\t\t))}\n\t\t\t</dl>\n\t\t\t<p className=\"hidden h-8 items-center gap-1 border-t border-border px-3 text-[0.6875rem] text-muted-foreground pointer-fine:flex\">\n\t\t\t\t{model.levels && model.levels.length > 1 ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Kbd>←</Kbd>\n\t\t\t\t\t\t<Kbd>→</Kbd>\n\t\t\t\t\t\t<span className=\"me-2\">level</span>\n\t\t\t\t\t</>\n\t\t\t\t) : null}\n\t\t\t\t<Kbd>↵</Kbd>\n\t\t\t\t<span>choose</span>\n\t\t\t</p>\n\t\t</>\n\t);\n}\n\ntype Point = { x: number; y: number };\n\n/** Whether `point` lies inside the triangle `a b c` (sign test). */\nfunction inTriangle(point: Point, a: Point, b: Point, c: Point) {\n\tconst side = (p: Point, q: Point, r: Point) => (p.x - r.x) * (q.y - r.y) - (q.x - r.x) * (p.y - r.y);\n\tconst d1 = side(point, a, b);\n\tconst d2 = side(point, b, c);\n\tconst d3 = side(point, c, a);\n\treturn !((d1 < 0 || d2 < 0 || d3 < 0) && (d1 > 0 || d2 > 0 || d3 > 0));\n}\n\n/** How long a row crossed on the way to the side card waits before taking it over. */\nconst PANEL_INTENT_MS = 240;\n\n/**\n * Model picker for composers: searchable list with pinned routers, recent and\n * recommended sections, per-provider groups, reasoning levels, relative cost\n * or per-million pricing, tags, and a side card for the highlighted model\n * with its reasoning levels.\n * Controlled: the host owns the selection and persists recents.\n */\nfunction ModelSelector({\n\tmodels,\n\tvalue,\n\tonValueChange,\n\tpinnedIds = [],\n\trecentIds = [],\n\trecommendedIds = [],\n\tpriceDisplay: priceDisplayProp = 'meter',\n\tallowPriceToggle,\n\tdisabled,\n\talign = 'start',\n\tside = 'top',\n\ttriggerClassName,\n\tcontentClassName,\n\tlabel = 'Model',\n}: ModelSelectorProps) {\n\tconst [open, setOpen] = React.useState(false);\n\tconst [query, setQuery] = React.useState('');\n\tconst [highlighted, setHighlighted] = React.useState('');\n\tconst [pendingLevels, setPendingLevels] = React.useState<Record<string, string>>({});\n\tconst [priceDisplay, setPriceDisplay] = React.useState(priceDisplayProp);\n\t/** The row the side card shows. Follows the highlight, except while the pointer heads for the card. */\n\tconst [active, setActive] = React.useState('');\n\tconst [panel, setPanel] = React.useState<{ top: number; side: 'left' | 'right' | 'below' }>({ top: 0, side: 'right' });\n\tconst contentRef = React.useRef<HTMLDivElement>(null);\n\tconst panelRef = React.useRef<HTMLDivElement>(null);\n\tconst trail = React.useRef<Point[]>([]);\n\tconst intentTimer = React.useRef<number | undefined>(undefined);\n\n\tconst byId = React.useMemo(() => new Map(models.map((model) => [model.id, model])), [models]);\n\tconst selected = byId.get(value.modelId);\n\tconst selectedLevel = selected ? levelOf(selected, value.levelId) : undefined;\n\tconst hasPricing = models.some((model) => model.pricing || model.levels?.some((level) => level.pricing));\n\tconst canTogglePrice = (allowPriceToggle ?? hasPricing) && priceDisplayProp !== 'none';\n\tconst maxCost = React.useMemo(\n\t\t() => Math.max(0, ...models.map((model) => blendedCost(pricingOf(model, levelOf(model, undefined))))),\n\t\t[models],\n\t);\n\n\tconst sections = React.useMemo(() => {\n\t\tconst pick = (ids: string[]) => ids.map((id) => byId.get(id)).filter((model): model is AiModel => Boolean(model));\n\t\tconst providers = new Map<string, AiModel[]>();\n\t\t// Unavailable models sink to the bottom of their provider group.\n\t\tfor (const model of [...models].sort((a, b) => Number(Boolean(a.disabled)) - Number(Boolean(b.disabled)))) {\n\t\t\tif (pinnedIds.includes(model.id)) continue;\n\t\t\tconst group = providers.get(model.provider);\n\t\t\tif (group) group.push(model);\n\t\t\telse providers.set(model.provider, [model]);\n\t\t}\n\t\tconst browsing = [\n\t\t\t{ id: 'pinned', label: undefined, items: pick(pinnedIds) },\n\t\t\t{ id: 'recent', label: 'Recently used', items: pick(recentIds) },\n\t\t\t{ id: 'recommended', label: 'Recommended', items: pick(recommendedIds) },\n\t\t];\n\t\tconst all = [...providers].map(([provider, items]) => ({ id: `provider:${provider}`, label: provider, items }));\n\t\treturn { browsing: browsing.filter((section) => section.items.length > 0), all };\n\t}, [byId, models, pinnedIds, recentIds, recommendedIds]);\n\n\tconst levelFor = (model: AiModel) =>\n\t\tpendingLevels[model.id] ?? (model.id === value.modelId ? value.levelId : undefined) ?? levelOf(model, undefined)?.id;\n\n\tconst choose = (model: AiModel, levelId = levelFor(model)) => {\n\t\tif (model.disabled) return;\n\t\tonValueChange({ modelId: model.id, levelId });\n\t\tsetOpen(false);\n\t};\n\n\tconst highlightedModel = byId.get(highlighted.split('::')[1] ?? '');\n\t/** Falls back to the selection so the card is present from the first frame. */\n\tconst detailModel = byId.get(active.split('::')[1] ?? '') ?? selected;\n\n\t/** The pointer is moving toward the side card through the rows between (the submenu \"safe triangle\"). */\n\tconst headingToPanel = () => {\n\t\tconst card = panelRef.current?.getBoundingClientRect();\n\t\tconst from = trail.current[0];\n\t\tconst to = trail.current[trail.current.length - 1];\n\t\tif (!card || !from || !to || panel.side === 'below') return false;\n\t\tconst edge = panel.side === 'right' ? card.left : card.right;\n\t\tconst towards = panel.side === 'right' ? to.x > from.x : to.x < from.x;\n\t\treturn towards && inTriangle(to, from, { x: edge, y: card.top - 8 }, { x: edge, y: card.bottom + 8 });\n\t};\n\n\tReact.useEffect(() => {\n\t\tif (!open) return;\n\t\tif (headingToPanel()) intentTimer.current = window.setTimeout(() => setActive(highlighted), PANEL_INTENT_MS);\n\t\telse setActive(highlighted);\n\t\treturn () => window.clearTimeout(intentTimer.current);\n\t\t// headingToPanel only reads refs and the card's side.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [highlighted, open]);\n\n\t/** Lines the card up with its row, clamped to the list, on whichever side has room. */\n\tconst placePanel = React.useCallback(() => {\n\t\tconst content = contentRef.current;\n\t\tconst card = panelRef.current;\n\t\tif (!content || !card) return;\n\t\tif (window.innerWidth < 640) {\n\t\t\tsetPanel((current) => (current.side === 'below' ? current : { top: 0, side: 'below' }));\n\t\t\treturn;\n\t\t}\n\t\tconst box = content.getBoundingClientRect();\n\t\tconst rows = Array.from(content.querySelectorAll<HTMLElement>('[data-model-value]'));\n\t\tconst row =\n\t\t\trows.find((element) => element.dataset.modelValue === active) ??\n\t\t\trows.find((element) => element.dataset.modelValue?.endsWith(`::${value.modelId}`));\n\t\tconst rowTop = row ? row.getBoundingClientRect().top - box.top - 4 : 0;\n\t\t// Aligned with its row; only the viewport edges push it, not the list's own height.\n\t\tconst top = Math.round(Math.min(Math.max(8 - box.top, rowTop), window.innerHeight - box.top - card.offsetHeight - 8));\n\t\tconst side = box.right + card.offsetWidth + 8 > window.innerWidth ? 'left' : 'right';\n\t\tsetPanel((current) => (current.top === top && current.side === side ? current : { top, side }));\n\t}, [active, value.modelId]);\n\n\tReact.useLayoutEffect(() => {\n\t\tif (!open) return;\n\t\tplacePanel();\n\t\t// The popover positions itself after mounting, so measure again once it has settled.\n\t\tlet frame = requestAnimationFrame(() => {\n\t\t\tframe = requestAnimationFrame(placePanel);\n\t\t});\n\t\treturn () => cancelAnimationFrame(frame);\n\t}, [open, placePanel, detailModel]);\n\n\tconst onKeyDown = (event: React.KeyboardEvent) => {\n\t\t// Keys move the highlight directly, so the card follows at once.\n\t\twindow.clearTimeout(intentTimer.current);\n\t\ttrail.current = [];\n\t\tif (query || !highlightedModel?.levels?.length || (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight')) return;\n\t\tevent.preventDefault();\n\t\tconst levels = highlightedModel.levels;\n\t\tconst index = levels.findIndex((level) => level.id === levelFor(highlightedModel));\n\t\tconst next = levels[Math.min(levels.length - 1, Math.max(0, index + (event.key === 'ArrowRight' ? 1 : -1)))];\n\t\tif (next) setPendingLevels((current) => ({ ...current, [highlightedModel.id]: next.id }));\n\t};\n\n\t/** Right-aligned column with a fixed minimum width, so prices, blocks, and checks line up down the list. */\n\tconst trailing = (model: AiModel, pricing: AiModelPricing | undefined) => {\n\t\tif (model.disabled && model.disabledReason) return <span title={model.disabledReason} className=\"truncate text-xs text-muted-foreground\">{model.disabledReason}</span>;\n\t\tif (priceDisplay === 'none' || !pricing) return null;\n\t\tif (isFree(pricing)) return <span className=\"text-xs font-medium text-link\">Free</span>;\n\t\tif (priceDisplay === 'price') return <PriceText pricing={pricing} />;\n\t\tconst share = maxCost > 0 ? Math.log1p(blendedCost(pricing)) / Math.log1p(maxCost) : 0;\n\t\treturn <CostBlocks tier={costTier(share, false)} />;\n\t};\n\n\tconst renderItem = (model: AiModel, section: string) => {\n\t\tconst level = levelOf(model, levelFor(model));\n\t\tconst pricing = pricingOf(model, level);\n\t\tconst tags = model.tags?.filter((tag) => !(tag === 'free' && isFree(pricing) && priceDisplay !== 'none'));\n\t\treturn (\n\t\t\t<CommandItem\n\t\t\t\tkey={`${section}::${model.id}`}\n\t\t\t\tvalue={`${section}::${model.id}`}\n\t\t\t\tdata-model-value={`${section}::${model.id}`}\n\t\t\t\tkeywords={[model.name, model.provider, ...(model.levels?.map((entry) => entry.label) ?? []), ...(model.tags ?? [])]}\n\t\t\t\tdisabled={model.disabled}\n\t\t\t\tonSelect={() => choose(model)}\n\t\t\t\tclassName=\"h-9 gap-2 rounded-sm pointer-coarse:h-11\"\n\t\t\t>\n\t\t\t\t<ModelGlyph model={model} />\n\t\t\t\t<span className=\"flex min-w-0 flex-1 items-baseline gap-1.5\">\n\t\t\t\t\t<span title={model.name} className=\"truncate text-foreground\">{model.name}</span>\n\t\t\t\t\t{level ? <span title={level.label} className=\"shrink truncate text-muted-foreground\">{level.label}</span> : null}\n\t\t\t\t\t{/* Two tags at most, so a model with many of them cannot squeeze its own name out of the row. */}\n\t\t\t\t\t{tags?.slice(0, MAX_ROW_TAGS).map((tag) => <Tag key={tag} tag={tag} />)}\n\t\t\t\t\t{tags && tags.length > MAX_ROW_TAGS ? (\n\t\t\t\t\t\t<span title={tags.slice(MAX_ROW_TAGS).map((tag) => TAG_LABEL[tag]).join(', ')} className=\"shrink-0 text-xs text-muted-foreground tabular-nums\">\n\t\t\t\t\t\t\t+{tags.length - MAX_ROW_TAGS}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : null}\n\t\t\t\t</span>\n\t\t\t\t<span className=\"flex min-w-14 shrink-0 justify-end text-muted-foreground\">{trailing(model, pricing)}</span>\n\t\t\t\t<Check\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tclassName={cn('size-3.5 shrink-0 text-foreground', model.id === value.modelId ? 'opacity-100' : 'opacity-0')}\n\t\t\t\t/>\n\t\t\t</CommandItem>\n\t\t);\n\t};\n\n\tconst visible = query ? sections.all : [...sections.browsing, ...sections.all];\n\n\treturn (\n\t\t<Popover\n\t\t\topen={open}\n\t\t\tonOpenChange={(next) => {\n\t\t\t\tsetOpen(next);\n\t\t\t\tif (next) {\n\t\t\t\t\tsetQuery('');\n\t\t\t\t\tsetPendingLevels({});\n\t\t\t\t\t// Open on the current model, so its card is the first one shown.\n\t\t\t\t\tconst home = [...sections.browsing, ...sections.all].find((section) =>\n\t\t\t\t\t\tsection.items.some((model) => model.id === value.modelId),\n\t\t\t\t\t);\n\t\t\t\t\tif (home) setHighlighted(`${home.id}::${value.modelId}`);\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t<PopoverTrigger\n\t\t\t\taria-label={selected ? `${label}: ${selected.name}${selectedLevel ? `, ${selectedLevel.label}` : ''}` : label}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tonClick={(event) => event.stopPropagation()}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'flex h-8 max-w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-md px-2 text-[0.8125rem] text-foreground outline-none',\n\t\t\t\t\t'hover:bg-overlay-hover focus-visible:ring-[3px] focus-visible:ring-ring/50 data-popup-open:bg-overlay-hover',\n\t\t\t\t\t'transition-transform duration-(--duration-fast) motion-safe:active:scale-[0.96] disabled:cursor-not-allowed disabled:opacity-64',\n\t\t\t\t\ttriggerClassName,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{selected ? <ModelGlyph model={selected} /> : null}\n\t\t\t\t<span title={selected?.name ?? 'Choose a model'} className=\"truncate\">{selected?.name ?? 'Choose a model'}</span>\n\t\t\t\t{selectedLevel ? <span title={selectedLevel.label} className=\"truncate text-muted-foreground\">{selectedLevel.label}</span> : null}\n\t\t\t\t<ChevronDown aria-hidden=\"true\" className=\"size-3.5 shrink-0 text-muted-foreground\" />\n\t\t\t</PopoverTrigger>\n\t\t\t<PopoverContent\n\t\t\t\tside={side}\n\t\t\t\talign={align}\n\t\t\t\tclassName={cn('relative w-[min(22rem,calc(100vw-1.5rem))] p-0', contentClassName)}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tref={contentRef}\n\t\t\t\t\tonPointerMove={(event) => {\n\t\t\t\t\t\ttrail.current = [...trail.current.slice(-3), { x: event.clientX, y: event.clientY }];\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<Command\n\t\t\t\t\t\tvalue={highlighted}\n\t\t\t\t\t\tonValueChange={setHighlighted}\n\t\t\t\t\t\tonKeyDown={onKeyDown}\n\t\t\t\t\t\tloop\n\t\t\t\t\t\tclassName=\"rounded-[inherit]\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"relative border-b border-border\">\n\t\t\t\t\t\t\t<CommandInput value={query} onValueChange={setQuery} placeholder=\"Search models\" className=\"pe-9\" />\n\t\t\t\t\t\t\t{canTogglePrice ? (\n\t\t\t\t\t\t\t\t<Tooltip>\n\t\t\t\t\t\t\t\t\t<TooltipTrigger\n\t\t\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\t\taria-label=\"Show prices per million tokens\"\n\t\t\t\t\t\t\t\t\t\t\t\taria-pressed={priceDisplay === 'price'}\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={() => setPriceDisplay((current) => (current === 'price' ? 'meter' : 'price'))}\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'absolute top-1/2 end-2.5 grid size-7 -translate-y-1/2 cursor-pointer place-items-center rounded-md outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50',\n\t\t\t\t\t\t\t\t\t\t\t\t\tpriceDisplay === 'price' ? 'bg-muted text-foreground' : 'text-muted-foreground hover:bg-overlay-hover hover:text-foreground',\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<CircleDollarSign aria-hidden=\"true\" className=\"size-4\" />\n\t\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<TooltipContent>{priceDisplay === 'price' ? 'Show relative cost' : 'Show prices per 1M tokens'}</TooltipContent>\n\t\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<CommandList className=\"h-[min(20rem,50vh)] max-h-none p-1 not-empty:p-1\" onScroll={placePanel}>\n\t\t\t\t\t\t\t<CommandEmpty className=\"py-6 text-center text-sm text-muted-foreground\">No models matched</CommandEmpty>\n\t\t\t\t\t\t\t{visible.map((section) => (\n\t\t\t\t\t\t\t\t<CommandGroup key={section.id} heading={section.label}>\n\t\t\t\t\t\t\t\t\t{section.items.map((model) => renderItem(model, section.id))}\n\t\t\t\t\t\t\t\t</CommandGroup>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</CommandList>\n\t\t\t\t\t</Command>\n\t\t\t\t</div>\n\t\t\t\t{detailModel ? (\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={panelRef}\n\t\t\t\t\t\tdata-slot=\"model-selector-details\"\n\t\t\t\t\t\tonPointerEnter={() => {\n\t\t\t\t\t\t\t// Arriving at the card keeps its model and moves the row highlight back to it.\n\t\t\t\t\t\t\twindow.clearTimeout(intentTimer.current);\n\t\t\t\t\t\t\tif (active && active !== highlighted) setHighlighted(active);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tstyle={panel.side === 'below' ? undefined : { top: panel.top }}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\tpanel.side === 'below'\n\t\t\t\t\t\t\t\t? 'border-t border-border'\n\t\t\t\t\t\t\t\t: cn(\n\t\t\t\t\t\t\t\t\t\t'absolute w-64 rounded-lg border bg-popover text-popover-foreground shadow-lg',\n\t\t\t\t\t\t\t\t\t\tpanel.side === 'right' ? 'left-full ml-1.5' : 'right-full mr-1.5',\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ModelDetails\n\t\t\t\t\t\t\tmodel={detailModel}\n\t\t\t\t\t\t\tlevelId={levelFor(detailModel)}\n\t\t\t\t\t\t\tonPickLevel={(levelId) => {\n\t\t\t\t\t\t\t\tsetPendingLevels((current) => ({ ...current, [detailModel.id]: levelId }));\n\t\t\t\t\t\t\t\tchoose(detailModel, levelId);\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t</PopoverContent>\n\t\t</Popover>\n\t);\n}\n\nexport { ModelSelector, CostBlocks };\nexport type { AiModel, AiModelLevel, AiModelPricing, AiModelTag, ModelSelection, ModelSelectorProps };\n","'use client';\n\nimport { CircleAlert, FileText, X } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Spinner } from '../spinner';\nimport { MarkTile } from './mark-tile';\n\ntype PromptInputAttachmentStatus = 'uploading' | 'ready' | 'error';\n\ntype PromptInputAttachmentProps = Omit<React.ComponentProps<'div'>, 'children'> & {\n\tname: string;\n\t/** Secondary line, e.g. \"PDF · 2.4 MB\" or an error reason. */\n\tmeta?: React.ReactNode;\n\t/** Image preview URL. Falls back to `icon`, then a document glyph. */\n\tpreviewUrl?: string;\n\ticon?: React.ReactNode;\n\tstatus?: PromptInputAttachmentStatus;\n\tonRemove?: () => void;\n};\n\n/**\n * Staged file chip shown inside a composer before sending: thumbnail or icon,\n * name, meta, upload state, and remove.\n */\nfunction PromptInputAttachment({\n\tname,\n\tmeta,\n\tpreviewUrl,\n\ticon,\n\tstatus = 'ready',\n\tonRemove,\n\tclassName,\n\t...props\n}: PromptInputAttachmentProps) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"prompt-input-attachment\"\n\t\t\tdata-status={status}\n\t\t\tclassName={cn(\n\t\t\t\t'relative flex h-10 max-w-56 min-w-0 items-center gap-2 rounded-lg bg-muted/70 pe-1.5 ps-1 text-start dark:bg-muted',\n\t\t\t\tstatus === 'error' && 'bg-destructive/8 dark:bg-destructive/16',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<MarkTile size=\"md\" className={cn('rounded-md', status === 'error' && 'text-destructive')}>\n\t\t\t\t{status === 'uploading' ? (\n\t\t\t\t\t<Spinner aria-hidden=\"true\" role={undefined} className=\"size-4\" strokeWidth={1.5} />\n\t\t\t\t) : status === 'error' ? (\n\t\t\t\t\t<CircleAlert />\n\t\t\t\t) : previewUrl ? (\n\t\t\t\t\t<img src={previewUrl} alt=\"\" className=\"size-full object-cover\" />\n\t\t\t\t) : (\n\t\t\t\t\t(icon ?? <FileText />)\n\t\t\t\t)}\n\t\t\t</MarkTile>\n\t\t\t<div className=\"min-w-0 flex-1 leading-tight\">\n\t\t\t\t<p title={name} className=\"truncate text-[0.8125rem] text-foreground\">{name}</p>\n\t\t\t\t{meta ? (\n\t\t\t\t\t<p className={cn('truncate text-xs', status === 'error' ? 'text-destructive' : 'text-muted-foreground')}>{meta}</p>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t\t{status === 'uploading' ? <span className=\"sr-only\">Uploading</span> : null}\n\t\t\t{onRemove ? (\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\taria-label={`Remove ${name}`}\n\t\t\t\t\tonClick={onRemove}\n\t\t\t\t\tclassName=\"relative grid size-5 shrink-0 cursor-pointer place-items-center rounded-full text-muted-foreground outline-none before:absolute before:-inset-2 hover:bg-overlay-active hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 pointer-coarse:before:-inset-3\"\n\t\t\t\t>\n\t\t\t\t\t<X aria-hidden=\"true\" className=\"size-3\" />\n\t\t\t\t</button>\n\t\t\t) : null}\n\t\t</div>\n\t);\n}\n\ntype PromptInputAttachmentsProps = React.ComponentProps<'div'>;\n\n/** Wrapping row of attachment chips, placed above the textarea. */\nfunction PromptInputAttachments({ className, ...props }: PromptInputAttachmentsProps) {\n\treturn (\n\t\t<div\n\t\t\trole=\"group\"\n\t\t\taria-label=\"Attachments\"\n\t\t\tdata-slot=\"prompt-input-attachments\"\n\t\t\tclassName={cn('flex flex-wrap gap-1.5 px-1 pt-0.5 pb-1 [&>*]:shrink-0', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { PromptInputAttachment, PromptInputAttachments };\nexport type { PromptInputAttachmentProps, PromptInputAttachmentsProps, PromptInputAttachmentStatus };\n","'use client';\n\nimport { CircleCheck, CircleHelp } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Button } from '../button';\nimport { iconEnterClass } from './mark-tile';\n\ntype AskOption = {\n\tid: string;\n\tlabel: React.ReactNode;\n};\n\ntype AskQuestion = {\n\tid: string;\n\tquestion: React.ReactNode;\n\toptions: AskOption[];\n\t/** Adds a free-text \"Something else\" row. Defaults to true. */\n\tallowOther?: boolean;\n};\n\ntype AskChoice = { option: string } | { other: string };\n\ntype AskAnswer = { choices: Record<string, AskChoice> } | { skipped: true };\n\ntype AskCardProps = Omit<React.ComponentProps<'div'>, 'onSubmit'> & {\n\tquestions: AskQuestion[];\n\t/** Settled answer. When set, the card collapses to a read-only summary. */\n\tanswer?: AskAnswer;\n\tonSubmit?: (choices: Record<string, AskChoice>) => void;\n\tonSkip?: () => void;\n\tcontinueLabel?: React.ReactNode;\n\tskipLabel?: React.ReactNode;\n\t/** Name and placeholder of the free-text row. */\n\totherLabel?: string;\n\tdisabled?: boolean;\n};\n\nconst KEYS = 'ABCDEFGHIJ';\n\nfunction QuestionHeading({ id, children }: { id?: string; children: React.ReactNode }) {\n\treturn (\n\t\t<div className=\"flex min-h-7 items-start gap-2 px-1 py-1\">\n\t\t\t<CircleHelp aria-hidden=\"true\" className=\"mt-0.5 size-4 shrink-0 text-muted-foreground\" />\n\t\t\t<p id={id} className=\"min-w-0 text-pretty text-sm text-foreground [overflow-wrap:anywhere]\">\n\t\t\t\t{children}\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n\nfunction KeyBadge({ children, active }: { children: React.ReactNode; active?: boolean }) {\n\treturn (\n\t\t<span\n\t\t\taria-hidden=\"true\"\n\t\t\tclassName={cn(\n\t\t\t\t'grid size-5 shrink-0 place-items-center rounded-[5px] border text-[0.6875rem] font-medium tabular-nums',\n\t\t\t\tactive ? 'border-primary bg-primary text-primary-foreground' : 'border-border bg-muted text-muted-foreground',\n\t\t\t)}\n\t\t>\n\t\t\t{children}\n\t\t</span>\n\t);\n}\n\nfunction AskQuestionField({\n\tquestion,\n\tchoice,\n\tonChoose,\n\totherLabel,\n\tdisabled,\n}: {\n\tquestion: AskQuestion;\n\tchoice: AskChoice | undefined;\n\tonChoose: (choice: AskChoice | undefined) => void;\n\totherLabel: string;\n\tdisabled?: boolean;\n}) {\n\tconst headingId = React.useId();\n\tconst otherValue = choice && 'other' in choice ? choice.other : '';\n\tconst rowClass =\n\t\t'flex min-h-9 w-full items-center gap-2.5 rounded-sm border px-2 py-1.5 text-start text-sm outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50';\n\n\treturn (\n\t\t<div className=\"flex flex-col gap-1.5\">\n\t\t\t<QuestionHeading id={headingId}>{question.question}</QuestionHeading>\n\t\t\t<div role=\"radiogroup\" aria-labelledby={headingId} className=\"flex flex-col gap-1.5\">\n\t\t\t\t{question.options.map((option, index) => {\n\t\t\t\t\tconst checked = Boolean(choice && 'option' in choice && choice.option === option.id);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tkey={option.id}\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\trole=\"radio\"\n\t\t\t\t\t\t\taria-checked={checked}\n\t\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t\tonClick={() => onChoose({ option: option.id })}\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\trowClass,\n\t\t\t\t\t\t\t\t'cursor-pointer disabled:cursor-not-allowed disabled:opacity-64',\n\t\t\t\t\t\t\t\tchecked\n\t\t\t\t\t\t\t\t\t? 'border-primary/40 bg-primary/6 text-foreground'\n\t\t\t\t\t\t\t\t\t: 'border-border bg-card text-foreground hover:bg-overlay-hover',\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<KeyBadge active={checked}>{KEYS[index]}</KeyBadge>\n\t\t\t\t\t\t\t<span className=\"min-w-0 flex-1 [overflow-wrap:anywhere]\">{option.label}</span>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t\t{question.allowOther !== false ? (\n\t\t\t\t\t<label\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\trowClass,\n\t\t\t\t\t\t\t'cursor-text focus-within:ring-[3px] focus-within:ring-ring/50',\n\t\t\t\t\t\t\totherValue ? 'border-primary/40 bg-primary/6' : 'border-border bg-card',\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<KeyBadge active={Boolean(otherValue)}>{KEYS[question.options.length]}</KeyBadge>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\tvalue={otherValue}\n\t\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t\tplaceholder={`${otherLabel}…`}\n\t\t\t\t\t\t\taria-label={otherLabel}\n\t\t\t\t\t\t\tonChange={(event) => onChoose(event.target.value ? { other: event.target.value } : undefined)}\n\t\t\t\t\t\t\tclassName=\"min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-subtle-foreground pointer-coarse:text-base\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</label>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nfunction AnswerChip({ children, muted }: { children: React.ReactNode; muted?: boolean }) {\n\treturn (\n\t\t<span\n\t\t\tclassName={cn(\n\t\t\t\t'inline-flex h-6 max-w-full items-center gap-1.5 rounded-md border border-border bg-muted px-1.5 text-[0.8125rem]',\n\t\t\t\tmuted ? 'text-muted-foreground' : 'text-foreground',\n\t\t\t)}\n\t\t>\n\t\t\t{muted ? null : (\n\t\t\t\t<CircleCheck aria-hidden=\"true\" className={cn('size-3.5 shrink-0 fill-primary text-primary-foreground', iconEnterClass)} />\n\t\t\t)}\n\t\t\t<span title={typeof children === 'string' ? children : undefined} className=\"truncate\">\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t</span>\n\t);\n}\n\n/**\n * Inline clarifying questions from an agent. Each question offers lettered\n * options plus a free-text row; the card settles into a one-line summary per\n * question once answered or skipped.\n */\nfunction AskCard({\n\tquestions,\n\tanswer,\n\tonSubmit,\n\tonSkip,\n\tcontinueLabel = 'Continue',\n\tskipLabel = 'Skip',\n\totherLabel = 'Something else',\n\tdisabled,\n\tclassName,\n\t...props\n}: AskCardProps) {\n\tconst [choices, setChoices] = React.useState<Record<string, AskChoice>>({});\n\tconst complete = questions.every((question) => {\n\t\tconst choice = choices[question.id];\n\t\treturn choice && ('option' in choice || choice.other.trim().length > 0);\n\t});\n\n\tif (answer) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tdata-slot=\"ask-card\"\n\t\t\t\tdata-state=\"answered\"\n\t\t\t\tclassName={cn('flex animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] flex-col gap-1 motion-reduce:animate-none', className)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{questions.map((question) => {\n\t\t\t\t\tconst choice = 'choices' in answer ? answer.choices[question.id] : undefined;\n\t\t\t\t\tconst label = choice\n\t\t\t\t\t\t? 'option' in choice\n\t\t\t\t\t\t\t? question.options.find((option) => option.id === choice.option)?.label\n\t\t\t\t\t\t\t: `“${choice.other}”`\n\t\t\t\t\t\t: undefined;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div key={question.id} className=\"flex flex-wrap items-center gap-x-2 gap-y-1\">\n\t\t\t\t\t\t\t<CircleHelp aria-hidden=\"true\" className=\"size-4 shrink-0 text-muted-foreground\" />\n\t\t\t\t\t\t\t<p className=\"min-w-0 text-pretty text-sm text-foreground [overflow-wrap:anywhere]\">{question.question}</p>\n\t\t\t\t\t\t\t{label ? <AnswerChip>{label}</AnswerChip> : <AnswerChip muted>Skipped</AnswerChip>}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"ask-card\"\n\t\t\tdata-state=\"open\"\n\t\t\tclassName={cn('flex animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] flex-col gap-3 rounded-xl bg-card p-2 shadow-card motion-reduce:animate-none', className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{questions.map((question) => (\n\t\t\t\t<AskQuestionField\n\t\t\t\t\tkey={question.id}\n\t\t\t\t\tquestion={question}\n\t\t\t\t\tchoice={choices[question.id]}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\totherLabel={otherLabel}\n\t\t\t\t\tonChoose={(choice) =>\n\t\t\t\t\t\tsetChoices((current) => {\n\t\t\t\t\t\t\tconst next = { ...current };\n\t\t\t\t\t\t\tif (choice) next[question.id] = choice;\n\t\t\t\t\t\t\telse delete next[question.id];\n\t\t\t\t\t\t\treturn next;\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t))}\n\t\t\t<div className=\"flex flex-wrap items-center gap-2\">\n\t\t\t\t<Button size=\"xs\" disabled={disabled || !complete} onClick={() => onSubmit?.(choices)}>\n\t\t\t\t\t{continueLabel}\n\t\t\t\t</Button>\n\t\t\t\t{onSkip ? (\n\t\t\t\t\t<Button size=\"xs\" variant=\"outline\" disabled={disabled} onClick={onSkip}>\n\t\t\t\t\t\t{skipLabel}\n\t\t\t\t\t</Button>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport { AskCard };\nexport type { AskCardProps, AskQuestion, AskOption, AskChoice, AskAnswer };\n","'use client';\n\nimport { Check } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Button } from '../button';\nimport { iconEnterClass, MarkTile } from './mark-tile';\n\ntype ConnectPromptStatus = 'idle' | 'connecting' | 'connected' | 'skipped';\n\ntype ConnectPromptProps = Omit<React.ComponentProps<'div'>, 'children'> & {\n\t/** App mark rendered inside a 32px tile. */\n\ticon?: React.ReactNode;\n\tname: React.ReactNode;\n\tdescription?: React.ReactNode;\n\tstatus?: ConnectPromptStatus;\n\tconnectLabel?: React.ReactNode;\n\t/** Continue-without label, e.g. \"Zendesk only for now\". Hidden when omitted. */\n\tskipLabel?: React.ReactNode;\n\tonConnect?: () => void;\n\tonSkip?: () => void;\n};\n\n/**\n * Inline request from an agent to connect a missing app before it continues.\n * Settles into a quiet \"Connected\" or \"Skipped\" chip.\n */\nfunction ConnectPrompt({\n\ticon,\n\tname,\n\tdescription,\n\tstatus = 'idle',\n\tconnectLabel = 'Connect',\n\tskipLabel,\n\tonConnect,\n\tonSkip,\n\tclassName,\n\t...props\n}: ConnectPromptProps) {\n\tconst settled = status === 'connected' || status === 'skipped';\n\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"connect-prompt\"\n\t\t\tdata-status={status}\n\t\t\tclassName={cn('flex animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] flex-wrap items-center gap-x-3 gap-y-2 rounded-xl bg-card p-3 shadow-card motion-reduce:animate-none', className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{icon ? (\n\t\t\t\t<MarkTile size=\"md\" className=\"text-foreground\">\n\t\t\t\t\t{icon}\n\t\t\t\t</MarkTile>\n\t\t\t) : null}\n\t\t\t<div className=\"min-w-40 flex-1\">\n\t\t\t\t<p title={typeof name === 'string' ? name : undefined} className=\"line-clamp-2 text-sm font-medium text-foreground [overflow-wrap:anywhere]\">\n\t\t\t\t\t{name}\n\t\t\t\t</p>\n\t\t\t\t{description ? (\n\t\t\t\t\t<p title={typeof description === 'string' ? description : undefined} className=\"line-clamp-2 text-[0.8125rem] text-muted-foreground [overflow-wrap:anywhere]\">\n\t\t\t\t\t\t{description}\n\t\t\t\t\t</p>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t\t{settled ? (\n\t\t\t\t<span className=\"ms-auto inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md bg-muted px-2 text-[0.8125rem] text-foreground\">\n\t\t\t\t\t{status === 'connected' ? <Check aria-hidden=\"true\" className={cn('size-3.5', iconEnterClass)} /> : null}\n\t\t\t\t\t{status === 'connected' ? 'Connected' : 'Skipped'}\n\t\t\t\t</span>\n\t\t\t) : (\n\t\t\t\t<div className=\"ms-auto flex max-w-full flex-wrap items-center justify-end gap-2\">\n\t\t\t\t\t{skipLabel && onSkip ? (\n\t\t\t\t\t\t<Button size=\"xs\" variant=\"outline\" wrap disabled={status === 'connecting'} onClick={onSkip}>\n\t\t\t\t\t\t\t{skipLabel}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) : null}\n\t\t\t\t\t<Button size=\"xs\" wrap disabled={status === 'connecting'} onClick={onConnect}>\n\t\t\t\t\t\t{connectLabel}\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nexport { ConnectPrompt };\nexport type { ConnectPromptProps, ConnectPromptStatus };\n","'use client';\n\nimport { Bot, Check, ChevronRight } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\nimport { Button } from '../button';\nimport { Collapsible, CollapsiblePanel, CollapsibleTrigger } from '../collapsible';\nimport { iconEnterClass, MarkTile } from './mark-tile';\n\ntype AgentDraftTool = {\n\tid: string;\n\tlabel: string;\n\ticon?: React.ReactNode;\n};\n\ntype AgentDraftAction = {\n\tid: string;\n\tlabel: React.ReactNode;\n\t/** Label shown in the settled chip once this action is chosen. */\n\tchosenLabel?: React.ReactNode;\n\tvariant?: 'default' | 'outline';\n};\n\ntype AgentDraftCardProps = Omit<React.ComponentProps<'div'>, 'children'> & {\n\tname: React.ReactNode;\n\tbadge?: React.ReactNode;\n\tschedule?: React.ReactNode;\n\ttools?: AgentDraftTool[];\n\tsteps?: React.ReactNode[];\n\tactions?: AgentDraftAction[];\n\t/** Settled action id; replaces the action row with a summary chip. */\n\tchosenActionId?: string;\n\tonAction?: (actionId: string) => void;\n\tdefaultOpen?: boolean;\n};\n\n/**\n * Proposed agent spec an assistant drafts in chat: schedule, tools, and the\n * ordered steps it will run. Nothing runs until the host handles an action.\n */\nfunction AgentDraftCard({\n\tname,\n\tbadge = 'Draft',\n\tschedule,\n\ttools = [],\n\tsteps = [],\n\tactions = [],\n\tchosenActionId,\n\tonAction,\n\tdefaultOpen = true,\n\tclassName,\n\t...props\n}: AgentDraftCardProps) {\n\tconst chosen = actions.find((action) => action.id === chosenActionId);\n\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"agent-draft-card\"\n\t\t\tclassName={cn('animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] overflow-hidden rounded-xl bg-card shadow-card motion-reduce:animate-none', className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<Collapsible defaultOpen={defaultOpen}>\n\t\t\t\t<div className=\"flex h-10 items-center gap-2 px-2\">\n\t\t\t\t\t<CollapsibleTrigger className=\"group flex min-w-0 flex-1 cursor-pointer items-center justify-start gap-2 rounded-md font-normal py-1 text-start outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50\">\n\t\t\t\t\t\t<ChevronRight\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\tclassName=\"size-3.5 shrink-0 text-muted-foreground transition-transform duration-(--duration-moderate) ease-out group-data-panel-open:rotate-90 motion-reduce:transition-none rtl:-scale-x-100 rtl:group-data-panel-open:scale-x-100\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<MarkTile className=\"size-5 [&_svg:not([class*=size-])]:size-3\">\n\t\t\t\t\t\t\t<Bot />\n\t\t\t\t\t\t</MarkTile>\n\t\t\t\t\t\t<span title={typeof name === 'string' ? name : undefined} className=\"truncate font-mono text-[0.8125rem] text-foreground\">\n\t\t\t\t\t\t\t{name}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</CollapsibleTrigger>\n\t\t\t\t\t{badge ? (\n\t\t\t\t\t\t<span className=\"inline-flex h-5 shrink-0 items-center rounded-[5px] border border-border px-1.5 text-xs text-muted-foreground\">\n\t\t\t\t\t\t\t{badge}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : null}\n\t\t\t\t</div>\n\t\t\t\t<CollapsiblePanel>\n\t\t\t\t\t{schedule || tools.length ? (\n\t\t\t\t\t\t<dl className=\"grid grid-cols-[5.5rem_minmax(0,1fr)] gap-x-3 gap-y-2 border-t border-border px-4 py-3 text-[0.8125rem]\">\n\t\t\t\t\t\t\t{schedule ? (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<dt className=\"text-muted-foreground\">Runs</dt>\n\t\t\t\t\t\t\t\t\t<dd className=\"min-w-0 text-foreground [overflow-wrap:anywhere]\">{schedule}</dd>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t{tools.length ? (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<dt className=\"text-muted-foreground\">Tools</dt>\n\t\t\t\t\t\t\t\t\t<dd className=\"flex min-w-0 items-center gap-2 text-foreground\">\n\t\t\t\t\t\t\t\t\t\t<span className=\"flex -space-x-1\">\n\t\t\t\t\t\t\t\t\t\t\t{tools.map((tool) =>\n\t\t\t\t\t\t\t\t\t\t\t\ttool.icon ? (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<MarkTile key={tool.id} className=\"text-foreground ring-2 ring-card\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{tool.icon}\n\t\t\t\t\t\t\t\t\t\t\t\t\t</MarkTile>\n\t\t\t\t\t\t\t\t\t\t\t\t) : null,\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t<span title={tools.map((tool) => tool.label).join(', ')} className=\"truncate\">\n\t\t\t\t\t\t\t\t\t\t\t{tools.map((tool) => tool.label).join(', ')}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t</dd>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t</dl>\n\t\t\t\t\t) : null}\n\t\t\t\t\t{steps.length ? (\n\t\t\t\t\t\t<ol className=\"flex flex-col gap-1.5 border-t border-border px-4 py-3 text-[0.8125rem] text-muted-foreground\">\n\t\t\t\t\t\t\t{steps.map((step, index) => (\n\t\t\t\t\t\t\t\t<li key={index} className=\"flex gap-3\">\n\t\t\t\t\t\t\t\t\t<span className=\"w-3 shrink-0 text-end tabular-nums text-subtle-foreground\">{index + 1}</span>\n\t\t\t\t\t\t\t\t\t<span className=\"min-w-0 text-pretty [overflow-wrap:anywhere]\">{step}</span>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</ol>\n\t\t\t\t\t) : null}\n\t\t\t\t</CollapsiblePanel>\n\t\t\t</Collapsible>\n\t\t\t{actions.length ? (\n\t\t\t\t<div className=\"flex flex-wrap items-center gap-2 border-t border-border p-2\">\n\t\t\t\t\t{chosen ? (\n\t\t\t\t\t\t<span className=\"inline-flex min-h-7 max-w-full items-center gap-1.5 rounded-md bg-muted px-2 py-1 text-[0.8125rem] text-foreground [overflow-wrap:anywhere]\">\n\t\t\t\t\t\t\t<Check aria-hidden=\"true\" className={cn('size-3.5 shrink-0', iconEnterClass)} />\n\t\t\t\t\t\t\t{chosen.chosenLabel ?? chosen.label}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tactions.map((action, index) => (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tkey={action.id}\n\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\twrap\n\t\t\t\t\t\t\t\tvariant={action.variant ?? (index === 0 ? 'default' : 'outline')}\n\t\t\t\t\t\t\t\tonClick={() => onAction?.(action.id)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{action.label}\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t))\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t</div>\n\t);\n}\n\nexport { AgentDraftCard };\nexport type { AgentDraftCardProps, AgentDraftAction, AgentDraftTool };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAeA,SAAS,YAAY,EAAE,WAAW,SAAS,MAAM,UAAU,GAAG,SAA2B;CACxF,OACC,2CAAC,QAAD;EACC,aAAU;EACV,eAAa,SAAS,SAAS;EAC/B,WAAWA,iBACV,4BACA,SACG;GAIA;GACA;GACA;GACA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