@copilotkit/react-ui 1.51.5-next.0 → 1.51.5-next.2

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 (339) hide show
  1. package/.attw.json +3 -0
  2. package/CHANGELOG.md +17 -0
  3. package/dist/index.cjs +2737 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.css +258 -70
  6. package/dist/index.css.map +1 -1
  7. package/dist/index.d.cts +781 -0
  8. package/dist/index.d.cts.map +1 -0
  9. package/dist/index.d.mts +781 -0
  10. package/dist/index.d.mts.map +1 -0
  11. package/dist/index.mjs +2685 -81
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/index.umd.js +2750 -25
  14. package/dist/index.umd.js.map +1 -1
  15. package/package.json +19 -18
  16. package/src/components/chat/Popup.tsx +1 -1
  17. package/src/components/chat/Sidebar.tsx +1 -1
  18. package/tsdown.config.ts +58 -0
  19. package/vitest.config.mjs +11 -0
  20. package/dist/chunk-2QEDCM6H.mjs +0 -150
  21. package/dist/chunk-2QEDCM6H.mjs.map +0 -1
  22. package/dist/chunk-6SMTHXVA.mjs +0 -28
  23. package/dist/chunk-6SMTHXVA.mjs.map +0 -1
  24. package/dist/chunk-6TLDRWAD.mjs +0 -95
  25. package/dist/chunk-6TLDRWAD.mjs.map +0 -1
  26. package/dist/chunk-72FQQMQ2.mjs +0 -25
  27. package/dist/chunk-72FQQMQ2.mjs.map +0 -1
  28. package/dist/chunk-AOUHT4JR.mjs +0 -34
  29. package/dist/chunk-AOUHT4JR.mjs.map +0 -1
  30. package/dist/chunk-BNJX66OH.mjs +0 -118
  31. package/dist/chunk-BNJX66OH.mjs.map +0 -1
  32. package/dist/chunk-C27LZFA5.mjs +0 -97
  33. package/dist/chunk-C27LZFA5.mjs.map +0 -1
  34. package/dist/chunk-C7WM7GM3.mjs +0 -235
  35. package/dist/chunk-C7WM7GM3.mjs.map +0 -1
  36. package/dist/chunk-CNIC5HO5.mjs +0 -36
  37. package/dist/chunk-CNIC5HO5.mjs.map +0 -1
  38. package/dist/chunk-CQCXH5LY.mjs +0 -143
  39. package/dist/chunk-CQCXH5LY.mjs.map +0 -1
  40. package/dist/chunk-DM2V5WTG.mjs +0 -34
  41. package/dist/chunk-DM2V5WTG.mjs.map +0 -1
  42. package/dist/chunk-DSHTRV2R.mjs +0 -140
  43. package/dist/chunk-DSHTRV2R.mjs.map +0 -1
  44. package/dist/chunk-EACIYBQH.mjs +0 -32
  45. package/dist/chunk-EACIYBQH.mjs.map +0 -1
  46. package/dist/chunk-EFZPSZWO.mjs +0 -1
  47. package/dist/chunk-EFZPSZWO.mjs.map +0 -1
  48. package/dist/chunk-GBAPANZE.mjs +0 -323
  49. package/dist/chunk-GBAPANZE.mjs.map +0 -1
  50. package/dist/chunk-GFE5ZSPV.mjs +0 -112
  51. package/dist/chunk-GFE5ZSPV.mjs.map +0 -1
  52. package/dist/chunk-HHLX4MQN.mjs +0 -31
  53. package/dist/chunk-HHLX4MQN.mjs.map +0 -1
  54. package/dist/chunk-ICA2EXIX.mjs +0 -187
  55. package/dist/chunk-ICA2EXIX.mjs.map +0 -1
  56. package/dist/chunk-IU3WTXLQ.mjs +0 -1
  57. package/dist/chunk-IU3WTXLQ.mjs.map +0 -1
  58. package/dist/chunk-IWOCQACI.mjs +0 -73
  59. package/dist/chunk-IWOCQACI.mjs.map +0 -1
  60. package/dist/chunk-JGMFJZMG.mjs +0 -11
  61. package/dist/chunk-JGMFJZMG.mjs.map +0 -1
  62. package/dist/chunk-JYHRHKV5.mjs +0 -90
  63. package/dist/chunk-JYHRHKV5.mjs.map +0 -1
  64. package/dist/chunk-KXE2JCUH.mjs +0 -1
  65. package/dist/chunk-KXE2JCUH.mjs.map +0 -1
  66. package/dist/chunk-LIXN3OVQ.mjs +0 -405
  67. package/dist/chunk-LIXN3OVQ.mjs.map +0 -1
  68. package/dist/chunk-MC6PY7XH.mjs +0 -456
  69. package/dist/chunk-MC6PY7XH.mjs.map +0 -1
  70. package/dist/chunk-MMVDU6DF.mjs +0 -1
  71. package/dist/chunk-MMVDU6DF.mjs.map +0 -1
  72. package/dist/chunk-MRXNTQOX.mjs +0 -59
  73. package/dist/chunk-MRXNTQOX.mjs.map +0 -1
  74. package/dist/chunk-OQWEOBRX.mjs +0 -120
  75. package/dist/chunk-OQWEOBRX.mjs.map +0 -1
  76. package/dist/chunk-P34CL4LC.mjs +0 -82
  77. package/dist/chunk-P34CL4LC.mjs.map +0 -1
  78. package/dist/chunk-PF3QBO7V.mjs +0 -133
  79. package/dist/chunk-PF3QBO7V.mjs.map +0 -1
  80. package/dist/chunk-PLHTVHUW.mjs +0 -82
  81. package/dist/chunk-PLHTVHUW.mjs.map +0 -1
  82. package/dist/chunk-PP2A5RP6.mjs +0 -21
  83. package/dist/chunk-PP2A5RP6.mjs.map +0 -1
  84. package/dist/chunk-Q64GLWPQ.mjs +0 -30
  85. package/dist/chunk-Q64GLWPQ.mjs.map +0 -1
  86. package/dist/chunk-SC6JRFAJ.mjs +0 -1
  87. package/dist/chunk-SC6JRFAJ.mjs.map +0 -1
  88. package/dist/chunk-T26KLXLH.mjs +0 -1
  89. package/dist/chunk-T26KLXLH.mjs.map +0 -1
  90. package/dist/chunk-T4NNQG6T.mjs +0 -231
  91. package/dist/chunk-T4NNQG6T.mjs.map +0 -1
  92. package/dist/chunk-TGM5PKBF.mjs +0 -44
  93. package/dist/chunk-TGM5PKBF.mjs.map +0 -1
  94. package/dist/chunk-V7W6IM2V.mjs +0 -1
  95. package/dist/chunk-V7W6IM2V.mjs.map +0 -1
  96. package/dist/chunk-WB3YULQ4.mjs +0 -1
  97. package/dist/chunk-WB3YULQ4.mjs.map +0 -1
  98. package/dist/chunk-Y4FKRAKJ.mjs +0 -12
  99. package/dist/chunk-Y4FKRAKJ.mjs.map +0 -1
  100. package/dist/chunk-YDJ4YUUF.mjs +0 -141
  101. package/dist/chunk-YDJ4YUUF.mjs.map +0 -1
  102. package/dist/components/chat/Button.d.ts +0 -9
  103. package/dist/components/chat/Button.js +0 -73
  104. package/dist/components/chat/Button.js.map +0 -1
  105. package/dist/components/chat/Button.mjs +0 -10
  106. package/dist/components/chat/Button.mjs.map +0 -1
  107. package/dist/components/chat/Chat.d.ts +0 -204
  108. package/dist/components/chat/Chat.js +0 -2428
  109. package/dist/components/chat/Chat.js.map +0 -1
  110. package/dist/components/chat/Chat.mjs +0 -29
  111. package/dist/components/chat/Chat.mjs.map +0 -1
  112. package/dist/components/chat/ChatContext.d.ts +0 -145
  113. package/dist/components/chat/ChatContext.js +0 -383
  114. package/dist/components/chat/ChatContext.js.map +0 -1
  115. package/dist/components/chat/ChatContext.mjs +0 -13
  116. package/dist/components/chat/ChatContext.mjs.map +0 -1
  117. package/dist/components/chat/CodeBlock.d.ts +0 -14
  118. package/dist/components/chat/CodeBlock.js +0 -524
  119. package/dist/components/chat/CodeBlock.js.map +0 -1
  120. package/dist/components/chat/CodeBlock.mjs +0 -14
  121. package/dist/components/chat/CodeBlock.mjs.map +0 -1
  122. package/dist/components/chat/Header.d.ts +0 -9
  123. package/dist/components/chat/Header.js +0 -642
  124. package/dist/components/chat/Header.js.map +0 -1
  125. package/dist/components/chat/Header.mjs +0 -17
  126. package/dist/components/chat/Header.mjs.map +0 -1
  127. package/dist/components/chat/Icons.d.ts +0 -20
  128. package/dist/components/chat/Icons.js +0 -362
  129. package/dist/components/chat/Icons.js.map +0 -1
  130. package/dist/components/chat/Icons.mjs +0 -38
  131. package/dist/components/chat/Icons.mjs.map +0 -1
  132. package/dist/components/chat/ImageUploadQueue.d.ts +0 -13
  133. package/dist/components/chat/ImageUploadQueue.js +0 -106
  134. package/dist/components/chat/ImageUploadQueue.js.map +0 -1
  135. package/dist/components/chat/ImageUploadQueue.mjs +0 -8
  136. package/dist/components/chat/ImageUploadQueue.mjs.map +0 -1
  137. package/dist/components/chat/Input.d.ts +0 -9
  138. package/dist/components/chat/Input.js +0 -424
  139. package/dist/components/chat/Input.js.map +0 -1
  140. package/dist/components/chat/Input.mjs +0 -14
  141. package/dist/components/chat/Input.mjs.map +0 -1
  142. package/dist/components/chat/Markdown.d.ts +0 -10
  143. package/dist/components/chat/Markdown.js +0 -678
  144. package/dist/components/chat/Markdown.js.map +0 -1
  145. package/dist/components/chat/Markdown.mjs +0 -11
  146. package/dist/components/chat/Markdown.mjs.map +0 -1
  147. package/dist/components/chat/Messages.d.ts +0 -13
  148. package/dist/components/chat/Messages.js +0 -1242
  149. package/dist/components/chat/Messages.js.map +0 -1
  150. package/dist/components/chat/Messages.mjs +0 -20
  151. package/dist/components/chat/Messages.mjs.map +0 -1
  152. package/dist/components/chat/Modal.d.ts +0 -51
  153. package/dist/components/chat/Modal.js +0 -3294
  154. package/dist/components/chat/Modal.js.map +0 -1
  155. package/dist/components/chat/Modal.mjs +0 -38
  156. package/dist/components/chat/Modal.mjs.map +0 -1
  157. package/dist/components/chat/Popup.d.ts +0 -13
  158. package/dist/components/chat/Popup.js +0 -3305
  159. package/dist/components/chat/Popup.js.map +0 -1
  160. package/dist/components/chat/Popup.mjs +0 -39
  161. package/dist/components/chat/Popup.mjs.map +0 -1
  162. package/dist/components/chat/PoweredByTag.d.ts +0 -7
  163. package/dist/components/chat/PoweredByTag.js +0 -63
  164. package/dist/components/chat/PoweredByTag.js.map +0 -1
  165. package/dist/components/chat/PoweredByTag.mjs +0 -9
  166. package/dist/components/chat/PoweredByTag.mjs.map +0 -1
  167. package/dist/components/chat/Sidebar.d.ts +0 -13
  168. package/dist/components/chat/Sidebar.js +0 -3314
  169. package/dist/components/chat/Sidebar.js.map +0 -1
  170. package/dist/components/chat/Sidebar.mjs +0 -39
  171. package/dist/components/chat/Sidebar.mjs.map +0 -1
  172. package/dist/components/chat/Suggestion.d.ts +0 -12
  173. package/dist/components/chat/Suggestion.js +0 -68
  174. package/dist/components/chat/Suggestion.js.map +0 -1
  175. package/dist/components/chat/Suggestion.mjs +0 -9
  176. package/dist/components/chat/Suggestion.mjs.map +0 -1
  177. package/dist/components/chat/Suggestions.d.ts +0 -9
  178. package/dist/components/chat/Suggestions.js +0 -93
  179. package/dist/components/chat/Suggestions.js.map +0 -1
  180. package/dist/components/chat/Suggestions.mjs +0 -10
  181. package/dist/components/chat/Suggestions.mjs.map +0 -1
  182. package/dist/components/chat/Textarea.d.ts +0 -15
  183. package/dist/components/chat/Textarea.js +0 -87
  184. package/dist/components/chat/Textarea.js.map +0 -1
  185. package/dist/components/chat/Textarea.mjs +0 -8
  186. package/dist/components/chat/Textarea.mjs.map +0 -1
  187. package/dist/components/chat/Window.d.ts +0 -9
  188. package/dist/components/chat/Window.js +0 -166
  189. package/dist/components/chat/Window.js.map +0 -1
  190. package/dist/components/chat/Window.mjs +0 -10
  191. package/dist/components/chat/Window.mjs.map +0 -1
  192. package/dist/components/chat/index.d.ts +0 -18
  193. package/dist/components/chat/index.js +0 -3341
  194. package/dist/components/chat/index.js.map +0 -1
  195. package/dist/components/chat/index.mjs +0 -69
  196. package/dist/components/chat/index.mjs.map +0 -1
  197. package/dist/components/chat/messages/AssistantMessage.d.ts +0 -9
  198. package/dist/components/chat/messages/AssistantMessage.js +0 -807
  199. package/dist/components/chat/messages/AssistantMessage.js.map +0 -1
  200. package/dist/components/chat/messages/AssistantMessage.mjs +0 -13
  201. package/dist/components/chat/messages/AssistantMessage.mjs.map +0 -1
  202. package/dist/components/chat/messages/ErrorMessage.d.ts +0 -9
  203. package/dist/components/chat/messages/ErrorMessage.js +0 -756
  204. package/dist/components/chat/messages/ErrorMessage.js.map +0 -1
  205. package/dist/components/chat/messages/ErrorMessage.mjs +0 -72
  206. package/dist/components/chat/messages/ErrorMessage.mjs.map +0 -1
  207. package/dist/components/chat/messages/ImageRenderer.d.ts +0 -12
  208. package/dist/components/chat/messages/ImageRenderer.js +0 -68
  209. package/dist/components/chat/messages/ImageRenderer.js.map +0 -1
  210. package/dist/components/chat/messages/ImageRenderer.mjs +0 -8
  211. package/dist/components/chat/messages/ImageRenderer.mjs.map +0 -1
  212. package/dist/components/chat/messages/LegacyRenderMessage.d.ts +0 -28
  213. package/dist/components/chat/messages/LegacyRenderMessage.js +0 -1067
  214. package/dist/components/chat/messages/LegacyRenderMessage.js.map +0 -1
  215. package/dist/components/chat/messages/LegacyRenderMessage.mjs +0 -17
  216. package/dist/components/chat/messages/LegacyRenderMessage.mjs.map +0 -1
  217. package/dist/components/chat/messages/RenderMessage.d.ts +0 -9
  218. package/dist/components/chat/messages/RenderMessage.js +0 -942
  219. package/dist/components/chat/messages/RenderMessage.js.map +0 -1
  220. package/dist/components/chat/messages/RenderMessage.mjs +0 -16
  221. package/dist/components/chat/messages/RenderMessage.mjs.map +0 -1
  222. package/dist/components/chat/messages/UserMessage.d.ts +0 -9
  223. package/dist/components/chat/messages/UserMessage.js +0 -58
  224. package/dist/components/chat/messages/UserMessage.js.map +0 -1
  225. package/dist/components/chat/messages/UserMessage.mjs +0 -8
  226. package/dist/components/chat/messages/UserMessage.mjs.map +0 -1
  227. package/dist/components/chat/props.d.ts +0 -298
  228. package/dist/components/chat/props.js +0 -19
  229. package/dist/components/chat/props.js.map +0 -1
  230. package/dist/components/chat/props.mjs +0 -2
  231. package/dist/components/chat/props.mjs.map +0 -1
  232. package/dist/components/dev-console/console.d.ts +0 -11
  233. package/dist/components/dev-console/console.js +0 -595
  234. package/dist/components/dev-console/console.js.map +0 -1
  235. package/dist/components/dev-console/console.mjs +0 -17
  236. package/dist/components/dev-console/console.mjs.map +0 -1
  237. package/dist/components/dev-console/icons.d.ts +0 -9
  238. package/dist/components/dev-console/icons.js +0 -140
  239. package/dist/components/dev-console/icons.js.map +0 -1
  240. package/dist/components/dev-console/icons.mjs +0 -16
  241. package/dist/components/dev-console/icons.mjs.map +0 -1
  242. package/dist/components/dev-console/index.d.ts +0 -3
  243. package/dist/components/dev-console/index.js +0 -595
  244. package/dist/components/dev-console/index.js.map +0 -1
  245. package/dist/components/dev-console/index.mjs +0 -18
  246. package/dist/components/dev-console/index.mjs.map +0 -1
  247. package/dist/components/dev-console/types.d.ts +0 -9
  248. package/dist/components/dev-console/types.js +0 -19
  249. package/dist/components/dev-console/types.js.map +0 -1
  250. package/dist/components/dev-console/types.mjs +0 -1
  251. package/dist/components/dev-console/types.mjs.map +0 -1
  252. package/dist/components/dev-console/utils.d.ts +0 -10
  253. package/dist/components/dev-console/utils.js +0 -183
  254. package/dist/components/dev-console/utils.js.map +0 -1
  255. package/dist/components/dev-console/utils.mjs +0 -16
  256. package/dist/components/dev-console/utils.mjs.map +0 -1
  257. package/dist/components/help-modal/icons.d.ts +0 -9
  258. package/dist/components/help-modal/icons.js +0 -116
  259. package/dist/components/help-modal/icons.js.map +0 -1
  260. package/dist/components/help-modal/icons.mjs +0 -12
  261. package/dist/components/help-modal/icons.mjs.map +0 -1
  262. package/dist/components/help-modal/index.d.ts +0 -2
  263. package/dist/components/help-modal/index.js +0 -144
  264. package/dist/components/help-modal/index.js.map +0 -1
  265. package/dist/components/help-modal/index.mjs +0 -10
  266. package/dist/components/help-modal/index.mjs.map +0 -1
  267. package/dist/components/help-modal/modal.d.ts +0 -5
  268. package/dist/components/help-modal/modal.js +0 -142
  269. package/dist/components/help-modal/modal.js.map +0 -1
  270. package/dist/components/help-modal/modal.mjs +0 -9
  271. package/dist/components/help-modal/modal.mjs.map +0 -1
  272. package/dist/components/index.d.ts +0 -19
  273. package/dist/components/index.js +0 -3345
  274. package/dist/components/index.js.map +0 -1
  275. package/dist/components/index.mjs +0 -76
  276. package/dist/components/index.mjs.map +0 -1
  277. package/dist/context/index.d.ts +0 -2
  278. package/dist/context/index.js +0 -19
  279. package/dist/context/index.js.map +0 -1
  280. package/dist/context/index.mjs +0 -2
  281. package/dist/context/index.mjs.map +0 -1
  282. package/dist/hooks/index.d.ts +0 -2
  283. package/dist/hooks/index.js +0 -36
  284. package/dist/hooks/index.js.map +0 -1
  285. package/dist/hooks/index.mjs +0 -9
  286. package/dist/hooks/index.mjs.map +0 -1
  287. package/dist/hooks/use-copilot-chat-suggestions.d.ts +0 -66
  288. package/dist/hooks/use-copilot-chat-suggestions.js +0 -34
  289. package/dist/hooks/use-copilot-chat-suggestions.js.map +0 -1
  290. package/dist/hooks/use-copilot-chat-suggestions.mjs +0 -8
  291. package/dist/hooks/use-copilot-chat-suggestions.mjs.map +0 -1
  292. package/dist/hooks/use-copy-to-clipboard.d.ts +0 -9
  293. package/dist/hooks/use-copy-to-clipboard.js +0 -62
  294. package/dist/hooks/use-copy-to-clipboard.js.map +0 -1
  295. package/dist/hooks/use-copy-to-clipboard.mjs +0 -8
  296. package/dist/hooks/use-copy-to-clipboard.mjs.map +0 -1
  297. package/dist/hooks/use-dark-mode.d.ts +0 -3
  298. package/dist/hooks/use-dark-mode.js +0 -35
  299. package/dist/hooks/use-dark-mode.js.map +0 -1
  300. package/dist/hooks/use-dark-mode.mjs +0 -8
  301. package/dist/hooks/use-dark-mode.mjs.map +0 -1
  302. package/dist/hooks/use-push-to-talk.d.ts +0 -19
  303. package/dist/hooks/use-push-to-talk.js +0 -202
  304. package/dist/hooks/use-push-to-talk.js.map +0 -1
  305. package/dist/hooks/use-push-to-talk.mjs +0 -12
  306. package/dist/hooks/use-push-to-talk.mjs.map +0 -1
  307. package/dist/index.d.ts +0 -21
  308. package/dist/index.js +0 -3354
  309. package/dist/index.js.map +0 -1
  310. package/dist/lib/utils.d.ts +0 -4
  311. package/dist/lib/utils.js +0 -76
  312. package/dist/lib/utils.js.map +0 -1
  313. package/dist/lib/utils.mjs +0 -34
  314. package/dist/lib/utils.mjs.map +0 -1
  315. package/dist/types/css.d.ts +0 -22
  316. package/dist/types/css.js +0 -19
  317. package/dist/types/css.js.map +0 -1
  318. package/dist/types/css.mjs +0 -1
  319. package/dist/types/css.mjs.map +0 -1
  320. package/dist/types/index.d.ts +0 -3
  321. package/dist/types/index.js +0 -19
  322. package/dist/types/index.js.map +0 -1
  323. package/dist/types/index.mjs +0 -2
  324. package/dist/types/index.mjs.map +0 -1
  325. package/dist/types/suggestions.d.ts +0 -9
  326. package/dist/types/suggestions.js +0 -19
  327. package/dist/types/suggestions.js.map +0 -1
  328. package/dist/types/suggestions.mjs +0 -1
  329. package/dist/types/suggestions.mjs.map +0 -1
  330. package/dist/v2/index.css +0 -4
  331. package/dist/v2/index.css.map +0 -1
  332. package/dist/v2/index.d.ts +0 -2
  333. package/dist/v2/index.js +0 -2
  334. package/dist/v2/index.js.map +0 -1
  335. package/dist/v2/index.mjs +0 -2
  336. package/dist/v2/index.mjs.map +0 -1
  337. package/jest.config.js +0 -5
  338. package/rollup.config.mjs +0 -64
  339. package/tsup.config.ts +0 -15
@@ -1,807 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __defProps = Object.defineProperties;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
- var __getProtoOf = Object.getPrototypeOf;
10
- var __hasOwnProp = Object.prototype.hasOwnProperty;
11
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {}))
15
- if (__hasOwnProp.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- if (__getOwnPropSymbols)
18
- for (var prop of __getOwnPropSymbols(b)) {
19
- if (__propIsEnum.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- }
22
- return a;
23
- };
24
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
- var __objRest = (source, exclude) => {
26
- var target = {};
27
- for (var prop in source)
28
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
- target[prop] = source[prop];
30
- if (source != null && __getOwnPropSymbols)
31
- for (var prop of __getOwnPropSymbols(source)) {
32
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
- target[prop] = source[prop];
34
- }
35
- return target;
36
- };
37
- var __export = (target, all) => {
38
- for (var name in all)
39
- __defProp(target, name, { get: all[name], enumerable: true });
40
- };
41
- var __copyProps = (to, from, except, desc) => {
42
- if (from && typeof from === "object" || typeof from === "function") {
43
- for (let key of __getOwnPropNames(from))
44
- if (!__hasOwnProp.call(to, key) && key !== except)
45
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
46
- }
47
- return to;
48
- };
49
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
50
- // If the importer is in node compatibility mode or this is not an ESM
51
- // file that has been converted to a CommonJS file using a Babel-
52
- // compatible transform (i.e. "__esModule" has not been set), then set
53
- // "default" to the CommonJS "module.exports" for node compatibility.
54
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
55
- mod
56
- ));
57
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
58
-
59
- // src/components/chat/messages/AssistantMessage.tsx
60
- var AssistantMessage_exports = {};
61
- __export(AssistantMessage_exports, {
62
- AssistantMessage: () => AssistantMessage
63
- });
64
- module.exports = __toCommonJS(AssistantMessage_exports);
65
-
66
- // src/components/chat/ChatContext.tsx
67
- var import_react = __toESM(require("react"));
68
-
69
- // src/components/chat/Icons.tsx
70
- var import_jsx_runtime = require("react/jsx-runtime");
71
- var CopyIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
72
- "svg",
73
- {
74
- xmlns: "http://www.w3.org/2000/svg",
75
- fill: "none",
76
- viewBox: "0 0 24 24",
77
- strokeWidth: "2",
78
- stroke: "currentColor",
79
- width: "16",
80
- height: "16",
81
- style: { minWidth: "16px", minHeight: "16px" },
82
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
83
- "path",
84
- {
85
- strokeLinecap: "round",
86
- strokeLinejoin: "round",
87
- d: "M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75"
88
- }
89
- )
90
- }
91
- );
92
- var DownloadIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
93
- "svg",
94
- {
95
- xmlns: "http://www.w3.org/2000/svg",
96
- fill: "none",
97
- viewBox: "0 0 24 24",
98
- strokeWidth: "2",
99
- stroke: "currentColor",
100
- width: "16",
101
- height: "16",
102
- style: { minWidth: "16px", minHeight: "16px" },
103
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
104
- "path",
105
- {
106
- strokeLinecap: "round",
107
- strokeLinejoin: "round",
108
- d: "M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"
109
- }
110
- )
111
- }
112
- );
113
- var CheckIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
114
- "svg",
115
- {
116
- xmlns: "http://www.w3.org/2000/svg",
117
- fill: "none",
118
- viewBox: "0 0 24 24",
119
- strokeWidth: "2",
120
- stroke: "currentColor",
121
- width: "16",
122
- height: "16",
123
- style: { minWidth: "16px", minHeight: "16px" },
124
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
125
- "path",
126
- {
127
- strokeLinecap: "round",
128
- strokeLinejoin: "round",
129
- d: "M4.5 12.75l6 6 9-13.5"
130
- }
131
- )
132
- }
133
- );
134
-
135
- // src/components/chat/ChatContext.tsx
136
- var import_jsx_runtime2 = require("react/jsx-runtime");
137
- var ChatContext = import_react.default.createContext(
138
- void 0
139
- );
140
- function useChatContext() {
141
- const context = import_react.default.useContext(ChatContext);
142
- if (context === void 0) {
143
- throw new Error(
144
- "Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?"
145
- );
146
- }
147
- return context;
148
- }
149
-
150
- // src/components/chat/Markdown.tsx
151
- var import_react3 = require("react");
152
- var import_react_markdown = __toESM(require("react-markdown"));
153
-
154
- // src/components/chat/CodeBlock.tsx
155
- var import_react2 = require("react");
156
- var import_react_syntax_highlighter = require("react-syntax-highlighter");
157
-
158
- // src/hooks/use-copy-to-clipboard.tsx
159
- var React2 = __toESM(require("react"));
160
- function useCopyToClipboard({
161
- timeout = 2e3
162
- }) {
163
- const [isCopied, setIsCopied] = React2.useState(false);
164
- const copyToClipboard = (value) => {
165
- var _a;
166
- if (typeof window === "undefined" || !((_a = navigator.clipboard) == null ? void 0 : _a.writeText)) {
167
- return;
168
- }
169
- if (!value) {
170
- return;
171
- }
172
- navigator.clipboard.writeText(value).then(() => {
173
- setIsCopied(true);
174
- setTimeout(() => {
175
- setIsCopied(false);
176
- }, timeout);
177
- });
178
- };
179
- return { isCopied, copyToClipboard };
180
- }
181
-
182
- // src/components/chat/CodeBlock.tsx
183
- var import_jsx_runtime3 = require("react/jsx-runtime");
184
- var programmingLanguages = {
185
- javascript: ".js",
186
- python: ".py",
187
- java: ".java",
188
- c: ".c",
189
- cpp: ".cpp",
190
- "c++": ".cpp",
191
- "c#": ".cs",
192
- ruby: ".rb",
193
- php: ".php",
194
- swift: ".swift",
195
- "objective-c": ".m",
196
- kotlin: ".kt",
197
- typescript: ".ts",
198
- go: ".go",
199
- perl: ".pl",
200
- rust: ".rs",
201
- scala: ".scala",
202
- haskell: ".hs",
203
- lua: ".lua",
204
- shell: ".sh",
205
- sql: ".sql",
206
- html: ".html",
207
- css: ".css"
208
- // add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component
209
- };
210
- var generateRandomString = (length, lowercase = false) => {
211
- const chars = "ABCDEFGHJKLMNPQRSTUVWXY3456789";
212
- let result = "";
213
- for (let i = 0; i < length; i++) {
214
- result += chars.charAt(Math.floor(Math.random() * chars.length));
215
- }
216
- return lowercase ? result.toLowerCase() : result;
217
- };
218
- var CodeBlock = (0, import_react2.memo)(({ language, value }) => {
219
- const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
220
- const [SyntaxHighlighter, setSyntaxHighlighter] = (0, import_react2.useState)(() => import_react_syntax_highlighter.Light);
221
- (0, import_react2.useEffect)(() => {
222
- try {
223
- new RegExp("(?<=#)\\w+");
224
- setSyntaxHighlighter(() => import_react_syntax_highlighter.Prism);
225
- } catch (e) {
226
- setSyntaxHighlighter(() => import_react_syntax_highlighter.Light);
227
- }
228
- }, []);
229
- const downloadAsFile = () => {
230
- if (typeof window === "undefined") {
231
- return;
232
- }
233
- const fileExtension = programmingLanguages[language] || ".file";
234
- const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;
235
- const fileName = window.prompt("Enter file name", suggestedFileName);
236
- if (!fileName) {
237
- return;
238
- }
239
- const blob = new Blob([value], { type: "text/plain" });
240
- const url = URL.createObjectURL(blob);
241
- const link = document.createElement("a");
242
- link.download = fileName;
243
- link.href = url;
244
- link.style.display = "none";
245
- document.body.appendChild(link);
246
- link.click();
247
- document.body.removeChild(link);
248
- URL.revokeObjectURL(url);
249
- };
250
- const onCopy = () => {
251
- if (isCopied)
252
- return;
253
- copyToClipboard(value);
254
- };
255
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "copilotKitCodeBlock", children: [
256
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "copilotKitCodeBlockToolbar", children: [
257
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
258
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
259
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
260
- "button",
261
- {
262
- className: "copilotKitCodeBlockToolbarButton",
263
- onClick: downloadAsFile,
264
- children: DownloadIcon
265
- }
266
- ),
267
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: isCopied ? CheckIcon : CopyIcon })
268
- ] })
269
- ] }),
270
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
271
- SyntaxHighlighter,
272
- {
273
- language,
274
- style: highlightStyle,
275
- PreTag: "div",
276
- customStyle: {
277
- margin: 0,
278
- borderBottomLeftRadius: "0.375rem",
279
- borderBottomRightRadius: "0.375rem"
280
- },
281
- children: value
282
- }
283
- )
284
- ] });
285
- });
286
- CodeBlock.displayName = "CodeBlock";
287
- var highlightStyle = {
288
- 'pre[class*="language-"]': {
289
- color: "#d4d4d4",
290
- fontSize: "13px",
291
- textShadow: "none",
292
- fontFamily: 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
293
- direction: "ltr",
294
- textAlign: "left",
295
- whiteSpace: "pre",
296
- wordSpacing: "normal",
297
- wordBreak: "normal",
298
- lineHeight: "1.5",
299
- MozTabSize: "4",
300
- OTabSize: "4",
301
- tabSize: "4",
302
- WebkitHyphens: "none",
303
- MozHyphens: "none",
304
- msHyphens: "none",
305
- hyphens: "none",
306
- padding: "1em",
307
- margin: ".5em 0",
308
- overflow: "auto",
309
- background: "#1e1e1e"
310
- },
311
- 'code[class*="language-"]': {
312
- color: "#d4d4d4",
313
- fontSize: "13px",
314
- textShadow: "none",
315
- fontFamily: 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
316
- direction: "ltr",
317
- textAlign: "left",
318
- whiteSpace: "pre",
319
- wordSpacing: "normal",
320
- wordBreak: "normal",
321
- lineHeight: "1.5",
322
- MozTabSize: "4",
323
- OTabSize: "4",
324
- tabSize: "4",
325
- WebkitHyphens: "none",
326
- MozHyphens: "none",
327
- msHyphens: "none",
328
- hyphens: "none"
329
- },
330
- 'pre[class*="language-"]::selection': {
331
- textShadow: "none",
332
- background: "#264F78"
333
- },
334
- 'code[class*="language-"]::selection': {
335
- textShadow: "none",
336
- background: "#264F78"
337
- },
338
- 'pre[class*="language-"] *::selection': {
339
- textShadow: "none",
340
- background: "#264F78"
341
- },
342
- 'code[class*="language-"] *::selection': {
343
- textShadow: "none",
344
- background: "#264F78"
345
- },
346
- ':not(pre) > code[class*="language-"]': {
347
- padding: ".1em .3em",
348
- borderRadius: ".3em",
349
- color: "#db4c69",
350
- background: "#1e1e1e"
351
- },
352
- ".namespace": {
353
- Opacity: ".7"
354
- },
355
- "doctype.doctype-tag": {
356
- color: "#569CD6"
357
- },
358
- "doctype.name": {
359
- color: "#9cdcfe"
360
- },
361
- comment: {
362
- color: "#6a9955"
363
- },
364
- prolog: {
365
- color: "#6a9955"
366
- },
367
- punctuation: {
368
- color: "#d4d4d4"
369
- },
370
- ".language-html .language-css .token.punctuation": {
371
- color: "#d4d4d4"
372
- },
373
- ".language-html .language-javascript .token.punctuation": {
374
- color: "#d4d4d4"
375
- },
376
- property: {
377
- color: "#9cdcfe"
378
- },
379
- tag: {
380
- color: "#569cd6"
381
- },
382
- boolean: {
383
- color: "#569cd6"
384
- },
385
- number: {
386
- color: "#b5cea8"
387
- },
388
- constant: {
389
- color: "#9cdcfe"
390
- },
391
- symbol: {
392
- color: "#b5cea8"
393
- },
394
- inserted: {
395
- color: "#b5cea8"
396
- },
397
- unit: {
398
- color: "#b5cea8"
399
- },
400
- selector: {
401
- color: "#d7ba7d"
402
- },
403
- "attr-name": {
404
- color: "#9cdcfe"
405
- },
406
- string: {
407
- color: "#ce9178"
408
- },
409
- char: {
410
- color: "#ce9178"
411
- },
412
- builtin: {
413
- color: "#ce9178"
414
- },
415
- deleted: {
416
- color: "#ce9178"
417
- },
418
- ".language-css .token.string.url": {
419
- textDecoration: "underline"
420
- },
421
- operator: {
422
- color: "#d4d4d4"
423
- },
424
- entity: {
425
- color: "#569cd6"
426
- },
427
- "operator.arrow": {
428
- color: "#569CD6"
429
- },
430
- atrule: {
431
- color: "#ce9178"
432
- },
433
- "atrule.rule": {
434
- color: "#c586c0"
435
- },
436
- "atrule.url": {
437
- color: "#9cdcfe"
438
- },
439
- "atrule.url.function": {
440
- color: "#dcdcaa"
441
- },
442
- "atrule.url.punctuation": {
443
- color: "#d4d4d4"
444
- },
445
- keyword: {
446
- color: "#569CD6"
447
- },
448
- "keyword.module": {
449
- color: "#c586c0"
450
- },
451
- "keyword.control-flow": {
452
- color: "#c586c0"
453
- },
454
- function: {
455
- color: "#dcdcaa"
456
- },
457
- "function.maybe-class-name": {
458
- color: "#dcdcaa"
459
- },
460
- regex: {
461
- color: "#d16969"
462
- },
463
- important: {
464
- color: "#569cd6"
465
- },
466
- italic: {
467
- fontStyle: "italic"
468
- },
469
- "class-name": {
470
- color: "#4ec9b0"
471
- },
472
- "maybe-class-name": {
473
- color: "#4ec9b0"
474
- },
475
- console: {
476
- color: "#9cdcfe"
477
- },
478
- parameter: {
479
- color: "#9cdcfe"
480
- },
481
- interpolation: {
482
- color: "#9cdcfe"
483
- },
484
- "punctuation.interpolation-punctuation": {
485
- color: "#569cd6"
486
- },
487
- variable: {
488
- color: "#9cdcfe"
489
- },
490
- "imports.maybe-class-name": {
491
- color: "#9cdcfe"
492
- },
493
- "exports.maybe-class-name": {
494
- color: "#9cdcfe"
495
- },
496
- escape: {
497
- color: "#d7ba7d"
498
- },
499
- "tag.punctuation": {
500
- color: "#808080"
501
- },
502
- cdata: {
503
- color: "#808080"
504
- },
505
- "attr-value": {
506
- color: "#ce9178"
507
- },
508
- "attr-value.punctuation": {
509
- color: "#ce9178"
510
- },
511
- "attr-value.punctuation.attr-equals": {
512
- color: "#d4d4d4"
513
- },
514
- namespace: {
515
- color: "#4ec9b0"
516
- },
517
- 'pre[class*="language-javascript"]': {
518
- color: "#9cdcfe"
519
- },
520
- 'code[class*="language-javascript"]': {
521
- color: "#9cdcfe"
522
- },
523
- 'pre[class*="language-jsx"]': {
524
- color: "#9cdcfe"
525
- },
526
- 'code[class*="language-jsx"]': {
527
- color: "#9cdcfe"
528
- },
529
- 'pre[class*="language-typescript"]': {
530
- color: "#9cdcfe"
531
- },
532
- 'code[class*="language-typescript"]': {
533
- color: "#9cdcfe"
534
- },
535
- 'pre[class*="language-tsx"]': {
536
- color: "#9cdcfe"
537
- },
538
- 'code[class*="language-tsx"]': {
539
- color: "#9cdcfe"
540
- },
541
- 'pre[class*="language-css"]': {
542
- color: "#ce9178"
543
- },
544
- 'code[class*="language-css"]': {
545
- color: "#ce9178"
546
- },
547
- 'pre[class*="language-html"]': {
548
- color: "#d4d4d4"
549
- },
550
- 'code[class*="language-html"]': {
551
- color: "#d4d4d4"
552
- },
553
- ".language-regex .token.anchor": {
554
- color: "#dcdcaa"
555
- },
556
- ".language-html .token.punctuation": {
557
- color: "#808080"
558
- },
559
- 'pre[class*="language-"] > code[class*="language-"]': {
560
- position: "relative",
561
- zIndex: "1"
562
- },
563
- ".line-highlight.line-highlight": {
564
- background: "#f7ebc6",
565
- boxShadow: "inset 5px 0 0 #f7d87c",
566
- zIndex: "0"
567
- }
568
- };
569
-
570
- // src/components/chat/Markdown.tsx
571
- var import_remark_gfm = __toESM(require("remark-gfm"));
572
- var import_remark_math = __toESM(require("remark-math"));
573
- var import_rehype_raw = __toESM(require("rehype-raw"));
574
- var import_jsx_runtime4 = require("react/jsx-runtime");
575
- var defaultComponents = {
576
- a(_a) {
577
- var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
578
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
579
- "a",
580
- __spreadProps(__spreadValues({
581
- className: "copilotKitMarkdownElement"
582
- }, props), {
583
- target: "_blank",
584
- rel: "noopener noreferrer",
585
- children
586
- })
587
- );
588
- },
589
- // @ts-expect-error -- inline
590
- code(_c) {
591
- var _d = _c, { children, className, inline } = _d, props = __objRest(_d, ["children", "className", "inline"]);
592
- if (Array.isArray(children) && children.length) {
593
- if (children[0] == "\u258D") {
594
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
595
- "span",
596
- {
597
- style: {
598
- animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
599
- marginTop: "0.25rem"
600
- },
601
- children: "\u258D"
602
- }
603
- );
604
- }
605
- children[0] = (children == null ? void 0 : children[0]).replace("`\u258D`", "\u258D");
606
- }
607
- const match = /language-(\w+)/.exec(className || "");
608
- const hasLanguage = match && match[1];
609
- const content = String(children);
610
- const hasNewlines = content.includes("\n");
611
- const isInline = !hasLanguage && !hasNewlines;
612
- if (isInline) {
613
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
614
- "code",
615
- __spreadProps(__spreadValues({
616
- className: `copilotKitMarkdownElement copilotKitInlineCode ${className || ""}`
617
- }, props), {
618
- children
619
- })
620
- );
621
- }
622
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
623
- CodeBlock,
624
- __spreadValues({
625
- language: match && match[1] || "",
626
- value: String(children).replace(/\n$/, "")
627
- }, props),
628
- Math.random()
629
- );
630
- },
631
- h1: (_e) => {
632
- var _f = _e, { children } = _f, props = __objRest(_f, ["children"]);
633
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h1", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
634
- },
635
- h2: (_g) => {
636
- var _h = _g, { children } = _h, props = __objRest(_h, ["children"]);
637
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
638
- },
639
- h3: (_i) => {
640
- var _j = _i, { children } = _j, props = __objRest(_j, ["children"]);
641
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
642
- },
643
- h4: (_k) => {
644
- var _l = _k, { children } = _l, props = __objRest(_l, ["children"]);
645
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h4", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
646
- },
647
- h5: (_m) => {
648
- var _n = _m, { children } = _n, props = __objRest(_n, ["children"]);
649
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h5", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
650
- },
651
- h6: (_o) => {
652
- var _p = _o, { children } = _p, props = __objRest(_p, ["children"]);
653
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h6", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
654
- },
655
- p: (_q) => {
656
- var _r = _q, { children } = _r, props = __objRest(_r, ["children"]);
657
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
658
- },
659
- pre: (_s) => {
660
- var _t = _s, { children } = _t, props = __objRest(_t, ["children"]);
661
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("pre", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
662
- },
663
- blockquote: (_u) => {
664
- var _v = _u, { children } = _v, props = __objRest(_v, ["children"]);
665
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("blockquote", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
666
- },
667
- ul: (_w) => {
668
- var _x = _w, { children } = _x, props = __objRest(_x, ["children"]);
669
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
670
- },
671
- li: (_y) => {
672
- var _z = _y, { children } = _z, props = __objRest(_z, ["children"]);
673
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
674
- }
675
- };
676
- var MemoizedReactMarkdown = (0, import_react3.memo)(
677
- import_react_markdown.default,
678
- (prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.components === nextProps.components
679
- );
680
- var Markdown = ({ content, components }) => {
681
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "copilotKitMarkdown", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
682
- MemoizedReactMarkdown,
683
- {
684
- components: __spreadValues(__spreadValues({}, defaultComponents), components),
685
- remarkPlugins: [
686
- import_remark_gfm.default,
687
- [import_remark_math.default, { singleDollarTextMath: false }]
688
- ],
689
- rehypePlugins: [import_rehype_raw.default],
690
- children: content
691
- }
692
- ) });
693
- };
694
-
695
- // src/components/chat/messages/AssistantMessage.tsx
696
- var import_react4 = require("react");
697
- var import_jsx_runtime5 = require("react/jsx-runtime");
698
- var AssistantMessage = (props) => {
699
- var _a, _b, _c;
700
- const { icons, labels } = useChatContext();
701
- const {
702
- message,
703
- isLoading,
704
- onRegenerate,
705
- onCopy,
706
- onThumbsUp,
707
- onThumbsDown,
708
- isCurrentMessage,
709
- feedback,
710
- markdownTagRenderers
711
- } = props;
712
- const [copied, setCopied] = (0, import_react4.useState)(false);
713
- const handleCopy = () => {
714
- const content2 = (message == null ? void 0 : message.content) || "";
715
- if (content2 && onCopy) {
716
- navigator.clipboard.writeText(content2);
717
- setCopied(true);
718
- onCopy(content2);
719
- setTimeout(() => setCopied(false), 2e3);
720
- } else if (content2) {
721
- navigator.clipboard.writeText(content2);
722
- setCopied(true);
723
- setTimeout(() => setCopied(false), 2e3);
724
- }
725
- };
726
- const handleRegenerate = () => {
727
- if (onRegenerate)
728
- onRegenerate();
729
- };
730
- const handleThumbsUp = () => {
731
- if (onThumbsUp && message) {
732
- onThumbsUp(message);
733
- }
734
- };
735
- const handleThumbsDown = () => {
736
- if (onThumbsDown && message) {
737
- onThumbsDown(message);
738
- }
739
- };
740
- const LoadingIcon = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: icons.activityIcon });
741
- const content = (message == null ? void 0 : message.content) || "";
742
- const subComponent = (_b = (_a = message == null ? void 0 : message.generativeUI) == null ? void 0 : _a.call(message)) != null ? _b : props.subComponent;
743
- const subComponentPosition = (_c = message == null ? void 0 : message.generativeUIPosition) != null ? _c : "after";
744
- const renderBefore = subComponent && subComponentPosition === "before";
745
- const renderAfter = subComponent && subComponentPosition !== "before";
746
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
747
- renderBefore ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { marginBottom: "0.5rem" }, children: subComponent }) : null,
748
- content && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
749
- content && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Markdown, { content, components: markdownTagRenderers }),
750
- content && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
751
- "div",
752
- {
753
- className: `copilotKitMessageControls ${isCurrentMessage ? "currentMessage" : ""}`,
754
- children: [
755
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
756
- "button",
757
- {
758
- className: "copilotKitMessageControlButton",
759
- onClick: handleRegenerate,
760
- "aria-label": labels.regenerateResponse,
761
- title: labels.regenerateResponse,
762
- children: icons.regenerateIcon
763
- }
764
- ),
765
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
766
- "button",
767
- {
768
- className: "copilotKitMessageControlButton",
769
- onClick: handleCopy,
770
- "aria-label": labels.copyToClipboard,
771
- title: labels.copyToClipboard,
772
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { fontSize: "10px", fontWeight: "bold" }, children: "\u2713" }) : icons.copyIcon
773
- }
774
- ),
775
- onThumbsUp && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
776
- "button",
777
- {
778
- className: `copilotKitMessageControlButton ${feedback === "thumbsUp" ? "active" : ""}`,
779
- onClick: handleThumbsUp,
780
- "aria-label": labels.thumbsUp,
781
- title: labels.thumbsUp,
782
- children: icons.thumbsUpIcon
783
- }
784
- ),
785
- onThumbsDown && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
786
- "button",
787
- {
788
- className: `copilotKitMessageControlButton ${feedback === "thumbsDown" ? "active" : ""}`,
789
- onClick: handleThumbsDown,
790
- "aria-label": labels.thumbsDown,
791
- title: labels.thumbsDown,
792
- children: icons.thumbsDownIcon
793
- }
794
- )
795
- ]
796
- }
797
- )
798
- ] }),
799
- renderAfter ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { marginBottom: "0.5rem" }, children: subComponent }) : null,
800
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LoadingIcon, {})
801
- ] });
802
- };
803
- // Annotate the CommonJS export names for ESM import in node:
804
- 0 && (module.exports = {
805
- AssistantMessage
806
- });
807
- //# sourceMappingURL=AssistantMessage.js.map