@devalok/shilp-sutra 0.38.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (361) hide show
  1. package/AGENTS.md +151 -0
  2. package/MIGRATION.md +255 -0
  3. package/README.md +3 -0
  4. package/dist/_chunks/badge-group.js +76 -75
  5. package/dist/_chunks/badge-group.js.map +1 -1
  6. package/dist/_chunks/chart-container.js +50 -0
  7. package/dist/_chunks/chart-container.js.map +1 -0
  8. package/dist/_chunks/chat.js +236 -228
  9. package/dist/_chunks/chat.js.map +1 -1
  10. package/dist/_chunks/colors.js +30 -0
  11. package/dist/_chunks/colors.js.map +1 -0
  12. package/dist/_chunks/document-preview.js +2 -2
  13. package/dist/_chunks/document-preview.js.map +1 -1
  14. package/dist/_chunks/emoji-data.js +45 -0
  15. package/dist/_chunks/emoji-data.js.map +1 -0
  16. package/dist/_chunks/grid-lines.js +72 -0
  17. package/dist/_chunks/grid-lines.js.map +1 -0
  18. package/dist/_chunks/image-preview.js +2 -2
  19. package/dist/_chunks/image-preview.js.map +1 -1
  20. package/dist/_chunks/mention-suggestion.js +35 -263
  21. package/dist/_chunks/mention-suggestion.js.map +1 -1
  22. package/dist/_chunks/normalize-icon.js +18 -0
  23. package/dist/_chunks/normalize-icon.js.map +1 -0
  24. package/dist/_chunks/oauth-button.js +227 -0
  25. package/dist/_chunks/oauth-button.js.map +1 -0
  26. package/dist/_chunks/popover.js +3 -3
  27. package/dist/_chunks/popover.js.map +1 -1
  28. package/dist/_chunks/primitives.js +107 -107
  29. package/dist/_chunks/primitives.js.map +1 -1
  30. package/dist/_chunks/shared.js +5 -5
  31. package/dist/_chunks/shared.js.map +1 -1
  32. package/dist/_chunks/{text.js → success.js} +26 -63
  33. package/dist/_chunks/success.js.map +1 -0
  34. package/dist/_chunks/tiptap.js +1952 -1949
  35. package/dist/_chunks/tiptap.js.map +1 -1
  36. package/dist/_chunks/tooltip.js +58 -0
  37. package/dist/_chunks/tooltip.js.map +1 -0
  38. package/dist/_chunks/tree-view.js +101 -96
  39. package/dist/_chunks/tree-view.js.map +1 -1
  40. package/dist/_chunks/use-calendar.js +5 -5
  41. package/dist/_chunks/use-calendar.js.map +1 -1
  42. package/dist/ai/ai-command-provider.d.ts +3 -2
  43. package/dist/ai/ai-command-provider.d.ts.map +1 -1
  44. package/dist/ai/ai-command-provider.js.map +1 -1
  45. package/dist/ai/block-renderer.js +11 -9
  46. package/dist/ai/block-renderer.js.map +1 -1
  47. package/dist/ai/blocks/error.js +31 -0
  48. package/dist/ai/blocks/error.js.map +1 -0
  49. package/dist/ai/blocks/index.d.ts +0 -2
  50. package/dist/ai/blocks/index.d.ts.map +1 -1
  51. package/dist/ai/blocks/index.js +2 -2
  52. package/dist/ai/blocks/text.js +19 -0
  53. package/dist/ai/blocks/text.js.map +1 -0
  54. package/dist/ai/command-bar.d.ts.map +1 -1
  55. package/dist/ai/command-bar.js +198 -193
  56. package/dist/ai/command-bar.js.map +1 -1
  57. package/dist/ai/conversation.d.ts +2 -1
  58. package/dist/ai/conversation.d.ts.map +1 -1
  59. package/dist/ai/conversation.js +92 -87
  60. package/dist/ai/conversation.js.map +1 -1
  61. package/dist/ai/index.d.ts +0 -4
  62. package/dist/ai/index.d.ts.map +1 -1
  63. package/dist/ai/index.js +45 -46
  64. package/dist/ai/index.js.map +1 -1
  65. package/dist/composed/activity-feed.d.ts +2 -1
  66. package/dist/composed/activity-feed.d.ts.map +1 -1
  67. package/dist/composed/activity-feed.js +5 -5
  68. package/dist/composed/activity-feed.js.map +1 -1
  69. package/dist/composed/avatar-group.js +4 -4
  70. package/dist/composed/avatar-group.js.map +1 -1
  71. package/dist/composed/bulk-action-bar.d.ts +2 -2
  72. package/dist/composed/bulk-action-bar.d.ts.map +1 -1
  73. package/dist/composed/bulk-action-bar.js +12 -12
  74. package/dist/composed/bulk-action-bar.js.map +1 -1
  75. package/dist/composed/command-palette.d.ts +2 -1
  76. package/dist/composed/command-palette.d.ts.map +1 -1
  77. package/dist/composed/command-palette.js +106 -101
  78. package/dist/composed/command-palette.js.map +1 -1
  79. package/dist/composed/content-card.js +1 -1
  80. package/dist/composed/content-card.js.map +1 -1
  81. package/dist/composed/date-picker/index.js +747 -3
  82. package/dist/composed/date-picker/index.js.map +1 -0
  83. package/dist/composed/emoji-picker.js +4 -4
  84. package/dist/composed/emoji-picker.js.map +1 -1
  85. package/dist/composed/empty-state.d.ts +3 -3
  86. package/dist/composed/empty-state.d.ts.map +1 -1
  87. package/dist/composed/empty-state.js +40 -31
  88. package/dist/composed/empty-state.js.map +1 -1
  89. package/dist/composed/error-boundary.js +3 -3
  90. package/dist/composed/error-boundary.js.map +1 -1
  91. package/dist/composed/extensions/emoji-node.js +81 -0
  92. package/dist/composed/extensions/emoji-node.js.map +1 -0
  93. package/dist/composed/extensions/emoji-suggestion.js +117 -0
  94. package/dist/composed/extensions/emoji-suggestion.js.map +1 -0
  95. package/dist/composed/file-preview.js +498 -2
  96. package/dist/composed/file-preview.js.map +1 -0
  97. package/dist/composed/filter-bar.js +1 -1
  98. package/dist/composed/filter-bar.js.map +1 -1
  99. package/dist/composed/index.d.ts +0 -15
  100. package/dist/composed/index.d.ts.map +1 -1
  101. package/dist/composed/index.js +16 -24
  102. package/dist/composed/inline-edit.js +1 -1
  103. package/dist/composed/inline-edit.js.map +1 -1
  104. package/dist/composed/loading-skeleton.js +9 -9
  105. package/dist/composed/loading-skeleton.js.map +1 -1
  106. package/dist/composed/markdown-viewer.js +3 -3
  107. package/dist/composed/markdown-viewer.js.map +1 -1
  108. package/dist/composed/multi-select-popover.js +1 -1
  109. package/dist/composed/multi-select-popover.js.map +1 -1
  110. package/dist/composed/page-header.js +1 -1
  111. package/dist/composed/page-header.js.map +1 -1
  112. package/dist/composed/page-skeletons.js +15 -15
  113. package/dist/composed/page-skeletons.js.map +1 -1
  114. package/dist/composed/priority-indicator.js +3 -3
  115. package/dist/composed/priority-indicator.js.map +1 -1
  116. package/dist/composed/rich-chat-input.js +2073 -2
  117. package/dist/composed/rich-chat-input.js.map +1 -0
  118. package/dist/composed/rich-text-editor.js +75 -72
  119. package/dist/composed/rich-text-editor.js.map +1 -1
  120. package/dist/composed/schedule-view.js +3 -3
  121. package/dist/composed/schedule-view.js.map +1 -1
  122. package/dist/composed/status-badge.d.ts +3 -2
  123. package/dist/composed/status-badge.d.ts.map +1 -1
  124. package/dist/composed/status-badge.js +58 -53
  125. package/dist/composed/status-badge.js.map +1 -1
  126. package/dist/shell/app-command-palette.d.ts +2 -1
  127. package/dist/shell/app-command-palette.d.ts.map +1 -1
  128. package/dist/shell/app-command-palette.js.map +1 -1
  129. package/dist/shell/bottom-navbar.d.ts +3 -1
  130. package/dist/shell/bottom-navbar.d.ts.map +1 -1
  131. package/dist/shell/bottom-navbar.js +94 -86
  132. package/dist/shell/bottom-navbar.js.map +1 -1
  133. package/dist/shell/command-registry.d.ts +2 -1
  134. package/dist/shell/command-registry.d.ts.map +1 -1
  135. package/dist/shell/command-registry.js.map +1 -1
  136. package/dist/shell/notification-center.js +8 -8
  137. package/dist/shell/notification-center.js.map +1 -1
  138. package/dist/shell/notification-preferences.js +1 -1
  139. package/dist/shell/notification-preferences.js.map +1 -1
  140. package/dist/shell/sidebar.d.ts +7 -4
  141. package/dist/shell/sidebar.d.ts.map +1 -1
  142. package/dist/shell/sidebar.js +148 -134
  143. package/dist/shell/sidebar.js.map +1 -1
  144. package/dist/shell/top-bar.d.ts +4 -3
  145. package/dist/shell/top-bar.d.ts.map +1 -1
  146. package/dist/shell/top-bar.js +116 -108
  147. package/dist/shell/top-bar.js.map +1 -1
  148. package/dist/tokens/semantic.css +82 -9
  149. package/dist/ui/accordion.js +1 -1
  150. package/dist/ui/accordion.js.map +1 -1
  151. package/dist/ui/alert-dialog.js +3 -3
  152. package/dist/ui/alert-dialog.js.map +1 -1
  153. package/dist/ui/alert.js +2 -2
  154. package/dist/ui/alert.js.map +1 -1
  155. package/dist/ui/autocomplete.js +2 -2
  156. package/dist/ui/autocomplete.js.map +1 -1
  157. package/dist/ui/avatar.js +11 -11
  158. package/dist/ui/avatar.js.map +1 -1
  159. package/dist/ui/badge-indicator.js +1 -1
  160. package/dist/ui/badge-indicator.js.map +1 -1
  161. package/dist/ui/badge.d.ts +3 -2
  162. package/dist/ui/badge.d.ts.map +1 -1
  163. package/dist/ui/banner.js +1 -1
  164. package/dist/ui/banner.js.map +1 -1
  165. package/dist/ui/breadcrumb.js +1 -1
  166. package/dist/ui/breadcrumb.js.map +1 -1
  167. package/dist/ui/button.d.ts +5 -4
  168. package/dist/ui/button.d.ts.map +1 -1
  169. package/dist/ui/button.js +66 -65
  170. package/dist/ui/button.js.map +1 -1
  171. package/dist/ui/card.js +5 -5
  172. package/dist/ui/card.js.map +1 -1
  173. package/dist/ui/charts/area-chart.js +177 -0
  174. package/dist/ui/charts/area-chart.js.map +1 -0
  175. package/dist/ui/charts/bar-chart.js +127 -0
  176. package/dist/ui/charts/bar-chart.js.map +1 -0
  177. package/dist/ui/charts/chart-container.js +3 -0
  178. package/dist/ui/charts/gauge-chart.js +72 -0
  179. package/dist/ui/charts/gauge-chart.js.map +1 -0
  180. package/dist/ui/charts/index.js +10 -1035
  181. package/dist/ui/charts/line-chart.js +135 -0
  182. package/dist/ui/charts/line-chart.js.map +1 -0
  183. package/dist/ui/charts/pie-chart.js +111 -0
  184. package/dist/ui/charts/pie-chart.js.map +1 -0
  185. package/dist/ui/charts/radar-chart.js +170 -0
  186. package/dist/ui/charts/radar-chart.js.map +1 -0
  187. package/dist/ui/charts/sparkline.js +119 -0
  188. package/dist/ui/charts/sparkline.js.map +1 -0
  189. package/dist/ui/chat/message.d.ts +3 -3
  190. package/dist/ui/chat/message.d.ts.map +1 -1
  191. package/dist/ui/chat/system-message.d.ts +2 -1
  192. package/dist/ui/chat/system-message.d.ts.map +1 -1
  193. package/dist/ui/checkbox.js +1 -1
  194. package/dist/ui/checkbox.js.map +1 -1
  195. package/dist/ui/code.js +2 -2
  196. package/dist/ui/code.js.map +1 -1
  197. package/dist/ui/color-input.js +10 -10
  198. package/dist/ui/color-input.js.map +1 -1
  199. package/dist/ui/color-swatch.js +3 -3
  200. package/dist/ui/color-swatch.js.map +1 -1
  201. package/dist/ui/combobox.d.ts +2 -1
  202. package/dist/ui/combobox.d.ts.map +1 -1
  203. package/dist/ui/combobox.js +100 -95
  204. package/dist/ui/combobox.js.map +1 -1
  205. package/dist/ui/container.d.ts +6 -1
  206. package/dist/ui/container.d.ts.map +1 -1
  207. package/dist/ui/container.js +2 -1
  208. package/dist/ui/container.js.map +1 -1
  209. package/dist/ui/context-menu.js +6 -6
  210. package/dist/ui/context-menu.js.map +1 -1
  211. package/dist/ui/data-table-body.js +1 -1
  212. package/dist/ui/data-table-body.js.map +1 -1
  213. package/dist/ui/data-table-bulk-actions.js +2 -2
  214. package/dist/ui/data-table-bulk-actions.js.map +1 -1
  215. package/dist/ui/data-table-card.js +2 -2
  216. package/dist/ui/data-table-card.js.map +1 -1
  217. package/dist/ui/data-table-header.js +2 -2
  218. package/dist/ui/data-table-header.js.map +1 -1
  219. package/dist/ui/data-table-pagination.js +3 -3
  220. package/dist/ui/data-table-pagination.js.map +1 -1
  221. package/dist/ui/data-table-toolbar.js +1 -1
  222. package/dist/ui/data-table-toolbar.js.map +1 -1
  223. package/dist/ui/data-table.js +1 -1
  224. package/dist/ui/data-table.js.map +1 -1
  225. package/dist/ui/devalok-grain.d.ts +1 -1
  226. package/dist/ui/devalok-grain.js.map +1 -1
  227. package/dist/ui/dialog.js +2 -2
  228. package/dist/ui/dialog.js.map +1 -1
  229. package/dist/ui/dropdown-menu.js +6 -6
  230. package/dist/ui/dropdown-menu.js.map +1 -1
  231. package/dist/ui/file-upload.js +4 -4
  232. package/dist/ui/file-upload.js.map +1 -1
  233. package/dist/ui/hover-card.js +1 -1
  234. package/dist/ui/hover-card.js.map +1 -1
  235. package/dist/ui/icon-button.d.ts +9 -2
  236. package/dist/ui/icon-button.d.ts.map +1 -1
  237. package/dist/ui/icon-button.js +14 -13
  238. package/dist/ui/icon-button.js.map +1 -1
  239. package/dist/ui/index.d.ts +1 -3
  240. package/dist/ui/index.d.ts.map +1 -1
  241. package/dist/ui/index.js +31 -33
  242. package/dist/ui/index.js.map +1 -1
  243. package/dist/ui/input-otp.js +1 -1
  244. package/dist/ui/input-otp.js.map +1 -1
  245. package/dist/ui/input.js +2 -2
  246. package/dist/ui/input.js.map +1 -1
  247. package/dist/ui/lib/icon-input.d.ts +42 -0
  248. package/dist/ui/lib/icon-input.d.ts.map +1 -0
  249. package/dist/ui/lib/normalize-icon.d.ts +39 -0
  250. package/dist/ui/lib/normalize-icon.d.ts.map +1 -0
  251. package/dist/ui/link.js +1 -1
  252. package/dist/ui/link.js.map +1 -1
  253. package/dist/ui/menubar.js +8 -8
  254. package/dist/ui/menubar.js.map +1 -1
  255. package/dist/ui/navigation-menu.js +3 -3
  256. package/dist/ui/navigation-menu.js.map +1 -1
  257. package/dist/ui/number-input.js +3 -3
  258. package/dist/ui/number-input.js.map +1 -1
  259. package/dist/ui/oauth-button/index.d.ts +3 -0
  260. package/dist/ui/oauth-button/index.d.ts.map +1 -0
  261. package/dist/ui/oauth-button/index.js +3 -0
  262. package/dist/ui/oauth-button/oauth-button.d.ts +208 -0
  263. package/dist/ui/oauth-button/oauth-button.d.ts.map +1 -0
  264. package/dist/ui/pagination.js +1 -1
  265. package/dist/ui/pagination.js.map +1 -1
  266. package/dist/ui/progress.js +2 -2
  267. package/dist/ui/progress.js.map +1 -1
  268. package/dist/ui/radio.js +1 -1
  269. package/dist/ui/radio.js.map +1 -1
  270. package/dist/ui/segmented-control.d.ts +3 -4
  271. package/dist/ui/segmented-control.d.ts.map +1 -1
  272. package/dist/ui/segmented-control.js +53 -45
  273. package/dist/ui/segmented-control.js.map +1 -1
  274. package/dist/ui/select.js +3 -3
  275. package/dist/ui/select.js.map +1 -1
  276. package/dist/ui/sheet.js +2 -2
  277. package/dist/ui/sheet.js.map +1 -1
  278. package/dist/ui/sidebar.js +11 -11
  279. package/dist/ui/sidebar.js.map +1 -1
  280. package/dist/ui/skeleton.js +9 -9
  281. package/dist/ui/skeleton.js.map +1 -1
  282. package/dist/ui/slider.js +2 -2
  283. package/dist/ui/slider.js.map +1 -1
  284. package/dist/ui/split-button.js +7 -7
  285. package/dist/ui/split-button.js.map +1 -1
  286. package/dist/ui/stack.d.ts +6 -1
  287. package/dist/ui/stack.d.ts.map +1 -1
  288. package/dist/ui/stack.js +2 -1
  289. package/dist/ui/stack.js.map +1 -1
  290. package/dist/ui/stat-card.d.ts +2 -3
  291. package/dist/ui/stat-card.d.ts.map +1 -1
  292. package/dist/ui/stat-card.js +118 -116
  293. package/dist/ui/stat-card.js.map +1 -1
  294. package/dist/ui/status-dot.js +2 -2
  295. package/dist/ui/status-dot.js.map +1 -1
  296. package/dist/ui/stepper.d.ts +2 -1
  297. package/dist/ui/stepper.d.ts.map +1 -1
  298. package/dist/ui/stepper.js +74 -69
  299. package/dist/ui/stepper.js.map +1 -1
  300. package/dist/ui/switch.js +2 -2
  301. package/dist/ui/switch.js.map +1 -1
  302. package/dist/ui/tabs.js +3 -3
  303. package/dist/ui/tabs.js.map +1 -1
  304. package/dist/ui/text.d.ts +7 -2
  305. package/dist/ui/text.d.ts.map +1 -1
  306. package/dist/ui/text.js +2 -1
  307. package/dist/ui/text.js.map +1 -1
  308. package/dist/ui/textarea.js +1 -1
  309. package/dist/ui/textarea.js.map +1 -1
  310. package/dist/ui/toast.js +8 -8
  311. package/dist/ui/toast.js.map +1 -1
  312. package/dist/ui/toaster.d.ts +11 -2
  313. package/dist/ui/toaster.d.ts.map +1 -1
  314. package/dist/ui/toaster.js.map +1 -1
  315. package/dist/ui/toggle.js +1 -1
  316. package/dist/ui/toggle.js.map +1 -1
  317. package/dist/ui/tooltip.js +12 -12
  318. package/dist/ui/tooltip.js.map +1 -1
  319. package/dist/ui/tree-view/tree-item.d.ts +3 -2
  320. package/dist/ui/tree-view/tree-item.d.ts.map +1 -1
  321. package/dist/ui/tree-view/use-tree.d.ts +2 -1
  322. package/dist/ui/tree-view/use-tree.d.ts.map +1 -1
  323. package/docs/components/_header.md +90 -1
  324. package/docs/components/ui/oauth-button.md +86 -0
  325. package/docs/recipes/customize-brand.md +100 -4
  326. package/docs/recipes/index.md +5 -1
  327. package/docs/recipes/install-astro.md +15 -0
  328. package/docs/recipes/install-next-app-router.md +21 -5
  329. package/docs/recipes/install-next-pages.md +2 -0
  330. package/docs/recipes/install-remix.md +15 -0
  331. package/docs/recipes/install-tanstack-start.md +15 -0
  332. package/docs/recipes/install-vite.md +15 -0
  333. package/docs/recipes/troubleshoot.md +22 -0
  334. package/llms-full.txt +177 -2
  335. package/llms-quick.txt +247 -0
  336. package/llms.txt +116 -3
  337. package/package.json +80 -2
  338. package/scripts/welcome.mjs +219 -0
  339. package/skill/README.md +99 -0
  340. package/skill/SKILL.md +163 -0
  341. package/skill/install.sh +59 -0
  342. package/skill/references/components-full.md +7083 -0
  343. package/skill/references/components.md +778 -0
  344. package/skill/references/customize-brand.md +314 -0
  345. package/skill/references/server-components.md +211 -0
  346. package/skill/references/setup-astro.md +195 -0
  347. package/skill/references/setup-next-app-router.md +248 -0
  348. package/skill/references/setup-next-pages.md +127 -0
  349. package/skill/references/setup-remix.md +188 -0
  350. package/skill/references/setup-tanstack-start.md +160 -0
  351. package/skill/references/setup-vite.md +187 -0
  352. package/skill/references/troubleshoot.md +241 -0
  353. package/dist/_chunks/date-picker.js +0 -748
  354. package/dist/_chunks/date-picker.js.map +0 -1
  355. package/dist/_chunks/file-preview.js +0 -499
  356. package/dist/_chunks/file-preview.js.map +0 -1
  357. package/dist/_chunks/rich-chat-input.js +0 -2071
  358. package/dist/_chunks/rich-chat-input.js.map +0 -1
  359. package/dist/_chunks/text.js.map +0 -1
  360. package/dist/ui/charts/index.js.map +0 -1
  361. /package/{LICENSE → skill/LICENSE} +0 -0
@@ -1,3 +1,2074 @@
1
1
  "use client";
2
- import { _ as e, a as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _, v, y } from "../_chunks/rich-chat-input.js";
3
- export { y as AudioPlayer, n as AudioWaveform, m as BlockquoteButton, c as BoldButton, t as BulletListButton, f as CodeButton, h as EmojiButton, r as HighlightButton, l as ItalicButton, _ as LinkButton, i as MentionButton, a as OrderedListButton, g as RichChatInput, p as SlashCommandButton, u as StrikeButton, s as ToolbarButton, o as ToolbarDivider, e as ToolbarGroup, v as UnderlineButton, d as useVoiceRecorder };
2
+ import { ln as e, mn as t, pn as n, un as r } from "../_chunks/primitives.js";
3
+ import { durations as i } from "../ui/lib/motion.js";
4
+ import { cn as a } from "../ui/lib/utils.js";
5
+ import { Spinner as o } from "../ui/spinner.js";
6
+ import { Icon as s } from "../ui/icon.js";
7
+ import { useIsMobile as c } from "../hooks/use-mobile.js";
8
+ import { Button as l } from "../ui/button.js";
9
+ import { Dialog as u, DialogContent as d, DialogFooter as f, DialogHeader as p, DialogTitle as m } from "../ui/dialog.js";
10
+ import { SplitButton as h } from "../ui/split-button.js";
11
+ import { emojiDataLoaders as g } from "./emoji-picker.js";
12
+ import { a as _, c as v, d as y, f as b, g as x, h as ee, i as S, l as C, m as te, n as ne, p as w, u as re, y as T } from "../_chunks/tiptap.js";
13
+ import { useColorMode as ie } from "../hooks/use-color-mode.js";
14
+ import { n as ae, r as oe } from "../_chunks/emoji-data.js";
15
+ import { EmojiNode as se } from "./extensions/emoji-node.js";
16
+ import { createEmojiSuggestion as ce } from "./extensions/emoji-suggestion.js";
17
+ import { n as le, t as ue } from "../_chunks/mention-suggestion.js";
18
+ import { n as de, t as fe } from "../_chunks/use-calendar.js";
19
+ import * as E from "react";
20
+ import { useCallback as D, useEffect as pe, useRef as O, useState as k } from "react";
21
+ import { Fragment as me, jsx as A, jsxs as j } from "react/jsx-runtime";
22
+ import * as he from "react-dom";
23
+ import { IconAt as ge, IconBlockquote as _e, IconBold as M, IconCalendarEvent as ve, IconChevronDown as ye, IconClock as be, IconCode as xe, IconFile as Se, IconHighlight as Ce, IconItalic as we, IconLink as N, IconList as Te, IconListNumbers as P, IconMicrophone as Ee, IconMoodSmile as De, IconPencil as Oe, IconPlayerPause as ke, IconPlayerPlay as Ae, IconPlus as je, IconSend as Me, IconSlash as F, IconSquare as Ne, IconStrikethrough as I, IconTextSize as Pe, IconTrash as Fe, IconUnderline as L, IconX as R } from "@tabler/icons-react";
24
+ import { AnimatePresence as Ie, motion as z, useReducedMotion as Le } from "framer-motion";
25
+ import { createRoot as Re } from "react-dom/client";
26
+ //#region src/composed/extensions/slash-command.tsx
27
+ var B = E.forwardRef(({ groups: e, query: t, command: n }, r) => {
28
+ let [i, o] = E.useState(0), s = E.useMemo(() => {
29
+ let n = t.toLowerCase(), r = [];
30
+ return e.forEach((e, t) => {
31
+ e.commands.forEach((e) => {
32
+ (!n || e.label.toLowerCase().includes(n) || e.description?.toLowerCase().includes(n)) && r.push({
33
+ command: e,
34
+ groupIndex: t
35
+ });
36
+ });
37
+ }), r;
38
+ }, [e, t]);
39
+ if (E.useEffect(() => o(0), [s]), E.useImperativeHandle(r, () => ({ onKeyDown: ({ event: e }) => e.key === "ArrowUp" ? (o((e) => (e + s.length - 1) % s.length), !0) : e.key === "ArrowDown" ? (o((e) => (e + 1) % s.length), !0) : e.key === "Enter" ? (s[i] && n(s[i].command), !0) : !1 })), !s.length) return null;
40
+ let c = [], l = 0;
41
+ for (let t of s) {
42
+ let n = e[t.groupIndex].label, r = c[c.length - 1];
43
+ (!r || r.label !== n) && (r = {
44
+ label: n,
45
+ items: []
46
+ }, c.push(r)), r.items.push({
47
+ command: t.command,
48
+ flatIndex: l
49
+ }), l++;
50
+ }
51
+ return /* @__PURE__ */ A("div", {
52
+ role: "listbox",
53
+ "aria-label": "Slash commands",
54
+ className: "z-popover max-h-[320px] min-w-[220px] overflow-x-hidden overflow-y-auto rounded-surface border border-surface-border-strong bg-surface-overlay p-ds-02 shadow-floating",
55
+ children: c.map((e, t) => /* @__PURE__ */ j("div", {
56
+ role: "group",
57
+ "aria-label": e.label,
58
+ children: [
59
+ t > 0 && /* @__PURE__ */ A("div", { className: "my-ds-01 border-t border-surface-border" }),
60
+ /* @__PURE__ */ A("div", {
61
+ className: "px-ds-03 py-ds-01 text-ds-xs font-medium text-surface-fg-subtle",
62
+ children: e.label
63
+ }),
64
+ e.items.map(({ command: e, flatIndex: t }) => {
65
+ let r = e.icon;
66
+ return /* @__PURE__ */ j("button", {
67
+ type: "button",
68
+ role: "option",
69
+ "aria-selected": t === i,
70
+ onClick: () => n(e),
71
+ className: a("flex w-full items-center gap-ds-03 rounded-control px-ds-03 py-ds-02 text-left cursor-pointer", t === i ? "bg-surface-raised-hover" : "hover:bg-surface-raised-hover"),
72
+ children: [r && /* @__PURE__ */ A("span", {
73
+ className: "flex h-4 w-4 shrink-0 items-center justify-center text-surface-fg-muted",
74
+ children: /* @__PURE__ */ A(r, { className: "h-4 w-4" })
75
+ }), /* @__PURE__ */ j("div", {
76
+ className: "flex flex-col",
77
+ children: [/* @__PURE__ */ A("span", {
78
+ className: "text-ds-sm text-surface-fg",
79
+ children: e.label
80
+ }), e.description && /* @__PURE__ */ A("span", {
81
+ className: "text-ds-xs text-surface-fg-subtle",
82
+ children: e.description
83
+ })]
84
+ })]
85
+ }, e.id);
86
+ })
87
+ ]
88
+ }, e.label))
89
+ });
90
+ });
91
+ B.displayName = "SlashCommandList";
92
+ function ze(e) {
93
+ return () => {
94
+ let t = null, n = null, r = null;
95
+ return {
96
+ onStart: (i) => {
97
+ n = document.createElement("div"), n.style.position = "absolute", n.style.zIndex = "1400";
98
+ let a = i.clientRect?.();
99
+ a && (n.style.left = `${a.left}px`, n.style.top = `${a.bottom + 4}px`), document.body.appendChild(n), t = Re(n), t.render(/* @__PURE__ */ A(B, {
100
+ ref: (e) => {
101
+ r = e;
102
+ },
103
+ groups: e,
104
+ query: i.query,
105
+ command: (e) => i.command(e)
106
+ }));
107
+ },
108
+ onUpdate: (i) => {
109
+ if (!t || !n) return;
110
+ let a = i.clientRect?.();
111
+ a && (n.style.left = `${a.left}px`, n.style.top = `${a.bottom + 4}px`), t.render(/* @__PURE__ */ A(B, {
112
+ ref: (e) => {
113
+ r = e;
114
+ },
115
+ groups: e,
116
+ query: i.query,
117
+ command: (e) => i.command(e)
118
+ }));
119
+ },
120
+ onKeyDown: (e) => e.event.key === "Escape" ? (n && (t?.unmount(), n.remove(), n = null, t = null), !0) : r?.onKeyDown(e) ?? !1,
121
+ onExit: () => {
122
+ n && (t?.unmount(), n.remove(), n = null, t = null);
123
+ }
124
+ };
125
+ };
126
+ }
127
+ function Be(e) {
128
+ let t = e.flatMap((e) => e.commands);
129
+ return x.create({
130
+ name: "slashCommand",
131
+ addProseMirrorPlugins() {
132
+ return [w({
133
+ pluginKey: new T("slashCommand"),
134
+ editor: this.editor,
135
+ char: "/",
136
+ startOfLine: !0,
137
+ allowSpaces: !1,
138
+ items: ({ query: e }) => {
139
+ if (!e) return t.slice(0, 8);
140
+ let n = e.toLowerCase();
141
+ return t.filter((e) => e.label.toLowerCase().includes(n) || e.description?.toLowerCase().includes(n)).slice(0, 8);
142
+ },
143
+ command: ({ editor: e, range: t, props: n }) => {
144
+ e.chain().focus().deleteRange(t).run(), n.action(e);
145
+ },
146
+ render: ze(e)
147
+ })];
148
+ }
149
+ });
150
+ }
151
+ //#endregion
152
+ //#region src/composed/rich-chat-input/attachment-strip.tsx
153
+ function Ve(e) {
154
+ return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
155
+ }
156
+ function He({ attachments: e, onRemoveAttachment: t }) {
157
+ return /* @__PURE__ */ A(z.div, {
158
+ initial: {
159
+ height: 0,
160
+ opacity: 0
161
+ },
162
+ animate: {
163
+ height: "auto",
164
+ opacity: 1
165
+ },
166
+ exit: {
167
+ height: 0,
168
+ opacity: 0
169
+ },
170
+ transition: {
171
+ duration: i.moderate02,
172
+ ease: [
173
+ .2,
174
+ 0,
175
+ .38,
176
+ .9
177
+ ]
178
+ },
179
+ className: "overflow-hidden",
180
+ children: /* @__PURE__ */ A("div", {
181
+ role: "list",
182
+ "aria-label": "Attachments",
183
+ className: "flex gap-ds-02 overflow-x-auto px-ds-04 py-ds-02b border-b border-surface-border",
184
+ children: /* @__PURE__ */ A(Ie, {
185
+ initial: !1,
186
+ children: e.map((e) => e.type === "image" ? /* @__PURE__ */ j(z.div, {
187
+ role: "listitem",
188
+ "aria-label": `Image: ${e.name}`,
189
+ layout: !0,
190
+ initial: {
191
+ scale: 0,
192
+ opacity: 0
193
+ },
194
+ animate: {
195
+ scale: 1,
196
+ opacity: 1
197
+ },
198
+ exit: {
199
+ scale: .95,
200
+ opacity: 0
201
+ },
202
+ transition: {
203
+ layout: {
204
+ type: "spring",
205
+ stiffness: 400,
206
+ damping: 30
207
+ },
208
+ scale: {
209
+ type: "spring",
210
+ stiffness: 400,
211
+ damping: 30
212
+ },
213
+ opacity: { duration: i.fast02 }
214
+ },
215
+ className: "relative h-12 w-12 shrink-0 group",
216
+ children: [
217
+ /* @__PURE__ */ A("img", {
218
+ src: e.url,
219
+ alt: e.name,
220
+ className: "h-full w-full rounded-control object-cover"
221
+ }),
222
+ /* @__PURE__ */ A("button", {
223
+ onClick: () => t(e.id),
224
+ className: "absolute -top-1 -right-1 h-ico-sm w-ico-sm rounded-pill bg-error-9 text-error-fg flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-fast-02",
225
+ "aria-label": `Remove ${e.name}`,
226
+ title: "Remove",
227
+ children: /* @__PURE__ */ A(s, {
228
+ icon: R,
229
+ size: "xs"
230
+ })
231
+ }),
232
+ e.uploading && /* @__PURE__ */ A("div", {
233
+ className: "absolute inset-0 rounded-control bg-surface-overlay/50 flex items-center justify-center",
234
+ children: /* @__PURE__ */ A(o, { size: "sm" })
235
+ })
236
+ ]
237
+ }, e.id) : /* @__PURE__ */ j(z.div, {
238
+ role: "listitem",
239
+ "aria-label": `File: ${e.name}, ${Ve(e.size)}`,
240
+ layout: !0,
241
+ initial: {
242
+ scale: 0,
243
+ opacity: 0
244
+ },
245
+ animate: {
246
+ scale: 1,
247
+ opacity: 1
248
+ },
249
+ exit: {
250
+ scale: .95,
251
+ opacity: 0
252
+ },
253
+ transition: {
254
+ layout: {
255
+ type: "spring",
256
+ stiffness: 400,
257
+ damping: 30
258
+ },
259
+ scale: {
260
+ type: "spring",
261
+ stiffness: 400,
262
+ damping: 30
263
+ },
264
+ opacity: { duration: i.fast02 }
265
+ },
266
+ className: "flex items-center gap-ds-02 shrink-0 rounded-control bg-surface-raised px-ds-03 py-ds-01 group",
267
+ children: [
268
+ /* @__PURE__ */ A(s, {
269
+ icon: Se,
270
+ size: "xs",
271
+ className: "text-surface-fg-muted"
272
+ }),
273
+ /* @__PURE__ */ A("span", {
274
+ className: "text-ds-xs text-surface-fg-muted truncate max-w-[120px]",
275
+ children: e.name
276
+ }),
277
+ /* @__PURE__ */ A("span", {
278
+ className: "text-ds-xs text-surface-fg-subtle",
279
+ children: Ve(e.size)
280
+ }),
281
+ /* @__PURE__ */ A("button", {
282
+ onClick: () => t(e.id),
283
+ className: "text-surface-fg-subtle hover:text-error-11 opacity-0 group-hover:opacity-100 transition-opacity duration-fast-02",
284
+ "aria-label": `Remove ${e.name}`,
285
+ title: "Remove",
286
+ children: /* @__PURE__ */ A(s, {
287
+ icon: R,
288
+ size: "xs"
289
+ })
290
+ })
291
+ ]
292
+ }, e.id))
293
+ })
294
+ })
295
+ });
296
+ }
297
+ //#endregion
298
+ //#region src/composed/rich-chat-input/audio-waveform.tsx
299
+ var V = E.forwardRef(function({ mode: e, analyserNode: t, data: n, progress: r = 0, barWidth: i = 3, barGap: o = 2, barCount: s = 40, height: c = 32, className: l, ...u }, d) {
300
+ let [f, p] = E.useState(() => Array(s).fill(.05)), m = E.useRef(0), h = E.useRef(f);
301
+ E.useEffect(() => {
302
+ if (e !== "live" || !t) return;
303
+ let n = new Uint8Array(t.frequencyBinCount), r = () => {
304
+ t.getByteFrequencyData(n);
305
+ let e = Math.floor(n.length / s), i = Array(s);
306
+ for (let t = 0; t < s; t++) {
307
+ let r = 0;
308
+ for (let i = 0; i < e; i++) r += n[t * e + i];
309
+ let a = r / (e * 255);
310
+ i[t] = h.current[t] + (a - h.current[t]) * .3;
311
+ }
312
+ h.current = i, p(i), m.current = requestAnimationFrame(r);
313
+ };
314
+ return m.current = requestAnimationFrame(r), () => cancelAnimationFrame(m.current);
315
+ }, [
316
+ e,
317
+ t,
318
+ s
319
+ ]), E.useEffect(() => {
320
+ if (!(e !== "static" || !n)) if (n.length === s) p(n);
321
+ else {
322
+ let e = Array(s), t = n.length / s;
323
+ for (let r = 0; r < s; r++) {
324
+ let i = Math.floor(r * t);
325
+ e[r] = n[Math.min(i, n.length - 1)];
326
+ }
327
+ p(e);
328
+ }
329
+ }, [
330
+ e,
331
+ n,
332
+ s
333
+ ]);
334
+ let g = s * (i + o) - o, _ = E.useMemo(() => f.map((t, n) => {
335
+ let a = Math.max(2, t * c), l = n * (i + o), u = (c - a) / 2, d = e === "static" && r > 0 && n / s <= r;
336
+ return /* @__PURE__ */ A("rect", {
337
+ x: l,
338
+ y: u,
339
+ width: i,
340
+ height: a,
341
+ rx: i / 2,
342
+ fill: d ? "var(--color-accent-9)" : "var(--color-surface-border)"
343
+ }, n);
344
+ }), [
345
+ f,
346
+ r,
347
+ e,
348
+ i,
349
+ o,
350
+ s,
351
+ c
352
+ ]);
353
+ return /* @__PURE__ */ A("svg", {
354
+ ref: d,
355
+ height: c,
356
+ viewBox: `0 0 ${g} ${c}`,
357
+ preserveAspectRatio: "none",
358
+ "aria-hidden": "true",
359
+ className: a("shrink-0", l),
360
+ ...u,
361
+ children: _
362
+ });
363
+ });
364
+ V.displayName = "AudioWaveform";
365
+ //#endregion
366
+ //#region src/composed/rich-chat-input/audio-player.tsx
367
+ var Ue = [
368
+ 1,
369
+ 1.5,
370
+ 2
371
+ ];
372
+ function We(e) {
373
+ return `${Math.floor(e / 60)}:${Math.floor(e % 60).toString().padStart(2, "0")}`;
374
+ }
375
+ var Ge = E.forwardRef(function({ src: e, duration: t, waveformData: n, className: r, ...i }, o) {
376
+ let s = E.useRef(null), c = E.useRef(null), [l, u] = E.useState(!1), [d, f] = E.useState(0), [p, m] = E.useState(0), [h, g] = E.useState(null), _ = E.useMemo(() => {
377
+ if (typeof e == "string") return e;
378
+ let t = URL.createObjectURL(e);
379
+ return g(t), t;
380
+ }, [e]);
381
+ E.useEffect(() => () => {
382
+ h && URL.revokeObjectURL(h);
383
+ }, [h]), E.useEffect(() => {
384
+ let e = s.current;
385
+ if (!e) return;
386
+ let t = () => f(e.currentTime), n = () => {
387
+ u(!1), f(0);
388
+ };
389
+ return e.addEventListener("timeupdate", t), e.addEventListener("ended", n), () => {
390
+ e.removeEventListener("timeupdate", t), e.removeEventListener("ended", n);
391
+ };
392
+ }, []);
393
+ let v = E.useCallback(() => {
394
+ let e = s.current;
395
+ e && (l ? (e.pause(), u(!1)) : (e.play(), u(!0)));
396
+ }, [l]), y = E.useCallback((e) => {
397
+ (e.key === " " || e.key === "Enter") && (e.preventDefault(), v());
398
+ }, [v]), b = E.useCallback((e) => {
399
+ let n = s.current, r = c.current;
400
+ if (!n || !r || t <= 0) return;
401
+ let i = r.getBoundingClientRect(), a = e.clientX - i.left;
402
+ n.currentTime = Math.max(0, Math.min(1, a / i.width)) * t, f(n.currentTime);
403
+ }, [t]), x = E.useCallback(() => {
404
+ let e = (p + 1) % Ue.length;
405
+ m(e), s.current && (s.current.playbackRate = Ue[e]);
406
+ }, [p]), ee = t > 0 ? d / t : 0, S = Ue[p];
407
+ return /* @__PURE__ */ j("div", {
408
+ ref: o,
409
+ role: "group",
410
+ "aria-label": "Voice message player",
411
+ className: a("flex items-center gap-ds-03", r),
412
+ ...i,
413
+ children: [
414
+ /* @__PURE__ */ A("audio", {
415
+ ref: s,
416
+ src: _,
417
+ preload: "metadata"
418
+ }),
419
+ /* @__PURE__ */ A("button", {
420
+ type: "button",
421
+ onClick: v,
422
+ onKeyDown: y,
423
+ "aria-label": l ? "Pause voice message" : "Play voice message",
424
+ className: "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-pill bg-accent-9 text-accent-fg hover:bg-accent-10 active:scale-95 transition-colors duration-fast-01 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2",
425
+ children: A(l ? ke : Ae, {
426
+ size: 16,
427
+ stroke: 2,
428
+ "aria-hidden": "true"
429
+ })
430
+ }),
431
+ /* @__PURE__ */ A(V, {
432
+ ref: c,
433
+ mode: "static",
434
+ data: n,
435
+ progress: ee,
436
+ className: "cursor-pointer",
437
+ onClick: b
438
+ }),
439
+ /* @__PURE__ */ j("span", {
440
+ className: "text-ds-xs tabular-nums text-surface-fg-subtle whitespace-nowrap",
441
+ children: [
442
+ We(d),
443
+ " / ",
444
+ We(t)
445
+ ]
446
+ }),
447
+ /* @__PURE__ */ j("button", {
448
+ type: "button",
449
+ onClick: x,
450
+ "aria-label": `Playback speed ${S}x`,
451
+ className: "shrink-0 text-ds-xs bg-surface-raised rounded-pill px-ds-02 py-[1px] hover:bg-surface-raised-hover tabular-nums transition-colors duration-fast-01 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2",
452
+ children: [S, "x"]
453
+ })
454
+ ]
455
+ });
456
+ });
457
+ Ge.displayName = "AudioPlayer";
458
+ //#endregion
459
+ //#region src/composed/rich-chat-input/chat-toolbar.tsx
460
+ var Ke = E.createContext(null);
461
+ function H() {
462
+ let e = E.useContext(Ke);
463
+ if (!e) throw Error("Toolbar primitives must be used inside <ChatToolbar>");
464
+ return e;
465
+ }
466
+ function U({ onClick: e, isActive: t, disabled: n, title: r, children: i, className: o }) {
467
+ let { disabled: s } = H();
468
+ return /* @__PURE__ */ A("button", {
469
+ type: "button",
470
+ onClick: e,
471
+ disabled: n ?? s,
472
+ title: r,
473
+ "aria-label": r,
474
+ "aria-pressed": t,
475
+ className: a("inline-flex h-ds-xs-plus items-center justify-center rounded-control touch-target", !o?.includes("w-") && "w-ds-xs-plus", "transition-[color,background-color,transform] duration-fast-01 ease-productive-standard", "hover:bg-surface-raised-hover hover:text-surface-fg", "active:scale-95", "disabled:pointer-events-none disabled:opacity-action-disabled", t ? "bg-surface-raised-hover text-accent-11" : "text-surface-fg-subtle", o),
476
+ children: i
477
+ });
478
+ }
479
+ function W() {
480
+ return /* @__PURE__ */ A("div", { className: "h-4 w-px bg-surface-border-subtle mx-ds-01" });
481
+ }
482
+ function G({ children: e, className: t }) {
483
+ return /* @__PURE__ */ A("div", {
484
+ className: a("flex items-center gap-ds-01", t),
485
+ children: e
486
+ });
487
+ }
488
+ function K() {
489
+ let { editor: e } = H(), { isActive: t } = C({
490
+ editor: e,
491
+ selector: ({ editor: e }) => ({ isActive: e.isActive("bold") })
492
+ });
493
+ return /* @__PURE__ */ A(U, {
494
+ onClick: () => e.chain().focus().toggleBold().run(),
495
+ isActive: t,
496
+ title: "Bold",
497
+ children: /* @__PURE__ */ A(s, {
498
+ icon: M,
499
+ size: "xs"
500
+ })
501
+ });
502
+ }
503
+ function q() {
504
+ let { editor: e } = H(), { isActive: t } = C({
505
+ editor: e,
506
+ selector: ({ editor: e }) => ({ isActive: e.isActive("italic") })
507
+ });
508
+ return /* @__PURE__ */ A(U, {
509
+ onClick: () => e.chain().focus().toggleItalic().run(),
510
+ isActive: t,
511
+ title: "Italic",
512
+ children: /* @__PURE__ */ A(s, {
513
+ icon: we,
514
+ size: "xs"
515
+ })
516
+ });
517
+ }
518
+ function qe() {
519
+ let { editor: e } = H(), { isActive: t } = C({
520
+ editor: e,
521
+ selector: ({ editor: e }) => ({ isActive: e.isActive("underline") })
522
+ });
523
+ return /* @__PURE__ */ A(U, {
524
+ onClick: () => e.chain().focus().toggleUnderline().run(),
525
+ isActive: t,
526
+ title: "Underline",
527
+ children: /* @__PURE__ */ A(s, {
528
+ icon: L,
529
+ size: "xs"
530
+ })
531
+ });
532
+ }
533
+ function Je() {
534
+ let { editor: e } = H(), { isActive: t } = C({
535
+ editor: e,
536
+ selector: ({ editor: e }) => ({ isActive: e.isActive("strike") })
537
+ });
538
+ return /* @__PURE__ */ A(U, {
539
+ onClick: () => e.chain().focus().toggleStrike().run(),
540
+ isActive: t,
541
+ title: "Strikethrough",
542
+ children: /* @__PURE__ */ A(s, {
543
+ icon: I,
544
+ size: "xs"
545
+ })
546
+ });
547
+ }
548
+ function Ye() {
549
+ let { editor: e } = H(), { isActive: t } = C({
550
+ editor: e,
551
+ selector: ({ editor: e }) => ({ isActive: e.isActive("highlight") })
552
+ });
553
+ return /* @__PURE__ */ A(U, {
554
+ onClick: () => e.chain().focus().toggleHighlight().run(),
555
+ isActive: t,
556
+ title: "Highlight",
557
+ children: /* @__PURE__ */ A(s, {
558
+ icon: Ce,
559
+ size: "xs"
560
+ })
561
+ });
562
+ }
563
+ function Xe() {
564
+ let { editor: e } = H(), { isActive: t } = C({
565
+ editor: e,
566
+ selector: ({ editor: e }) => ({ isActive: e.isActive("code") })
567
+ });
568
+ return /* @__PURE__ */ A(U, {
569
+ onClick: () => e.chain().focus().toggleCode().run(),
570
+ isActive: t,
571
+ title: "Inline code",
572
+ children: /* @__PURE__ */ A(s, {
573
+ icon: xe,
574
+ size: "xs"
575
+ })
576
+ });
577
+ }
578
+ function Ze() {
579
+ let { editor: e } = H(), { isActive: t } = C({
580
+ editor: e,
581
+ selector: ({ editor: e }) => ({ isActive: e.isActive("bulletList") })
582
+ });
583
+ return /* @__PURE__ */ A(U, {
584
+ onClick: () => e.chain().focus().toggleBulletList().run(),
585
+ isActive: t,
586
+ title: "Bullet list",
587
+ children: /* @__PURE__ */ A(s, {
588
+ icon: Te,
589
+ size: "xs"
590
+ })
591
+ });
592
+ }
593
+ function Qe() {
594
+ let { editor: e } = H(), { isActive: t } = C({
595
+ editor: e,
596
+ selector: ({ editor: e }) => ({ isActive: e.isActive("orderedList") })
597
+ });
598
+ return /* @__PURE__ */ A(U, {
599
+ onClick: () => e.chain().focus().toggleOrderedList().run(),
600
+ isActive: t,
601
+ title: "Ordered list",
602
+ children: /* @__PURE__ */ A(s, {
603
+ icon: P,
604
+ size: "xs"
605
+ })
606
+ });
607
+ }
608
+ function $e() {
609
+ let { editor: e } = H(), { isActive: t } = C({
610
+ editor: e,
611
+ selector: ({ editor: e }) => ({ isActive: e.isActive("blockquote") })
612
+ });
613
+ return /* @__PURE__ */ A(U, {
614
+ onClick: () => e.chain().focus().toggleBlockquote().run(),
615
+ isActive: t,
616
+ title: "Quote",
617
+ children: /* @__PURE__ */ A(s, {
618
+ icon: _e,
619
+ size: "xs"
620
+ })
621
+ });
622
+ }
623
+ function et() {
624
+ let { editor: e } = H(), { isActive: t } = C({
625
+ editor: e,
626
+ selector: ({ editor: e }) => ({ isActive: e.isActive("link") })
627
+ });
628
+ return /* @__PURE__ */ A(U, {
629
+ onClick: () => {
630
+ let t = window.prompt("URL");
631
+ t && e.chain().focus().setLink({ href: t }).run();
632
+ },
633
+ isActive: t,
634
+ title: "Link",
635
+ children: /* @__PURE__ */ A(s, {
636
+ icon: N,
637
+ size: "xs"
638
+ })
639
+ });
640
+ }
641
+ function tt() {
642
+ let { editor: e } = H();
643
+ return /* @__PURE__ */ A(U, {
644
+ onClick: () => e.chain().focus().insertContent("@").run(),
645
+ title: "Mention",
646
+ children: /* @__PURE__ */ A(s, {
647
+ icon: ge,
648
+ size: "xs"
649
+ })
650
+ });
651
+ }
652
+ function J() {
653
+ let { editor: e } = H();
654
+ return /* @__PURE__ */ A(U, {
655
+ onClick: () => e.chain().focus().insertContent(":").run(),
656
+ title: "Emoji",
657
+ children: /* @__PURE__ */ A(s, {
658
+ icon: De,
659
+ size: "xs"
660
+ })
661
+ });
662
+ }
663
+ function nt() {
664
+ let { editor: e } = H();
665
+ return /* @__PURE__ */ A(U, {
666
+ onClick: () => e.chain().focus().insertContent("/").run(),
667
+ title: "Slash command",
668
+ children: /* @__PURE__ */ A(s, {
669
+ icon: F,
670
+ size: "xs"
671
+ })
672
+ });
673
+ }
674
+ function Y({ items: e, isMobile: t, hasMentions: n, hasSlashCommands: r }) {
675
+ let i = (t) => !e || e.includes(t);
676
+ return /* @__PURE__ */ j(me, { children: [
677
+ !t && /* @__PURE__ */ j(G, { children: [
678
+ i("bold") && /* @__PURE__ */ A(K, {}),
679
+ i("italic") && /* @__PURE__ */ A(q, {}),
680
+ i("underline") && /* @__PURE__ */ A(qe, {}),
681
+ i("strike") && /* @__PURE__ */ A(Je, {}),
682
+ i("highlight") && /* @__PURE__ */ A(Ye, {})
683
+ ] }),
684
+ !t && /* @__PURE__ */ A(W, {}),
685
+ !t && /* @__PURE__ */ j(G, { children: [i("bulletList") && /* @__PURE__ */ A(Ze, {}), i("orderedList") && /* @__PURE__ */ A(Qe, {})] }),
686
+ !t && (i("blockquote") || i("link") || i("code")) && /* @__PURE__ */ A(W, {}),
687
+ !t && /* @__PURE__ */ j(G, { children: [
688
+ i("blockquote") && /* @__PURE__ */ A($e, {}),
689
+ i("link") && /* @__PURE__ */ A(et, {}),
690
+ i("code") && /* @__PURE__ */ A(Xe, {})
691
+ ] }),
692
+ !t && (n || r) && /* @__PURE__ */ A(W, {}),
693
+ /* @__PURE__ */ j(G, { children: [
694
+ n && i("mention") && /* @__PURE__ */ A(tt, {}),
695
+ i("emoji") && /* @__PURE__ */ A(J, {}),
696
+ r && i("slash") && /* @__PURE__ */ A(nt, {})
697
+ ] })
698
+ ] });
699
+ }
700
+ function rt({ editor: e, toolbar: t, isMobile: n, hasMentions: r, hasSlashCommands: i, disabled: a }) {
701
+ if (t === !1) return null;
702
+ let o = typeof t != "boolean" && !Array.isArray(t), s = Array.isArray(t) ? t : null;
703
+ return /* @__PURE__ */ A(Ke.Provider, {
704
+ value: {
705
+ editor: e,
706
+ disabled: a
707
+ },
708
+ children: /* @__PURE__ */ A("div", {
709
+ role: "toolbar",
710
+ "aria-label": "Text formatting",
711
+ className: "flex flex-wrap items-center gap-ds-01 border-t border-surface-border px-ds-04 py-ds-02b",
712
+ children: o ? t : /* @__PURE__ */ A(Y, {
713
+ items: s,
714
+ isMobile: n,
715
+ hasMentions: r,
716
+ hasSlashCommands: i
717
+ })
718
+ })
719
+ });
720
+ }
721
+ //#endregion
722
+ //#region src/composed/rich-chat-input/recording-overlay.tsx
723
+ function it(e) {
724
+ let t = Math.floor(e / 60), n = Math.floor(e % 60);
725
+ return {
726
+ minutes: String(t),
727
+ separator: ":",
728
+ secs: n.toString().padStart(2, "0")
729
+ };
730
+ }
731
+ function at({ duration: e, analyserNode: t, maxDuration: n, onCancel: r }) {
732
+ let i = Le();
733
+ E.useEffect(() => {
734
+ let e = (e) => {
735
+ e.key === "Escape" && r();
736
+ };
737
+ return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
738
+ }, [r]);
739
+ let o = n != null && n > 0 && e >= n - 10, s = n != null && n > 0 && e >= n - 5, c = s ? "animate-[pulse_500ms_ease-in-out_infinite]" : "animate-[pulse_1s_ease-in-out_infinite]", l = it(e), u = s ? "text-error-11" : o ? "text-warning-11" : "text-surface-fg";
740
+ return /* @__PURE__ */ j("div", {
741
+ role: "status",
742
+ "aria-live": "polite",
743
+ "aria-label": "Recording voice message",
744
+ className: "absolute inset-0 flex items-center gap-ds-03 px-ds-04 py-ds-03 bg-surface-raised-hover rounded-surface z-10",
745
+ children: [
746
+ /* @__PURE__ */ A("span", {
747
+ className: a("w-ds-02b h-ds-02b shrink-0 rounded-pill bg-error-9", i ? "opacity-100" : c),
748
+ "aria-hidden": "true"
749
+ }),
750
+ /* @__PURE__ */ j("span", {
751
+ className: a("text-ds-sm font-mono tabular-nums whitespace-nowrap", u),
752
+ "aria-label": `${l.minutes} minutes ${l.secs} seconds`,
753
+ children: [
754
+ l.minutes,
755
+ /* @__PURE__ */ A("span", {
756
+ className: i ? void 0 : "animate-[blink_1s_step-end_infinite]",
757
+ "aria-hidden": "true",
758
+ children: l.separator
759
+ }),
760
+ l.secs
761
+ ]
762
+ }),
763
+ /* @__PURE__ */ A("div", {
764
+ className: "flex-1 min-w-0 overflow-hidden",
765
+ children: /* @__PURE__ */ A(V, {
766
+ mode: "live",
767
+ analyserNode: t,
768
+ height: 24,
769
+ barCount: 60,
770
+ className: "w-full"
771
+ })
772
+ })
773
+ ]
774
+ });
775
+ }
776
+ at.displayName = "RecordingOverlay";
777
+ //#endregion
778
+ //#region src/composed/rich-chat-input/reply-banner.tsx
779
+ function ot({ author: e, preview: t, onDismiss: n }) {
780
+ return /* @__PURE__ */ A(z.div, {
781
+ initial: {
782
+ height: 0,
783
+ opacity: 0
784
+ },
785
+ animate: {
786
+ height: "auto",
787
+ opacity: 1
788
+ },
789
+ exit: {
790
+ height: 0,
791
+ opacity: 0
792
+ },
793
+ transition: {
794
+ duration: i.moderate02,
795
+ ease: [
796
+ .2,
797
+ 0,
798
+ .38,
799
+ .9
800
+ ]
801
+ },
802
+ className: "overflow-hidden",
803
+ children: /* @__PURE__ */ j("div", {
804
+ role: "status",
805
+ "aria-label": `Replying to ${e}`,
806
+ className: "flex items-center gap-ds-03 border-b border-surface-border px-ds-04 py-ds-02b",
807
+ children: [/* @__PURE__ */ j("div", {
808
+ className: "flex-1 min-w-0",
809
+ children: [
810
+ /* @__PURE__ */ j("span", {
811
+ className: "text-ds-sm font-semibold text-surface-fg",
812
+ children: ["Replying to ", e]
813
+ }),
814
+ /* @__PURE__ */ A("span", {
815
+ className: "mx-ds-02 text-surface-fg-subtle",
816
+ children: "·"
817
+ }),
818
+ /* @__PURE__ */ A("span", {
819
+ className: "text-ds-sm text-surface-fg-muted truncate",
820
+ children: t
821
+ })
822
+ ]
823
+ }), /* @__PURE__ */ A("button", {
824
+ type: "button",
825
+ onClick: n,
826
+ className: a("inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-control touch-target", "text-surface-fg-subtle hover:text-surface-fg hover:bg-surface-raised-hover", "transition-colors duration-fast-01 ease-productive-standard", "active:scale-95"),
827
+ "aria-label": "Cancel reply",
828
+ title: "Cancel reply",
829
+ children: /* @__PURE__ */ A(s, {
830
+ icon: R,
831
+ size: "xs"
832
+ })
833
+ })]
834
+ })
835
+ });
836
+ }
837
+ //#endregion
838
+ //#region src/composed/rich-chat-input/schedule-send.tsx
839
+ function st() {
840
+ let e = /* @__PURE__ */ new Date(), t = e.getHours(), n = [], r = (t, n = 0) => {
841
+ let r = new Date(e);
842
+ return r.setDate(r.getDate() + n), r.setHours(t, 0, 0, 0), r;
843
+ }, i = (t) => {
844
+ let n = new Date(e), r = n.getDay(), i = r === 0 ? 1 : r === 1 ? 7 : 8 - r;
845
+ return n.setDate(n.getDate() + i), n.setHours(t, 0, 0, 0), n;
846
+ };
847
+ t < 9 ? (n.push({
848
+ label: "Later this morning · 9:00 AM",
849
+ date: r(9)
850
+ }), n.push({
851
+ label: "This afternoon · 1:00 PM",
852
+ date: r(13)
853
+ }), n.push({
854
+ label: "This evening · 6:00 PM",
855
+ date: r(18)
856
+ })) : t < 13 ? (n.push({
857
+ label: "This afternoon · 1:00 PM",
858
+ date: r(13)
859
+ }), n.push({
860
+ label: "This evening · 6:00 PM",
861
+ date: r(18)
862
+ }), n.push({
863
+ label: "Tomorrow morning · 9:00 AM",
864
+ date: r(9, 1)
865
+ })) : t < 18 ? (n.push({
866
+ label: "This evening · 6:00 PM",
867
+ date: r(18)
868
+ }), n.push({
869
+ label: "Tomorrow morning · 9:00 AM",
870
+ date: r(9, 1)
871
+ }), n.push({
872
+ label: "Tomorrow afternoon · 1:00 PM",
873
+ date: r(13, 1)
874
+ })) : (n.push({
875
+ label: "Tomorrow morning · 9:00 AM",
876
+ date: r(9, 1)
877
+ }), n.push({
878
+ label: "Tomorrow afternoon · 1:00 PM",
879
+ date: r(13, 1)
880
+ }));
881
+ let a = i(9);
882
+ return a.getTime() - e.getTime() > 2880 * 60 * 1e3 && n.push({
883
+ label: "Next Monday · 9:00 AM",
884
+ date: a
885
+ }), n;
886
+ }
887
+ function ct({ value: e, onChange: t }) {
888
+ let n = e.getHours() % 12 || 12, r = e.getMinutes(), i = e.getHours() >= 12, o = (n) => {
889
+ let r = new Date(e);
890
+ r.setHours(i ? n % 12 + 12 : n % 12), t(r);
891
+ }, s = (n) => {
892
+ let r = new Date(e);
893
+ r.setMinutes(n), t(r);
894
+ }, c = (n) => {
895
+ let r = new Date(e), i = r.getHours();
896
+ n && i < 12 ? r.setHours(i + 12) : !n && i >= 12 && r.setHours(i - 12), t(r);
897
+ };
898
+ return /* @__PURE__ */ j("div", {
899
+ className: "flex items-center gap-ds-02",
900
+ children: [
901
+ /* @__PURE__ */ A("select", {
902
+ value: n,
903
+ onChange: (e) => o(Number(e.target.value)),
904
+ className: "h-ds-sm rounded-control border border-surface-border-strong bg-surface-raised px-ds-02 text-ds-sm text-surface-fg focus:outline-hidden focus:ring-2 focus:ring-accent-9",
905
+ "aria-label": "Hour",
906
+ children: Array.from({ length: 12 }, (e, t) => t + 1).map((e) => /* @__PURE__ */ A("option", {
907
+ value: e,
908
+ children: e
909
+ }, e))
910
+ }),
911
+ /* @__PURE__ */ A("span", {
912
+ className: "text-ds-sm text-surface-fg-subtle font-medium",
913
+ children: ":"
914
+ }),
915
+ /* @__PURE__ */ A("select", {
916
+ value: r - r % 5,
917
+ onChange: (e) => s(Number(e.target.value)),
918
+ className: "h-ds-sm rounded-control border border-surface-border-strong bg-surface-raised px-ds-02 text-ds-sm text-surface-fg focus:outline-hidden focus:ring-2 focus:ring-accent-9",
919
+ "aria-label": "Minute",
920
+ children: Array.from({ length: 12 }, (e, t) => t * 5).map((e) => /* @__PURE__ */ A("option", {
921
+ value: e,
922
+ children: String(e).padStart(2, "0")
923
+ }, e))
924
+ }),
925
+ /* @__PURE__ */ j("div", {
926
+ className: "inline-flex rounded-control border border-surface-border-strong overflow-hidden",
927
+ children: [/* @__PURE__ */ A("button", {
928
+ type: "button",
929
+ onClick: () => c(!1),
930
+ className: a("px-ds-02b py-ds-01 text-ds-xs font-medium transition-colors duration-fast-01", i ? "bg-surface-raised text-surface-fg-subtle hover:bg-surface-raised-hover" : "bg-accent-9 text-white"),
931
+ children: "AM"
932
+ }), /* @__PURE__ */ A("button", {
933
+ type: "button",
934
+ onClick: () => c(!0),
935
+ className: a("px-ds-02b py-ds-01 text-ds-xs font-medium transition-colors duration-fast-01", i ? "bg-accent-9 text-white" : "bg-surface-raised text-surface-fg-subtle hover:bg-surface-raised-hover"),
936
+ children: "PM"
937
+ })]
938
+ })
939
+ ]
940
+ });
941
+ }
942
+ function X({ value: e, onChange: t, minDate: n }) {
943
+ let r = /* @__PURE__ */ new Date(), i = e ?? (() => {
944
+ let e = new Date(r);
945
+ return e.setHours(e.getHours() + 1, 0, 0, 0), e;
946
+ })(), a = `${i.getFullYear()}-${String(i.getMonth() + 1).padStart(2, "0")}-${String(i.getDate()).padStart(2, "0")}`, o = (e) => {
947
+ let n = e.target.value.split("-");
948
+ if (n.length !== 3) return;
949
+ let r = new Date(i);
950
+ r.setFullYear(Number(n[0]), Number(n[1]) - 1, Number(n[2])), t(r);
951
+ }, s = n ? `${n.getFullYear()}-${String(n.getMonth() + 1).padStart(2, "0")}-${String(n.getDate()).padStart(2, "0")}` : void 0;
952
+ return /* @__PURE__ */ j("div", {
953
+ className: "space-y-ds-03",
954
+ children: [/* @__PURE__ */ j("div", {
955
+ className: "flex items-center justify-between",
956
+ children: [/* @__PURE__ */ A("span", {
957
+ className: "text-ds-xs font-medium text-surface-fg-subtle",
958
+ children: "Date"
959
+ }), /* @__PURE__ */ A("input", {
960
+ type: "date",
961
+ value: a,
962
+ min: s,
963
+ onChange: o,
964
+ className: "h-ds-sm rounded-control border border-surface-border-strong bg-surface-raised px-ds-03 text-ds-sm text-surface-fg focus:outline-hidden focus:ring-2 focus:ring-accent-9"
965
+ })]
966
+ }), /* @__PURE__ */ j("div", {
967
+ className: "flex items-center justify-between",
968
+ children: [/* @__PURE__ */ A("span", {
969
+ className: "text-ds-xs font-medium text-surface-fg-subtle",
970
+ children: "Time"
971
+ }), /* @__PURE__ */ A(ct, {
972
+ value: i,
973
+ onChange: t
974
+ })]
975
+ })]
976
+ });
977
+ }
978
+ function lt({ value: e, onChange: t, minDate: n }) {
979
+ let r = /* @__PURE__ */ new Date(), i = e ?? (() => {
980
+ let e = new Date(r);
981
+ return e.setHours(e.getHours() + 1, 0, 0, 0), e;
982
+ })(), { currentMonth: a, goToPreviousMonth: o, goToNextMonth: s } = fe(i);
983
+ return /* @__PURE__ */ j("div", {
984
+ className: "space-y-ds-03",
985
+ children: [/* @__PURE__ */ A(de, {
986
+ currentMonth: a,
987
+ selected: i,
988
+ onSelect: (e) => {
989
+ let n = new Date(e);
990
+ n.setHours(i.getHours(), i.getMinutes(), 0, 0), t(n);
991
+ },
992
+ onMonthChange: (e) => {
993
+ e < a ? o() : s();
994
+ },
995
+ minDate: n,
996
+ className: "w-full"
997
+ }), /* @__PURE__ */ j("div", {
998
+ className: "flex items-center justify-between border-t border-surface-border pt-ds-03",
999
+ children: [/* @__PURE__ */ A("span", {
1000
+ className: "text-ds-xs font-medium text-surface-fg-subtle",
1001
+ children: "Time"
1002
+ }), /* @__PURE__ */ A(ct, {
1003
+ value: i,
1004
+ onChange: t
1005
+ })]
1006
+ })]
1007
+ });
1008
+ }
1009
+ function ut({ onSchedule: e, onClose: t, onOpenDialog: n }) {
1010
+ let [r, i] = E.useState(!1), [a, o] = E.useState(null), c = E.useMemo(() => st(), []), u = (n) => {
1011
+ e(n), t();
1012
+ };
1013
+ return r ? /* @__PURE__ */ j("div", {
1014
+ className: "p-ds-04",
1015
+ style: { minWidth: 270 },
1016
+ children: [
1017
+ /* @__PURE__ */ j("div", {
1018
+ className: "mb-ds-03 flex items-center justify-between",
1019
+ children: [/* @__PURE__ */ A("p", {
1020
+ className: "text-ds-sm font-medium text-surface-fg",
1021
+ children: "Pick date & time"
1022
+ }), /* @__PURE__ */ A("button", {
1023
+ type: "button",
1024
+ onClick: () => i(!1),
1025
+ className: "inline-flex items-center justify-center rounded-control p-ds-01 text-surface-fg-subtle hover:bg-surface-raised-hover hover:text-surface-fg transition-colors",
1026
+ "aria-label": "Back to presets",
1027
+ children: /* @__PURE__ */ A(s, {
1028
+ icon: R,
1029
+ size: "sm"
1030
+ })
1031
+ })]
1032
+ }),
1033
+ /* @__PURE__ */ A(X, {
1034
+ value: a,
1035
+ onChange: o,
1036
+ minDate: /* @__PURE__ */ new Date()
1037
+ }),
1038
+ /* @__PURE__ */ A("div", {
1039
+ className: "mt-ds-03 flex justify-end",
1040
+ children: /* @__PURE__ */ A(l, {
1041
+ variant: "solid",
1042
+ size: "sm",
1043
+ onClick: () => {
1044
+ a && a > /* @__PURE__ */ new Date() && (e(a), t(), o(null), i(!1));
1045
+ },
1046
+ disabled: !a || a <= /* @__PURE__ */ new Date(),
1047
+ children: "Confirm"
1048
+ })
1049
+ })
1050
+ ]
1051
+ }) : /* @__PURE__ */ j("div", {
1052
+ className: "p-ds-02",
1053
+ style: { minWidth: 260 },
1054
+ children: [
1055
+ /* @__PURE__ */ A("p", {
1056
+ className: "px-ds-03 py-ds-01 text-ds-xs font-medium text-surface-fg-subtle",
1057
+ children: "Schedule send"
1058
+ }),
1059
+ c.map((e, t) => /* @__PURE__ */ j("button", {
1060
+ type: "button",
1061
+ onClick: () => u(e.date),
1062
+ className: "flex w-full items-center gap-ds-03 rounded-control px-ds-03 py-ds-02b text-ds-sm text-surface-fg hover:bg-surface-raised-hover transition-colors duration-fast-01",
1063
+ children: [/* @__PURE__ */ A(s, {
1064
+ icon: be,
1065
+ size: "sm",
1066
+ className: "shrink-0 text-surface-fg-muted"
1067
+ }), e.label]
1068
+ }, t)),
1069
+ /* @__PURE__ */ A("div", { className: "mx-ds-02 my-ds-02 h-px bg-surface-border" }),
1070
+ /* @__PURE__ */ j("button", {
1071
+ type: "button",
1072
+ onClick: () => i(!0),
1073
+ className: "flex w-full items-center gap-ds-03 rounded-control px-ds-03 py-ds-02b text-ds-sm text-surface-fg hover:bg-surface-raised-hover transition-colors duration-fast-01",
1074
+ children: [/* @__PURE__ */ A(s, {
1075
+ icon: ve,
1076
+ size: "sm",
1077
+ className: "shrink-0 text-accent-11"
1078
+ }), "Pick date & time..."]
1079
+ }),
1080
+ n && /* @__PURE__ */ j("button", {
1081
+ type: "button",
1082
+ onClick: () => {
1083
+ n(), t();
1084
+ },
1085
+ className: "flex w-full items-center gap-ds-03 rounded-control px-ds-03 py-ds-02b text-ds-sm text-surface-fg hover:bg-surface-raised-hover transition-colors duration-fast-01",
1086
+ children: [/* @__PURE__ */ A(s, {
1087
+ icon: ve,
1088
+ size: "sm",
1089
+ className: "shrink-0 text-surface-fg-muted"
1090
+ }), "Open full picker..."]
1091
+ })
1092
+ ]
1093
+ });
1094
+ }
1095
+ function dt({ open: e, onOpenChange: t, onSchedule: n, initialDate: r }) {
1096
+ let [i, a] = E.useState(r ?? null);
1097
+ return E.useEffect(() => {
1098
+ e && a(r ?? null);
1099
+ }, [e, r]), /* @__PURE__ */ A(u, {
1100
+ open: e,
1101
+ onOpenChange: t,
1102
+ children: /* @__PURE__ */ j(d, {
1103
+ className: "sm:max-w-[380px]",
1104
+ children: [
1105
+ /* @__PURE__ */ A(p, { children: /* @__PURE__ */ A(m, { children: r ? "Reschedule message" : "Schedule send" }) }),
1106
+ /* @__PURE__ */ A(lt, {
1107
+ value: i,
1108
+ onChange: a,
1109
+ minDate: /* @__PURE__ */ new Date()
1110
+ }),
1111
+ /* @__PURE__ */ j(f, {
1112
+ className: "gap-ds-02",
1113
+ children: [/* @__PURE__ */ A(l, {
1114
+ variant: "soft",
1115
+ onClick: () => t(!1),
1116
+ children: "Cancel"
1117
+ }), /* @__PURE__ */ A(l, {
1118
+ variant: "solid",
1119
+ onClick: () => {
1120
+ i && i > /* @__PURE__ */ new Date() && (n(i), t(!1));
1121
+ },
1122
+ disabled: !i || i <= /* @__PURE__ */ new Date(),
1123
+ children: r ? "Reschedule" : "Schedule"
1124
+ })]
1125
+ })
1126
+ ]
1127
+ })
1128
+ });
1129
+ }
1130
+ function Z(e) {
1131
+ let t = /* @__PURE__ */ new Date(), n = new Date(t);
1132
+ n.setDate(n.getDate() + 1);
1133
+ let r = e.toDateString() === t.toDateString(), i = e.toDateString() === n.toDateString(), a = e.toLocaleTimeString(void 0, {
1134
+ hour: "numeric",
1135
+ minute: "2-digit"
1136
+ });
1137
+ return r ? `Today at ${a}` : i ? `Tomorrow at ${a}` : `${e.toLocaleDateString(void 0, {
1138
+ weekday: "short",
1139
+ month: "short",
1140
+ day: "numeric"
1141
+ })} at ${a}`;
1142
+ }
1143
+ function ft({ date: e, onClear: t, onEdit: n }) {
1144
+ return /* @__PURE__ */ A(z.div, {
1145
+ initial: {
1146
+ height: 0,
1147
+ opacity: 0
1148
+ },
1149
+ animate: {
1150
+ height: "auto",
1151
+ opacity: 1
1152
+ },
1153
+ exit: {
1154
+ height: 0,
1155
+ opacity: 0
1156
+ },
1157
+ transition: { duration: i.moderate01 },
1158
+ className: "overflow-hidden",
1159
+ children: /* @__PURE__ */ j("div", {
1160
+ className: "flex items-center gap-ds-03 px-ds-04 py-ds-02b text-ds-xs text-accent-11 bg-accent-2 border-b border-accent-4",
1161
+ children: [
1162
+ /* @__PURE__ */ A(s, {
1163
+ icon: be,
1164
+ size: "xs",
1165
+ className: "shrink-0"
1166
+ }),
1167
+ /* @__PURE__ */ j("span", {
1168
+ className: "flex-1 truncate",
1169
+ children: ["Scheduled for ", Z(e)]
1170
+ }),
1171
+ n && /* @__PURE__ */ A("button", {
1172
+ type: "button",
1173
+ onClick: n,
1174
+ className: "inline-flex shrink-0 items-center justify-center rounded-control-inner p-ds-01 hover:bg-accent-3 transition-colors",
1175
+ "aria-label": "Edit schedule",
1176
+ children: /* @__PURE__ */ A(s, {
1177
+ icon: Oe,
1178
+ size: "xs"
1179
+ })
1180
+ }),
1181
+ /* @__PURE__ */ A("button", {
1182
+ type: "button",
1183
+ onClick: t,
1184
+ className: "inline-flex shrink-0 items-center justify-center rounded-control-inner p-ds-01 hover:bg-accent-3 transition-colors",
1185
+ "aria-label": "Cancel schedule",
1186
+ children: /* @__PURE__ */ A(s, {
1187
+ icon: R,
1188
+ size: "xs"
1189
+ })
1190
+ })
1191
+ ]
1192
+ })
1193
+ });
1194
+ }
1195
+ //#endregion
1196
+ //#region src/composed/rich-chat-input/use-voice-recorder.ts
1197
+ function pt() {
1198
+ return typeof MediaRecorder < "u" && MediaRecorder.isTypeSupported("audio/webm;codecs=opus") ? "audio/webm;codecs=opus" : typeof MediaRecorder < "u" && MediaRecorder.isTypeSupported("audio/mp4") ? "audio/mp4" : "";
1199
+ }
1200
+ function mt(e) {
1201
+ let { maxDuration: t, onComplete: n } = e, [r, i] = k("idle"), [a, o] = k(0), [s, c] = k(null), [l, u] = k([]), d = O(null), f = O(null), p = O(null), m = O([]), h = O(null), g = O(null), _ = O(null), v = O(null), y = O(0), b = O([]), x = O(!1), ee = O(n);
1202
+ ee.current = n;
1203
+ let S = D(() => {
1204
+ h.current !== null && (clearInterval(h.current), h.current = null), g.current !== null && (clearInterval(g.current), g.current = null), _.current !== null && (clearTimeout(_.current), _.current = null), p.current &&= (p.current.getTracks().forEach((e) => e.stop()), null), f.current &&= (f.current.close().catch(() => {}), null), v.current = null, c(null), d.current = null, m.current = [];
1205
+ }, []), C = D(async () => {
1206
+ if (typeof MediaRecorder > "u") throw Error("MediaRecorder is not supported in this browser. Voice recording requires a modern browser with MediaRecorder support.");
1207
+ let e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
1208
+ p.current = e;
1209
+ let n = pt(), r = n ? new MediaRecorder(e, { mimeType: n }) : new MediaRecorder(e);
1210
+ d.current = r, m.current = [], x.current = !1;
1211
+ let a = new AudioContext();
1212
+ f.current = a;
1213
+ let s = a.createMediaStreamSource(e), l = a.createAnalyser();
1214
+ l.fftSize = 256, l.smoothingTimeConstant = .7, s.connect(l), v.current = l, c(l), r.ondataavailable = (e) => {
1215
+ e.data.size > 0 && m.current.push(e.data);
1216
+ }, r.onstop = () => {
1217
+ if (x.current) S(), i("idle"), o(0), u([]);
1218
+ else {
1219
+ let e = new Blob(m.current, { type: r.mimeType || "audio/webm" }), t = y.current, n = b.current;
1220
+ S(), i("idle"), o(0), u([]), ee.current(e, t, n);
1221
+ }
1222
+ }, r.start(), o(0), y.current = 0, h.current = setInterval(() => {
1223
+ y.current += 1, o((e) => e + 1);
1224
+ }, 1e3);
1225
+ let C = new Uint8Array(l.frequencyBinCount);
1226
+ u([]), b.current = [], g.current = setInterval(() => {
1227
+ if (v.current) {
1228
+ v.current.getByteFrequencyData(C);
1229
+ let e = 0;
1230
+ for (let t = 0; t < C.length; t++) e += C[t];
1231
+ let t = e / C.length / 255;
1232
+ b.current = [...b.current, t], u((e) => [...e, t]);
1233
+ }
1234
+ }, 100), t !== void 0 && t > 0 && (_.current = setTimeout(() => {
1235
+ d.current && d.current.state !== "inactive" && d.current.stop();
1236
+ }, t * 1e3)), i("recording");
1237
+ }, [t, S]), te = D(() => {
1238
+ d.current && d.current.state !== "inactive" && (x.current = !1, d.current.stop());
1239
+ }, []), ne = D(() => {
1240
+ d.current && d.current.state !== "inactive" ? (x.current = !0, d.current.stop()) : (S(), i("idle"), o(0), u([]));
1241
+ }, [S]), w = D(() => {
1242
+ d.current && d.current.state === "recording" && (d.current.pause(), h.current !== null && (clearInterval(h.current), h.current = null), g.current !== null && (clearInterval(g.current), g.current = null), i("paused"));
1243
+ }, []), re = D(() => {
1244
+ if (d.current && d.current.state === "paused") {
1245
+ d.current.resume(), h.current = setInterval(() => {
1246
+ y.current += 1, o((e) => e + 1);
1247
+ }, 1e3);
1248
+ let e = new Uint8Array(v.current?.frequencyBinCount ?? 128);
1249
+ g.current = setInterval(() => {
1250
+ if (v.current) {
1251
+ v.current.getByteFrequencyData(e);
1252
+ let t = 0;
1253
+ for (let n = 0; n < e.length; n++) t += e[n];
1254
+ let n = t / e.length / 255;
1255
+ b.current = [...b.current, n], u((e) => [...e, n]);
1256
+ }
1257
+ }, 100), i("recording");
1258
+ }
1259
+ }, []);
1260
+ return pe(() => () => {
1261
+ h.current !== null && clearInterval(h.current), g.current !== null && clearInterval(g.current), _.current !== null && clearTimeout(_.current), d.current && d.current.state !== "inactive" && d.current.stop(), p.current && p.current.getTracks().forEach((e) => e.stop()), f.current && f.current.close().catch(() => {});
1262
+ }, []), {
1263
+ state: r,
1264
+ duration: a,
1265
+ analyserNode: s,
1266
+ waveformData: l,
1267
+ start: C,
1268
+ stop: te,
1269
+ cancel: ne,
1270
+ pause: w,
1271
+ resume: re
1272
+ };
1273
+ }
1274
+ //#endregion
1275
+ //#region src/composed/rich-chat-input.tsx
1276
+ var ht = {
1277
+ compact: {
1278
+ minHeight: 44,
1279
+ maxHeight: 256,
1280
+ showToolbar: !0,
1281
+ toolbarPosition: "bottom"
1282
+ },
1283
+ expanded: {
1284
+ minHeight: 96,
1285
+ maxHeight: 384,
1286
+ showToolbar: !0,
1287
+ toolbarPosition: "bottom"
1288
+ },
1289
+ minimal: {
1290
+ minHeight: 44,
1291
+ maxHeight: 128,
1292
+ showToolbar: !1,
1293
+ toolbarPosition: "bottom"
1294
+ },
1295
+ inline: {
1296
+ minHeight: 40,
1297
+ maxHeight: 160,
1298
+ showToolbar: !1,
1299
+ toolbarPosition: "top"
1300
+ }
1301
+ }, gt = [
1302
+ "prose prose-sm max-w-none focus:outline-hidden",
1303
+ "font-body text-ds-md leading-relaxed text-surface-fg",
1304
+ "[&_p.is-editor-empty:first-child]:relative",
1305
+ "[&_p.is-editor-empty:first-child::before]:text-surface-fg-subtle [&_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)] [&_p.is-editor-empty:first-child::before]:pointer-events-none [&_p.is-editor-empty:first-child::before]:absolute [&_p.is-editor-empty:first-child::before]:left-0 [&_p.is-editor-empty:first-child::before]:top-0 [&_p.is-editor-empty:first-child::before]:w-full [&_p.is-editor-empty:first-child::before]:truncate",
1306
+ "[&_p]:mb-ds-01 [&_p]:text-surface-fg",
1307
+ "[&_p:last-child]:mb-0",
1308
+ "[&_ul]:ml-ds-04 [&_ul]:list-disc [&_ol]:ml-ds-04 [&_ol]:list-decimal",
1309
+ "[&_li]:text-surface-fg",
1310
+ "[&_code]:rounded [&_code]:bg-surface-raised [&_code]:px-ds-02 [&_code]:py-[1px] [&_code]:text-ds-md [&_code]:text-accent-11",
1311
+ "[&_strong]:font-semibold [&_strong]:text-surface-fg",
1312
+ "[&_mark]:rounded-xs [&_mark]:bg-warning-3 [&_mark]:px-[2px]",
1313
+ "[&_a]:text-accent-11 [&_a]:underline",
1314
+ "[&_.mention]:rounded-control-inner [&_.mention]:bg-accent-2 [&_.mention]:px-ds-02 [&_.mention]:py-[1px] [&_.mention]:font-medium [&_.mention]:text-accent-11"
1315
+ ].join(" ");
1316
+ function _t({ options: e }) {
1317
+ let [t, n] = E.useState(!1), r = E.useRef(null);
1318
+ return E.useEffect(() => {
1319
+ if (!t) return;
1320
+ let e = (e) => {
1321
+ r.current && !r.current.contains(e.target) && n(!1);
1322
+ };
1323
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
1324
+ }, [t]), /* @__PURE__ */ j("div", {
1325
+ ref: r,
1326
+ className: "relative",
1327
+ children: [/* @__PURE__ */ A("button", {
1328
+ type: "button",
1329
+ onClick: () => n((e) => !e),
1330
+ title: "More send options",
1331
+ "aria-label": "More send options",
1332
+ "aria-expanded": t,
1333
+ className: a("inline-flex h-ds-xs-plus w-5 items-center justify-center rounded-control touch-target", "text-surface-fg-subtle hover:bg-surface-raised-hover hover:text-surface-fg", "transition-colors duration-fast-01 ease-productive-standard", t && "bg-surface-raised-hover text-surface-fg"),
1334
+ children: /* @__PURE__ */ A(s, {
1335
+ icon: ye,
1336
+ size: "xs"
1337
+ })
1338
+ }), t && /* @__PURE__ */ j("div", {
1339
+ className: "absolute bottom-full right-0 mb-ds-02 min-w-[200px] rounded-surface border border-surface-border-strong bg-surface-overlay p-ds-02 shadow-floating z-popover",
1340
+ children: [/* @__PURE__ */ A("p", {
1341
+ className: "px-ds-03 py-ds-01 text-ds-xs font-medium text-surface-fg-subtle",
1342
+ children: "Send options"
1343
+ }), e.map((e, t) => /* @__PURE__ */ j("button", {
1344
+ type: "button",
1345
+ onClick: () => {
1346
+ e.onSelect(), n(!1);
1347
+ },
1348
+ className: "flex w-full items-center gap-ds-03 rounded-control px-ds-03 py-ds-02 text-ds-sm text-surface-fg hover:bg-surface-raised-hover transition-colors duration-fast-01",
1349
+ children: [e.icon && /* @__PURE__ */ A(e.icon, { className: "h-ico-sm w-ico-sm text-surface-fg-muted" }), e.label]
1350
+ }, t))]
1351
+ })]
1352
+ });
1353
+ }
1354
+ var vt = E.lazy(() => import("@emoji-mart/react"));
1355
+ function yt({ set: e = "native", onSelect: t, onClose: n }) {
1356
+ let [r, i] = E.useState(null), { colorMode: a } = ie(), o = E.useRef(null);
1357
+ E.useEffect(() => {
1358
+ (g[e] ?? g.native)().then((e) => i(e.default));
1359
+ }, [e]), E.useEffect(() => {
1360
+ let e = (e) => {
1361
+ o.current && !o.current.contains(e.target) && n();
1362
+ };
1363
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
1364
+ }, [n]), E.useEffect(() => {
1365
+ let e = (e) => {
1366
+ e.key === "Escape" && n();
1367
+ };
1368
+ return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
1369
+ }, [n]);
1370
+ let s = /* @__PURE__ */ A("div", {
1371
+ className: "flex h-[350px] w-[352px] items-center justify-center rounded-surface border border-surface-border-strong bg-surface-overlay shadow-floating",
1372
+ children: /* @__PURE__ */ A("span", {
1373
+ className: "text-ds-sm text-surface-fg-subtle",
1374
+ children: "Loading..."
1375
+ })
1376
+ });
1377
+ return /* @__PURE__ */ A("div", {
1378
+ ref: o,
1379
+ className: "rounded-surface border border-surface-border-strong bg-surface-overlay shadow-floating overflow-hidden",
1380
+ children: r ? /* @__PURE__ */ A(E.Suspense, {
1381
+ fallback: s,
1382
+ children: /* @__PURE__ */ A(vt, {
1383
+ data: r,
1384
+ set: e,
1385
+ onEmojiSelect: (e) => t({
1386
+ id: e.id,
1387
+ native: e.native
1388
+ }),
1389
+ theme: a === "dark" ? "dark" : "light",
1390
+ previewPosition: "none",
1391
+ skinTonePosition: "none"
1392
+ })
1393
+ }) : s
1394
+ });
1395
+ }
1396
+ function Q({ onClick: e, isActive: t = !1, title: n, children: r }) {
1397
+ return /* @__PURE__ */ A("button", {
1398
+ type: "button",
1399
+ onClick: e,
1400
+ title: n,
1401
+ "aria-label": n,
1402
+ "aria-pressed": t,
1403
+ className: a("inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-control touch-target", "transition-colors duration-fast-01 ease-productive-standard", "hover:bg-surface-raised-hover", t ? "bg-surface-raised-hover text-accent-11" : "text-surface-fg-subtle"),
1404
+ children: r
1405
+ });
1406
+ }
1407
+ function bt({ editor: e }) {
1408
+ let t = C({
1409
+ editor: e,
1410
+ selector: ({ editor: e }) => ({
1411
+ isBold: e.isActive("bold"),
1412
+ isItalic: e.isActive("italic"),
1413
+ isUnderline: e.isActive("underline"),
1414
+ isStrike: e.isActive("strike"),
1415
+ isHighlight: e.isActive("highlight"),
1416
+ isCode: e.isActive("code")
1417
+ })
1418
+ });
1419
+ return /* @__PURE__ */ j(S, {
1420
+ editor: e,
1421
+ className: "flex gap-ds-01 rounded-surface border border-surface-border-strong bg-surface-overlay p-ds-02 shadow-floating",
1422
+ children: [
1423
+ /* @__PURE__ */ A(Q, {
1424
+ onClick: () => e.chain().focus().toggleBold().run(),
1425
+ isActive: t.isBold,
1426
+ title: "Bold",
1427
+ children: /* @__PURE__ */ A(s, {
1428
+ icon: M,
1429
+ size: "xs"
1430
+ })
1431
+ }),
1432
+ /* @__PURE__ */ A(Q, {
1433
+ onClick: () => e.chain().focus().toggleItalic().run(),
1434
+ isActive: t.isItalic,
1435
+ title: "Italic",
1436
+ children: /* @__PURE__ */ A(s, {
1437
+ icon: we,
1438
+ size: "xs"
1439
+ })
1440
+ }),
1441
+ /* @__PURE__ */ A(Q, {
1442
+ onClick: () => e.chain().focus().toggleUnderline().run(),
1443
+ isActive: t.isUnderline,
1444
+ title: "Underline",
1445
+ children: /* @__PURE__ */ A(s, {
1446
+ icon: L,
1447
+ size: "xs"
1448
+ })
1449
+ }),
1450
+ /* @__PURE__ */ A(Q, {
1451
+ onClick: () => e.chain().focus().toggleStrike().run(),
1452
+ isActive: t.isStrike,
1453
+ title: "Strikethrough",
1454
+ children: /* @__PURE__ */ A(s, {
1455
+ icon: I,
1456
+ size: "xs"
1457
+ })
1458
+ }),
1459
+ /* @__PURE__ */ A(Q, {
1460
+ onClick: () => e.chain().focus().toggleHighlight().run(),
1461
+ isActive: t.isHighlight,
1462
+ title: "Highlight",
1463
+ children: /* @__PURE__ */ A(s, {
1464
+ icon: Ce,
1465
+ size: "xs"
1466
+ })
1467
+ }),
1468
+ /* @__PURE__ */ A(Q, {
1469
+ onClick: () => e.chain().focus().toggleCode().run(),
1470
+ isActive: t.isCode,
1471
+ title: "Code",
1472
+ children: /* @__PURE__ */ A(s, {
1473
+ icon: xe,
1474
+ size: "xs"
1475
+ })
1476
+ })
1477
+ ]
1478
+ });
1479
+ }
1480
+ var xt = E.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message...", disabled: d = !1, content: f = "", variant: p = "compact", enterBehavior: m = "send", maxLength: g, charCountDisplay: S = "near-limit", mentions: w, onMentionSearch: T, onMentionSelect: ie, onFileUpload: de, onImageUpload: fe, slashCommands: D, onVoiceRecord: pe, onTranscribe: O, maxDuration: k, replyTo: me, onTyping: ge, onEmpty: _e, isStreaming: M = !1, onCancel: ve, leadingSlot: ye, trailingSlot: xe, disclaimer: Se, toolbar: Ce = !0, sendOptions: we, onSchedule: N, actionButton: Te, emojiSet: P = "native", className: Oe, ...ke }, Ae) {
1481
+ let [F, I] = E.useState("idle"), [L, R] = E.useState(!1), [Le, Re] = E.useState(!1), [B, ze] = E.useState(null), [Ve, V] = E.useState(!1), [Ue, We] = E.useState(!1), [Ke, H] = E.useState(0), U = E.useRef(null), W = E.useRef(null);
1482
+ E.useEffect(() => {
1483
+ if (!Le || !U.current || !W.current) return;
1484
+ let i = U.current, a = W.current, o = () => {
1485
+ e(i, a, {
1486
+ placement: "top-end",
1487
+ middleware: [
1488
+ n(8),
1489
+ r(),
1490
+ t({ padding: 8 })
1491
+ ]
1492
+ }).then(({ x: e, y: t }) => {
1493
+ Object.assign(a.style, {
1494
+ left: `${e}px`,
1495
+ top: `${t}px`
1496
+ });
1497
+ });
1498
+ };
1499
+ return o(), window.addEventListener("scroll", o, !0), window.addEventListener("resize", o), () => {
1500
+ window.removeEventListener("scroll", o, !0), window.removeEventListener("resize", o);
1501
+ };
1502
+ }, [Le]);
1503
+ let [G, K] = E.useState([]), [q, qe] = E.useState(null), [Je, Ye] = E.useState(!1), Xe = E.useRef(null), Ze = E.useRef(null), Qe = E.useRef(void 0), $e = E.useRef(void 0), et = E.useRef(m);
1504
+ et.current = m;
1505
+ let tt = c(), J = ht[p], nt = J.maxHeight, Y = mt({
1506
+ maxDuration: k,
1507
+ onComplete: async (e, t, n) => {
1508
+ if (pe?.(e, t), O) {
1509
+ let n = await O(e, t);
1510
+ if (n != null) {
1511
+ X?.chain().focus().insertContent(n).run(), I("idle");
1512
+ return;
1513
+ }
1514
+ }
1515
+ qe({
1516
+ blob: e,
1517
+ duration: t,
1518
+ waveformData: n
1519
+ }), I("review");
1520
+ }
1521
+ }), it = E.useCallback(() => {
1522
+ Y.start(), I("recording");
1523
+ }, [Y]), st = E.useCallback(() => {
1524
+ Y.stop();
1525
+ }, [Y]), ct = E.useCallback(() => {
1526
+ Y.cancel(), I("idle");
1527
+ }, [Y]), X = v({
1528
+ immediatelyRender: !1,
1529
+ extensions: E.useMemo(() => {
1530
+ let e = [
1531
+ ne.configure({
1532
+ heading: !1,
1533
+ horizontalRule: !1,
1534
+ codeBlock: !1,
1535
+ blockquote: !1,
1536
+ link: {
1537
+ openOnClick: !1,
1538
+ HTMLAttributes: { class: "text-accent-11 underline" }
1539
+ }
1540
+ }),
1541
+ y.configure({ placeholder: u }),
1542
+ ee.configure({ multicolor: !1 }),
1543
+ te,
1544
+ re.configure({ limit: g || void 0 }),
1545
+ le,
1546
+ se,
1547
+ ce(P),
1548
+ x.create({
1549
+ name: "enterToSend",
1550
+ addKeyboardShortcuts() {
1551
+ return {
1552
+ Enter: () => et.current === "send" ? ($e.current?.(), !0) : !1,
1553
+ "Shift-Enter": () => et.current === "send" ? (this.editor.commands.splitBlock(), !0) : !1,
1554
+ "Mod-Enter": () => ($e.current?.(), !0)
1555
+ };
1556
+ }
1557
+ })
1558
+ ];
1559
+ return (w || T) && e.push(b.configure({
1560
+ HTMLAttributes: { class: "mention" },
1561
+ suggestion: {
1562
+ items: async ({ query: e }) => T ? await T(e) : w ? w.filter((t) => t.label.toLowerCase().includes(e.toLowerCase())).slice(0, 8) : [],
1563
+ render: ue(ie)
1564
+ }
1565
+ })), D && e.push(Be(D)), e;
1566
+ }, [
1567
+ u,
1568
+ g,
1569
+ P,
1570
+ !!w,
1571
+ !!T,
1572
+ !!D
1573
+ ]),
1574
+ content: f || void 0,
1575
+ editable: !d,
1576
+ editorProps: {
1577
+ attributes: { class: gt },
1578
+ handlePaste: (e, t) => {
1579
+ let n = Array.from(t.clipboardData?.files ?? []);
1580
+ return n.length > 0 ? (n.forEach(Z), !0) : !1;
1581
+ }
1582
+ }
1583
+ }), lt = E.useCallback(() => {
1584
+ if (!X) return;
1585
+ let e = !X.isEmpty, t = G.length > 0, n = !!q;
1586
+ if (!e && !t && !n || M) return;
1587
+ let r = {
1588
+ html: e ? X.getHTML() : "",
1589
+ plainText: e ? X.getText() : ""
1590
+ };
1591
+ t && (r.attachments = G.filter((e) => !e.uploading && e.url).map((e) => ({
1592
+ url: e.url,
1593
+ name: e.name,
1594
+ size: e.size,
1595
+ type: e.type
1596
+ }))), n && (r.voiceNote = {
1597
+ blob: q.blob,
1598
+ duration: q.duration
1599
+ }), B && N ? N(r, B) : o(r), X.commands.clearContent(), K([]), qe(null), ze(null), I("idle");
1600
+ }, [
1601
+ X,
1602
+ G,
1603
+ q,
1604
+ M,
1605
+ o,
1606
+ N,
1607
+ B
1608
+ ]);
1609
+ $e.current = lt, E.useEffect(() => {
1610
+ if (!X || !ge) return;
1611
+ let e = () => {
1612
+ ge(!0), clearTimeout(Qe.current), Qe.current = setTimeout(() => ge(!1), 2e3);
1613
+ };
1614
+ return X.on("update", e), () => {
1615
+ X.off("update", e), clearTimeout(Qe.current);
1616
+ };
1617
+ }, [X, ge]), E.useEffect(() => {
1618
+ if (!X || !_e) return;
1619
+ let e = () => {
1620
+ _e(X.isEmpty);
1621
+ };
1622
+ return X.on("update", e), e(), () => {
1623
+ X.off("update", e);
1624
+ };
1625
+ }, [X, _e]);
1626
+ let Z = E.useCallback(async (e) => {
1627
+ let t = Math.random().toString(36).slice(2), n = e.type.startsWith("image/");
1628
+ K((r) => [...r, {
1629
+ id: t,
1630
+ name: e.name,
1631
+ size: e.size,
1632
+ type: n ? "image" : "file",
1633
+ uploading: !0
1634
+ }]);
1635
+ try {
1636
+ if (n && fe) {
1637
+ let n = await fe(e);
1638
+ K((e) => e.map((e) => e.id === t ? {
1639
+ ...e,
1640
+ url: n,
1641
+ uploading: !1
1642
+ } : e));
1643
+ } else if (de) {
1644
+ let n = await de(e);
1645
+ K((e) => e.map((e) => e.id === t ? {
1646
+ ...e,
1647
+ url: n.url,
1648
+ name: n.name,
1649
+ size: n.size,
1650
+ uploading: !1
1651
+ } : e));
1652
+ } else if (n) {
1653
+ let n = URL.createObjectURL(e);
1654
+ K((e) => e.map((e) => e.id === t ? {
1655
+ ...e,
1656
+ url: n,
1657
+ uploading: !1
1658
+ } : e));
1659
+ } else K((e) => e.filter((e) => e.id !== t));
1660
+ } catch {
1661
+ K((e) => e.filter((e) => e.id !== t));
1662
+ }
1663
+ }, [de, fe]), pt = E.useCallback((e) => {
1664
+ K((t) => t.filter((t) => t.id !== e));
1665
+ }, []), vt = E.useCallback((e) => {
1666
+ e.preventDefault(), Ye(!1), Array.from(e.dataTransfer.files).forEach(Z);
1667
+ }, [Z]), Q = E.useCallback((e) => {
1668
+ Array.from(e.target.files || []).forEach(Z), e.target.value = "";
1669
+ }, [Z]), xt = E.useCallback(() => {
1670
+ qe(null), I("idle");
1671
+ }, []), St = C({
1672
+ editor: X,
1673
+ selector: ({ editor: e }) => e ? { editorIsEmpty: e.isEmpty } : null
1674
+ })?.editorIsEmpty ?? !0;
1675
+ E.useEffect(() => {
1676
+ if (!X) return;
1677
+ let e = () => {
1678
+ H(X.state.doc.textBetween(0, X.state.doc.content.size, void 0, " ").length);
1679
+ };
1680
+ return e(), X.on("update", e), () => {
1681
+ X.off("update", e);
1682
+ };
1683
+ }, [X]);
1684
+ let Ct = !St || G.length > 0 || !!q, wt = L || F === "review" || p === "expanded", $ = "icon-md";
1685
+ return /* @__PURE__ */ j("div", {
1686
+ ref: Ae,
1687
+ className: a("border-t border-surface-border-subtle px-ds-05 py-ds-04", "flex items-center gap-ds-03", Oe),
1688
+ ...ke,
1689
+ children: [
1690
+ Te !== !1 && (Te ?? (de || fe ? /* @__PURE__ */ A(l, {
1691
+ variant: "solid",
1692
+ size: "icon-md",
1693
+ onClick: () => Xe.current?.click(),
1694
+ title: "Attach",
1695
+ "aria-label": "Attach file",
1696
+ className: "shrink-0",
1697
+ children: /* @__PURE__ */ A(s, {
1698
+ icon: je,
1699
+ size: "md"
1700
+ })
1701
+ }) : null)),
1702
+ /* @__PURE__ */ j("div", {
1703
+ role: "region",
1704
+ "aria-label": "Message composer",
1705
+ className: a("flex-1 min-w-0 overflow-hidden rounded-surface border border-surface-border-strong bg-surface-raised-hover", "transition-[color,background-color,border-color,box-shadow] duration-fast-02 ease-productive-standard", "hover:bg-surface-raised-active", "focus-within:ring-2 focus-within:ring-accent-9 focus-within:ring-offset-2 focus-within:border-accent-9", F === "recording" && "border-error-7/30", Je && "border-dashed border-accent-7 bg-accent-2", d && "opacity-action-disabled cursor-not-allowed"),
1706
+ onFocus: () => We(!0),
1707
+ onBlur: (e) => {
1708
+ e.currentTarget.contains(e.relatedTarget) || We(!1);
1709
+ },
1710
+ onDragOver: (e) => {
1711
+ e.preventDefault(), Ye(!0);
1712
+ },
1713
+ onDragLeave: () => Ye(!1),
1714
+ onDrop: vt,
1715
+ children: [
1716
+ ye,
1717
+ /* @__PURE__ */ A(Ie, { children: me && /* @__PURE__ */ A(ot, {
1718
+ author: me.author,
1719
+ preview: me.preview,
1720
+ onDismiss: me.onDismiss
1721
+ }, "reply") }),
1722
+ /* @__PURE__ */ A(Ie, { children: B && /* @__PURE__ */ A(ft, {
1723
+ date: B,
1724
+ onEdit: () => V(!0),
1725
+ onClear: () => ze(null)
1726
+ }, "schedule") }),
1727
+ /* @__PURE__ */ A(Ie, { children: G.length > 0 && /* @__PURE__ */ A(He, {
1728
+ attachments: G,
1729
+ onRemoveAttachment: pt
1730
+ }, "attachments") }),
1731
+ J.toolbarPosition === "top" && X && /* @__PURE__ */ A("div", {
1732
+ className: a("grid transition-[grid-template-rows,opacity] duration-moderate-01 ease-productive-standard", L ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0 pointer-events-none"),
1733
+ children: /* @__PURE__ */ A("div", {
1734
+ className: "overflow-hidden",
1735
+ children: /* @__PURE__ */ A(rt, {
1736
+ editor: X,
1737
+ toolbar: Ce,
1738
+ isMobile: !1,
1739
+ hasMentions: !!(w || T),
1740
+ hasSlashCommands: !!D,
1741
+ disabled: d
1742
+ })
1743
+ })
1744
+ }),
1745
+ /* @__PURE__ */ j("div", {
1746
+ className: "relative",
1747
+ children: [F === "recording" && /* @__PURE__ */ A(at, {
1748
+ duration: Y.duration,
1749
+ analyserNode: Y.analyserNode,
1750
+ maxDuration: k,
1751
+ onCancel: ct
1752
+ }), /* @__PURE__ */ j("div", {
1753
+ ref: Ze,
1754
+ className: a("flex items-center px-ds-04 py-ds-03 cursor-text [&_.tiptap]:w-full [&_.tiptap]:outline-hidden", F === "recording" && "invisible"),
1755
+ style: {
1756
+ minHeight: J.minHeight,
1757
+ maxHeight: nt,
1758
+ overflowY: "auto"
1759
+ },
1760
+ onClick: () => X?.commands.focus(),
1761
+ children: [/* @__PURE__ */ A("div", {
1762
+ className: "flex-1 min-w-0",
1763
+ children: /* @__PURE__ */ A(_, { editor: X })
1764
+ }), X && F !== "recording" && /* @__PURE__ */ j("div", {
1765
+ className: "flex items-center gap-ds-01 shrink-0 ml-ds-03",
1766
+ children: [/* @__PURE__ */ A("button", {
1767
+ type: "button",
1768
+ onClick: () => R((e) => !e),
1769
+ title: L ? "Hide formatting" : "Show formatting",
1770
+ "aria-label": L ? "Hide formatting" : "Show formatting",
1771
+ "aria-pressed": L,
1772
+ className: a("inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-control touch-target", "transition-colors duration-fast-01 ease-productive-standard", "hover:bg-surface-raised-hover", L ? "bg-surface-raised-hover text-accent-11" : "text-surface-fg-subtle"),
1773
+ children: /* @__PURE__ */ A(s, {
1774
+ icon: Pe,
1775
+ size: "xs"
1776
+ })
1777
+ }), /* @__PURE__ */ j("div", {
1778
+ className: "relative",
1779
+ children: [/* @__PURE__ */ A("button", {
1780
+ ref: U,
1781
+ type: "button",
1782
+ onClick: () => Re((e) => !e),
1783
+ title: "Emoji",
1784
+ "aria-label": "Emoji",
1785
+ className: a("inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-control touch-target transition-colors duration-fast-01", Le ? "bg-surface-raised-hover text-accent-11" : "text-surface-fg-subtle hover:bg-surface-raised-hover hover:text-surface-fg"),
1786
+ children: /* @__PURE__ */ A(s, {
1787
+ icon: De,
1788
+ size: "xs"
1789
+ })
1790
+ }), Le && he.createPortal(/* @__PURE__ */ A("div", {
1791
+ ref: W,
1792
+ className: "absolute z-popover",
1793
+ style: {
1794
+ top: 0,
1795
+ left: 0
1796
+ },
1797
+ children: /* @__PURE__ */ A(yt, {
1798
+ set: P,
1799
+ onSelect: async ({ id: e, native: t }) => {
1800
+ let n = oe(await ae(P), e);
1801
+ n ? X.chain().focus().insertContent({
1802
+ type: "emojiNode",
1803
+ attrs: {
1804
+ id: e,
1805
+ native: n.native,
1806
+ set: P,
1807
+ x: n.x,
1808
+ y: n.y
1809
+ }
1810
+ }).run() : X.chain().focus().insertContent(t).run(), Re(!1);
1811
+ },
1812
+ onClose: () => Re(!1)
1813
+ })
1814
+ }), document.body)]
1815
+ })]
1816
+ })]
1817
+ })]
1818
+ }),
1819
+ F === "review" && q && /* @__PURE__ */ j("div", {
1820
+ className: "flex items-center gap-ds-03 px-ds-04 py-ds-02b border-b border-surface-border",
1821
+ children: [/* @__PURE__ */ A(Ge, {
1822
+ src: q.blob,
1823
+ duration: q.duration,
1824
+ waveformData: q.waveformData,
1825
+ className: "flex-1"
1826
+ }), /* @__PURE__ */ A(l, {
1827
+ variant: "ghost",
1828
+ size: "icon-sm",
1829
+ onClick: xt,
1830
+ "aria-label": "Discard voice note",
1831
+ title: "Discard voice note",
1832
+ className: "text-surface-fg-subtle hover:text-error-11",
1833
+ children: /* @__PURE__ */ A(s, {
1834
+ icon: Fe,
1835
+ size: "sm"
1836
+ })
1837
+ })]
1838
+ }),
1839
+ tt && X && !St && /* @__PURE__ */ A(bt, { editor: X }),
1840
+ J.toolbarPosition === "bottom" && X && /* @__PURE__ */ A("div", {
1841
+ className: a("grid transition-[grid-template-rows,opacity] duration-moderate-01 ease-productive-standard", wt ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0 pointer-events-none"),
1842
+ children: /* @__PURE__ */ A("div", {
1843
+ className: "overflow-hidden",
1844
+ children: /* @__PURE__ */ A(rt, {
1845
+ editor: X,
1846
+ toolbar: Ce,
1847
+ isMobile: tt,
1848
+ hasMentions: !!(w || T),
1849
+ hasSlashCommands: !!D,
1850
+ disabled: d
1851
+ })
1852
+ })
1853
+ }),
1854
+ g && S !== "hidden" && (() => {
1855
+ let e = Ke / g;
1856
+ return S === "always" || S === "focus" && Ue || (S === "near-limit" || !S) && e >= .8 || e >= 1 ? /* @__PURE__ */ j("div", {
1857
+ className: a("flex justify-end px-ds-04 pb-ds-02 text-ds-xs tabular-nums transition-opacity duration-fast-01", e >= 1 ? "text-error-11 font-medium" : e >= .9 ? "text-warning-11" : "text-surface-fg-subtle"),
1858
+ children: [
1859
+ Ke,
1860
+ "/",
1861
+ g
1862
+ ]
1863
+ }) : null;
1864
+ })(),
1865
+ xe,
1866
+ /* @__PURE__ */ A("input", {
1867
+ ref: Xe,
1868
+ type: "file",
1869
+ multiple: !0,
1870
+ className: "hidden",
1871
+ onChange: Q
1872
+ })
1873
+ ]
1874
+ }),
1875
+ /* @__PURE__ */ j("div", {
1876
+ className: "flex items-center gap-ds-02 shrink-0",
1877
+ children: [we && we.length > 0 && F !== "recording" && /* @__PURE__ */ A(_t, { options: we }), /* @__PURE__ */ j(Ie, {
1878
+ mode: "popLayout",
1879
+ initial: !1,
1880
+ children: [
1881
+ F === "recording" && /* @__PURE__ */ j(z.div, {
1882
+ initial: {
1883
+ scale: .8,
1884
+ opacity: 0
1885
+ },
1886
+ animate: {
1887
+ scale: 1,
1888
+ opacity: 1
1889
+ },
1890
+ exit: {
1891
+ scale: .8,
1892
+ opacity: 0
1893
+ },
1894
+ transition: { duration: i.moderate01 },
1895
+ className: "flex items-center gap-ds-02",
1896
+ children: [/* @__PURE__ */ A(l, {
1897
+ variant: "soft",
1898
+ size: $,
1899
+ onClick: ct,
1900
+ "aria-label": "Cancel recording",
1901
+ title: "Cancel recording",
1902
+ className: "text-surface-fg-subtle hover:text-error-11",
1903
+ children: /* @__PURE__ */ A(s, {
1904
+ icon: Fe,
1905
+ size: "md"
1906
+ })
1907
+ }), /* @__PURE__ */ A(l, {
1908
+ variant: "solid",
1909
+ size: $,
1910
+ color: "error",
1911
+ onClick: st,
1912
+ "aria-label": "Stop recording",
1913
+ title: "Stop recording",
1914
+ children: /* @__PURE__ */ A(s, {
1915
+ icon: Ne,
1916
+ size: "md"
1917
+ })
1918
+ })]
1919
+ }, "recording"),
1920
+ M && F !== "recording" && /* @__PURE__ */ A(z.div, {
1921
+ initial: {
1922
+ scale: .8,
1923
+ opacity: 0
1924
+ },
1925
+ animate: {
1926
+ scale: 1,
1927
+ opacity: 1
1928
+ },
1929
+ exit: {
1930
+ scale: .8,
1931
+ opacity: 0
1932
+ },
1933
+ transition: { duration: i.moderate01 },
1934
+ children: /* @__PURE__ */ A(l, {
1935
+ variant: "solid",
1936
+ size: $,
1937
+ color: "error",
1938
+ onClick: ve,
1939
+ "aria-label": "Stop",
1940
+ title: "Stop",
1941
+ children: /* @__PURE__ */ A(s, {
1942
+ icon: Ne,
1943
+ size: "md"
1944
+ })
1945
+ })
1946
+ }, "streaming"),
1947
+ !M && F !== "recording" && Ct && N && /* @__PURE__ */ A(z.div, {
1948
+ initial: {
1949
+ scale: .8,
1950
+ opacity: 0
1951
+ },
1952
+ animate: {
1953
+ scale: 1,
1954
+ opacity: 1
1955
+ },
1956
+ exit: {
1957
+ scale: .8,
1958
+ opacity: 0
1959
+ },
1960
+ transition: { duration: i.moderate01 },
1961
+ children: /* @__PURE__ */ A(h, {
1962
+ onClick: lt,
1963
+ disabled: d,
1964
+ "aria-label": B ? "Schedule send" : "Send",
1965
+ size: $,
1966
+ dropdownContent: /* @__PURE__ */ A(ut, {
1967
+ onSchedule: (e) => ze(e),
1968
+ onClose: () => {},
1969
+ onOpenDialog: () => V(!0)
1970
+ }),
1971
+ children: /* @__PURE__ */ A(s, {
1972
+ icon: B ? be : Me,
1973
+ size: "md"
1974
+ })
1975
+ })
1976
+ }, "split-send"),
1977
+ !M && F !== "recording" && Ct && !N && /* @__PURE__ */ A(z.div, {
1978
+ initial: {
1979
+ scale: .8,
1980
+ opacity: 0
1981
+ },
1982
+ animate: {
1983
+ scale: 1,
1984
+ opacity: 1
1985
+ },
1986
+ exit: {
1987
+ scale: .8,
1988
+ opacity: 0
1989
+ },
1990
+ transition: { duration: i.moderate01 },
1991
+ children: /* @__PURE__ */ A(l, {
1992
+ variant: "solid",
1993
+ size: $,
1994
+ onClick: lt,
1995
+ disabled: d,
1996
+ "aria-label": "Send",
1997
+ title: "Send",
1998
+ children: /* @__PURE__ */ A(s, {
1999
+ icon: Me,
2000
+ size: "md"
2001
+ })
2002
+ })
2003
+ }, "send"),
2004
+ !M && F !== "recording" && !Ct && pe && /* @__PURE__ */ A(z.div, {
2005
+ initial: {
2006
+ scale: .8,
2007
+ opacity: 0
2008
+ },
2009
+ animate: {
2010
+ scale: 1,
2011
+ opacity: 1
2012
+ },
2013
+ exit: {
2014
+ scale: .8,
2015
+ opacity: 0
2016
+ },
2017
+ transition: { duration: i.moderate01 },
2018
+ children: /* @__PURE__ */ A(l, {
2019
+ variant: "soft",
2020
+ size: $,
2021
+ onClick: it,
2022
+ "aria-label": "Record voice message",
2023
+ title: "Record voice message",
2024
+ children: /* @__PURE__ */ A(s, {
2025
+ icon: Ee,
2026
+ size: "md"
2027
+ })
2028
+ })
2029
+ }, "mic"),
2030
+ !M && F !== "recording" && !Ct && !pe && /* @__PURE__ */ A(z.div, {
2031
+ initial: {
2032
+ scale: .8,
2033
+ opacity: 0
2034
+ },
2035
+ animate: {
2036
+ scale: 1,
2037
+ opacity: 1
2038
+ },
2039
+ exit: {
2040
+ scale: .8,
2041
+ opacity: 0
2042
+ },
2043
+ transition: { duration: i.moderate01 },
2044
+ children: /* @__PURE__ */ A(l, {
2045
+ variant: "solid",
2046
+ size: $,
2047
+ disabled: !0,
2048
+ "aria-label": "Send",
2049
+ title: "Send",
2050
+ children: /* @__PURE__ */ A(s, {
2051
+ icon: Me,
2052
+ size: "md"
2053
+ })
2054
+ })
2055
+ }, "send-disabled")
2056
+ ]
2057
+ })]
2058
+ }),
2059
+ Se && /* @__PURE__ */ A("p", {
2060
+ className: "mt-ds-02 text-center text-ds-xs text-surface-fg-subtle/50",
2061
+ children: Se
2062
+ }),
2063
+ N && /* @__PURE__ */ A(dt, {
2064
+ open: Ve,
2065
+ onOpenChange: V,
2066
+ onSchedule: (e) => ze(e),
2067
+ initialDate: B
2068
+ })
2069
+ ]
2070
+ });
2071
+ });
2072
+ xt.displayName = "RichChatInput";
2073
+ //#endregion
2074
+ export { Ge as AudioPlayer, V as AudioWaveform, $e as BlockquoteButton, K as BoldButton, Ze as BulletListButton, Xe as CodeButton, J as EmojiButton, Ye as HighlightButton, q as ItalicButton, et as LinkButton, tt as MentionButton, Qe as OrderedListButton, xt as RichChatInput, nt as SlashCommandButton, Je as StrikeButton, U as ToolbarButton, W as ToolbarDivider, G as ToolbarGroup, qe as UnderlineButton, mt as useVoiceRecorder };