@tetrascience-npm/tetrascience-react-ui 0.7.0-beta.108.1 → 0.7.0-beta.128.1

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 (439) hide show
  1. package/README.md +2 -2
  2. package/dist/components/ai/chain-of-thought.cjs +1 -1
  3. package/dist/components/ai/chain-of-thought.cjs.map +1 -1
  4. package/dist/components/ai/chain-of-thought.js +1 -1
  5. package/dist/components/ai/chain-of-thought.js.map +1 -1
  6. package/dist/components/ai/confirmation.cjs +1 -1
  7. package/dist/components/ai/confirmation.cjs.map +1 -1
  8. package/dist/components/ai/confirmation.js +1 -1
  9. package/dist/components/ai/confirmation.js.map +1 -1
  10. package/dist/components/ai/context.cjs +1 -1
  11. package/dist/components/ai/context.cjs.map +1 -1
  12. package/dist/components/ai/context.js +36 -35
  13. package/dist/components/ai/context.js.map +1 -1
  14. package/dist/components/ai/message.cjs +1 -1
  15. package/dist/components/ai/message.cjs.map +1 -1
  16. package/dist/components/ai/message.js +68 -68
  17. package/dist/components/ai/message.js.map +1 -1
  18. package/dist/components/ai/prompt-input.cjs +1 -1
  19. package/dist/components/ai/prompt-input.cjs.map +1 -1
  20. package/dist/components/ai/prompt-input.js +4 -2
  21. package/dist/components/ai/prompt-input.js.map +1 -1
  22. package/dist/components/ai/queue.cjs +1 -1
  23. package/dist/components/ai/queue.cjs.map +1 -1
  24. package/dist/components/ai/queue.js +9 -9
  25. package/dist/components/ai/queue.js.map +1 -1
  26. package/dist/components/ai/reasoning.cjs +1 -1
  27. package/dist/components/ai/reasoning.cjs.map +1 -1
  28. package/dist/components/ai/reasoning.js +67 -67
  29. package/dist/components/ai/reasoning.js.map +1 -1
  30. package/dist/components/ai/stream-status.cjs +1 -1
  31. package/dist/components/ai/stream-status.cjs.map +1 -1
  32. package/dist/components/ai/stream-status.js +41 -39
  33. package/dist/components/ai/stream-status.js.map +1 -1
  34. package/dist/components/ai/streamdown-code-plugin.cjs +2 -0
  35. package/dist/components/ai/streamdown-code-plugin.cjs.map +1 -0
  36. package/dist/components/ai/streamdown-code-plugin.js +42 -0
  37. package/dist/components/ai/streamdown-code-plugin.js.map +1 -0
  38. package/dist/components/ai/streamdown-plugins.cjs +2 -0
  39. package/dist/components/ai/streamdown-plugins.cjs.map +1 -0
  40. package/dist/components/ai/streamdown-plugins.js +14 -0
  41. package/dist/components/ai/streamdown-plugins.js.map +1 -0
  42. package/dist/components/ai/task.cjs +1 -1
  43. package/dist/components/ai/task.cjs.map +1 -1
  44. package/dist/components/ai/task.js +18 -11
  45. package/dist/components/ai/task.js.map +1 -1
  46. package/dist/components/ai/tool.cjs +1 -1
  47. package/dist/components/ai/tool.cjs.map +1 -1
  48. package/dist/components/ai/tool.js +51 -55
  49. package/dist/components/ai/tool.js.map +1 -1
  50. package/dist/components/ai/use-streamdown-plugins.cjs +2 -0
  51. package/dist/components/ai/use-streamdown-plugins.cjs.map +1 -0
  52. package/dist/components/ai/use-streamdown-plugins.js +25 -0
  53. package/dist/components/ai/use-streamdown-plugins.js.map +1 -0
  54. package/dist/components/charts/AreaPlot/AreaPlot.cjs +2 -0
  55. package/dist/components/charts/AreaPlot/AreaPlot.cjs.map +1 -0
  56. package/dist/components/charts/AreaPlot/AreaPlot.js +270 -0
  57. package/dist/components/charts/AreaPlot/AreaPlot.js.map +1 -0
  58. package/dist/components/charts/BarChart/BarChart.cjs +2 -0
  59. package/dist/components/charts/BarChart/BarChart.cjs.map +1 -0
  60. package/dist/components/charts/BarChart/BarChart.js +219 -0
  61. package/dist/components/charts/BarChart/BarChart.js.map +1 -0
  62. package/dist/components/charts/BoxPlot/BoxPlot.cjs +2 -0
  63. package/dist/components/charts/BoxPlot/BoxPlot.cjs.map +1 -0
  64. package/dist/components/charts/{Boxplot/Boxplot.js → BoxPlot/BoxPlot.js} +78 -79
  65. package/dist/components/charts/BoxPlot/BoxPlot.js.map +1 -0
  66. package/dist/components/charts/ChartTooltip/ChartTooltip.cjs +1 -1
  67. package/dist/components/charts/ChartTooltip/ChartTooltip.cjs.map +1 -1
  68. package/dist/components/charts/ChartTooltip/ChartTooltip.js +22 -22
  69. package/dist/components/charts/ChartTooltip/ChartTooltip.js.map +1 -1
  70. package/dist/components/charts/Chromatogram/Chromatogram.cjs +1 -1
  71. package/dist/components/charts/Chromatogram/Chromatogram.cjs.map +1 -1
  72. package/dist/components/charts/Chromatogram/Chromatogram.js +232 -170
  73. package/dist/components/charts/Chromatogram/Chromatogram.js.map +1 -1
  74. package/dist/components/charts/Chromatogram/annotations.cjs +2 -0
  75. package/dist/components/charts/Chromatogram/annotations.cjs.map +1 -0
  76. package/dist/components/charts/Chromatogram/annotations.js +137 -0
  77. package/dist/components/charts/Chromatogram/annotations.js.map +1 -0
  78. package/dist/components/charts/Chromatogram/boundaryMarkers.cjs.map +1 -0
  79. package/dist/components/charts/Chromatogram/boundaryMarkers.js.map +1 -0
  80. package/dist/components/charts/Chromatogram/constants.cjs.map +1 -0
  81. package/dist/components/charts/Chromatogram/constants.js.map +1 -0
  82. package/dist/components/charts/Chromatogram/dataProcessing.cjs.map +1 -0
  83. package/dist/components/charts/Chromatogram/dataProcessing.js.map +1 -0
  84. package/dist/components/charts/Chromatogram/peakDetection.cjs.map +1 -0
  85. package/dist/components/charts/Chromatogram/peakDetection.js.map +1 -0
  86. package/dist/components/charts/Chromatogram/plotBuilder.cjs +2 -0
  87. package/dist/components/charts/Chromatogram/plotBuilder.cjs.map +1 -0
  88. package/dist/components/charts/Chromatogram/plotBuilder.js +216 -0
  89. package/dist/components/charts/Chromatogram/plotBuilder.js.map +1 -0
  90. package/dist/components/charts/Chromatogram/regionOverlays.cjs.map +1 -0
  91. package/dist/components/charts/Chromatogram/regionOverlays.js.map +1 -0
  92. package/dist/components/charts/Electropherogram/Electropherogram.cjs +2 -0
  93. package/dist/components/charts/Electropherogram/Electropherogram.cjs.map +1 -0
  94. package/dist/components/charts/Electropherogram/Electropherogram.js +180 -0
  95. package/dist/components/charts/Electropherogram/Electropherogram.js.map +1 -0
  96. package/dist/components/charts/Histogram/Histogram.cjs +1 -1
  97. package/dist/components/charts/Histogram/Histogram.cjs.map +1 -1
  98. package/dist/components/charts/Histogram/Histogram.js +107 -108
  99. package/dist/components/charts/Histogram/Histogram.js.map +1 -1
  100. package/dist/components/charts/LinePlot/LinePlot.cjs +2 -0
  101. package/dist/components/charts/LinePlot/LinePlot.cjs.map +1 -0
  102. package/dist/components/charts/LinePlot/LinePlot.js +224 -0
  103. package/dist/components/charts/LinePlot/LinePlot.js.map +1 -0
  104. package/dist/components/charts/PieChart/PieChart.cjs +1 -1
  105. package/dist/components/charts/PieChart/PieChart.cjs.map +1 -1
  106. package/dist/components/charts/PieChart/PieChart.js +62 -61
  107. package/dist/components/charts/PieChart/PieChart.js.map +1 -1
  108. package/dist/components/charts/PlateMap/PlateMap.cjs +1 -1
  109. package/dist/components/charts/PlateMap/PlateMap.cjs.map +1 -1
  110. package/dist/components/charts/PlateMap/PlateMap.js +246 -242
  111. package/dist/components/charts/PlateMap/PlateMap.js.map +1 -1
  112. package/dist/components/charts/ScatterPlot/ScatterPlot.cjs +2 -0
  113. package/dist/components/charts/ScatterPlot/ScatterPlot.cjs.map +1 -0
  114. package/dist/components/charts/ScatterPlot/ScatterPlot.js +252 -0
  115. package/dist/components/charts/ScatterPlot/ScatterPlot.js.map +1 -0
  116. package/dist/components/charts/ScatterPlotInteractive/ScatterPlotInteractive.cjs +2 -0
  117. package/dist/components/charts/ScatterPlotInteractive/ScatterPlotInteractive.cjs.map +1 -0
  118. package/dist/components/charts/ScatterPlotInteractive/ScatterPlotInteractive.js +215 -0
  119. package/dist/components/charts/ScatterPlotInteractive/ScatterPlotInteractive.js.map +1 -0
  120. package/dist/components/charts/ScatterPlotInteractive/constants.cjs +2 -0
  121. package/dist/components/charts/ScatterPlotInteractive/constants.cjs.map +1 -0
  122. package/dist/components/charts/ScatterPlotInteractive/constants.js +38 -0
  123. package/dist/components/charts/ScatterPlotInteractive/constants.js.map +1 -0
  124. package/dist/components/charts/ScatterPlotInteractive/utils.cjs +2 -0
  125. package/dist/components/charts/ScatterPlotInteractive/utils.cjs.map +1 -0
  126. package/dist/components/charts/ScatterPlotInteractive/utils.js +261 -0
  127. package/dist/components/charts/ScatterPlotInteractive/utils.js.map +1 -0
  128. package/dist/components/charts/StackedChromatogram/StackedChromatogram.cjs +2 -0
  129. package/dist/components/charts/StackedChromatogram/StackedChromatogram.cjs.map +1 -0
  130. package/dist/components/charts/StackedChromatogram/StackedChromatogram.js +40 -0
  131. package/dist/components/charts/StackedChromatogram/StackedChromatogram.js.map +1 -0
  132. package/dist/components/charts/StackedChromatogram/transforms.cjs.map +1 -0
  133. package/dist/components/charts/StackedChromatogram/transforms.js.map +1 -0
  134. package/dist/components/charts/plotly-loader.cjs +2 -0
  135. package/dist/components/charts/plotly-loader.cjs.map +1 -0
  136. package/dist/components/charts/plotly-loader.js +22 -0
  137. package/dist/components/charts/plotly-loader.js.map +1 -0
  138. package/dist/components/composed/AssistantLayout/AssistantLayout.cjs +2 -0
  139. package/dist/components/composed/AssistantLayout/AssistantLayout.cjs.map +1 -0
  140. package/dist/components/composed/AssistantLayout/AssistantLayout.js +142 -0
  141. package/dist/components/composed/AssistantLayout/AssistantLayout.js.map +1 -0
  142. package/dist/components/composed/AssistantLayout/dockLayout.cjs +2 -0
  143. package/dist/components/composed/AssistantLayout/dockLayout.cjs.map +1 -0
  144. package/dist/components/composed/AssistantLayout/dockLayout.js +10 -0
  145. package/dist/components/composed/AssistantLayout/dockLayout.js.map +1 -0
  146. package/dist/components/composed/Chat/Chat.cjs +1 -1
  147. package/dist/components/composed/Chat/Chat.cjs.map +1 -1
  148. package/dist/components/composed/Chat/Chat.js +23 -23
  149. package/dist/components/composed/Chat/Chat.js.map +1 -1
  150. package/dist/components/composed/ConfirmDialog/ConfirmDialog.cjs +1 -1
  151. package/dist/components/composed/ConfirmDialog/ConfirmDialog.cjs.map +1 -1
  152. package/dist/components/composed/ConfirmDialog/ConfirmDialog.js +33 -29
  153. package/dist/components/composed/ConfirmDialog/ConfirmDialog.js.map +1 -1
  154. package/dist/components/composed/DataAppShell/CollapseButton.cjs +2 -0
  155. package/dist/components/composed/DataAppShell/CollapseButton.cjs.map +1 -0
  156. package/dist/components/composed/DataAppShell/CollapseButton.js +42 -0
  157. package/dist/components/composed/DataAppShell/CollapseButton.js.map +1 -0
  158. package/dist/components/composed/DataAppShell/DataAppShell.cjs +1 -1
  159. package/dist/components/composed/DataAppShell/DataAppShell.cjs.map +1 -1
  160. package/dist/components/composed/DataAppShell/DataAppShell.js +349 -313
  161. package/dist/components/composed/DataAppShell/DataAppShell.js.map +1 -1
  162. package/dist/components/composed/DataAppShell/PrimaryNav.cjs +2 -0
  163. package/dist/components/composed/DataAppShell/PrimaryNav.cjs.map +1 -0
  164. package/dist/components/composed/DataAppShell/PrimaryNav.js +268 -0
  165. package/dist/components/composed/DataAppShell/PrimaryNav.js.map +1 -0
  166. package/dist/components/composed/DataAppShell/RightPanel.cjs +2 -0
  167. package/dist/components/composed/DataAppShell/RightPanel.cjs.map +1 -0
  168. package/dist/components/composed/DataAppShell/RightPanel.js +282 -0
  169. package/dist/components/composed/DataAppShell/RightPanel.js.map +1 -0
  170. package/dist/components/composed/DataAppShell/SecondaryNav.cjs +2 -0
  171. package/dist/components/composed/DataAppShell/SecondaryNav.cjs.map +1 -0
  172. package/dist/components/composed/DataAppShell/SecondaryNav.js +364 -0
  173. package/dist/components/composed/DataAppShell/SecondaryNav.js.map +1 -0
  174. package/dist/components/composed/DataAppShell/ShellContext.cjs +2 -0
  175. package/dist/components/composed/DataAppShell/ShellContext.cjs.map +1 -0
  176. package/dist/components/composed/DataAppShell/ShellContext.js +23 -0
  177. package/dist/components/composed/DataAppShell/ShellContext.js.map +1 -0
  178. package/dist/components/composed/MoleculeStructure/MoleculeStructure.cjs +2 -0
  179. package/dist/components/composed/MoleculeStructure/MoleculeStructure.cjs.map +1 -0
  180. package/dist/components/composed/MoleculeStructure/MoleculeStructure.js +87 -0
  181. package/dist/components/composed/MoleculeStructure/MoleculeStructure.js.map +1 -0
  182. package/dist/components/composed/MoleculeStructure/rdkit-loader.cjs +2 -0
  183. package/dist/components/composed/MoleculeStructure/rdkit-loader.cjs.map +1 -0
  184. package/dist/components/composed/MoleculeStructure/rdkit-loader.js +89 -0
  185. package/dist/components/composed/MoleculeStructure/rdkit-loader.js.map +1 -0
  186. package/dist/components/composed/MoleculeStructure/use-rdkit.cjs +2 -0
  187. package/dist/components/composed/MoleculeStructure/use-rdkit.cjs.map +1 -0
  188. package/dist/components/composed/MoleculeStructure/use-rdkit.js +19 -0
  189. package/dist/components/composed/MoleculeStructure/use-rdkit.js.map +1 -0
  190. package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.cjs +1 -1
  191. package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.cjs.map +1 -1
  192. package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.js +17 -17
  193. package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.js.map +1 -1
  194. package/dist/components/composed/PlateMapEditor/PlateMapActionsMenu.cjs +1 -1
  195. package/dist/components/composed/PlateMapEditor/PlateMapActionsMenu.cjs.map +1 -1
  196. package/dist/components/composed/PlateMapEditor/PlateMapActionsMenu.js +33 -33
  197. package/dist/components/composed/PlateMapEditor/PlateMapActionsMenu.js.map +1 -1
  198. package/dist/components/composed/PlateMapEditor/PlateMapPlateSelector.cjs +1 -1
  199. package/dist/components/composed/PlateMapEditor/PlateMapPlateSelector.cjs.map +1 -1
  200. package/dist/components/composed/PlateMapEditor/PlateMapPlateSelector.js +7 -7
  201. package/dist/components/composed/PlateMapEditor/PlateMapPlateSelector.js.map +1 -1
  202. package/dist/components/composed/PlateMapEditor/PlatePaintGrid.cjs +1 -1
  203. package/dist/components/composed/PlateMapEditor/PlatePaintGrid.cjs.map +1 -1
  204. package/dist/components/composed/PlateMapEditor/PlatePaintGrid.js +1 -1
  205. package/dist/components/composed/PlateMapEditor/PlatePaintGrid.js.map +1 -1
  206. package/dist/components/composed/PlateMapEditor/WellLegend.cjs +1 -1
  207. package/dist/components/composed/PlateMapEditor/WellLegend.cjs.map +1 -1
  208. package/dist/components/composed/PlateMapEditor/WellLegend.js +24 -12
  209. package/dist/components/composed/PlateMapEditor/WellLegend.js.map +1 -1
  210. package/dist/components/composed/PlateMapEditor/WellManifestTable.cjs +1 -1
  211. package/dist/components/composed/PlateMapEditor/WellManifestTable.cjs.map +1 -1
  212. package/dist/components/composed/PlateMapEditor/WellManifestTable.js +1 -1
  213. package/dist/components/composed/PlateMapEditor/WellManifestTable.js.map +1 -1
  214. package/dist/components/composed/TdpSearch/components/DefaultFilters.cjs +1 -1
  215. package/dist/components/composed/TdpSearch/components/DefaultFilters.cjs.map +1 -1
  216. package/dist/components/composed/TdpSearch/components/DefaultFilters.js +3 -3
  217. package/dist/components/composed/TdpSearch/components/DefaultFilters.js.map +1 -1
  218. package/dist/components/composed/TopBar/TopBar.cjs +2 -0
  219. package/dist/components/composed/TopBar/TopBar.cjs.map +1 -0
  220. package/dist/components/composed/TopBar/TopBar.js +56 -0
  221. package/dist/components/composed/TopBar/TopBar.js.map +1 -0
  222. package/dist/components/composed/UserMenu/UserMenu.cjs +2 -0
  223. package/dist/components/composed/UserMenu/UserMenu.cjs.map +1 -0
  224. package/dist/components/composed/UserMenu/UserMenu.js +99 -0
  225. package/dist/components/composed/UserMenu/UserMenu.js.map +1 -0
  226. package/dist/components/composed/tdp-link.cjs +1 -1
  227. package/dist/components/composed/tdp-link.cjs.map +1 -1
  228. package/dist/components/composed/tdp-link.js +5 -5
  229. package/dist/components/composed/tdp-link.js.map +1 -1
  230. package/dist/components/ui/alert.cjs +1 -1
  231. package/dist/components/ui/alert.cjs.map +1 -1
  232. package/dist/components/ui/alert.js +12 -12
  233. package/dist/components/ui/alert.js.map +1 -1
  234. package/dist/components/ui/badge.cjs +1 -1
  235. package/dist/components/ui/badge.cjs.map +1 -1
  236. package/dist/components/ui/badge.js +14 -14
  237. package/dist/components/ui/badge.js.map +1 -1
  238. package/dist/components/ui/banner.cjs +1 -1
  239. package/dist/components/ui/banner.cjs.map +1 -1
  240. package/dist/components/ui/banner.js +17 -17
  241. package/dist/components/ui/banner.js.map +1 -1
  242. package/dist/components/ui/button.cjs +1 -1
  243. package/dist/components/ui/button.cjs.map +1 -1
  244. package/dist/components/ui/button.js +16 -16
  245. package/dist/components/ui/button.js.map +1 -1
  246. package/dist/components/ui/calendar.cjs +1 -1
  247. package/dist/components/ui/calendar.cjs.map +1 -1
  248. package/dist/components/ui/calendar.js +3 -3
  249. package/dist/components/ui/calendar.js.map +1 -1
  250. package/dist/components/ui/code-block.cjs +3 -3
  251. package/dist/components/ui/code-block.cjs.map +1 -1
  252. package/dist/components/ui/code-block.js +136 -118
  253. package/dist/components/ui/code-block.js.map +1 -1
  254. package/dist/components/ui/code-editor.cjs +1 -1
  255. package/dist/components/ui/code-editor.cjs.map +1 -1
  256. package/dist/components/ui/code-editor.js +14 -12
  257. package/dist/components/ui/code-editor.js.map +1 -1
  258. package/dist/components/ui/combobox.cjs +1 -1
  259. package/dist/components/ui/combobox.cjs.map +1 -1
  260. package/dist/components/ui/combobox.js +33 -29
  261. package/dist/components/ui/combobox.js.map +1 -1
  262. package/dist/components/ui/command.cjs +1 -1
  263. package/dist/components/ui/command.cjs.map +1 -1
  264. package/dist/components/ui/command.js +81 -77
  265. package/dist/components/ui/command.js.map +1 -1
  266. package/dist/components/ui/context-menu.cjs +1 -1
  267. package/dist/components/ui/context-menu.cjs.map +1 -1
  268. package/dist/components/ui/context-menu.js +13 -13
  269. package/dist/components/ui/context-menu.js.map +1 -1
  270. package/dist/components/ui/data-table/data-table-column-toggle.cjs +1 -1
  271. package/dist/components/ui/data-table/data-table-column-toggle.cjs.map +1 -1
  272. package/dist/components/ui/data-table/data-table-column-toggle.js +70 -62
  273. package/dist/components/ui/data-table/data-table-column-toggle.js.map +1 -1
  274. package/dist/components/ui/data-table/data-table-filter.cjs +1 -1
  275. package/dist/components/ui/data-table/data-table-filter.cjs.map +1 -1
  276. package/dist/components/ui/data-table/data-table-filter.js +24 -23
  277. package/dist/components/ui/data-table/data-table-filter.js.map +1 -1
  278. package/dist/components/ui/data-table/data-table-group.cjs +1 -1
  279. package/dist/components/ui/data-table/data-table-group.cjs.map +1 -1
  280. package/dist/components/ui/data-table/data-table-group.js +17 -16
  281. package/dist/components/ui/data-table/data-table-group.js.map +1 -1
  282. package/dist/components/ui/data-table/data-table-pagination.cjs +1 -1
  283. package/dist/components/ui/data-table/data-table-pagination.cjs.map +1 -1
  284. package/dist/components/ui/data-table/data-table-pagination.js +15 -15
  285. package/dist/components/ui/data-table/data-table-pagination.js.map +1 -1
  286. package/dist/components/ui/data-table/data-table.cjs +1 -1
  287. package/dist/components/ui/data-table/data-table.cjs.map +1 -1
  288. package/dist/components/ui/data-table/data-table.js +191 -190
  289. package/dist/components/ui/data-table/data-table.js.map +1 -1
  290. package/dist/components/ui/dialog.cjs +1 -1
  291. package/dist/components/ui/dialog.cjs.map +1 -1
  292. package/dist/components/ui/dialog.js +1 -1
  293. package/dist/components/ui/dialog.js.map +1 -1
  294. package/dist/components/ui/dropdown-menu.cjs +1 -1
  295. package/dist/components/ui/dropdown-menu.cjs.map +1 -1
  296. package/dist/components/ui/dropdown-menu.js +12 -4
  297. package/dist/components/ui/dropdown-menu.js.map +1 -1
  298. package/dist/components/ui/hover-card.cjs +1 -1
  299. package/dist/components/ui/hover-card.cjs.map +1 -1
  300. package/dist/components/ui/hover-card.js +3 -3
  301. package/dist/components/ui/hover-card.js.map +1 -1
  302. package/dist/components/ui/item.cjs +1 -1
  303. package/dist/components/ui/item.cjs.map +1 -1
  304. package/dist/components/ui/item.js +44 -36
  305. package/dist/components/ui/item.js.map +1 -1
  306. package/dist/components/ui/menubar.cjs +1 -1
  307. package/dist/components/ui/menubar.cjs.map +1 -1
  308. package/dist/components/ui/menubar.js +2 -2
  309. package/dist/components/ui/menubar.js.map +1 -1
  310. package/dist/components/ui/navigation-menu.cjs +1 -1
  311. package/dist/components/ui/navigation-menu.cjs.map +1 -1
  312. package/dist/components/ui/navigation-menu.js +1 -1
  313. package/dist/components/ui/navigation-menu.js.map +1 -1
  314. package/dist/components/ui/popover.cjs +1 -1
  315. package/dist/components/ui/popover.cjs.map +1 -1
  316. package/dist/components/ui/popover.js +1 -1
  317. package/dist/components/ui/popover.js.map +1 -1
  318. package/dist/components/ui/scroll-area.cjs +1 -1
  319. package/dist/components/ui/scroll-area.cjs.map +1 -1
  320. package/dist/components/ui/scroll-area.js +1 -0
  321. package/dist/components/ui/scroll-area.js.map +1 -1
  322. package/dist/components/ui/select.cjs +1 -1
  323. package/dist/components/ui/select.cjs.map +1 -1
  324. package/dist/components/ui/select.js +1 -1
  325. package/dist/components/ui/select.js.map +1 -1
  326. package/dist/components/ui/sheet.cjs +1 -1
  327. package/dist/components/ui/sheet.cjs.map +1 -1
  328. package/dist/components/ui/sheet.js +5 -5
  329. package/dist/components/ui/sheet.js.map +1 -1
  330. package/dist/components/ui/sidebar.cjs +1 -1
  331. package/dist/components/ui/sidebar.cjs.map +1 -1
  332. package/dist/components/ui/sidebar.js +2 -2
  333. package/dist/components/ui/sidebar.js.map +1 -1
  334. package/dist/components/ui/slider.cjs +1 -1
  335. package/dist/components/ui/slider.cjs.map +1 -1
  336. package/dist/components/ui/slider.js +10 -9
  337. package/dist/components/ui/slider.js.map +1 -1
  338. package/dist/components/ui/sonner.cjs +1 -1
  339. package/dist/components/ui/sonner.cjs.map +1 -1
  340. package/dist/components/ui/sonner.js +25 -10
  341. package/dist/components/ui/sonner.js.map +1 -1
  342. package/dist/components/ui/table.cjs +1 -1
  343. package/dist/components/ui/table.cjs.map +1 -1
  344. package/dist/components/ui/table.js +1 -0
  345. package/dist/components/ui/table.js.map +1 -1
  346. package/dist/components/ui/tabs.cjs +1 -1
  347. package/dist/components/ui/tabs.cjs.map +1 -1
  348. package/dist/components/ui/tabs.js +18 -18
  349. package/dist/components/ui/tabs.js.map +1 -1
  350. package/dist/components/ui/tetra-molecule-icon.cjs +2 -0
  351. package/dist/components/ui/tetra-molecule-icon.cjs.map +1 -0
  352. package/dist/components/ui/tetra-molecule-icon.js +49 -0
  353. package/dist/components/ui/tetra-molecule-icon.js.map +1 -0
  354. package/dist/components/ui/toggle-group.cjs +1 -1
  355. package/dist/components/ui/toggle-group.cjs.map +1 -1
  356. package/dist/components/ui/toggle-group.js +35 -31
  357. package/dist/components/ui/toggle-group.js.map +1 -1
  358. package/dist/hooks/use-plotly-theme.cjs +1 -1
  359. package/dist/hooks/use-plotly-theme.cjs.map +1 -1
  360. package/dist/hooks/use-plotly-theme.js +4 -3
  361. package/dist/hooks/use-plotly-theme.js.map +1 -1
  362. package/dist/index.cjs +1 -1
  363. package/dist/index.css +1 -1
  364. package/dist/index.d.ts +1073 -136
  365. package/dist/index.js +698 -647
  366. package/dist/index.js.map +1 -1
  367. package/dist/index.tailwind.css +1 -1
  368. package/dist/lib/shiki.cjs +2 -0
  369. package/dist/lib/shiki.cjs.map +1 -0
  370. package/dist/lib/shiki.js +72 -0
  371. package/dist/lib/shiki.js.map +1 -0
  372. package/package.json +23 -12
  373. package/dist/components/charts/AreaGraph/AreaGraph.cjs +0 -2
  374. package/dist/components/charts/AreaGraph/AreaGraph.cjs.map +0 -1
  375. package/dist/components/charts/AreaGraph/AreaGraph.js +0 -271
  376. package/dist/components/charts/AreaGraph/AreaGraph.js.map +0 -1
  377. package/dist/components/charts/BarGraph/BarGraph.cjs +0 -2
  378. package/dist/components/charts/BarGraph/BarGraph.cjs.map +0 -1
  379. package/dist/components/charts/BarGraph/BarGraph.js +0 -220
  380. package/dist/components/charts/BarGraph/BarGraph.js.map +0 -1
  381. package/dist/components/charts/Boxplot/Boxplot.cjs +0 -2
  382. package/dist/components/charts/Boxplot/Boxplot.cjs.map +0 -1
  383. package/dist/components/charts/Boxplot/Boxplot.js.map +0 -1
  384. package/dist/components/charts/ChromatogramChart/ChromatogramChart.cjs +0 -2
  385. package/dist/components/charts/ChromatogramChart/ChromatogramChart.cjs.map +0 -1
  386. package/dist/components/charts/ChromatogramChart/ChromatogramChart.js +0 -241
  387. package/dist/components/charts/ChromatogramChart/ChromatogramChart.js.map +0 -1
  388. package/dist/components/charts/ChromatogramChart/annotations.cjs +0 -2
  389. package/dist/components/charts/ChromatogramChart/annotations.cjs.map +0 -1
  390. package/dist/components/charts/ChromatogramChart/annotations.js +0 -136
  391. package/dist/components/charts/ChromatogramChart/annotations.js.map +0 -1
  392. package/dist/components/charts/ChromatogramChart/boundaryMarkers.cjs.map +0 -1
  393. package/dist/components/charts/ChromatogramChart/boundaryMarkers.js.map +0 -1
  394. package/dist/components/charts/ChromatogramChart/constants.cjs.map +0 -1
  395. package/dist/components/charts/ChromatogramChart/constants.js.map +0 -1
  396. package/dist/components/charts/ChromatogramChart/dataProcessing.cjs.map +0 -1
  397. package/dist/components/charts/ChromatogramChart/dataProcessing.js.map +0 -1
  398. package/dist/components/charts/ChromatogramChart/peakDetection.cjs.map +0 -1
  399. package/dist/components/charts/ChromatogramChart/peakDetection.js.map +0 -1
  400. package/dist/components/charts/ChromatogramChart/plotBuilder.cjs +0 -2
  401. package/dist/components/charts/ChromatogramChart/plotBuilder.cjs.map +0 -1
  402. package/dist/components/charts/ChromatogramChart/plotBuilder.js +0 -207
  403. package/dist/components/charts/ChromatogramChart/plotBuilder.js.map +0 -1
  404. package/dist/components/charts/ChromatogramChart/regionOverlays.cjs.map +0 -1
  405. package/dist/components/charts/ChromatogramChart/regionOverlays.js.map +0 -1
  406. package/dist/components/charts/DotPlot/DotPlot.cjs +0 -2
  407. package/dist/components/charts/DotPlot/DotPlot.cjs.map +0 -1
  408. package/dist/components/charts/DotPlot/DotPlot.js +0 -208
  409. package/dist/components/charts/DotPlot/DotPlot.js.map +0 -1
  410. package/dist/components/charts/Heatmap/Heatmap.cjs +0 -2
  411. package/dist/components/charts/Heatmap/Heatmap.cjs.map +0 -1
  412. package/dist/components/charts/Heatmap/Heatmap.js +0 -67
  413. package/dist/components/charts/Heatmap/Heatmap.js.map +0 -1
  414. package/dist/components/charts/LineGraph/LineGraph.cjs +0 -2
  415. package/dist/components/charts/LineGraph/LineGraph.cjs.map +0 -1
  416. package/dist/components/charts/LineGraph/LineGraph.js +0 -225
  417. package/dist/components/charts/LineGraph/LineGraph.js.map +0 -1
  418. package/dist/components/charts/ScatterGraph/ScatterGraph.cjs +0 -2
  419. package/dist/components/charts/ScatterGraph/ScatterGraph.cjs.map +0 -1
  420. package/dist/components/charts/ScatterGraph/ScatterGraph.js +0 -234
  421. package/dist/components/charts/ScatterGraph/ScatterGraph.js.map +0 -1
  422. package/dist/components/charts/StackedChromatogramChart/StackedChromatogramChart.cjs +0 -2
  423. package/dist/components/charts/StackedChromatogramChart/StackedChromatogramChart.cjs.map +0 -1
  424. package/dist/components/charts/StackedChromatogramChart/StackedChromatogramChart.js +0 -40
  425. package/dist/components/charts/StackedChromatogramChart/StackedChromatogramChart.js.map +0 -1
  426. package/dist/components/charts/StackedChromatogramChart/transforms.cjs.map +0 -1
  427. package/dist/components/charts/StackedChromatogramChart/transforms.js.map +0 -1
  428. /package/dist/components/charts/{ChromatogramChart → Chromatogram}/boundaryMarkers.cjs +0 -0
  429. /package/dist/components/charts/{ChromatogramChart → Chromatogram}/boundaryMarkers.js +0 -0
  430. /package/dist/components/charts/{ChromatogramChart → Chromatogram}/constants.cjs +0 -0
  431. /package/dist/components/charts/{ChromatogramChart → Chromatogram}/constants.js +0 -0
  432. /package/dist/components/charts/{ChromatogramChart → Chromatogram}/dataProcessing.cjs +0 -0
  433. /package/dist/components/charts/{ChromatogramChart → Chromatogram}/dataProcessing.js +0 -0
  434. /package/dist/components/charts/{ChromatogramChart → Chromatogram}/peakDetection.cjs +0 -0
  435. /package/dist/components/charts/{ChromatogramChart → Chromatogram}/peakDetection.js +0 -0
  436. /package/dist/components/charts/{ChromatogramChart → Chromatogram}/regionOverlays.cjs +0 -0
  437. /package/dist/components/charts/{ChromatogramChart → Chromatogram}/regionOverlays.js +0 -0
  438. /package/dist/components/charts/{StackedChromatogramChart → StackedChromatogram}/transforms.cjs +0 -0
  439. /package/dist/components/charts/{StackedChromatogramChart → StackedChromatogram}/transforms.js +0 -0
package/README.md CHANGED
@@ -157,7 +157,7 @@ Use `ProcessFlow` from `@tetrascience-npm/tetrascience-react-ui` for multi-step
157
157
 
158
158
  Plotly.js-based data visualisations:
159
159
 
160
- AreaGraph, BarGraph, Boxplot, Chromatogram, ChromatogramChart, DotPlot, Heatmap, Histogram, LineGraph, PieChart, PlateMap, ScatterGraph
160
+ AreaPlot, BarChart, BoxPlot, Chromatogram, StackedChromatogram, Electropherogram, Histogram, LinePlot, PieChart, PlateMap, ScatterPlot, ScatterPlotInteractive
161
161
 
162
162
  ## Server Utilities
163
163
 
@@ -363,7 +363,7 @@ Full TypeScript support with exported types:
363
363
 
364
364
  ```tsx
365
365
  import { Button } from "@tetrascience-npm/tetrascience-react-ui";
366
- import type { ButtonProps, BarGraphProps, BarDataSeries } from "@tetrascience-npm/tetrascience-react-ui";
366
+ import type { ButtonProps, BarChartProps, BarDataSeries } from "@tetrascience-npm/tetrascience-react-ui";
367
367
  ```
368
368
 
369
369
  ## Examples
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("lucide-react"),i=require("../ui/collapsible.cjs"),s=require("../../lib/utils.cjs"),h=({className:t,defaultOpen:a=!0,...o})=>e.jsx(i.Collapsible,{className:s.cn("overflow-hidden rounded-lg text-sm",t),defaultOpen:a,...o}),c=({className:t,children:a,title:o="Chain of Thought",icon:r,isStreaming:n=!1,...p})=>e.jsx(i.CollapsibleTrigger,{className:s.cn("group flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",t),...p,children:a??e.jsxs(e.Fragment,{children:[r??e.jsx(l.Brain,{className:"size-4 text-muted-foreground"}),e.jsxs("span",{className:"flex-1 text-left items-center gap-2",children:[o,n&&e.jsx("span",{className:"size-1.5 animate-pulse rounded-full bg-primary"})]}),e.jsx(l.ChevronUpIcon,{className:"size-4 text-muted-foreground opacity-0 transition-all group-focus-visible:opacity-100 group-hover:opacity-100 group-data-[state=open]:opacity-100 group-data-[state=closed]:rotate-180","data-slot":"collapsible-chevron"})]})}),u=({className:t,...a})=>e.jsx(i.CollapsibleContent,{className:s.cn("flex flex-col gap-2.5 pb-4 pt-3","data-[state=closed]:animate-out data-[state=open]:animate-in","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:slide-out-to-top-1 data-[state=open]:slide-in-from-top-1",t),...a}),x={bullet:e.jsx("span",{className:"mt-[7px] ml-1 size-1.5 shrink-0 rounded-full bg-muted-foreground/50"}),search:e.jsx(l.SearchIcon,{className:"mt-0.5 w-[18px] size-3.5 shrink-0 text-muted-foreground"}),image:e.jsx(l.ImageIcon,{className:"mt-0.5 size-3.5 shrink-0 text-muted-foreground"})},d=({variant:t="bullet",className:a,children:o,...r})=>{const n=typeof t=="string"?x[t]:t;return e.jsxs("div",{className:s.cn("flex items-start gap-2 text-muted-foreground",a),...r,children:[e.jsx("span",{className:"flex shrink-0",children:n}),e.jsx("span",{className:"min-w-0 flex-1 leading-relaxed",children:o})]})},g=({className:t,...a})=>e.jsx("div",{className:s.cn("ml-[6px] flex flex-wrap gap-1.5 border-l-2 border-muted-foreground/20 py-0.5 pl-3",t),...a}),m=({className:t,children:a,...o})=>e.jsx("a",{className:s.cn("inline-flex items-center rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-xs text-muted-foreground transition-colors",o.href&&"cursor-pointer hover:bg-accent hover:text-accent-foreground",t),rel:"noreferrer",target:"_blank",...o,children:a}),f=({src:t,alt:a="",caption:o,className:r,...n})=>e.jsxs("figure",{className:s.cn("ml-[22px] overflow-hidden rounded-lg border",r),...n,children:[e.jsx("img",{alt:a,className:"max-h-64 w-full object-cover",src:t}),o&&e.jsx("figcaption",{className:"border-t px-3 py-2 text-xs italic text-muted-foreground/70",children:o})]});h.displayName="ChainOfThought";c.displayName="ChainOfThoughtTrigger";u.displayName="ChainOfThoughtContent";d.displayName="ChainOfThoughtStep";g.displayName="ChainOfThoughtSources";m.displayName="ChainOfThoughtSource";f.displayName="ChainOfThoughtImage";exports.ChainOfThought=h;exports.ChainOfThoughtContent=u;exports.ChainOfThoughtImage=f;exports.ChainOfThoughtSource=m;exports.ChainOfThoughtSources=g;exports.ChainOfThoughtStep=d;exports.ChainOfThoughtTrigger=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("lucide-react"),i=require("../ui/collapsible.cjs"),s=require("../../lib/utils.cjs"),h=({className:t,defaultOpen:a=!0,...o})=>e.jsx(i.Collapsible,{className:s.cn("overflow-hidden rounded-lg text-sm",t),defaultOpen:a,...o}),c=({className:t,children:a,title:o="Chain of Thought",icon:r,isStreaming:n=!1,...p})=>e.jsx(i.CollapsibleTrigger,{className:s.cn("group flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",t),...p,children:a??e.jsxs(e.Fragment,{children:[r??e.jsx(l.Brain,{className:"size-4 text-muted-foreground"}),e.jsxs("span",{className:"flex-1 text-left items-center gap-2",children:[o,n&&e.jsx("span",{className:"size-1.5 animate-pulse rounded-full bg-primary"})]}),e.jsx(l.ChevronUpIcon,{className:"size-4 text-muted-foreground opacity-0 transition-all group-focus-visible:opacity-100 group-hover:opacity-100 group-data-[state=open]:opacity-100 group-data-[state=closed]:rotate-180","data-slot":"collapsible-chevron"})]})}),u=({className:t,...a})=>e.jsx(i.CollapsibleContent,{className:s.cn("flex flex-col gap-2.5 pb-4 pt-3","data-[state=closed]:animate-out data-[state=open]:animate-in","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:slide-out-to-top-1 data-[state=open]:slide-in-from-top-1",t),...a}),x={bullet:e.jsx("span",{className:"mt-[7px] ml-1 size-1.5 shrink-0 rounded-full bg-muted-foreground/50"}),search:e.jsx(l.SearchIcon,{className:"mt-0.5 w-[18px] size-3.5 shrink-0 text-muted-foreground"}),image:e.jsx(l.ImageIcon,{className:"mt-0.5 size-3.5 shrink-0 text-muted-foreground"})},d=({variant:t="bullet",className:a,children:o,...r})=>{const n=typeof t=="string"?x[t]:t;return e.jsxs("div",{className:s.cn("flex items-start gap-2 text-muted-foreground",a),...r,children:[e.jsx("span",{className:"flex shrink-0",children:n}),e.jsx("span",{className:"min-w-0 flex-1 leading-relaxed",children:o})]})},g=({className:t,...a})=>e.jsx("div",{className:s.cn("ml-[6px] flex flex-wrap gap-1.5 border-l-2 border-muted-foreground/20 py-0.5 pl-3",t),...a}),m=({className:t,children:a,...o})=>e.jsx("a",{className:s.cn("inline-flex items-center rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-xs text-muted-foreground transition-colors",o.href&&"cursor-pointer hover:bg-accent hover:text-accent-foreground",t),rel:"noreferrer",target:"_blank",...o,children:a}),f=({src:t,alt:a="",caption:o,className:r,...n})=>e.jsxs("figure",{className:s.cn("ml-[22px] overflow-hidden rounded-lg border",r),...n,children:[e.jsx("img",{alt:a,className:"max-h-64 w-full object-cover",src:t}),o&&e.jsx("figcaption",{className:"border-t px-3 py-2 text-xs italic text-muted-foreground",children:o})]});h.displayName="ChainOfThought";c.displayName="ChainOfThoughtTrigger";u.displayName="ChainOfThoughtContent";d.displayName="ChainOfThoughtStep";g.displayName="ChainOfThoughtSources";m.displayName="ChainOfThoughtSource";f.displayName="ChainOfThoughtImage";exports.ChainOfThought=h;exports.ChainOfThoughtContent=u;exports.ChainOfThoughtImage=f;exports.ChainOfThoughtSource=m;exports.ChainOfThoughtSources=g;exports.ChainOfThoughtStep=d;exports.ChainOfThoughtTrigger=c;
2
2
  //# sourceMappingURL=chain-of-thought.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"chain-of-thought.cjs","sources":["../../../src/components/ai/chain-of-thought.tsx"],"sourcesContent":["import { Brain, ChevronUpIcon, ImageIcon, SearchIcon } from \"lucide-react\";\n\nimport type { ComponentProps, ReactNode } from \"react\";\n\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"@/components/ui/collapsible\";\nimport { cn } from \"@/lib/utils\";\n\n// ---------------------------------------------------------------------------\n// ChainOfThought (root)\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtProps = ComponentProps<typeof Collapsible>;\n\nexport const ChainOfThought = ({\n className,\n defaultOpen = true,\n ...props\n}: ChainOfThoughtProps) => (\n <Collapsible\n className={cn(\"overflow-hidden rounded-lg text-sm\", className)}\n defaultOpen={defaultOpen}\n {...props}\n />\n);\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtTrigger\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtTriggerProps = ComponentProps<typeof CollapsibleTrigger> & {\n title?: string;\n icon?: ReactNode;\n /** When true, renders a subtle animated dot next to the title. */\n isStreaming?: boolean;\n};\n\nexport const ChainOfThoughtTrigger = ({\n className,\n children,\n title = \"Chain of Thought\",\n icon,\n isStreaming = false,\n ...props\n}: ChainOfThoughtTriggerProps) => (\n <CollapsibleTrigger\n className={cn(\n \"group flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground\",\n className\n )}\n {...props}\n >\n {children ?? (\n <>\n {icon ?? <Brain className=\"size-4 text-muted-foreground\" />}\n <span className=\"flex-1 text-left items-center gap-2\">\n {title}\n {isStreaming && (\n <span className=\"size-1.5 animate-pulse rounded-full bg-primary\" />\n )}\n </span>\n <ChevronUpIcon\n className=\"size-4 text-muted-foreground opacity-0 transition-all group-focus-visible:opacity-100 group-hover:opacity-100 group-data-[state=open]:opacity-100 group-data-[state=closed]:rotate-180\"\n data-slot=\"collapsible-chevron\"\n />\n </>\n )}\n </CollapsibleTrigger>\n);\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtContent\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtContentProps = ComponentProps<typeof CollapsibleContent>;\n\nexport const ChainOfThoughtContent = ({\n className,\n ...props\n}: ChainOfThoughtContentProps) => (\n <CollapsibleContent\n className={cn(\n \"flex flex-col gap-2.5 pb-4 pt-3\",\n \"data-[state=closed]:animate-out data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n \"data-[state=closed]:slide-out-to-top-1 data-[state=open]:slide-in-from-top-1\",\n className\n )}\n {...props}\n />\n);\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtStep\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtStepVariant = \"bullet\" | \"search\" | \"image\";\n\nexport type ChainOfThoughtStepProps = ComponentProps<\"div\"> & {\n /**\n * Visual prefix for the step.\n * - `\"bullet\"` — small dot (default, plain reasoning text)\n * - `\"search\"` — magnifying-glass (web search / tool call)\n * - `\"image\"` — image icon (image fetch / vision step)\n * - ReactNode — custom icon\n */\n variant?: ChainOfThoughtStepVariant | ReactNode;\n};\n\nconst STEP_ICONS: Record<ChainOfThoughtStepVariant, ReactNode> = {\n bullet: (\n <span className=\"mt-[7px] ml-1 size-1.5 shrink-0 rounded-full bg-muted-foreground/50\" />\n ),\n search: <SearchIcon className=\"mt-0.5 w-[18px] size-3.5 shrink-0 text-muted-foreground\" />,\n image: <ImageIcon className=\"mt-0.5 size-3.5 shrink-0 text-muted-foreground\" />,\n};\n\nexport const ChainOfThoughtStep = ({\n variant = \"bullet\",\n className,\n children,\n ...props\n}: ChainOfThoughtStepProps) => {\n const icon =\n typeof variant === \"string\"\n ? STEP_ICONS[variant as ChainOfThoughtStepVariant]\n : variant;\n\n return (\n <div\n className={cn(\"flex items-start gap-2 text-muted-foreground\", className)}\n {...props}\n >\n <span className=\"flex shrink-0\">{icon}</span>\n <span className=\"min-w-0 flex-1 leading-relaxed\">{children}</span>\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtSources — inline chip group with left bar\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtSourcesProps = ComponentProps<\"div\">;\n\nexport const ChainOfThoughtSources = ({\n className,\n ...props\n}: ChainOfThoughtSourcesProps) => (\n <div\n className={cn(\n \"ml-[6px] flex flex-wrap gap-1.5 border-l-2 border-muted-foreground/20 py-0.5 pl-3\",\n className\n )}\n {...props}\n />\n);\n\nexport type ChainOfThoughtSourceProps = ComponentProps<\"a\">;\n\nexport const ChainOfThoughtSource = ({\n className,\n children,\n ...props\n}: ChainOfThoughtSourceProps) => (\n <a\n className={cn(\n \"inline-flex items-center rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-xs text-muted-foreground transition-colors\",\n props.href && \"cursor-pointer hover:bg-accent hover:text-accent-foreground\",\n className\n )}\n rel=\"noreferrer\"\n target=\"_blank\"\n {...props}\n >\n {children}\n </a>\n);\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtImage — inline image with optional caption\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtImageProps = ComponentProps<\"figure\"> & {\n src: string;\n alt?: string;\n caption?: string;\n};\n\nexport const ChainOfThoughtImage = ({\n src,\n alt = \"\",\n caption,\n className,\n ...props\n}: ChainOfThoughtImageProps) => (\n <figure\n className={cn(\"ml-[22px] overflow-hidden rounded-lg border\", className)}\n {...props}\n >\n <img alt={alt} className=\"max-h-64 w-full object-cover\" src={src} />\n {caption && (\n <figcaption className=\"border-t px-3 py-2 text-xs italic text-muted-foreground/70\">\n {caption}\n </figcaption>\n )}\n </figure>\n);\n\nChainOfThought.displayName = \"ChainOfThought\";\nChainOfThoughtTrigger.displayName = \"ChainOfThoughtTrigger\";\nChainOfThoughtContent.displayName = \"ChainOfThoughtContent\";\nChainOfThoughtStep.displayName = \"ChainOfThoughtStep\";\nChainOfThoughtSources.displayName = \"ChainOfThoughtSources\";\nChainOfThoughtSource.displayName = \"ChainOfThoughtSource\";\nChainOfThoughtImage.displayName = \"ChainOfThoughtImage\";\n"],"names":["ChainOfThought","className","defaultOpen","props","jsx","Collapsible","cn","ChainOfThoughtTrigger","children","title","icon","isStreaming","CollapsibleTrigger","jsxs","Fragment","Brain","ChevronUpIcon","ChainOfThoughtContent","CollapsibleContent","STEP_ICONS","SearchIcon","ImageIcon","ChainOfThoughtStep","variant","ChainOfThoughtSources","ChainOfThoughtSource","ChainOfThoughtImage","src","alt","caption"],"mappings":"mNAiBaA,EAAiB,CAAC,CAC7B,UAAAC,EACA,YAAAC,EAAc,GACd,GAAGC,CACL,IACEC,EAAAA,IAACC,EAAAA,YAAA,CACC,UAAWC,EAAAA,GAAG,qCAAsCL,CAAS,EAC7D,YAAAC,EACC,GAAGC,CAAA,CACN,EAcWI,EAAwB,CAAC,CACpC,UAAAN,EACA,SAAAO,EACA,MAAAC,EAAQ,mBACR,KAAAC,EACA,YAAAC,EAAc,GACd,GAAGR,CACL,IACEC,EAAAA,IAACQ,EAAAA,mBAAA,CACC,UAAWN,EAAAA,GACT,6GACAL,CAAA,EAED,GAAGE,EAEH,YACCU,EAAAA,KAAAC,EAAAA,SAAA,CACG,SAAA,CAAAJ,GAAQN,EAAAA,IAACW,EAAAA,MAAA,CAAM,UAAU,8BAAA,CAA+B,EACzDF,EAAAA,KAAC,OAAA,CAAK,UAAU,sCACb,SAAA,CAAAJ,EACAE,GACCP,EAAAA,IAAC,OAAA,CAAK,UAAU,gDAAA,CAAiD,CAAA,EAErE,EACAA,EAAAA,IAACY,EAAAA,cAAA,CACC,UAAU,yLACV,YAAU,qBAAA,CAAA,CACZ,CAAA,CACF,CAAA,CAEJ,EASWC,EAAwB,CAAC,CACpC,UAAAhB,EACA,GAAGE,CACL,IACEC,EAAAA,IAACc,EAAAA,mBAAA,CACC,UAAWZ,EAAAA,GACT,kCACA,+DACA,6DACA,+EACAL,CAAA,EAED,GAAGE,CAAA,CACN,EAoBIgB,EAA2D,CAC/D,OACEf,EAAAA,IAAC,OAAA,CAAK,UAAU,qEAAA,CAAsE,EAExF,OAAQA,EAAAA,IAACgB,EAAAA,WAAA,CAAW,UAAU,yDAAA,CAA0D,EACxF,MAAOh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BACpCK,EAAmB,YAAc,qBACjCE,EAAsB,YAAc,wBACpCC,EAAqB,YAAc,uBACnCC,EAAoB,YAAc"}
1
+ {"version":3,"file":"chain-of-thought.cjs","sources":["../../../src/components/ai/chain-of-thought.tsx"],"sourcesContent":["import { Brain, ChevronUpIcon, ImageIcon, SearchIcon } from \"lucide-react\";\n\nimport type { ComponentProps, ReactNode } from \"react\";\n\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"@/components/ui/collapsible\";\nimport { cn } from \"@/lib/utils\";\n\n// ---------------------------------------------------------------------------\n// ChainOfThought (root)\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtProps = ComponentProps<typeof Collapsible>;\n\nexport const ChainOfThought = ({\n className,\n defaultOpen = true,\n ...props\n}: ChainOfThoughtProps) => (\n <Collapsible\n className={cn(\"overflow-hidden rounded-lg text-sm\", className)}\n defaultOpen={defaultOpen}\n {...props}\n />\n);\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtTrigger\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtTriggerProps = ComponentProps<typeof CollapsibleTrigger> & {\n title?: string;\n icon?: ReactNode;\n /** When true, renders a subtle animated dot next to the title. */\n isStreaming?: boolean;\n};\n\nexport const ChainOfThoughtTrigger = ({\n className,\n children,\n title = \"Chain of Thought\",\n icon,\n isStreaming = false,\n ...props\n}: ChainOfThoughtTriggerProps) => (\n <CollapsibleTrigger\n className={cn(\n \"group flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground\",\n className\n )}\n {...props}\n >\n {children ?? (\n <>\n {icon ?? <Brain className=\"size-4 text-muted-foreground\" />}\n <span className=\"flex-1 text-left items-center gap-2\">\n {title}\n {isStreaming && (\n <span className=\"size-1.5 animate-pulse rounded-full bg-primary\" />\n )}\n </span>\n <ChevronUpIcon\n className=\"size-4 text-muted-foreground opacity-0 transition-all group-focus-visible:opacity-100 group-hover:opacity-100 group-data-[state=open]:opacity-100 group-data-[state=closed]:rotate-180\"\n data-slot=\"collapsible-chevron\"\n />\n </>\n )}\n </CollapsibleTrigger>\n);\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtContent\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtContentProps = ComponentProps<typeof CollapsibleContent>;\n\nexport const ChainOfThoughtContent = ({\n className,\n ...props\n}: ChainOfThoughtContentProps) => (\n <CollapsibleContent\n className={cn(\n \"flex flex-col gap-2.5 pb-4 pt-3\",\n \"data-[state=closed]:animate-out data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n \"data-[state=closed]:slide-out-to-top-1 data-[state=open]:slide-in-from-top-1\",\n className\n )}\n {...props}\n />\n);\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtStep\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtStepVariant = \"bullet\" | \"search\" | \"image\";\n\nexport type ChainOfThoughtStepProps = ComponentProps<\"div\"> & {\n /**\n * Visual prefix for the step.\n * - `\"bullet\"` — small dot (default, plain reasoning text)\n * - `\"search\"` — magnifying-glass (web search / tool call)\n * - `\"image\"` — image icon (image fetch / vision step)\n * - ReactNode — custom icon\n */\n variant?: ChainOfThoughtStepVariant | ReactNode;\n};\n\nconst STEP_ICONS: Record<ChainOfThoughtStepVariant, ReactNode> = {\n bullet: (\n <span className=\"mt-[7px] ml-1 size-1.5 shrink-0 rounded-full bg-muted-foreground/50\" />\n ),\n search: <SearchIcon className=\"mt-0.5 w-[18px] size-3.5 shrink-0 text-muted-foreground\" />,\n image: <ImageIcon className=\"mt-0.5 size-3.5 shrink-0 text-muted-foreground\" />,\n};\n\nexport const ChainOfThoughtStep = ({\n variant = \"bullet\",\n className,\n children,\n ...props\n}: ChainOfThoughtStepProps) => {\n const icon =\n typeof variant === \"string\"\n ? STEP_ICONS[variant as ChainOfThoughtStepVariant]\n : variant;\n\n return (\n <div\n className={cn(\"flex items-start gap-2 text-muted-foreground\", className)}\n {...props}\n >\n <span className=\"flex shrink-0\">{icon}</span>\n <span className=\"min-w-0 flex-1 leading-relaxed\">{children}</span>\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtSources — inline chip group with left bar\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtSourcesProps = ComponentProps<\"div\">;\n\nexport const ChainOfThoughtSources = ({\n className,\n ...props\n}: ChainOfThoughtSourcesProps) => (\n <div\n className={cn(\n \"ml-[6px] flex flex-wrap gap-1.5 border-l-2 border-muted-foreground/20 py-0.5 pl-3\",\n className\n )}\n {...props}\n />\n);\n\nexport type ChainOfThoughtSourceProps = ComponentProps<\"a\">;\n\nexport const ChainOfThoughtSource = ({\n className,\n children,\n ...props\n}: ChainOfThoughtSourceProps) => (\n <a\n className={cn(\n \"inline-flex items-center rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-xs text-muted-foreground transition-colors\",\n props.href && \"cursor-pointer hover:bg-accent hover:text-accent-foreground\",\n className\n )}\n rel=\"noreferrer\"\n target=\"_blank\"\n {...props}\n >\n {children}\n </a>\n);\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtImage — inline image with optional caption\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtImageProps = ComponentProps<\"figure\"> & {\n src: string;\n alt?: string;\n caption?: string;\n};\n\nexport const ChainOfThoughtImage = ({\n src,\n alt = \"\",\n caption,\n className,\n ...props\n}: ChainOfThoughtImageProps) => (\n <figure\n className={cn(\"ml-[22px] overflow-hidden rounded-lg border\", className)}\n {...props}\n >\n <img alt={alt} className=\"max-h-64 w-full object-cover\" src={src} />\n {caption && (\n <figcaption className=\"border-t px-3 py-2 text-xs italic text-muted-foreground\">\n {caption}\n </figcaption>\n )}\n </figure>\n);\n\nChainOfThought.displayName = \"ChainOfThought\";\nChainOfThoughtTrigger.displayName = \"ChainOfThoughtTrigger\";\nChainOfThoughtContent.displayName = \"ChainOfThoughtContent\";\nChainOfThoughtStep.displayName = \"ChainOfThoughtStep\";\nChainOfThoughtSources.displayName = \"ChainOfThoughtSources\";\nChainOfThoughtSource.displayName = \"ChainOfThoughtSource\";\nChainOfThoughtImage.displayName = \"ChainOfThoughtImage\";\n"],"names":["ChainOfThought","className","defaultOpen","props","jsx","Collapsible","cn","ChainOfThoughtTrigger","children","title","icon","isStreaming","CollapsibleTrigger","jsxs","Fragment","Brain","ChevronUpIcon","ChainOfThoughtContent","CollapsibleContent","STEP_ICONS","SearchIcon","ImageIcon","ChainOfThoughtStep","variant","ChainOfThoughtSources","ChainOfThoughtSource","ChainOfThoughtImage","src","alt","caption"],"mappings":"mNAiBaA,EAAiB,CAAC,CAC7B,UAAAC,EACA,YAAAC,EAAc,GACd,GAAGC,CACL,IACEC,EAAAA,IAACC,EAAAA,YAAA,CACC,UAAWC,EAAAA,GAAG,qCAAsCL,CAAS,EAC7D,YAAAC,EACC,GAAGC,CAAA,CACN,EAcWI,EAAwB,CAAC,CACpC,UAAAN,EACA,SAAAO,EACA,MAAAC,EAAQ,mBACR,KAAAC,EACA,YAAAC,EAAc,GACd,GAAGR,CACL,IACEC,EAAAA,IAACQ,EAAAA,mBAAA,CACC,UAAWN,EAAAA,GACT,6GACAL,CAAA,EAED,GAAGE,EAEH,YACCU,EAAAA,KAAAC,EAAAA,SAAA,CACG,SAAA,CAAAJ,GAAQN,EAAAA,IAACW,EAAAA,MAAA,CAAM,UAAU,8BAAA,CAA+B,EACzDF,EAAAA,KAAC,OAAA,CAAK,UAAU,sCACb,SAAA,CAAAJ,EACAE,GACCP,EAAAA,IAAC,OAAA,CAAK,UAAU,gDAAA,CAAiD,CAAA,EAErE,EACAA,EAAAA,IAACY,EAAAA,cAAA,CACC,UAAU,yLACV,YAAU,qBAAA,CAAA,CACZ,CAAA,CACF,CAAA,CAEJ,EASWC,EAAwB,CAAC,CACpC,UAAAhB,EACA,GAAGE,CACL,IACEC,EAAAA,IAACc,EAAAA,mBAAA,CACC,UAAWZ,EAAAA,GACT,kCACA,+DACA,6DACA,+EACAL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UAAU,+BAA+B,IAAAD,EAAU,EACjEE,GACCzB,EAAAA,IAAC,aAAA,CAAW,UAAU,0DACnB,SAAAyB,CAAA,CACH,CAAA,CAAA,CAEJ,EAGF7B,EAAe,YAAc,iBAC7BO,EAAsB,YAAc,wBACpCU,EAAsB,YAAc,wBACpCK,EAAmB,YAAc,qBACjCE,EAAsB,YAAc,wBACpCC,EAAqB,YAAc,uBACnCC,EAAoB,YAAc"}
@@ -122,7 +122,7 @@ const x = ({
122
122
  ...n,
123
123
  children: [
124
124
  /* @__PURE__ */ t("img", { alt: a, className: "max-h-64 w-full object-cover", src: e }),
125
- o && /* @__PURE__ */ t("figcaption", { className: "border-t px-3 py-2 text-xs italic text-muted-foreground/70", children: o })
125
+ o && /* @__PURE__ */ t("figcaption", { className: "border-t px-3 py-2 text-xs italic text-muted-foreground", children: o })
126
126
  ]
127
127
  }
128
128
  );
@@ -1 +1 @@
1
- {"version":3,"file":"chain-of-thought.js","sources":["../../../src/components/ai/chain-of-thought.tsx"],"sourcesContent":["import { Brain, ChevronUpIcon, ImageIcon, SearchIcon } from \"lucide-react\";\n\nimport type { ComponentProps, ReactNode } from \"react\";\n\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"@/components/ui/collapsible\";\nimport { cn } from \"@/lib/utils\";\n\n// ---------------------------------------------------------------------------\n// ChainOfThought (root)\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtProps = ComponentProps<typeof Collapsible>;\n\nexport const ChainOfThought = ({\n className,\n defaultOpen = true,\n ...props\n}: ChainOfThoughtProps) => (\n <Collapsible\n className={cn(\"overflow-hidden rounded-lg text-sm\", className)}\n defaultOpen={defaultOpen}\n {...props}\n />\n);\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtTrigger\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtTriggerProps = ComponentProps<typeof CollapsibleTrigger> & {\n title?: string;\n icon?: ReactNode;\n /** When true, renders a subtle animated dot next to the title. */\n isStreaming?: boolean;\n};\n\nexport const ChainOfThoughtTrigger = ({\n className,\n children,\n title = \"Chain of Thought\",\n icon,\n isStreaming = false,\n ...props\n}: ChainOfThoughtTriggerProps) => (\n <CollapsibleTrigger\n className={cn(\n \"group flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground\",\n className\n )}\n {...props}\n >\n {children ?? (\n <>\n {icon ?? <Brain className=\"size-4 text-muted-foreground\" />}\n <span className=\"flex-1 text-left items-center gap-2\">\n {title}\n {isStreaming && (\n <span className=\"size-1.5 animate-pulse rounded-full bg-primary\" />\n )}\n </span>\n <ChevronUpIcon\n className=\"size-4 text-muted-foreground opacity-0 transition-all group-focus-visible:opacity-100 group-hover:opacity-100 group-data-[state=open]:opacity-100 group-data-[state=closed]:rotate-180\"\n data-slot=\"collapsible-chevron\"\n />\n </>\n )}\n </CollapsibleTrigger>\n);\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtContent\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtContentProps = ComponentProps<typeof CollapsibleContent>;\n\nexport const ChainOfThoughtContent = ({\n className,\n ...props\n}: ChainOfThoughtContentProps) => (\n <CollapsibleContent\n className={cn(\n \"flex flex-col gap-2.5 pb-4 pt-3\",\n \"data-[state=closed]:animate-out data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n \"data-[state=closed]:slide-out-to-top-1 data-[state=open]:slide-in-from-top-1\",\n className\n )}\n {...props}\n />\n);\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtStep\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtStepVariant = \"bullet\" | \"search\" | \"image\";\n\nexport type ChainOfThoughtStepProps = ComponentProps<\"div\"> & {\n /**\n * Visual prefix for the step.\n * - `\"bullet\"` — small dot (default, plain reasoning text)\n * - `\"search\"` — magnifying-glass (web search / tool call)\n * - `\"image\"` — image icon (image fetch / vision step)\n * - ReactNode — custom icon\n */\n variant?: ChainOfThoughtStepVariant | ReactNode;\n};\n\nconst STEP_ICONS: Record<ChainOfThoughtStepVariant, ReactNode> = {\n bullet: (\n <span className=\"mt-[7px] ml-1 size-1.5 shrink-0 rounded-full bg-muted-foreground/50\" />\n ),\n search: <SearchIcon className=\"mt-0.5 w-[18px] size-3.5 shrink-0 text-muted-foreground\" />,\n image: <ImageIcon className=\"mt-0.5 size-3.5 shrink-0 text-muted-foreground\" />,\n};\n\nexport const ChainOfThoughtStep = ({\n variant = \"bullet\",\n className,\n children,\n ...props\n}: ChainOfThoughtStepProps) => {\n const icon =\n typeof variant === \"string\"\n ? STEP_ICONS[variant as ChainOfThoughtStepVariant]\n : variant;\n\n return (\n <div\n className={cn(\"flex items-start gap-2 text-muted-foreground\", className)}\n {...props}\n >\n <span className=\"flex shrink-0\">{icon}</span>\n <span className=\"min-w-0 flex-1 leading-relaxed\">{children}</span>\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtSources — inline chip group with left bar\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtSourcesProps = ComponentProps<\"div\">;\n\nexport const ChainOfThoughtSources = ({\n className,\n ...props\n}: ChainOfThoughtSourcesProps) => (\n <div\n className={cn(\n \"ml-[6px] flex flex-wrap gap-1.5 border-l-2 border-muted-foreground/20 py-0.5 pl-3\",\n className\n )}\n {...props}\n />\n);\n\nexport type ChainOfThoughtSourceProps = ComponentProps<\"a\">;\n\nexport const ChainOfThoughtSource = ({\n className,\n children,\n ...props\n}: ChainOfThoughtSourceProps) => (\n <a\n className={cn(\n \"inline-flex items-center rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-xs text-muted-foreground transition-colors\",\n props.href && \"cursor-pointer hover:bg-accent hover:text-accent-foreground\",\n className\n )}\n rel=\"noreferrer\"\n target=\"_blank\"\n {...props}\n >\n {children}\n </a>\n);\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtImage — inline image with optional caption\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtImageProps = ComponentProps<\"figure\"> & {\n src: string;\n alt?: string;\n caption?: string;\n};\n\nexport const ChainOfThoughtImage = ({\n src,\n alt = \"\",\n caption,\n className,\n ...props\n}: ChainOfThoughtImageProps) => (\n <figure\n className={cn(\"ml-[22px] overflow-hidden rounded-lg border\", className)}\n {...props}\n >\n <img alt={alt} className=\"max-h-64 w-full object-cover\" src={src} />\n {caption && (\n <figcaption className=\"border-t px-3 py-2 text-xs italic text-muted-foreground/70\">\n {caption}\n </figcaption>\n )}\n </figure>\n);\n\nChainOfThought.displayName = \"ChainOfThought\";\nChainOfThoughtTrigger.displayName = \"ChainOfThoughtTrigger\";\nChainOfThoughtContent.displayName = \"ChainOfThoughtContent\";\nChainOfThoughtStep.displayName = \"ChainOfThoughtStep\";\nChainOfThoughtSources.displayName = \"ChainOfThoughtSources\";\nChainOfThoughtSource.displayName = \"ChainOfThoughtSource\";\nChainOfThoughtImage.displayName = \"ChainOfThoughtImage\";\n"],"names":["ChainOfThought","className","defaultOpen","props","jsx","Collapsible","cn","ChainOfThoughtTrigger","children","title","icon","isStreaming","CollapsibleTrigger","jsxs","Fragment","Brain","ChevronUpIcon","ChainOfThoughtContent","CollapsibleContent","STEP_ICONS","SearchIcon","ImageIcon","ChainOfThoughtStep","variant","ChainOfThoughtSources","ChainOfThoughtSource","ChainOfThoughtImage","src","alt","caption"],"mappings":";;;;AAiBO,MAAMA,IAAiB,CAAC;AAAA,EAC7B,WAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,GAAGC;AACL,MACE,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,WAAWC,EAAG,sCAAsCL,CAAS;AAAA,IAC7D,aAAAC;AAAA,IACC,GAAGC;AAAA,EAAA;AACN,GAcWI,IAAwB,CAAC;AAAA,EACpC,WAAAN;AAAA,EACA,UAAAO;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,GAAGR;AACL,MACE,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AAqB,cAAc;AACnCC,EAAoB,cAAc;"}
1
+ {"version":3,"file":"chain-of-thought.js","sources":["../../../src/components/ai/chain-of-thought.tsx"],"sourcesContent":["import { Brain, ChevronUpIcon, ImageIcon, SearchIcon } from \"lucide-react\";\n\nimport type { ComponentProps, ReactNode } from \"react\";\n\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"@/components/ui/collapsible\";\nimport { cn } from \"@/lib/utils\";\n\n// ---------------------------------------------------------------------------\n// ChainOfThought (root)\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtProps = ComponentProps<typeof Collapsible>;\n\nexport const ChainOfThought = ({\n className,\n defaultOpen = true,\n ...props\n}: ChainOfThoughtProps) => (\n <Collapsible\n className={cn(\"overflow-hidden rounded-lg text-sm\", className)}\n defaultOpen={defaultOpen}\n {...props}\n />\n);\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtTrigger\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtTriggerProps = ComponentProps<typeof CollapsibleTrigger> & {\n title?: string;\n icon?: ReactNode;\n /** When true, renders a subtle animated dot next to the title. */\n isStreaming?: boolean;\n};\n\nexport const ChainOfThoughtTrigger = ({\n className,\n children,\n title = \"Chain of Thought\",\n icon,\n isStreaming = false,\n ...props\n}: ChainOfThoughtTriggerProps) => (\n <CollapsibleTrigger\n className={cn(\n \"group flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground\",\n className\n )}\n {...props}\n >\n {children ?? (\n <>\n {icon ?? <Brain className=\"size-4 text-muted-foreground\" />}\n <span className=\"flex-1 text-left items-center gap-2\">\n {title}\n {isStreaming && (\n <span className=\"size-1.5 animate-pulse rounded-full bg-primary\" />\n )}\n </span>\n <ChevronUpIcon\n className=\"size-4 text-muted-foreground opacity-0 transition-all group-focus-visible:opacity-100 group-hover:opacity-100 group-data-[state=open]:opacity-100 group-data-[state=closed]:rotate-180\"\n data-slot=\"collapsible-chevron\"\n />\n </>\n )}\n </CollapsibleTrigger>\n);\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtContent\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtContentProps = ComponentProps<typeof CollapsibleContent>;\n\nexport const ChainOfThoughtContent = ({\n className,\n ...props\n}: ChainOfThoughtContentProps) => (\n <CollapsibleContent\n className={cn(\n \"flex flex-col gap-2.5 pb-4 pt-3\",\n \"data-[state=closed]:animate-out data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n \"data-[state=closed]:slide-out-to-top-1 data-[state=open]:slide-in-from-top-1\",\n className\n )}\n {...props}\n />\n);\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtStep\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtStepVariant = \"bullet\" | \"search\" | \"image\";\n\nexport type ChainOfThoughtStepProps = ComponentProps<\"div\"> & {\n /**\n * Visual prefix for the step.\n * - `\"bullet\"` — small dot (default, plain reasoning text)\n * - `\"search\"` — magnifying-glass (web search / tool call)\n * - `\"image\"` — image icon (image fetch / vision step)\n * - ReactNode — custom icon\n */\n variant?: ChainOfThoughtStepVariant | ReactNode;\n};\n\nconst STEP_ICONS: Record<ChainOfThoughtStepVariant, ReactNode> = {\n bullet: (\n <span className=\"mt-[7px] ml-1 size-1.5 shrink-0 rounded-full bg-muted-foreground/50\" />\n ),\n search: <SearchIcon className=\"mt-0.5 w-[18px] size-3.5 shrink-0 text-muted-foreground\" />,\n image: <ImageIcon className=\"mt-0.5 size-3.5 shrink-0 text-muted-foreground\" />,\n};\n\nexport const ChainOfThoughtStep = ({\n variant = \"bullet\",\n className,\n children,\n ...props\n}: ChainOfThoughtStepProps) => {\n const icon =\n typeof variant === \"string\"\n ? STEP_ICONS[variant as ChainOfThoughtStepVariant]\n : variant;\n\n return (\n <div\n className={cn(\"flex items-start gap-2 text-muted-foreground\", className)}\n {...props}\n >\n <span className=\"flex shrink-0\">{icon}</span>\n <span className=\"min-w-0 flex-1 leading-relaxed\">{children}</span>\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtSources — inline chip group with left bar\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtSourcesProps = ComponentProps<\"div\">;\n\nexport const ChainOfThoughtSources = ({\n className,\n ...props\n}: ChainOfThoughtSourcesProps) => (\n <div\n className={cn(\n \"ml-[6px] flex flex-wrap gap-1.5 border-l-2 border-muted-foreground/20 py-0.5 pl-3\",\n className\n )}\n {...props}\n />\n);\n\nexport type ChainOfThoughtSourceProps = ComponentProps<\"a\">;\n\nexport const ChainOfThoughtSource = ({\n className,\n children,\n ...props\n}: ChainOfThoughtSourceProps) => (\n <a\n className={cn(\n \"inline-flex items-center rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-xs text-muted-foreground transition-colors\",\n props.href && \"cursor-pointer hover:bg-accent hover:text-accent-foreground\",\n className\n )}\n rel=\"noreferrer\"\n target=\"_blank\"\n {...props}\n >\n {children}\n </a>\n);\n\n// ---------------------------------------------------------------------------\n// ChainOfThoughtImage — inline image with optional caption\n// ---------------------------------------------------------------------------\n\nexport type ChainOfThoughtImageProps = ComponentProps<\"figure\"> & {\n src: string;\n alt?: string;\n caption?: string;\n};\n\nexport const ChainOfThoughtImage = ({\n src,\n alt = \"\",\n caption,\n className,\n ...props\n}: ChainOfThoughtImageProps) => (\n <figure\n className={cn(\"ml-[22px] overflow-hidden rounded-lg border\", className)}\n {...props}\n >\n <img alt={alt} className=\"max-h-64 w-full object-cover\" src={src} />\n {caption && (\n <figcaption className=\"border-t px-3 py-2 text-xs italic text-muted-foreground\">\n {caption}\n </figcaption>\n )}\n </figure>\n);\n\nChainOfThought.displayName = \"ChainOfThought\";\nChainOfThoughtTrigger.displayName = \"ChainOfThoughtTrigger\";\nChainOfThoughtContent.displayName = \"ChainOfThoughtContent\";\nChainOfThoughtStep.displayName = \"ChainOfThoughtStep\";\nChainOfThoughtSources.displayName = \"ChainOfThoughtSources\";\nChainOfThoughtSource.displayName = \"ChainOfThoughtSource\";\nChainOfThoughtImage.displayName = \"ChainOfThoughtImage\";\n"],"names":["ChainOfThought","className","defaultOpen","props","jsx","Collapsible","cn","ChainOfThoughtTrigger","children","title","icon","isStreaming","CollapsibleTrigger","jsxs","Fragment","Brain","ChevronUpIcon","ChainOfThoughtContent","CollapsibleContent","STEP_ICONS","SearchIcon","ImageIcon","ChainOfThoughtStep","variant","ChainOfThoughtSources","ChainOfThoughtSource","ChainOfThoughtImage","src","alt","caption"],"mappings":";;;;AAiBO,MAAMA,IAAiB,CAAC;AAAA,EAC7B,WAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,GAAGC;AACL,MACE,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,WAAWC,EAAG,sCAAsCL,CAAS;AAAA,IAC7D,aAAAC;AAAA,IACC,GAAGC;AAAA,EAAA;AACN,GAcWI,IAAwB,CAAC;AAAA,EACpC,WAAAN;AAAA,EACA,UAAAO;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,GAAGR;AACL,MACE,gBAAAC;AAAA,EAACQ;AAAA,EAAA;AAAA,IACC,WAAWN;AAAA,MACT;AAAA,MACAL;AAAA,IAAA;AAAA,IAED,GAAGE;AAAA,IAEH,eACC,gBAAAU,EAAAC,GAAA,EACG,UAAA;AAAA,MAAAJ,KAAQ,gBAAAN,EAACW,GAAA,EAAM,WAAU,+BAAA,CAA+B;AAAA,MACzD,gBAAAF,EAAC,QAAA,EAAK,WAAU,uCACb,UAAA;AAAA,QAAAJ;AAAA,QACAE,KACC,gBAAAP,EAAC,QAAA,EAAK,WAAU,iDAAA,CAAiD;AAAA,MAAA,GAErE;AAAA,MACA,gBAAAA;AAAA,QAACY;AAAA,QAAA;AAAA,UACC,WAAU;AAAA,UACV,aAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IACZ,EAAA,CACF;AAAA,EAAA;AAEJ,GASWC,IAAwB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,WAAWE;AAAA,MACT;AAAA,MACAH,EAAM,QAAQ;AAAA,MACdF;AAAA,IAAA;AAAA,IAEF,KAAI;AAAA,IACJ,QAAO;AAAA,IACN,GAAGE;AAAA,IAEH,UAAAK;AAAA,EAAA;AACH,GAaWkB,IAAsB,CAAC;AAAA,EAClC,KAAAC;AAAA,EACA,KAAAC,IAAM;AAAA,EACN,SAAAC;AAAA,EACA,WAAA5B;AAAA,EACA,GAAGE;AACL,MACE,gBAAAU;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWP,EAAG,+CAA+CL,CAAS;AAAA,IACrE,GAAGE;AAAA,IAEJ,UAAA;AAAA,MAAA,gBAAAC,EAAC,OAAA,EAAI,KAAAwB,GAAU,WAAU,gCAA+B,KAAAD,GAAU;AAAA,MACjEE,KACC,gBAAAzB,EAAC,cAAA,EAAW,WAAU,2DACnB,UAAAyB,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAEJ;AAGF7B,EAAe,cAAc;AAC7BO,EAAsB,cAAc;AACpCU,EAAsB,cAAc;AACpCK,EAAmB,cAAc;AACjCE,EAAsB,cAAc;AACpCC,EAAqB,cAAc;AACnCC,EAAoB,cAAc;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),l=require("motion/react"),i=require("react"),b=require("../ui/button.cjs"),j=require("../ui/code-block.cjs"),v=require("../ui/kbd.cjs"),r=require("../../lib/utils.cjs"),d=i.createContext(null),a=()=>{const e=i.useContext(d);if(!e)throw new Error("Confirmation components must be used within Confirmation");return e},g=1500,h=({className:e,approval:n,state:t,children:m,...c})=>{const f=i.useMemo(()=>({approval:n,state:t}),[n,t]),[p,C]=i.useState(!0),u=n?.approved===!0&&(t==="approval-responded"||t==="output-available"||t==="output-denied");if(i.useEffect(()=>{if(u){const s=setTimeout(()=>C(!1),g);return()=>clearTimeout(s)}},[u]),!n||t==="input-streaming"||t==="input-available")return null;const x=Object.fromEntries(Object.entries(c).filter(([s])=>s.startsWith("data-")||s.startsWith("aria-")));return o.jsx(d.Provider,{value:f,children:o.jsx(l.AnimatePresence,{children:p&&o.jsx(l.motion.div,{...x,className:r.cn("flex flex-col gap-4 rounded-xl border bg-card p-5 shadow-sm",e),exit:{opacity:0,scale:.96},id:c.id,style:c.style,transition:{duration:.5,ease:"easeOut"},children:m})})})},q=({className:e,children:n,...t})=>o.jsx("h3",{className:r.cn("font-semibold text-base text-foreground",e),...t,children:n}),A=({className:e,children:n,...t})=>o.jsx(j.CodeBlock,{className:r.cn(e),...t,language:"bash",code:n?.toString()??""}),y=({children:e})=>{const{state:n}=a();return n!=="approval-requested"?null:o.jsx(o.Fragment,{children:e})},E=({children:e})=>{const{approval:n,state:t}=a();return!n?.approved||t!=="approval-responded"&&t!=="output-denied"&&t!=="output-available"?null:o.jsx(o.Fragment,{children:e})},N=({children:e})=>{const{approval:n,state:t}=a();return n?.approved!==!1||t!=="approval-responded"&&t!=="output-denied"&&t!=="output-available"?null:o.jsx(o.Fragment,{children:e})},R=({className:e,...n})=>{const{state:t}=a();return t!=="approval-requested"?null:o.jsx("div",{className:r.cn("flex items-center justify-between gap-2",e),...n})},S=({className:e,size:n="sm",...t})=>o.jsx(b.Button,{className:r.cn("gap-1.5",e),size:n,type:"button",...t}),T=({className:e,...n})=>o.jsx(v.Kbd,{className:r.cn("ml-0.5",e),...n});exports.Confirmation=h;exports.ConfirmationAccepted=E;exports.ConfirmationAction=S;exports.ConfirmationActions=R;exports.ConfirmationCode=A;exports.ConfirmationRejected=N;exports.ConfirmationRequest=y;exports.ConfirmationShortcut=T;exports.ConfirmationTitle=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),l=require("motion/react"),r=require("react"),b=require("../ui/button.cjs"),j=require("../ui/code-block.cjs"),v=require("../ui/kbd.cjs"),i=require("../../lib/utils.cjs"),d=r.createContext(null),a=()=>{const e=r.useContext(d);if(!e)throw new Error("Confirmation components must be used within Confirmation");return e},g=1500,h=({className:e,approval:n,state:t,children:m,...c})=>{const f=r.useMemo(()=>({approval:n,state:t}),[n,t]),[p,C]=r.useState(!0),u=n?.approved===!0&&(t==="approval-responded"||t==="output-available"||t==="output-denied");if(r.useEffect(()=>{if(u){const s=setTimeout(()=>C(!1),g);return()=>clearTimeout(s)}},[u]),!n||t==="input-streaming"||t==="input-available")return null;const x=Object.fromEntries(Object.entries(c).filter(([s])=>s.startsWith("data-")||s.startsWith("aria-")));return o.jsx(d.Provider,{value:f,children:o.jsx(l.AnimatePresence,{children:p&&o.jsx(l.motion.div,{...x,className:i.cn("flex flex-col gap-4 rounded-xl border bg-card p-5 shadow-elevation-3",e),exit:{opacity:0,scale:.96},id:c.id,style:c.style,transition:{duration:.5,ease:"easeOut"},children:m})})})},q=({className:e,children:n,...t})=>o.jsx("h3",{className:i.cn("font-semibold text-base text-foreground",e),...t,children:n}),A=({className:e,children:n,...t})=>o.jsx(j.CodeBlock,{className:i.cn(e),...t,language:"bash",code:n?.toString()??""}),y=({children:e})=>{const{state:n}=a();return n!=="approval-requested"?null:o.jsx(o.Fragment,{children:e})},E=({children:e})=>{const{approval:n,state:t}=a();return!n?.approved||t!=="approval-responded"&&t!=="output-denied"&&t!=="output-available"?null:o.jsx(o.Fragment,{children:e})},N=({children:e})=>{const{approval:n,state:t}=a();return n?.approved!==!1||t!=="approval-responded"&&t!=="output-denied"&&t!=="output-available"?null:o.jsx(o.Fragment,{children:e})},R=({className:e,...n})=>{const{state:t}=a();return t!=="approval-requested"?null:o.jsx("div",{className:i.cn("flex items-center justify-between gap-2",e),...n})},S=({className:e,size:n="sm",...t})=>o.jsx(b.Button,{className:i.cn("gap-1.5",e),size:n,type:"button",...t}),T=({className:e,...n})=>o.jsx(v.Kbd,{className:i.cn("ml-0.5",e),...n});exports.Confirmation=h;exports.ConfirmationAccepted=E;exports.ConfirmationAction=S;exports.ConfirmationActions=R;exports.ConfirmationCode=A;exports.ConfirmationRejected=N;exports.ConfirmationRequest=y;exports.ConfirmationShortcut=T;exports.ConfirmationTitle=q;
2
2
  //# sourceMappingURL=confirmation.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"confirmation.cjs","sources":["../../../src/components/ai/confirmation.tsx"],"sourcesContent":["import { AnimatePresence, motion } from \"motion/react\";\nimport { createContext, useContext, useEffect, useMemo, useState } from \"react\";\n\n\nimport type { ToolUIPart } from \"ai\";\nimport type { ComponentProps, PropsWithChildren, ReactNode } from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { CodeBlock } from \"@/components/ui/code-block\";\nimport { Kbd } from \"@/components/ui/kbd\";\nimport { cn } from \"@/lib/utils\";\n\n\ntype ToolUIPartApproval =\n | { id: string; approved?: never; reason?: never }\n | { id: string; approved: boolean; reason?: string }\n | { id: string; approved: true; reason?: string }\n | { id: string; approved: false; reason?: string }\n | undefined;\n\ninterface ConfirmationContextValue {\n approval: ToolUIPartApproval;\n state: ToolUIPart[\"state\"];\n}\n\nconst ConfirmationContext = createContext<ConfirmationContextValue | null>(null);\n\nconst useConfirmation = () => {\n const context = useContext(ConfirmationContext);\n if (!context) {\n throw new Error(\"Confirmation components must be used within Confirmation\");\n }\n return context;\n};\n\n// ---------------------------------------------------------------------------\n// Confirmation (root)\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationProps = ComponentProps<\"div\"> & {\n approval?: ToolUIPartApproval;\n state: ToolUIPart[\"state\"];\n};\n\nconst ACCEPTED_HIDE_DELAY = 1500;\n\nexport const Confirmation = ({\n className,\n approval,\n state,\n children,\n ...props\n}: ConfirmationProps) => {\n const contextValue = useMemo(() => ({ approval, state }), [approval, state]);\n const [visible, setVisible] = useState(true);\n\n const isAccepted =\n approval?.approved === true &&\n (state === \"approval-responded\" ||\n state === \"output-available\" ||\n state === \"output-denied\");\n\n useEffect(() => {\n if (isAccepted) {\n const timer = setTimeout(() => setVisible(false), ACCEPTED_HIDE_DELAY);\n return () => clearTimeout(timer);\n }\n }, [isAccepted]);\n\n if (!approval || state === \"input-streaming\" || state === \"input-available\") {\n return null;\n }\n\n // Pass through data-* and aria-* only; drop event handlers to avoid\n // onDrag type conflict between React and framer-motion.\n const passthroughProps = Object.fromEntries(\n Object.entries(props).filter(([k]) => k.startsWith(\"data-\") || k.startsWith(\"aria-\"))\n );\n\n return (\n <ConfirmationContext.Provider value={contextValue}>\n <AnimatePresence>\n {visible && (\n <motion.div\n {...passthroughProps}\n className={cn(\n \"flex flex-col gap-4 rounded-xl border bg-card p-5 shadow-sm\",\n className\n )}\n exit={{ opacity: 0, scale: 0.96 }}\n id={props.id}\n style={props.style}\n transition={{ duration: 0.5, ease: \"easeOut\" }}\n >\n {children}\n </motion.div>\n )}\n </AnimatePresence>\n </ConfirmationContext.Provider>\n );\n};\n\n// ---------------------------------------------------------------------------\n// ConfirmationTitle\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationTitleProps = PropsWithChildren<ComponentProps<\"h3\">>;\n\nexport const ConfirmationTitle = ({\n className,\n children,\n ...props\n}: ConfirmationTitleProps) => (\n <h3\n className={cn(\"font-semibold text-base text-foreground\", className)}\n {...props}\n >\n {children}\n </h3>\n);\n\n// ---------------------------------------------------------------------------\n// ConfirmationCode — monospace command/code block\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationCodeProps = ComponentProps<typeof CodeBlock>;\n\nexport const ConfirmationCode = ({\n className,\n children,\n ...props\n}: ConfirmationCodeProps) => (\n <CodeBlock className={cn(className)} {...props} language=\"bash\" code={children?.toString() ?? ''} />\n);\n\n// ---------------------------------------------------------------------------\n// ConfirmationRequest / Accepted / Rejected — conditional renderers\n// ---------------------------------------------------------------------------\n\nexport const ConfirmationRequest = ({ children }: { children?: ReactNode }) => {\n const { state } = useConfirmation();\n if (state !== \"approval-requested\") return null;\n return <>{children}</>;\n};\n\nexport const ConfirmationAccepted = ({ children }: { children?: ReactNode }) => {\n const { approval, state } = useConfirmation();\n if (\n !approval?.approved ||\n (state !== \"approval-responded\" &&\n state !== \"output-denied\" &&\n state !== \"output-available\")\n ) {\n return null;\n }\n return <>{children}</>;\n};\n\nexport const ConfirmationRejected = ({ children }: { children?: ReactNode }) => {\n const { approval, state } = useConfirmation();\n if (\n approval?.approved !== false ||\n (state !== \"approval-responded\" &&\n state !== \"output-denied\" &&\n state !== \"output-available\")\n ) {\n return null;\n }\n return <>{children}</>;\n};\n\n// ---------------------------------------------------------------------------\n// ConfirmationActions — deny left, allow buttons right\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationActionsProps = ComponentProps<\"div\">;\n\nexport const ConfirmationActions = ({\n className,\n ...props\n}: ConfirmationActionsProps) => {\n const { state } = useConfirmation();\n if (state !== \"approval-requested\") return null;\n return (\n <div\n className={cn(\"flex items-center justify-between gap-2\", className)}\n {...props}\n />\n );\n};\n\n// ---------------------------------------------------------------------------\n// ConfirmationAction — individual button\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationActionProps = ComponentProps<typeof Button>;\n\nexport const ConfirmationAction = ({\n className,\n size = \"sm\",\n ...props\n}: ConfirmationActionProps) => (\n <Button\n className={cn(\"gap-1.5\", className)}\n size={size}\n type=\"button\"\n {...props}\n />\n);\n\n// ---------------------------------------------------------------------------\n// ConfirmationShortcut — keyboard shortcut label inside a button\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationShortcutProps = ComponentProps<typeof Kbd>;\n\nexport const ConfirmationShortcut = ({\n className,\n ...props\n}: ConfirmationShortcutProps) => (\n <Kbd className={cn(\"ml-0.5\", className)} {...props} />\n);\n"],"names":["ConfirmationContext","createContext","useConfirmation","context","useContext","ACCEPTED_HIDE_DELAY","Confirmation","className","approval","state","children","props","contextValue","useMemo","visible","setVisible","useState","isAccepted","useEffect","timer","passthroughProps","k","jsx","AnimatePresence","motion","cn","ConfirmationTitle","ConfirmationCode","CodeBlock","ConfirmationRequest","ConfirmationAccepted","ConfirmationRejected","ConfirmationActions","ConfirmationAction","size","Button","ConfirmationShortcut","Kbd"],"mappings":"8RAyBMA,EAA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,EAAAA,GAAG,UAAWlB,CAAS,EAClC,KAAA2B,EACA,KAAK,SACJ,GAAGvB,CAAA,CACN,EASWyB,EAAuB,CAAC,CACnC,UAAA7B,EACA,GAAGI,CACL,IACEW,EAAAA,IAACe,EAAAA,KAAI,UAAWZ,EAAAA,GAAG,SAAUlB,CAAS,EAAI,GAAGI,CAAA,CAAO"}
1
+ {"version":3,"file":"confirmation.cjs","sources":["../../../src/components/ai/confirmation.tsx"],"sourcesContent":["import { AnimatePresence, motion } from \"motion/react\";\nimport { createContext, useContext, useEffect, useMemo, useState } from \"react\";\n\n\nimport type { ToolUIPart } from \"ai\";\nimport type { ComponentProps, PropsWithChildren, ReactNode } from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { CodeBlock } from \"@/components/ui/code-block\";\nimport { Kbd } from \"@/components/ui/kbd\";\nimport { cn } from \"@/lib/utils\";\n\n\ntype ToolUIPartApproval =\n | { id: string; approved?: never; reason?: never }\n | { id: string; approved: boolean; reason?: string }\n | { id: string; approved: true; reason?: string }\n | { id: string; approved: false; reason?: string }\n | undefined;\n\ninterface ConfirmationContextValue {\n approval: ToolUIPartApproval;\n state: ToolUIPart[\"state\"];\n}\n\nconst ConfirmationContext = createContext<ConfirmationContextValue | null>(null);\n\nconst useConfirmation = () => {\n const context = useContext(ConfirmationContext);\n if (!context) {\n throw new Error(\"Confirmation components must be used within Confirmation\");\n }\n return context;\n};\n\n// ---------------------------------------------------------------------------\n// Confirmation (root)\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationProps = ComponentProps<\"div\"> & {\n approval?: ToolUIPartApproval;\n state: ToolUIPart[\"state\"];\n};\n\nconst ACCEPTED_HIDE_DELAY = 1500;\n\nexport const Confirmation = ({\n className,\n approval,\n state,\n children,\n ...props\n}: ConfirmationProps) => {\n const contextValue = useMemo(() => ({ approval, state }), [approval, state]);\n const [visible, setVisible] = useState(true);\n\n const isAccepted =\n approval?.approved === true &&\n (state === \"approval-responded\" ||\n state === \"output-available\" ||\n state === \"output-denied\");\n\n useEffect(() => {\n if (isAccepted) {\n const timer = setTimeout(() => setVisible(false), ACCEPTED_HIDE_DELAY);\n return () => clearTimeout(timer);\n }\n }, [isAccepted]);\n\n if (!approval || state === \"input-streaming\" || state === \"input-available\") {\n return null;\n }\n\n // Pass through data-* and aria-* only; drop event handlers to avoid\n // onDrag type conflict between React and framer-motion.\n const passthroughProps = Object.fromEntries(\n Object.entries(props).filter(([k]) => k.startsWith(\"data-\") || k.startsWith(\"aria-\"))\n );\n\n return (\n <ConfirmationContext.Provider value={contextValue}>\n <AnimatePresence>\n {visible && (\n <motion.div\n {...passthroughProps}\n className={cn(\n \"flex flex-col gap-4 rounded-xl border bg-card p-5 shadow-elevation-3\",\n className\n )}\n exit={{ opacity: 0, scale: 0.96 }}\n id={props.id}\n style={props.style}\n transition={{ duration: 0.5, ease: \"easeOut\" }}\n >\n {children}\n </motion.div>\n )}\n </AnimatePresence>\n </ConfirmationContext.Provider>\n );\n};\n\n// ---------------------------------------------------------------------------\n// ConfirmationTitle\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationTitleProps = PropsWithChildren<ComponentProps<\"h3\">>;\n\nexport const ConfirmationTitle = ({\n className,\n children,\n ...props\n}: ConfirmationTitleProps) => (\n <h3\n className={cn(\"font-semibold text-base text-foreground\", className)}\n {...props}\n >\n {children}\n </h3>\n);\n\n// ---------------------------------------------------------------------------\n// ConfirmationCode — monospace command/code block\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationCodeProps = ComponentProps<typeof CodeBlock>;\n\nexport const ConfirmationCode = ({\n className,\n children,\n ...props\n}: ConfirmationCodeProps) => (\n <CodeBlock className={cn(className)} {...props} language=\"bash\" code={children?.toString() ?? ''} />\n);\n\n// ---------------------------------------------------------------------------\n// ConfirmationRequest / Accepted / Rejected — conditional renderers\n// ---------------------------------------------------------------------------\n\nexport const ConfirmationRequest = ({ children }: { children?: ReactNode }) => {\n const { state } = useConfirmation();\n if (state !== \"approval-requested\") return null;\n return <>{children}</>;\n};\n\nexport const ConfirmationAccepted = ({ children }: { children?: ReactNode }) => {\n const { approval, state } = useConfirmation();\n if (\n !approval?.approved ||\n (state !== \"approval-responded\" &&\n state !== \"output-denied\" &&\n state !== \"output-available\")\n ) {\n return null;\n }\n return <>{children}</>;\n};\n\nexport const ConfirmationRejected = ({ children }: { children?: ReactNode }) => {\n const { approval, state } = useConfirmation();\n if (\n approval?.approved !== false ||\n (state !== \"approval-responded\" &&\n state !== \"output-denied\" &&\n state !== \"output-available\")\n ) {\n return null;\n }\n return <>{children}</>;\n};\n\n// ---------------------------------------------------------------------------\n// ConfirmationActions — deny left, allow buttons right\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationActionsProps = ComponentProps<\"div\">;\n\nexport const ConfirmationActions = ({\n className,\n ...props\n}: ConfirmationActionsProps) => {\n const { state } = useConfirmation();\n if (state !== \"approval-requested\") return null;\n return (\n <div\n className={cn(\"flex items-center justify-between gap-2\", className)}\n {...props}\n />\n );\n};\n\n// ---------------------------------------------------------------------------\n// ConfirmationAction — individual button\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationActionProps = ComponentProps<typeof Button>;\n\nexport const ConfirmationAction = ({\n className,\n size = \"sm\",\n ...props\n}: ConfirmationActionProps) => (\n <Button\n className={cn(\"gap-1.5\", className)}\n size={size}\n type=\"button\"\n {...props}\n />\n);\n\n// ---------------------------------------------------------------------------\n// ConfirmationShortcut — keyboard shortcut label inside a button\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationShortcutProps = ComponentProps<typeof Kbd>;\n\nexport const ConfirmationShortcut = ({\n className,\n ...props\n}: ConfirmationShortcutProps) => (\n <Kbd className={cn(\"ml-0.5\", className)} {...props} />\n);\n"],"names":["ConfirmationContext","createContext","useConfirmation","context","useContext","ACCEPTED_HIDE_DELAY","Confirmation","className","approval","state","children","props","contextValue","useMemo","visible","setVisible","useState","isAccepted","useEffect","timer","passthroughProps","k","jsx","AnimatePresence","motion","cn","ConfirmationTitle","ConfirmationCode","CodeBlock","ConfirmationRequest","ConfirmationAccepted","ConfirmationRejected","ConfirmationActions","ConfirmationAction","size","Button","ConfirmationShortcut","Kbd"],"mappings":"8RAyBMA,EAAsBC,EAAAA,cAA+C,IAAI,EAEzEC,EAAkB,IAAM,CAC5B,MAAMC,EAAUC,EAAAA,WAAWJ,CAAmB,EAC9C,GAAI,CAACG,EACH,MAAM,IAAI,MAAM,0DAA0D,EAE5E,OAAOA,CACT,EAWME,EAAsB,KAEfC,EAAe,CAAC,CAC3B,UAAAC,EACA,SAAAC,EACA,MAAAC,EACA,SAAAC,EACA,GAAGC,CACL,IAAyB,CACvB,MAAMC,EAAeC,UAAQ,KAAO,CAAE,SAAAL,EAAU,MAAAC,IAAU,CAACD,EAAUC,CAAK,CAAC,EACrE,CAACK,EAASC,CAAU,EAAIC,EAAAA,SAAS,EAAI,EAErCC,EACJT,GAAU,WAAa,KACtBC,IAAU,sBACTA,IAAU,oBACVA,IAAU,iBASd,GAPAS,EAAAA,UAAU,IAAM,CACd,GAAID,EAAY,CACd,MAAME,EAAQ,WAAW,IAAMJ,EAAW,EAAK,EAAGV,CAAmB,EACrE,MAAO,IAAM,aAAac,CAAK,CACjC,CACF,EAAG,CAACF,CAAU,CAAC,EAEX,CAACT,GAAYC,IAAU,mBAAqBA,IAAU,kBACxD,OAAO,KAKT,MAAMW,EAAmB,OAAO,YAC9B,OAAO,QAAQT,CAAK,EAAE,OAAO,CAAC,CAACU,CAAC,IAAMA,EAAE,WAAW,OAAO,GAAKA,EAAE,WAAW,OAAO,CAAC,CAAA,EAGtF,OACEC,MAACtB,EAAoB,SAApB,CAA6B,MAAOY,EACnC,SAAAU,EAAAA,IAACC,EAAAA,iBACE,SAAAT,GACCQ,EAAAA,IAACE,EAAAA,OAAO,IAAP,CACE,GAAGJ,EACJ,UAAWK,EAAAA,GACT,uEACAlB,CAAA,EAEF,KAAM,CAAE,QAAS,EAAG,MAAO,GAAA,EAC3B,GAAII,EAAM,GACV,MAAOA,E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CAGV,EAQasB,EAAqB,CAAC,CACjC,UAAA1B,EACA,KAAA2B,EAAO,KACP,GAAGvB,CACL,IACEW,EAAAA,IAACa,EAAAA,OAAA,CACC,UAAWV,EAAAA,GAAG,UAAWlB,CAAS,EAClC,KAAA2B,EACA,KAAK,SACJ,GAAGvB,CAAA,CACN,EASWyB,EAAuB,CAAC,CACnC,UAAA7B,EACA,GAAGI,CACL,IACEW,EAAAA,IAACe,EAAAA,KAAI,UAAWZ,EAAAA,GAAG,SAAUlB,CAAS,EAAI,GAAGI,CAAA,CAAO"}
@@ -33,7 +33,7 @@ const l = x(null), a = () => {
33
33
  {
34
34
  ...C,
35
35
  className: r(
36
- "flex flex-col gap-4 rounded-xl border bg-card p-5 shadow-sm",
36
+ "flex flex-col gap-4 rounded-xl border bg-card p-5 shadow-elevation-3",
37
37
  e
38
38
  ),
39
39
  exit: { opacity: 0, scale: 0.96 },
@@ -1 +1 @@
1
- {"version":3,"file":"confirmation.js","sources":["../../../src/components/ai/confirmation.tsx"],"sourcesContent":["import { AnimatePresence, motion } from \"motion/react\";\nimport { createContext, useContext, useEffect, useMemo, useState } from \"react\";\n\n\nimport type { ToolUIPart } from \"ai\";\nimport type { ComponentProps, PropsWithChildren, ReactNode } from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { CodeBlock } from \"@/components/ui/code-block\";\nimport { Kbd } from \"@/components/ui/kbd\";\nimport { cn } from \"@/lib/utils\";\n\n\ntype ToolUIPartApproval =\n | { id: string; approved?: never; reason?: never }\n | { id: string; approved: boolean; reason?: string }\n | { id: string; approved: true; reason?: string }\n | { id: string; approved: false; reason?: string }\n | undefined;\n\ninterface ConfirmationContextValue {\n approval: ToolUIPartApproval;\n state: ToolUIPart[\"state\"];\n}\n\nconst ConfirmationContext = createContext<ConfirmationContextValue | null>(null);\n\nconst useConfirmation = () => {\n const context = useContext(ConfirmationContext);\n if (!context) {\n throw new Error(\"Confirmation components must be used within Confirmation\");\n }\n return context;\n};\n\n// ---------------------------------------------------------------------------\n// Confirmation (root)\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationProps = ComponentProps<\"div\"> & {\n approval?: ToolUIPartApproval;\n state: ToolUIPart[\"state\"];\n};\n\nconst ACCEPTED_HIDE_DELAY = 1500;\n\nexport const Confirmation = ({\n className,\n approval,\n state,\n children,\n ...props\n}: ConfirmationProps) => {\n const contextValue = useMemo(() => ({ approval, state }), [approval, state]);\n const [visible, setVisible] = useState(true);\n\n const isAccepted =\n approval?.approved === true &&\n (state === \"approval-responded\" ||\n state === \"output-available\" ||\n state === \"output-denied\");\n\n useEffect(() => {\n if (isAccepted) {\n const timer = setTimeout(() => setVisible(false), ACCEPTED_HIDE_DELAY);\n return () => clearTimeout(timer);\n }\n }, [isAccepted]);\n\n if (!approval || state === \"input-streaming\" || state === \"input-available\") {\n return null;\n }\n\n // Pass through data-* and aria-* only; drop event handlers to avoid\n // onDrag type conflict between React and framer-motion.\n const passthroughProps = Object.fromEntries(\n Object.entries(props).filter(([k]) => k.startsWith(\"data-\") || k.startsWith(\"aria-\"))\n );\n\n return (\n <ConfirmationContext.Provider value={contextValue}>\n <AnimatePresence>\n {visible && (\n <motion.div\n {...passthroughProps}\n className={cn(\n \"flex flex-col gap-4 rounded-xl border bg-card p-5 shadow-sm\",\n className\n )}\n exit={{ opacity: 0, scale: 0.96 }}\n id={props.id}\n style={props.style}\n transition={{ duration: 0.5, ease: \"easeOut\" }}\n >\n {children}\n </motion.div>\n )}\n </AnimatePresence>\n </ConfirmationContext.Provider>\n );\n};\n\n// ---------------------------------------------------------------------------\n// ConfirmationTitle\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationTitleProps = PropsWithChildren<ComponentProps<\"h3\">>;\n\nexport const ConfirmationTitle = ({\n className,\n children,\n ...props\n}: ConfirmationTitleProps) => (\n <h3\n className={cn(\"font-semibold text-base text-foreground\", className)}\n {...props}\n >\n {children}\n </h3>\n);\n\n// ---------------------------------------------------------------------------\n// ConfirmationCode — monospace command/code block\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationCodeProps = ComponentProps<typeof CodeBlock>;\n\nexport const ConfirmationCode = ({\n className,\n children,\n ...props\n}: ConfirmationCodeProps) => (\n <CodeBlock className={cn(className)} {...props} language=\"bash\" code={children?.toString() ?? ''} />\n);\n\n// ---------------------------------------------------------------------------\n// ConfirmationRequest / Accepted / Rejected — conditional renderers\n// ---------------------------------------------------------------------------\n\nexport const ConfirmationRequest = ({ children }: { children?: ReactNode }) => {\n const { state } = useConfirmation();\n if (state !== \"approval-requested\") return null;\n return <>{children}</>;\n};\n\nexport const ConfirmationAccepted = ({ children }: { children?: ReactNode }) => {\n const { approval, state } = useConfirmation();\n if (\n !approval?.approved ||\n (state !== \"approval-responded\" &&\n state !== \"output-denied\" &&\n state !== \"output-available\")\n ) {\n return null;\n }\n return <>{children}</>;\n};\n\nexport const ConfirmationRejected = ({ children }: { children?: ReactNode }) => {\n const { approval, state } = useConfirmation();\n if (\n approval?.approved !== false ||\n (state !== \"approval-responded\" &&\n state !== \"output-denied\" &&\n state !== \"output-available\")\n ) {\n return null;\n }\n return <>{children}</>;\n};\n\n// ---------------------------------------------------------------------------\n// ConfirmationActions — deny left, allow buttons right\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationActionsProps = ComponentProps<\"div\">;\n\nexport const ConfirmationActions = ({\n className,\n ...props\n}: ConfirmationActionsProps) => {\n const { state } = useConfirmation();\n if (state !== \"approval-requested\") return null;\n return (\n <div\n className={cn(\"flex items-center justify-between gap-2\", className)}\n {...props}\n />\n );\n};\n\n// ---------------------------------------------------------------------------\n// ConfirmationAction — individual button\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationActionProps = ComponentProps<typeof Button>;\n\nexport const ConfirmationAction = ({\n className,\n size = \"sm\",\n ...props\n}: ConfirmationActionProps) => (\n <Button\n className={cn(\"gap-1.5\", className)}\n size={size}\n type=\"button\"\n {...props}\n />\n);\n\n// ---------------------------------------------------------------------------\n// ConfirmationShortcut — keyboard shortcut label inside a button\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationShortcutProps = ComponentProps<typeof Kbd>;\n\nexport const ConfirmationShortcut = ({\n className,\n ...props\n}: ConfirmationShortcutProps) => (\n <Kbd className={cn(\"ml-0.5\", className)} {...props} />\n);\n"],"names":["ConfirmationContext","createContext","useConfirmation","context","useContext","ACCEPTED_HIDE_DELAY","Confirmation","className","approval","state","children","props","contextValue","useMemo","visible","setVisible","useState","isAccepted","useEffect","timer","passthroughProps","k","jsx","AnimatePresence","motion","cn","ConfirmationTitle","ConfirmationCode","CodeBlock","ConfirmationRequest","ConfirmationAccepted","ConfirmationRejected","ConfirmationActions","ConfirmationAction","size","Button","ConfirmationShortcut","Kbd"],"mappings":";;;;;;;AAyBA,MAAMA,IAAsBC,EAA+C,IAAI,GAEzEC,IAAkB,MAAM;AAC5B,QAAMC,IAAUC,EAAWJ,CAAmB;AAC9C,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,0DAA0D;AAE5E,SAAOA;AACT,GAWME,IAAsB,MAEfC,IAAe,CAAC;AAAA,EAC3B,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,MAAyB;AACvB,QAAMC,IAAeC,EAAQ,OAAO,EAAE,UAAAL,GAAU,OAAAC,MAAU,CAACD,GAAUC,CAAK,CAAC,GACrE,CAACK,GAASC,CAAU,IAAIC,EAAS,EAAI,GAErCC,IACJT,GAAU,aAAa,OACtBC,MAAU,wBACTA,MAAU,sBACVA,MAAU;AASd,MAPAS,EAAU,MAAM;AACd,QAAID,GAAY;AACd,YAAME,IAAQ,WAAW,MAAMJ,EAAW,EAAK,GAAGV,CAAmB;AACrE,aAAO,MAAM,aAAac,CAAK;AAAA,IACjC;AAAA,EACF,GAAG,CAACF,CAAU,CAAC,GAEX,CAACT,KAAYC,MAAU,qBAAqBA,MAAU;AACxD,WAAO;AAKT,QAAMW,IAAmB,OAAO;AAAA,IAC9B,OAA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,MAAU,wBACTA,MAAU,mBACVA,MAAU,qBAEL,8BAEC,UAAAC,GAAS;AACrB,GAEaqB,IAAuB,CAAC,EAAE,UAAArB,QAAyC;AAC9E,QAAM,EAAE,UAAAF,GAAU,OAAAC,EAAA,IAAUP,EAAA;AAC5B,SACEM,GAAU,aAAa,MACtBC,MAAU,wBACTA,MAAU,mBACVA,MAAU,qBAEL,8BAEC,UAAAC,GAAS;AACrB,GAQasB,IAAsB,CAAC;AAAA,EAClC,WAAAzB;AAAA,EACA,GAAGI;AACL,MAAgC;AAC9B,QAAM,EAAE,OAAAF,EAAA,IAAUP,EAAA;AAClB,SAAIO,MAAU,uBAA6B,OAEzC,gBAAAa;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWG,EAAG,2CAA2ClB,CAAS;AAAA,MACjE,GAAGI;AAAA,IAAA;AAAA,EAAA;AAGV,GAQasB,IAAqB,CAAC;AAAA,EACjC,WAAA1B;AAAA,EACA,MAAA2B,IAAO;AAAA,EACP,GAAGvB;AACL,MACE,gBAAAW;AAAA,EAACa;AAAA,EAAA;AAAA,IACC,WAAWV,EAAG,WAAWlB,CAAS;AAAA,IAClC,MAAA2B;AAAA,IACA,MAAK;AAAA,IACJ,GAAGvB;AAAA,EAAA;AACN,GASWyB,IAAuB,CAAC;AAAA,EACnC,WAAA7B;AAAA,EACA,GAAGI;AACL,MACE,gBAAAW,EAACe,KAAI,WAAWZ,EAAG,UAAUlB,CAAS,GAAI,GAAGI,EAAA,CAAO;"}
1
+ {"version":3,"file":"confirmation.js","sources":["../../../src/components/ai/confirmation.tsx"],"sourcesContent":["import { AnimatePresence, motion } from \"motion/react\";\nimport { createContext, useContext, useEffect, useMemo, useState } from \"react\";\n\n\nimport type { ToolUIPart } from \"ai\";\nimport type { ComponentProps, PropsWithChildren, ReactNode } from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { CodeBlock } from \"@/components/ui/code-block\";\nimport { Kbd } from \"@/components/ui/kbd\";\nimport { cn } from \"@/lib/utils\";\n\n\ntype ToolUIPartApproval =\n | { id: string; approved?: never; reason?: never }\n | { id: string; approved: boolean; reason?: string }\n | { id: string; approved: true; reason?: string }\n | { id: string; approved: false; reason?: string }\n | undefined;\n\ninterface ConfirmationContextValue {\n approval: ToolUIPartApproval;\n state: ToolUIPart[\"state\"];\n}\n\nconst ConfirmationContext = createContext<ConfirmationContextValue | null>(null);\n\nconst useConfirmation = () => {\n const context = useContext(ConfirmationContext);\n if (!context) {\n throw new Error(\"Confirmation components must be used within Confirmation\");\n }\n return context;\n};\n\n// ---------------------------------------------------------------------------\n// Confirmation (root)\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationProps = ComponentProps<\"div\"> & {\n approval?: ToolUIPartApproval;\n state: ToolUIPart[\"state\"];\n};\n\nconst ACCEPTED_HIDE_DELAY = 1500;\n\nexport const Confirmation = ({\n className,\n approval,\n state,\n children,\n ...props\n}: ConfirmationProps) => {\n const contextValue = useMemo(() => ({ approval, state }), [approval, state]);\n const [visible, setVisible] = useState(true);\n\n const isAccepted =\n approval?.approved === true &&\n (state === \"approval-responded\" ||\n state === \"output-available\" ||\n state === \"output-denied\");\n\n useEffect(() => {\n if (isAccepted) {\n const timer = setTimeout(() => setVisible(false), ACCEPTED_HIDE_DELAY);\n return () => clearTimeout(timer);\n }\n }, [isAccepted]);\n\n if (!approval || state === \"input-streaming\" || state === \"input-available\") {\n return null;\n }\n\n // Pass through data-* and aria-* only; drop event handlers to avoid\n // onDrag type conflict between React and framer-motion.\n const passthroughProps = Object.fromEntries(\n Object.entries(props).filter(([k]) => k.startsWith(\"data-\") || k.startsWith(\"aria-\"))\n );\n\n return (\n <ConfirmationContext.Provider value={contextValue}>\n <AnimatePresence>\n {visible && (\n <motion.div\n {...passthroughProps}\n className={cn(\n \"flex flex-col gap-4 rounded-xl border bg-card p-5 shadow-elevation-3\",\n className\n )}\n exit={{ opacity: 0, scale: 0.96 }}\n id={props.id}\n style={props.style}\n transition={{ duration: 0.5, ease: \"easeOut\" }}\n >\n {children}\n </motion.div>\n )}\n </AnimatePresence>\n </ConfirmationContext.Provider>\n );\n};\n\n// ---------------------------------------------------------------------------\n// ConfirmationTitle\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationTitleProps = PropsWithChildren<ComponentProps<\"h3\">>;\n\nexport const ConfirmationTitle = ({\n className,\n children,\n ...props\n}: ConfirmationTitleProps) => (\n <h3\n className={cn(\"font-semibold text-base text-foreground\", className)}\n {...props}\n >\n {children}\n </h3>\n);\n\n// ---------------------------------------------------------------------------\n// ConfirmationCode — monospace command/code block\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationCodeProps = ComponentProps<typeof CodeBlock>;\n\nexport const ConfirmationCode = ({\n className,\n children,\n ...props\n}: ConfirmationCodeProps) => (\n <CodeBlock className={cn(className)} {...props} language=\"bash\" code={children?.toString() ?? ''} />\n);\n\n// ---------------------------------------------------------------------------\n// ConfirmationRequest / Accepted / Rejected — conditional renderers\n// ---------------------------------------------------------------------------\n\nexport const ConfirmationRequest = ({ children }: { children?: ReactNode }) => {\n const { state } = useConfirmation();\n if (state !== \"approval-requested\") return null;\n return <>{children}</>;\n};\n\nexport const ConfirmationAccepted = ({ children }: { children?: ReactNode }) => {\n const { approval, state } = useConfirmation();\n if (\n !approval?.approved ||\n (state !== \"approval-responded\" &&\n state !== \"output-denied\" &&\n state !== \"output-available\")\n ) {\n return null;\n }\n return <>{children}</>;\n};\n\nexport const ConfirmationRejected = ({ children }: { children?: ReactNode }) => {\n const { approval, state } = useConfirmation();\n if (\n approval?.approved !== false ||\n (state !== \"approval-responded\" &&\n state !== \"output-denied\" &&\n state !== \"output-available\")\n ) {\n return null;\n }\n return <>{children}</>;\n};\n\n// ---------------------------------------------------------------------------\n// ConfirmationActions — deny left, allow buttons right\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationActionsProps = ComponentProps<\"div\">;\n\nexport const ConfirmationActions = ({\n className,\n ...props\n}: ConfirmationActionsProps) => {\n const { state } = useConfirmation();\n if (state !== \"approval-requested\") return null;\n return (\n <div\n className={cn(\"flex items-center justify-between gap-2\", className)}\n {...props}\n />\n );\n};\n\n// ---------------------------------------------------------------------------\n// ConfirmationAction — individual button\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationActionProps = ComponentProps<typeof Button>;\n\nexport const ConfirmationAction = ({\n className,\n size = \"sm\",\n ...props\n}: ConfirmationActionProps) => (\n <Button\n className={cn(\"gap-1.5\", className)}\n size={size}\n type=\"button\"\n {...props}\n />\n);\n\n// ---------------------------------------------------------------------------\n// ConfirmationShortcut — keyboard shortcut label inside a button\n// ---------------------------------------------------------------------------\n\nexport type ConfirmationShortcutProps = ComponentProps<typeof Kbd>;\n\nexport const ConfirmationShortcut = ({\n className,\n ...props\n}: ConfirmationShortcutProps) => (\n <Kbd className={cn(\"ml-0.5\", className)} {...props} />\n);\n"],"names":["ConfirmationContext","createContext","useConfirmation","context","useContext","ACCEPTED_HIDE_DELAY","Confirmation","className","approval","state","children","props","contextValue","useMemo","visible","setVisible","useState","isAccepted","useEffect","timer","passthroughProps","k","jsx","AnimatePresence","motion","cn","ConfirmationTitle","ConfirmationCode","CodeBlock","ConfirmationRequest","ConfirmationAccepted","ConfirmationRejected","ConfirmationActions","ConfirmationAction","size","Button","ConfirmationShortcut","Kbd"],"mappings":";;;;;;;AAyBA,MAAMA,IAAsBC,EAA+C,IAAI,GAEzEC,IAAkB,MAAM;AAC5B,QAAMC,IAAUC,EAAWJ,CAAmB;AAC9C,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,0DAA0D;AAE5E,SAAOA;AACT,GAWME,IAAsB,MAEfC,IAAe,CAAC;AAAA,EAC3B,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,MAAyB;AACvB,QAAMC,IAAeC,EAAQ,OAAO,EAAE,UAAAL,GAAU,OAAAC,MAAU,CAACD,GAAUC,CAAK,CAAC,GACrE,CAACK,GAASC,CAAU,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WZ,EAAG,UAAUlB,CAAS,GAAI,GAAGI,EAAA,CAAO;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),f=require("react"),b=require("../ui/button.cjs"),p=require("../ui/hover-card.cjs"),k=require("../ui/progress.cjs"),i=require("../../lib/utils.cjs"),S=100,g=10,h=24,l=12,j=2,U=.75,I=.9,T=e=>e>=I?"danger":e>=U?"warning":"normal",C={normal:"text-muted-foreground",warning:"text-amber-500",danger:"text-destructive"},O={normal:"",warning:"[&_[data-slot=progress-indicator]]:bg-amber-500",danger:"[&_[data-slot=progress-indicator]]:bg-destructive"},N=new Intl.NumberFormat("en-US",{currency:"USD",style:"currency"}),x=e=>e===void 0?void 0:N.format(e),y=f.createContext(null),u=()=>{const e=f.useContext(y);if(!e)throw new Error("Context components must be used within Context");return e},R=({usedTokens:e,maxTokens:n,usage:s,cost:o,...c})=>{const r=f.useMemo(()=>({cost:o,maxTokens:n,usage:s,usedTokens:e}),[o,n,s,e]);return t.jsx(y.Provider,{value:r,children:t.jsx(p.HoverCard,{closeDelay:0,openDelay:0,...c})})},D=()=>{const{usedTokens:e,maxTokens:n}=u(),s=2*Math.PI*g,o=e/n,c=s*(1-o);return t.jsxs("svg",{"aria-label":"Model context usage",height:"20",role:"img",style:{color:"currentcolor"},viewBox:`0 0 ${h} ${h}`,width:"20",children:[t.jsx("circle",{cx:l,cy:l,fill:"none",opacity:"0.25",r:g,stroke:"currentColor",strokeWidth:j}),t.jsx("circle",{cx:l,cy:l,fill:"none",opacity:"0.7",r:g,stroke:"currentColor",strokeDasharray:`${s} ${s}`,strokeDashoffset:c,strokeLinecap:"round",strokeWidth:j,style:{transform:"rotate(-90deg)",transformOrigin:"center"}})]})},F=({children:e,showPercentage:n=!1,...s})=>{const{usedTokens:o,maxTokens:c}=u(),r=o/c,a=T(r),m=new Intl.NumberFormat("en-US",{maximumFractionDigits:1,style:"percent"}).format(r);return t.jsx(p.HoverCardTrigger,{asChild:!0,children:e??t.jsxs(b.Button,{type:"button",variant:"ghost",...s,children:[n?t.jsx("span",{className:i.cn("font-medium",C[a]),children:m}):null,t.jsx("span",{className:C[a],children:t.jsx(D,{})})]})})},_=({className:e,...n})=>t.jsx(p.HoverCardContent,{className:i.cn("min-w-60 divide-y overflow-hidden p-0",e),...n}),E=({children:e,className:n,...s})=>{const{usedTokens:o,maxTokens:c}=u(),r=o/c,a=T(r),m=new Intl.NumberFormat("en-US",{maximumFractionDigits:1,style:"percent"}).format(r),v=new Intl.NumberFormat("en-US",{notation:"compact"}).format(o),w=new Intl.NumberFormat("en-US",{notation:"compact"}).format(c);return t.jsx("div",{className:i.cn("w-full space-y-2 p-3",n),...s,children:e??t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[t.jsx("p",{className:i.cn(C[a]),children:m}),t.jsxs("p",{className:"font-mono text-muted-foreground",children:[v," / ",w]})]}),t.jsx("div",{className:"space-y-2",children:t.jsx(k.Progress,{className:i.cn("bg-muted",O[a]),value:r*S})})]})})},P=({children:e,className:n,...s})=>t.jsx("div",{className:i.cn("w-full p-3",n),...s,children:e}),H=({children:e,className:n,...s})=>{const{cost:o}=u(),c=o?.total===void 0?"—":N.format(o.total);return t.jsx("div",{className:i.cn("flex w-full items-center justify-between gap-3 bg-muted/50 p-3 text-xs",n),...s,children:e??t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-muted-foreground",children:"Total cost"}),t.jsx("span",{children:c})]})})},d=({tokens:e,costText:n})=>t.jsxs("span",{children:[e===void 0?"—":new Intl.NumberFormat("en-US",{notation:"compact"}).format(e),n?t.jsxs("span",{className:"ml-2 text-muted-foreground",children:["• ",n]}):null]}),A=({className:e,children:n,...s})=>{const{usage:o,cost:c}=u(),r=o?.inputTokens??0;if(n)return n;if(!r)return null;const a=x(c?.input);return t.jsxs("div",{className:i.cn("flex items-center justify-between text-xs",e),...s,children:[t.jsx("span",{className:"text-muted-foreground",children:"Input"}),t.jsx(d,{costText:a,tokens:r})]})},q=({className:e,children:n,...s})=>{const{usage:o,cost:c}=u(),r=o?.outputTokens??0;if(n)return n;if(!r)return null;const a=x(c?.output);return t.jsxs("div",{className:i.cn("flex items-center justify-between text-xs",e),...s,children:[t.jsx("span",{className:"text-muted-foreground",children:"Output"}),t.jsx(d,{costText:a,tokens:r})]})},M=({className:e,children:n,...s})=>{const{usage:o,cost:c}=u(),r=o?.reasoningTokens??0;if(n)return n;if(!r)return null;const a=x(c?.reasoning);return t.jsxs("div",{className:i.cn("flex items-center justify-between text-xs",e),...s,children:[t.jsx("span",{className:"text-muted-foreground",children:"Reasoning"}),t.jsx(d,{costText:a,tokens:r})]})},W=({className:e,children:n,...s})=>{const{usage:o,cost:c}=u(),r=o?.cachedInputTokens??0;if(n)return n;if(!r)return null;const a=x(c?.cache);return t.jsxs("div",{className:i.cn("flex items-center justify-between text-xs",e),...s,children:[t.jsx("span",{className:"text-muted-foreground",children:"Cache"}),t.jsx(d,{costText:a,tokens:r})]})};exports.Context=R;exports.ContextCacheUsage=W;exports.ContextContent=_;exports.ContextContentBody=P;exports.ContextContentFooter=H;exports.ContextContentHeader=E;exports.ContextInputUsage=A;exports.ContextOutputUsage=q;exports.ContextReasoningUsage=M;exports.ContextTrigger=F;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),f=require("react"),b=require("../ui/button.cjs"),p=require("../ui/hover-card.cjs"),k=require("../ui/progress.cjs"),i=require("../../lib/utils.cjs"),S=100,g=10,h=24,l=12,j=2,U=.75,I=.9,T=e=>e>=I?"danger":e>=U?"warning":"normal",C={normal:"text-muted-foreground",warning:"text-warning",danger:"text-destructive"},O={normal:"",warning:"[&_[data-slot=progress-indicator]]:bg-warning",danger:"[&_[data-slot=progress-indicator]]:bg-destructive"},N=new Intl.NumberFormat("en-US",{currency:"USD",style:"currency"}),x=e=>e===void 0?void 0:N.format(e),w=f.createContext(null),u=()=>{const e=f.useContext(w);if(!e)throw new Error("Context components must be used within Context");return e},R=({usedTokens:e,maxTokens:n,usage:s,cost:o,...c})=>{const r=f.useMemo(()=>({cost:o,maxTokens:n,usage:s,usedTokens:e}),[o,n,s,e]);return t.jsx(w.Provider,{value:r,children:t.jsx(p.HoverCard,{closeDelay:0,openDelay:0,...c})})},D=()=>{const{usedTokens:e,maxTokens:n}=u(),s=2*Math.PI*g,o=e/n,c=s*(1-o);return t.jsxs("svg",{"aria-label":"Model context usage",height:"20",role:"img",style:{color:"currentcolor"},viewBox:`0 0 ${h} ${h}`,width:"20",children:[t.jsx("circle",{cx:l,cy:l,fill:"none",opacity:"0.25",r:g,stroke:"currentColor",strokeWidth:j}),t.jsx("circle",{cx:l,cy:l,fill:"none",opacity:"0.7",r:g,stroke:"currentColor",strokeDasharray:`${s} ${s}`,strokeDashoffset:c,strokeLinecap:"round",strokeWidth:j,style:{transform:"rotate(-90deg)",transformOrigin:"center"}})]})},F=({children:e,showPercentage:n=!1,...s})=>{const{usedTokens:o,maxTokens:c}=u(),r=o/c,a=T(r),m=new Intl.NumberFormat("en-US",{maximumFractionDigits:1,style:"percent"}).format(r);return t.jsx(p.HoverCardTrigger,{asChild:!0,children:e??t.jsxs(b.Button,{type:"button",variant:"ghost",...s,children:[n?t.jsx("span",{className:i.cn("font-medium",C[a]),children:m}):null,t.jsx("span",{className:C[a],children:t.jsx(D,{})})]})})},_=({className:e,...n})=>t.jsx(p.HoverCardContent,{className:i.cn("min-w-60 divide-y overflow-hidden p-0",e),...n}),E=({children:e,className:n,...s})=>{const{usedTokens:o,maxTokens:c}=u(),r=o/c,a=T(r),m=new Intl.NumberFormat("en-US",{maximumFractionDigits:1,style:"percent"}).format(r),y=new Intl.NumberFormat("en-US",{notation:"compact"}).format(o),v=new Intl.NumberFormat("en-US",{notation:"compact"}).format(c);return t.jsx("div",{className:i.cn("w-full space-y-2 p-3",n),...s,children:e??t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[t.jsx("p",{className:i.cn(C[a]),children:m}),t.jsxs("p",{className:"font-mono text-muted-foreground",children:[y," / ",v]})]}),t.jsx("div",{className:"space-y-2",children:t.jsx(k.Progress,{"aria-label":"Context window usage",className:i.cn("bg-muted",O[a]),value:r*S})})]})})},P=({children:e,className:n,...s})=>t.jsx("div",{className:i.cn("w-full p-3",n),...s,children:e}),H=({children:e,className:n,...s})=>{const{cost:o}=u(),c=o?.total===void 0?"—":N.format(o.total);return t.jsx("div",{className:i.cn("flex w-full items-center justify-between gap-3 bg-muted/50 p-3 text-xs",n),...s,children:e??t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-muted-foreground",children:"Total cost"}),t.jsx("span",{children:c})]})})},d=({tokens:e,costText:n})=>t.jsxs("span",{children:[e===void 0?"—":new Intl.NumberFormat("en-US",{notation:"compact"}).format(e),n?t.jsxs("span",{className:"ml-2 text-muted-foreground",children:["• ",n]}):null]}),A=({className:e,children:n,...s})=>{const{usage:o,cost:c}=u(),r=o?.inputTokens??0;if(n)return n;if(!r)return null;const a=x(c?.input);return t.jsxs("div",{className:i.cn("flex items-center justify-between text-xs",e),...s,children:[t.jsx("span",{className:"text-muted-foreground",children:"Input"}),t.jsx(d,{costText:a,tokens:r})]})},q=({className:e,children:n,...s})=>{const{usage:o,cost:c}=u(),r=o?.outputTokens??0;if(n)return n;if(!r)return null;const a=x(c?.output);return t.jsxs("div",{className:i.cn("flex items-center justify-between text-xs",e),...s,children:[t.jsx("span",{className:"text-muted-foreground",children:"Output"}),t.jsx(d,{costText:a,tokens:r})]})},M=({className:e,children:n,...s})=>{const{usage:o,cost:c}=u(),r=o?.reasoningTokens??0;if(n)return n;if(!r)return null;const a=x(c?.reasoning);return t.jsxs("div",{className:i.cn("flex items-center justify-between text-xs",e),...s,children:[t.jsx("span",{className:"text-muted-foreground",children:"Reasoning"}),t.jsx(d,{costText:a,tokens:r})]})},W=({className:e,children:n,...s})=>{const{usage:o,cost:c}=u(),r=o?.cachedInputTokens??0;if(n)return n;if(!r)return null;const a=x(c?.cache);return t.jsxs("div",{className:i.cn("flex items-center justify-between text-xs",e),...s,children:[t.jsx("span",{className:"text-muted-foreground",children:"Cache"}),t.jsx(d,{costText:a,tokens:r})]})};exports.Context=R;exports.ContextCacheUsage=W;exports.ContextContent=_;exports.ContextContentBody=P;exports.ContextContentFooter=H;exports.ContextContentHeader=E;exports.ContextInputUsage=A;exports.ContextOutputUsage=q;exports.ContextReasoningUsage=M;exports.ContextTrigger=F;
2
2
  //# sourceMappingURL=context.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.cjs","sources":["../../../src/components/ai/context.tsx"],"sourcesContent":["import { createContext, useContext, useMemo } from \"react\";\n\nimport type { LanguageModelUsage } from \"ai\";\nimport type { ComponentProps } from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport {\n HoverCard,\n HoverCardContent,\n HoverCardTrigger,\n} from \"@/components/ui/hover-card\";\nimport { Progress } from \"@/components/ui/progress\";\nimport { cn } from \"@/lib/utils\";\n\n\nconst PERCENT_MAX = 100;\nconst ICON_RADIUS = 10;\nconst ICON_VIEWBOX = 24;\nconst ICON_CENTER = 12;\nconst ICON_STROKE_WIDTH = 2;\nconst WARN_THRESHOLD = 0.75;\nconst DANGER_THRESHOLD = 0.9;\n\ntype UsageStatus = \"normal\" | \"warning\" | \"danger\";\n\nconst getUsageStatus = (pct: number): UsageStatus => {\n if (pct >= DANGER_THRESHOLD) return \"danger\";\n if (pct >= WARN_THRESHOLD) return \"warning\";\n return \"normal\";\n};\n\nconst STATUS_TEXT: Record<UsageStatus, string> = {\n normal: \"text-muted-foreground\",\n warning: \"text-amber-500\",\n danger: \"text-destructive\",\n};\n\nconst STATUS_PROGRESS: Record<UsageStatus, string> = {\n normal: \"\",\n warning: \"[&_[data-slot=progress-indicator]]:bg-amber-500\",\n danger: \"[&_[data-slot=progress-indicator]]:bg-destructive\",\n};\n\nconst USD_FORMAT = new Intl.NumberFormat(\"en-US\", {\n currency: \"USD\",\n style: \"currency\",\n});\n\nconst formatUSD = (value: number | undefined): string | undefined =>\n value === undefined ? undefined : USD_FORMAT.format(value);\n\nexport interface CostBreakdown {\n total?: number;\n input?: number;\n output?: number;\n reasoning?: number;\n cache?: number;\n}\n\ninterface ContextSchema {\n usedTokens: number;\n maxTokens: number;\n usage?: LanguageModelUsage;\n cost?: CostBreakdown;\n}\n\nconst ContextContext = createContext<ContextSchema | null>(null);\n\nconst useContextValue = () => {\n const context = useContext(ContextContext);\n\n if (!context) {\n throw new Error(\"Context components must be used within Context\");\n }\n\n return context;\n};\n\nexport type ContextProps = ComponentProps<typeof HoverCard> & ContextSchema;\n\nexport const Context = ({\n usedTokens,\n maxTokens,\n usage,\n cost,\n ...props\n}: ContextProps) => {\n const contextValue = useMemo(\n () => ({ cost, maxTokens, usage, usedTokens }),\n [cost, maxTokens, usage, usedTokens]\n );\n\n return (\n <ContextContext.Provider value={contextValue}>\n <HoverCard closeDelay={0} openDelay={0} {...props} />\n </ContextContext.Provider>\n );\n};\n\nconst ContextIcon = () => {\n const { usedTokens, maxTokens } = useContextValue();\n const circumference = 2 * Math.PI * ICON_RADIUS;\n const usedPercent = usedTokens / maxTokens;\n const dashOffset = circumference * (1 - usedPercent);\n\n return (\n <svg\n aria-label=\"Model context usage\"\n height=\"20\"\n role=\"img\"\n style={{ color: \"currentcolor\" }}\n viewBox={`0 0 ${ICON_VIEWBOX} ${ICON_VIEWBOX}`}\n width=\"20\"\n >\n <circle\n cx={ICON_CENTER}\n cy={ICON_CENTER}\n fill=\"none\"\n opacity=\"0.25\"\n r={ICON_RADIUS}\n stroke=\"currentColor\"\n strokeWidth={ICON_STROKE_WIDTH}\n />\n <circle\n cx={ICON_CENTER}\n cy={ICON_CENTER}\n fill=\"none\"\n opacity=\"0.7\"\n r={ICON_RADIUS}\n stroke=\"currentColor\"\n strokeDasharray={`${circumference} ${circumference}`}\n strokeDashoffset={dashOffset}\n strokeLinecap=\"round\"\n strokeWidth={ICON_STROKE_WIDTH}\n style={{ transform: \"rotate(-90deg)\", transformOrigin: \"center\" }}\n />\n </svg>\n );\n};\n\nexport type ContextTriggerProps = ComponentProps<typeof Button> & {\n showPercentage?: boolean;\n};\n\nexport const ContextTrigger = ({\n children,\n showPercentage = false,\n ...props\n}: ContextTriggerProps) => {\n const { usedTokens, maxTokens } = useContextValue();\n const usedPercent = usedTokens / maxTokens;\n const status = getUsageStatus(usedPercent);\n const renderedPercent = new Intl.NumberFormat(\"en-US\", {\n maximumFractionDigits: 1,\n style: \"percent\",\n }).format(usedPercent);\n\n return (\n <HoverCardTrigger asChild>\n {children ?? (\n <Button type=\"button\" variant=\"ghost\" {...props}>\n {showPercentage ? (\n <span className={cn(\"font-medium\", STATUS_TEXT[status])}>\n {renderedPercent}\n </span>\n ) : null}\n <span className={STATUS_TEXT[status]}>\n <ContextIcon />\n </span>\n </Button>\n )}\n </HoverCardTrigger>\n );\n};\n\nexport type ContextContentProps = ComponentProps<typeof HoverCardContent>;\n\nexport const ContextContent = ({\n className,\n ...props\n}: ContextContentProps) => (\n <HoverCardContent\n className={cn(\"min-w-60 divide-y overflow-hidden p-0\", className)}\n {...props}\n />\n);\n\nexport type ContextContentHeaderProps = ComponentProps<\"div\">;\n\nexport const ContextContentHeader = ({\n children,\n className,\n ...props\n}: ContextContentHeaderProps) => {\n const { usedTokens, maxTokens } = useContextValue();\n const usedPercent = usedTokens / maxTokens;\n const status = getUsageStatus(usedPercent);\n const displayPct = new Intl.NumberFormat(\"en-US\", {\n maximumFractionDigits: 1,\n style: \"percent\",\n }).format(usedPercent);\n const used = new Intl.NumberFormat(\"en-US\", {\n notation: \"compact\",\n }).format(usedTokens);\n const total = new Intl.NumberFormat(\"en-US\", {\n notation: \"compact\",\n }).format(maxTokens);\n\n return (\n <div className={cn(\"w-full space-y-2 p-3\", className)} {...props}>\n {children ?? (\n <>\n <div className=\"flex items-center justify-between gap-3 text-xs\">\n <p className={cn(STATUS_TEXT[status])}>{displayPct}</p>\n <p className=\"font-mono text-muted-foreground\">\n {used} / {total}\n </p>\n </div>\n <div className=\"space-y-2\">\n <Progress\n className={cn(\"bg-muted\", STATUS_PROGRESS[status])}\n value={usedPercent * PERCENT_MAX}\n />\n </div>\n </>\n )}\n </div>\n );\n};\n\nexport type ContextContentBodyProps = ComponentProps<\"div\">;\n\nexport const ContextContentBody = ({\n children,\n className,\n ...props\n}: ContextContentBodyProps) => (\n <div className={cn(\"w-full p-3\", className)} {...props}>\n {children}\n </div>\n);\n\nexport type ContextContentFooterProps = ComponentProps<\"div\">;\n\nexport const ContextContentFooter = ({\n children,\n className,\n ...props\n}: ContextContentFooterProps) => {\n const { cost } = useContextValue();\n const totalCost = cost?.total === undefined ? \"—\" : USD_FORMAT.format(cost.total);\n\n return (\n <div\n className={cn(\n \"flex w-full items-center justify-between gap-3 bg-muted/50 p-3 text-xs\",\n className\n )}\n {...props}\n >\n {children ?? (\n <>\n <span className=\"text-muted-foreground\">Total cost</span>\n <span>{totalCost}</span>\n </>\n )}\n </div>\n );\n};\n\nconst TokensWithCost = ({\n tokens,\n costText,\n}: {\n tokens?: number;\n costText?: string;\n}) => (\n <span>\n {tokens === undefined\n ? \"—\"\n : new Intl.NumberFormat(\"en-US\", {\n notation: \"compact\",\n }).format(tokens)}\n {costText ? (\n <span className=\"ml-2 text-muted-foreground\">• {costText}</span>\n ) : null}\n </span>\n);\n\nexport type ContextInputUsageProps = ComponentProps<\"div\">;\n\nexport const ContextInputUsage = ({\n className,\n children,\n ...props\n}: ContextInputUsageProps) => {\n const { usage, cost } = useContextValue();\n const inputTokens = usage?.inputTokens ?? 0;\n\n if (children) {\n return children;\n }\n\n if (!inputTokens) {\n return null;\n }\n\n const inputCostText = formatUSD(cost?.input);\n\n return (\n <div\n className={cn(\"flex items-center justify-between text-xs\", className)}\n {...props}\n >\n <span className=\"text-muted-foreground\">Input</span>\n <TokensWithCost costText={inputCostText} tokens={inputTokens} />\n </div>\n );\n};\n\nexport type ContextOutputUsageProps = ComponentProps<\"div\">;\n\nexport const ContextOutputUsage = ({\n className,\n children,\n ...props\n}: ContextOutputUsageProps) => {\n const { usage, cost } = useContextValue();\n const outputTokens = usage?.outputTokens ?? 0;\n\n if (children) {\n return children;\n }\n\n if (!outputTokens) {\n return null;\n }\n\n const outputCostText = formatUSD(cost?.output);\n\n return (\n <div\n className={cn(\"flex items-center justify-between text-xs\", className)}\n {...props}\n >\n <span className=\"text-muted-foreground\">Output</span>\n <TokensWithCost costText={outputCostText} tokens={outputTokens} />\n </div>\n );\n};\n\nexport type ContextReasoningUsageProps = ComponentProps<\"div\">;\n\nexport const ContextReasoningUsage = ({\n className,\n children,\n ...props\n}: ContextReasoningUsageProps) => {\n const { usage, cost } = useContextValue();\n const reasoningTokens = usage?.reasoningTokens ?? 0;\n\n if (children) {\n return children;\n }\n\n if (!reasoningTokens) {\n return null;\n }\n\n const reasoningCostText = formatUSD(cost?.reasoning);\n\n return (\n <div\n className={cn(\"flex items-center justify-between text-xs\", className)}\n {...props}\n >\n <span className=\"text-muted-foreground\">Reasoning</span>\n <TokensWithCost costText={reasoningCostText} tokens={reasoningTokens} />\n </div>\n );\n};\n\nexport type ContextCacheUsageProps = ComponentProps<\"div\">;\n\nexport const ContextCacheUsage = ({\n className,\n children,\n ...props\n}: ContextCacheUsageProps) => {\n const { usage, cost } = useContextValue();\n const cacheTokens = usage?.cachedInputTokens ?? 0;\n\n if (children) {\n return children;\n }\n\n if (!cacheTokens) {\n return null;\n }\n\n const cacheCostText = formatUSD(cost?.cache);\n\n return (\n <div\n className={cn(\"flex items-center justify-between text-xs\", className)}\n {...props}\n >\n <span className=\"text-muted-foreground\">Cache</span>\n <TokensWithCost costText={cacheCostText} tokens={cacheTokens} />\n </div>\n );\n};\n"],"names":["PERCENT_MAX","ICON_RADIUS","ICON_VIEWBOX","ICON_CENTER","ICON_STROKE_WIDTH","WARN_THRESHOLD","DANGER_THRESHOLD","getUsageStatus","pct","STATUS_TEXT","STATUS_PROGRESS","USD_FORMAT","formatUSD","value","ContextContext","createContext","useContextValue","context","useContext","Context","usedTokens","maxTokens","usage","cost","props","contextValue","useMemo","jsx","HoverCard","ContextIcon","circumference","usedPercent","dashOffset","jsxs","ContextTrigger","children","showPercentage","status","renderedPercent","HoverCardTrigger","Button","cn","ContextContent","className","HoverCardContent","ContextContentHeader","displayPct","used","total","Fragment","Progress","ContextContentBody","ContextContentFooter","totalCost","TokensWithCost","tokens","costText","ContextInputUsage","inputTokens","inputCostText","ContextOutputUsage","outputTokens","outputCostText","ContextReasoningUsage","reasoningTokens","reasoningCostText","ContextCacheUsage","cacheTokens","cacheCostText"],"mappings":"yQAeMA,EAAc,IACdC,EAAc,GACdC,EAAe,GACfC,EAAc,GACdC,EAAoB,EACpBC,EAAiB,IACjBC,EAAmB,GAInBC,EAAkBC,GAClBA,GAAOF,EAAyB,SAChCE,GAAOH,EAAuB,UAC3B,SAGHI,EAA2C,CAC/C,OAAQ,wBACR,QAAS,iBACT,OAAQ,kBACV,EAEMC,EAA+C,CACnD,OAAQ,GACR,QAAS,kDACT,OAAQ,mDACV,EAEMC,EAAa,IAAI,KAAK,aAAa,QAAS,CAChD,SAAU,MACV,MAAO,UACT,CAAC,EAEKC,EAAaC,GACjBA,IAAU,OAAY,OAAYF,EAAW,OAAOE,CAAK,EAiBrDC,EAAiBC,EAAAA,cAAoC,IAAI,EAEzDC,EAAkB,IAAM,CAC5B,MAAMC,EAAUC,EAAAA,WAAWJ,CAAc,EAEzC,GAAI,CAACG,EACH,MAAM,IAAI,MAAM,gDAAgD,EAGlE,OAAOA,CACT,EAIaE,EAAU,CAAC,CACtB,WAAAC,EACA,UAAAC,EACA,MAAAC,EACA,KAAAC,EACA,GAAGC,CACL,IAAoB,CAClB,MAAMC,EAAeC,EAAAA,QACnB,KAAO,CAAE,KAAAH,EAAM,UAAAF,EAAW,MAAAC,EAAO,WAAAF,CAAA,GACjC,CAACG,EAAMF,EAAWC,EAAOF,CAAU,CAAA,EAGrC,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,EAEnD,OACEU,EAAAA,KAAC,MAAA,CACC,UAAWQ,EAAAA,GAAG,4CAA6CE,CAAS,EACnE,GAAGnB,EAEJ,SAAA,CAAAG,EAAAA,IAAC,OAAA,CAAK,UAAU,wBAAwB,SAAA,YAAS,EACjDA,EAAAA,IAAC2B,EAAA,CAAe,SAAUW,EAAmB,OAAQD,CAAA,CAAiB,CAAA,CAAA,CAAA,CAG5E,EAIaE,EAAoB,CAAC,CAChC,UAAAvB,EACA,SAAAR,EACA,GAAGX,CACL,IAA8B,CAC5B,KAAM,CAAE,MAAAF,EAAO,KAAAC,CAAA,EAASP,EAAA,EAClBmD,EAAc7C,GAAO,mBAAqB,EAEhD,GAAIa,EACF,OAAOA,EAGT,GAAI,CAACgC,EACH,OAAO,KAGT,MAAMC,EAAgBxD,EAAUW,GAAM,KAAK,EAE3C,OACEU,EAAAA,KAAC,MAAA,CACC,UAAWQ,EAAAA,GAAG,4CAA6CE,CAAS,EACnE,GAAGnB,EAEJ,SAAA,CAAAG,EAAAA,IAAC,OAAA,CAAK,UAAU,wBAAwB,SAAA,QAAK,EAC7CA,EAAAA,IAAC2B,EAAA,CAAe,SAAUc,EAAe,OAAQD,CAAA,CAAa,CAAA,CAAA,CAAA,CAGpE"}
1
+ {"version":3,"file":"context.cjs","sources":["../../../src/components/ai/context.tsx"],"sourcesContent":["import { createContext, useContext, useMemo } from \"react\";\n\nimport type { LanguageModelUsage } from \"ai\";\nimport type { ComponentProps } from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport {\n HoverCard,\n HoverCardContent,\n HoverCardTrigger,\n} from \"@/components/ui/hover-card\";\nimport { Progress } from \"@/components/ui/progress\";\nimport { cn } from \"@/lib/utils\";\n\n\nconst PERCENT_MAX = 100;\nconst ICON_RADIUS = 10;\nconst ICON_VIEWBOX = 24;\nconst ICON_CENTER = 12;\nconst ICON_STROKE_WIDTH = 2;\nconst WARN_THRESHOLD = 0.75;\nconst DANGER_THRESHOLD = 0.9;\n\ntype UsageStatus = \"normal\" | \"warning\" | \"danger\";\n\nconst getUsageStatus = (pct: number): UsageStatus => {\n if (pct >= DANGER_THRESHOLD) return \"danger\";\n if (pct >= WARN_THRESHOLD) return \"warning\";\n return \"normal\";\n};\n\nconst STATUS_TEXT: Record<UsageStatus, string> = {\n normal: \"text-muted-foreground\",\n warning: \"text-warning\",\n danger: \"text-destructive\",\n};\n\nconst STATUS_PROGRESS: Record<UsageStatus, string> = {\n normal: \"\",\n warning: \"[&_[data-slot=progress-indicator]]:bg-warning\",\n danger: \"[&_[data-slot=progress-indicator]]:bg-destructive\",\n};\n\nconst USD_FORMAT = new Intl.NumberFormat(\"en-US\", {\n currency: \"USD\",\n style: \"currency\",\n});\n\nconst formatUSD = (value: number | undefined): string | undefined =>\n value === undefined ? undefined : USD_FORMAT.format(value);\n\nexport interface CostBreakdown {\n total?: number;\n input?: number;\n output?: number;\n reasoning?: number;\n cache?: number;\n}\n\ninterface ContextSchema {\n usedTokens: number;\n maxTokens: number;\n usage?: LanguageModelUsage;\n cost?: CostBreakdown;\n}\n\nconst ContextContext = createContext<ContextSchema | null>(null);\n\nconst useContextValue = () => {\n const context = useContext(ContextContext);\n\n if (!context) {\n throw new Error(\"Context components must be used within Context\");\n }\n\n return context;\n};\n\nexport type ContextProps = ComponentProps<typeof HoverCard> & ContextSchema;\n\nexport const Context = ({\n usedTokens,\n maxTokens,\n usage,\n cost,\n ...props\n}: ContextProps) => {\n const contextValue = useMemo(\n () => ({ cost, maxTokens, usage, usedTokens }),\n [cost, maxTokens, usage, usedTokens]\n );\n\n return (\n <ContextContext.Provider value={contextValue}>\n <HoverCard closeDelay={0} openDelay={0} {...props} />\n </ContextContext.Provider>\n );\n};\n\nconst ContextIcon = () => {\n const { usedTokens, maxTokens } = useContextValue();\n const circumference = 2 * Math.PI * ICON_RADIUS;\n const usedPercent = usedTokens / maxTokens;\n const dashOffset = circumference * (1 - usedPercent);\n\n return (\n <svg\n aria-label=\"Model context usage\"\n height=\"20\"\n role=\"img\"\n style={{ color: \"currentcolor\" }}\n viewBox={`0 0 ${ICON_VIEWBOX} ${ICON_VIEWBOX}`}\n width=\"20\"\n >\n <circle\n cx={ICON_CENTER}\n cy={ICON_CENTER}\n fill=\"none\"\n opacity=\"0.25\"\n r={ICON_RADIUS}\n stroke=\"currentColor\"\n strokeWidth={ICON_STROKE_WIDTH}\n />\n <circle\n cx={ICON_CENTER}\n cy={ICON_CENTER}\n fill=\"none\"\n opacity=\"0.7\"\n r={ICON_RADIUS}\n stroke=\"currentColor\"\n strokeDasharray={`${circumference} ${circumference}`}\n strokeDashoffset={dashOffset}\n strokeLinecap=\"round\"\n strokeWidth={ICON_STROKE_WIDTH}\n style={{ transform: \"rotate(-90deg)\", transformOrigin: \"center\" }}\n />\n </svg>\n );\n};\n\nexport type ContextTriggerProps = ComponentProps<typeof Button> & {\n showPercentage?: boolean;\n};\n\nexport const ContextTrigger = ({\n children,\n showPercentage = false,\n ...props\n}: ContextTriggerProps) => {\n const { usedTokens, maxTokens } = useContextValue();\n const usedPercent = usedTokens / maxTokens;\n const status = getUsageStatus(usedPercent);\n const renderedPercent = new Intl.NumberFormat(\"en-US\", {\n maximumFractionDigits: 1,\n style: \"percent\",\n }).format(usedPercent);\n\n return (\n <HoverCardTrigger asChild>\n {children ?? (\n <Button type=\"button\" variant=\"ghost\" {...props}>\n {showPercentage ? (\n <span className={cn(\"font-medium\", STATUS_TEXT[status])}>\n {renderedPercent}\n </span>\n ) : null}\n <span className={STATUS_TEXT[status]}>\n <ContextIcon />\n </span>\n </Button>\n )}\n </HoverCardTrigger>\n );\n};\n\nexport type ContextContentProps = ComponentProps<typeof HoverCardContent>;\n\nexport const ContextContent = ({\n className,\n ...props\n}: ContextContentProps) => (\n <HoverCardContent\n className={cn(\"min-w-60 divide-y overflow-hidden p-0\", className)}\n {...props}\n />\n);\n\nexport type ContextContentHeaderProps = ComponentProps<\"div\">;\n\nexport const ContextContentHeader = ({\n children,\n className,\n ...props\n}: ContextContentHeaderProps) => {\n const { usedTokens, maxTokens } = useContextValue();\n const usedPercent = usedTokens / maxTokens;\n const status = getUsageStatus(usedPercent);\n const displayPct = new Intl.NumberFormat(\"en-US\", {\n maximumFractionDigits: 1,\n style: \"percent\",\n }).format(usedPercent);\n const used = new Intl.NumberFormat(\"en-US\", {\n notation: \"compact\",\n }).format(usedTokens);\n const total = new Intl.NumberFormat(\"en-US\", {\n notation: \"compact\",\n }).format(maxTokens);\n\n return (\n <div className={cn(\"w-full space-y-2 p-3\", className)} {...props}>\n {children ?? (\n <>\n <div className=\"flex items-center justify-between gap-3 text-xs\">\n <p className={cn(STATUS_TEXT[status])}>{displayPct}</p>\n <p className=\"font-mono text-muted-foreground\">\n {used} / {total}\n </p>\n </div>\n <div className=\"space-y-2\">\n <Progress\n aria-label=\"Context window usage\"\n className={cn(\"bg-muted\", STATUS_PROGRESS[status])}\n value={usedPercent * PERCENT_MAX}\n />\n </div>\n </>\n )}\n </div>\n );\n};\n\nexport type ContextContentBodyProps = ComponentProps<\"div\">;\n\nexport const ContextContentBody = ({\n children,\n className,\n ...props\n}: ContextContentBodyProps) => (\n <div className={cn(\"w-full p-3\", className)} {...props}>\n {children}\n </div>\n);\n\nexport type ContextContentFooterProps = ComponentProps<\"div\">;\n\nexport const ContextContentFooter = ({\n children,\n className,\n ...props\n}: ContextContentFooterProps) => {\n const { cost } = useContextValue();\n const totalCost = cost?.total === undefined ? \"—\" : USD_FORMAT.format(cost.total);\n\n return (\n <div\n className={cn(\n \"flex w-full items-center justify-between gap-3 bg-muted/50 p-3 text-xs\",\n className\n )}\n {...props}\n >\n {children ?? (\n <>\n <span className=\"text-muted-foreground\">Total cost</span>\n <span>{totalCost}</span>\n </>\n )}\n </div>\n );\n};\n\nconst TokensWithCost = ({\n tokens,\n costText,\n}: {\n tokens?: number;\n costText?: string;\n}) => (\n <span>\n {tokens === undefined\n ? \"—\"\n : new Intl.NumberFormat(\"en-US\", {\n notation: \"compact\",\n }).format(tokens)}\n {costText ? (\n <span className=\"ml-2 text-muted-foreground\">• {costText}</span>\n ) : null}\n </span>\n);\n\nexport type ContextInputUsageProps = ComponentProps<\"div\">;\n\nexport const ContextInputUsage = ({\n className,\n children,\n ...props\n}: ContextInputUsageProps) => {\n const { usage, cost } = useContextValue();\n const inputTokens = usage?.inputTokens ?? 0;\n\n if (children) {\n return children;\n }\n\n if (!inputTokens) {\n return null;\n }\n\n const inputCostText = formatUSD(cost?.input);\n\n return (\n <div\n className={cn(\"flex items-center justify-between text-xs\", className)}\n {...props}\n >\n <span className=\"text-muted-foreground\">Input</span>\n <TokensWithCost costText={inputCostText} tokens={inputTokens} />\n </div>\n );\n};\n\nexport type ContextOutputUsageProps = ComponentProps<\"div\">;\n\nexport const ContextOutputUsage = ({\n className,\n children,\n ...props\n}: ContextOutputUsageProps) => {\n const { usage, cost } = useContextValue();\n const outputTokens = usage?.outputTokens ?? 0;\n\n if (children) {\n return children;\n }\n\n if (!outputTokens) {\n return null;\n }\n\n const outputCostText = formatUSD(cost?.output);\n\n return (\n <div\n className={cn(\"flex items-center justify-between text-xs\", className)}\n {...props}\n >\n <span className=\"text-muted-foreground\">Output</span>\n <TokensWithCost costText={outputCostText} tokens={outputTokens} />\n </div>\n );\n};\n\nexport type ContextReasoningUsageProps = ComponentProps<\"div\">;\n\nexport const ContextReasoningUsage = ({\n className,\n children,\n ...props\n}: ContextReasoningUsageProps) => {\n const { usage, cost } = useContextValue();\n const reasoningTokens = usage?.reasoningTokens ?? 0;\n\n if (children) {\n return children;\n }\n\n if (!reasoningTokens) {\n return null;\n }\n\n const reasoningCostText = formatUSD(cost?.reasoning);\n\n return (\n <div\n className={cn(\"flex items-center justify-between text-xs\", className)}\n {...props}\n >\n <span className=\"text-muted-foreground\">Reasoning</span>\n <TokensWithCost costText={reasoningCostText} tokens={reasoningTokens} />\n </div>\n );\n};\n\nexport type ContextCacheUsageProps = ComponentProps<\"div\">;\n\nexport const ContextCacheUsage = ({\n className,\n children,\n ...props\n}: ContextCacheUsageProps) => {\n const { usage, cost } = useContextValue();\n const cacheTokens = usage?.cachedInputTokens ?? 0;\n\n if (children) {\n return children;\n }\n\n if (!cacheTokens) {\n return null;\n }\n\n const cacheCostText = formatUSD(cost?.cache);\n\n return (\n <div\n className={cn(\"flex items-center justify-between text-xs\", className)}\n {...props}\n >\n <span className=\"text-muted-foreground\">Cache</span>\n <TokensWithCost costText={cacheCostText} tokens={cacheTokens} />\n </div>\n );\n};\n"],"names":["PERCENT_MAX","ICON_RADIUS","ICON_VIEWBOX","ICON_CENTER","ICON_STROKE_WIDTH","WARN_THRESHOLD","DANGER_THRESHOLD","getUsageStatus","pct","STATUS_TEXT","STATUS_PROGRESS","USD_FORMAT","formatUSD","value","ContextContext","createContext","useContextValue","context","useContext","Context","usedTokens","maxTokens","usage","cost","props","contextValue","useMemo","jsx","HoverCard","ContextIcon","circumference","usedPercent","dashOffset","jsxs","ContextTrigger","children","showPercentage","status","renderedPercent","HoverCardTrigger","Button","cn","ContextContent","className","HoverCardContent","ContextContentHeader","displayPct","used","total","Fragment","Progress","ContextContentBody","ContextContentFooter","totalCost","TokensWithCost","tokens","costText","ContextInputUsage","inputTokens","inputCostText","ContextOutputUsage","outputTokens","outputCostText","ContextReasoningUsage","reasoningTokens","reasoningCostText","ContextCacheUsage","cacheTokens","cacheCostText"],"mappings":"yQAeMA,EAAc,IACdC,EAAc,GACdC,EAAe,GACfC,EAAc,GACdC,EAAoB,EACpBC,EAAiB,IACjBC,EAAmB,GAInBC,EAAkBC,GAClBA,GAAOF,EAAyB,SAChCE,GAAOH,EAAuB,UAC3B,SAGHI,EAA2C,CAC/C,OAAQ,wBACR,QAAS,eACT,OAAQ,kBACV,EAEMC,EAA+C,CACnD,OAAQ,GACR,QAAS,gDACT,OAAQ,mDACV,EAEMC,EAAa,IAAI,KAAK,aAAa,QAAS,CAChD,SAAU,MACV,MAAO,UACT,CAAC,EAEKC,EAAaC,GACjBA,IAAU,OAAY,OAAYF,EAAW,OAAOE,CAAK,EAiBr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