@copilotkit/react-ui 0.15.0-alpha.1 → 0.15.0-alpha.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 (315) hide show
  1. package/.turbo/turbo-build.log +192 -288
  2. package/CHANGELOG.md +16 -1
  3. package/dist/{chunk-ZVAH2Z2W.mjs → chunk-3M4HWSE7.mjs} +3 -3
  4. package/dist/chunk-3M4HWSE7.mjs.map +1 -0
  5. package/dist/{chunk-Y2RUG4B3.mjs → chunk-5O2MCJZ2.mjs} +2 -2
  6. package/dist/chunk-5O2MCJZ2.mjs.map +1 -0
  7. package/dist/{chunk-X3Z2EVFV.mjs → chunk-CKJXXQ2W.mjs} +5 -5
  8. package/dist/chunk-CKJXXQ2W.mjs.map +1 -0
  9. package/dist/{chunk-NXWVWC33.mjs → chunk-DPRH4HX3.mjs} +11 -24
  10. package/dist/chunk-DPRH4HX3.mjs.map +1 -0
  11. package/dist/{chunk-UIRFLYXI.mjs → chunk-GWGHQNRI.mjs} +14 -13
  12. package/dist/chunk-GWGHQNRI.mjs.map +1 -0
  13. package/dist/chunk-JD7BAH7U.mjs +3 -0
  14. package/dist/{chunk-X4T6ZUVM.mjs → chunk-KBGIPFXA.mjs} +5 -5
  15. package/dist/chunk-KBGIPFXA.mjs.map +1 -0
  16. package/dist/{chunk-DN3OI5WF.mjs → chunk-NNVWLSYK.mjs} +9 -9
  17. package/dist/chunk-NNVWLSYK.mjs.map +1 -0
  18. package/dist/{chunk-QFASQEFJ.mjs → chunk-NYLOXKYT.mjs} +2 -2
  19. package/dist/chunk-NYLOXKYT.mjs.map +1 -0
  20. package/dist/{chunk-6H3Y2XEI.mjs → chunk-OF66AL5Z.mjs} +1 -1
  21. package/dist/chunk-OF66AL5Z.mjs.map +1 -0
  22. package/dist/{chunk-DPUPEOGG.mjs → chunk-UWPFPWAW.mjs} +2 -2
  23. package/dist/chunk-UWPFPWAW.mjs.map +1 -0
  24. package/dist/{chunk-GPEJCUWA.mjs → chunk-Z34F3WLK.mjs} +2 -2
  25. package/dist/chunk-Z34F3WLK.mjs.map +1 -0
  26. package/dist/components/chat/Button.d.ts +2 -3
  27. package/dist/components/chat/Button.js +38 -0
  28. package/dist/components/chat/Button.js.map +1 -0
  29. package/dist/components/chat/Button.mjs +2 -2
  30. package/dist/components/chat/Chat.d.ts +15 -14
  31. package/dist/components/chat/Chat.js +800 -0
  32. package/dist/components/chat/Chat.js.map +1 -0
  33. package/dist/components/chat/Chat.mjs +9 -9
  34. package/dist/components/chat/ChatContext.d.ts +21 -21
  35. package/dist/components/chat/ChatContext.js +220 -0
  36. package/dist/components/chat/ChatContext.js.map +1 -0
  37. package/dist/components/chat/ChatContext.mjs +1 -1
  38. package/dist/components/chat/CodeBlock.js +221 -0
  39. package/dist/components/chat/CodeBlock.js.map +1 -0
  40. package/dist/components/chat/CodeBlock.mjs +1 -1
  41. package/dist/components/chat/Header.d.ts +2 -3
  42. package/dist/components/chat/Header.js +31 -0
  43. package/dist/components/chat/Header.js.map +1 -0
  44. package/dist/components/chat/Header.mjs +2 -2
  45. package/dist/components/chat/Icons.d.ts +4 -4
  46. package/dist/components/chat/Icons.js +233 -0
  47. package/dist/components/chat/Icons.js.map +1 -0
  48. package/dist/components/chat/Input.d.ts +2 -3
  49. package/dist/components/chat/Input.js +111 -0
  50. package/dist/components/chat/Input.js.map +1 -0
  51. package/dist/components/chat/Input.mjs +2 -2
  52. package/dist/components/chat/Markdown.d.ts +1 -3
  53. package/dist/components/chat/Markdown.js +269 -0
  54. package/dist/components/chat/Markdown.js.map +1 -0
  55. package/dist/components/chat/Markdown.mjs +2 -2
  56. package/dist/components/chat/Messages.d.ts +2 -3
  57. package/dist/components/chat/Messages.js +331 -0
  58. package/dist/components/chat/Messages.js.map +1 -0
  59. package/dist/components/chat/Messages.mjs +4 -4
  60. package/dist/components/chat/Popup.d.ts +5 -4
  61. package/dist/components/chat/Popup.js +806 -0
  62. package/dist/components/chat/Popup.js.map +1 -0
  63. package/dist/components/chat/Popup.mjs +10 -10
  64. package/dist/components/chat/Response.d.ts +2 -3
  65. package/dist/components/chat/Response.js +31 -0
  66. package/dist/components/chat/Response.js.map +1 -0
  67. package/dist/components/chat/Response.mjs +2 -2
  68. package/dist/components/chat/Sidebar.d.ts +7 -6
  69. package/dist/components/chat/Sidebar.js +817 -0
  70. package/dist/components/chat/Sidebar.js.map +1 -0
  71. package/dist/components/chat/Sidebar.mjs +10 -10
  72. package/dist/components/chat/Textarea.d.ts +4 -4
  73. package/dist/components/chat/Textarea.js +55 -0
  74. package/dist/components/chat/Textarea.js.map +1 -0
  75. package/dist/components/chat/Window.d.ts +1 -1
  76. package/dist/components/chat/Window.js +116 -0
  77. package/dist/components/chat/Window.js.map +1 -0
  78. package/dist/components/chat/index.d.ts +5 -4
  79. package/dist/components/chat/index.js +824 -0
  80. package/dist/components/chat/index.js.map +1 -0
  81. package/dist/components/chat/index.mjs +11 -11
  82. package/dist/components/chat/props.d.ts +1 -1
  83. package/dist/components/chat/props.js +4 -0
  84. package/dist/components/index.d.ts +5 -11
  85. package/dist/components/index.js +824 -0
  86. package/dist/components/index.js.map +1 -0
  87. package/dist/components/index.mjs +12 -33
  88. package/dist/context/index.js +4 -0
  89. package/dist/hooks/index.js +4 -0
  90. package/dist/hooks/use-copy-to-clipboard.js +47 -0
  91. package/dist/hooks/use-copy-to-clipboard.js.map +1 -0
  92. package/dist/index.css +112 -916
  93. package/dist/index.css.map +1 -1
  94. package/dist/index.d.ts +5 -11
  95. package/dist/index.js +824 -0
  96. package/dist/index.js.map +1 -0
  97. package/dist/index.mjs +13 -34
  98. package/dist/lib/utils.js +64 -0
  99. package/dist/lib/utils.js.map +1 -0
  100. package/dist/lib/utils.mjs +38 -2
  101. package/dist/lib/utils.mjs.map +1 -1
  102. package/dist/lib/utils.test.js +10 -0
  103. package/dist/lib/utils.test.js.map +1 -0
  104. package/dist/types/index.js +4 -0
  105. package/dist/types/types.d.ts +1 -1
  106. package/dist/types/types.js +4 -0
  107. package/package.json +8 -7
  108. package/src/components/chat/Button.tsx +1 -2
  109. package/src/components/chat/Chat.tsx +7 -7
  110. package/src/components/chat/ChatContext.tsx +10 -10
  111. package/src/components/chat/CodeBlock.tsx +12 -36
  112. package/src/components/chat/Header.tsx +1 -2
  113. package/src/components/chat/Input.tsx +1 -1
  114. package/src/components/chat/Markdown.tsx +17 -11
  115. package/src/components/chat/Messages.tsx +2 -2
  116. package/src/components/chat/Popup.tsx +3 -4
  117. package/src/components/chat/Response.tsx +1 -2
  118. package/src/components/chat/Sidebar.tsx +4 -4
  119. package/src/components/chat/index.tsx +2 -2
  120. package/src/components/chat/props.ts +1 -1
  121. package/src/components/index.ts +0 -8
  122. package/src/css/animations.css +6 -0
  123. package/src/css/markdown.css +123 -0
  124. package/src/styles.css +1 -0
  125. package/src/types/types.ts +1 -1
  126. package/tsup.config.ts +1 -2
  127. package/dist/chunk-2KAF7NKC.mjs +0 -484
  128. package/dist/chunk-2KAF7NKC.mjs.map +0 -1
  129. package/dist/chunk-5KEDV5VC.mjs +0 -27
  130. package/dist/chunk-5KEDV5VC.mjs.map +0 -1
  131. package/dist/chunk-6H3Y2XEI.mjs.map +0 -1
  132. package/dist/chunk-6LAZQHEB.mjs +0 -129
  133. package/dist/chunk-6LAZQHEB.mjs.map +0 -1
  134. package/dist/chunk-C34L4AWW.mjs +0 -39
  135. package/dist/chunk-C34L4AWW.mjs.map +0 -1
  136. package/dist/chunk-CF3BK4OX.mjs +0 -53
  137. package/dist/chunk-CF3BK4OX.mjs.map +0 -1
  138. package/dist/chunk-CNQX2VY3.mjs +0 -66
  139. package/dist/chunk-CNQX2VY3.mjs.map +0 -1
  140. package/dist/chunk-DN3OI5WF.mjs.map +0 -1
  141. package/dist/chunk-DPUPEOGG.mjs.map +0 -1
  142. package/dist/chunk-FZRTAML3.mjs +0 -3
  143. package/dist/chunk-GCOPYGHH.mjs +0 -27
  144. package/dist/chunk-GCOPYGHH.mjs.map +0 -1
  145. package/dist/chunk-GPEJCUWA.mjs.map +0 -1
  146. package/dist/chunk-IJLMKBSZ.mjs +0 -25
  147. package/dist/chunk-IJLMKBSZ.mjs.map +0 -1
  148. package/dist/chunk-INCNMGJ7.mjs +0 -72
  149. package/dist/chunk-INCNMGJ7.mjs.map +0 -1
  150. package/dist/chunk-M3CZWJI3.mjs +0 -44
  151. package/dist/chunk-M3CZWJI3.mjs.map +0 -1
  152. package/dist/chunk-MC6KTH4X.mjs +0 -12
  153. package/dist/chunk-MC6KTH4X.mjs.map +0 -1
  154. package/dist/chunk-NXWVWC33.mjs.map +0 -1
  155. package/dist/chunk-OHWEJUCS.mjs +0 -18
  156. package/dist/chunk-OHWEJUCS.mjs.map +0 -1
  157. package/dist/chunk-OOBQC5H6.mjs +0 -34
  158. package/dist/chunk-OOBQC5H6.mjs.map +0 -1
  159. package/dist/chunk-Q6YO7LDK.mjs +0 -40
  160. package/dist/chunk-Q6YO7LDK.mjs.map +0 -1
  161. package/dist/chunk-QFASQEFJ.mjs.map +0 -1
  162. package/dist/chunk-RPTRCFSO.mjs +0 -42
  163. package/dist/chunk-RPTRCFSO.mjs.map +0 -1
  164. package/dist/chunk-SEH5PQVW.mjs +0 -52
  165. package/dist/chunk-SEH5PQVW.mjs.map +0 -1
  166. package/dist/chunk-SHOTWRKC.mjs +0 -18
  167. package/dist/chunk-SHOTWRKC.mjs.map +0 -1
  168. package/dist/chunk-SRBUGQTM.mjs +0 -109
  169. package/dist/chunk-SRBUGQTM.mjs.map +0 -1
  170. package/dist/chunk-TEYIQHMK.mjs +0 -12
  171. package/dist/chunk-TEYIQHMK.mjs.map +0 -1
  172. package/dist/chunk-UIRFLYXI.mjs.map +0 -1
  173. package/dist/chunk-VGX2W5ZB.mjs +0 -28
  174. package/dist/chunk-VGX2W5ZB.mjs.map +0 -1
  175. package/dist/chunk-X3Z2EVFV.mjs.map +0 -1
  176. package/dist/chunk-X4T6ZUVM.mjs.map +0 -1
  177. package/dist/chunk-XGUBRIUV.mjs +0 -72
  178. package/dist/chunk-XGUBRIUV.mjs.map +0 -1
  179. package/dist/chunk-Y2RUG4B3.mjs.map +0 -1
  180. package/dist/chunk-ZVAH2Z2W.mjs.map +0 -1
  181. package/dist/chunk-ZYC5YVDO.mjs +0 -21
  182. package/dist/chunk-ZYC5YVDO.mjs.map +0 -1
  183. package/dist/components/chat-components/chat-list.d.ts +0 -8
  184. package/dist/components/chat-components/chat-list.mjs +0 -13
  185. package/dist/components/chat-components/chat-message-actions.d.ts +0 -8
  186. package/dist/components/chat-components/chat-message-actions.mjs +0 -8
  187. package/dist/components/chat-components/chat-message.d.ts +0 -8
  188. package/dist/components/chat-components/chat-message.mjs +0 -11
  189. package/dist/components/chat-components/chat-panel.d.ts +0 -8
  190. package/dist/components/chat-components/chat-panel.mjs +0 -10
  191. package/dist/components/chat-components/chat-scroll-anchor.d.ts +0 -6
  192. package/dist/components/chat-components/chat-scroll-anchor.mjs +0 -5
  193. package/dist/components/chat-components/clear-history.d.ts +0 -9
  194. package/dist/components/chat-components/clear-history.mjs +0 -56
  195. package/dist/components/chat-components/clear-history.mjs.map +0 -1
  196. package/dist/components/chat-components/copilot-chat.d.ts +0 -12
  197. package/dist/components/chat-components/copilot-chat.mjs +0 -22
  198. package/dist/components/chat-components/copilot-chat.mjs.map +0 -1
  199. package/dist/components/chat-components/default-empty-screen.d.ts +0 -8
  200. package/dist/components/chat-components/default-empty-screen.mjs +0 -8
  201. package/dist/components/chat-components/default-empty-screen.mjs.map +0 -1
  202. package/dist/components/chat-components/external-link.d.ts +0 -6
  203. package/dist/components/chat-components/external-link.mjs +0 -4
  204. package/dist/components/chat-components/external-link.mjs.map +0 -1
  205. package/dist/components/chat-components/markdown.d.ts +0 -6
  206. package/dist/components/chat-components/markdown.mjs +0 -4
  207. package/dist/components/chat-components/markdown.mjs.map +0 -1
  208. package/dist/components/chat-components/prompt-form.d.ts +0 -9
  209. package/dist/components/chat-components/prompt-form.mjs +0 -9
  210. package/dist/components/chat-components/prompt-form.mjs.map +0 -1
  211. package/dist/components/chat-components/theme-toggle.d.ts +0 -3
  212. package/dist/components/chat-components/theme-toggle.mjs +0 -32
  213. package/dist/components/chat-components/theme-toggle.mjs.map +0 -1
  214. package/dist/components/chat-components/toaster.d.ts +0 -1
  215. package/dist/components/chat-components/toaster.mjs +0 -4
  216. package/dist/components/chat-components/toaster.mjs.map +0 -1
  217. package/dist/components/chat-components/ui/alert-dialog.d.ts +0 -20
  218. package/dist/components/chat-components/ui/alert-dialog.mjs +0 -6
  219. package/dist/components/chat-components/ui/alert-dialog.mjs.map +0 -1
  220. package/dist/components/chat-components/ui/badge.d.ts +0 -12
  221. package/dist/components/chat-components/ui/badge.mjs +0 -29
  222. package/dist/components/chat-components/ui/badge.mjs.map +0 -1
  223. package/dist/components/chat-components/ui/button.d.ts +0 -14
  224. package/dist/components/chat-components/ui/button.mjs +0 -5
  225. package/dist/components/chat-components/ui/button.mjs.map +0 -1
  226. package/dist/components/chat-components/ui/codeblock.d.ts +0 -14
  227. package/dist/components/chat-components/ui/codeblock.mjs +0 -8
  228. package/dist/components/chat-components/ui/codeblock.mjs.map +0 -1
  229. package/dist/components/chat-components/ui/dialog.d.ts +0 -18
  230. package/dist/components/chat-components/ui/dialog.mjs +0 -94
  231. package/dist/components/chat-components/ui/dialog.mjs.map +0 -1
  232. package/dist/components/chat-components/ui/dropdown-menu.d.ts +0 -24
  233. package/dist/components/chat-components/ui/dropdown-menu.mjs +0 -87
  234. package/dist/components/chat-components/ui/dropdown-menu.mjs.map +0 -1
  235. package/dist/components/chat-components/ui/icons.d.ts +0 -33
  236. package/dist/components/chat-components/ui/icons.mjs +0 -5
  237. package/dist/components/chat-components/ui/icons.mjs.map +0 -1
  238. package/dist/components/chat-components/ui/input.d.ts +0 -7
  239. package/dist/components/chat-components/ui/input.mjs +0 -26
  240. package/dist/components/chat-components/ui/input.mjs.map +0 -1
  241. package/dist/components/chat-components/ui/label.d.ts +0 -8
  242. package/dist/components/chat-components/ui/label.mjs +0 -19
  243. package/dist/components/chat-components/ui/label.mjs.map +0 -1
  244. package/dist/components/chat-components/ui/select.d.ts +0 -13
  245. package/dist/components/chat-components/ui/select.mjs +0 -101
  246. package/dist/components/chat-components/ui/select.mjs.map +0 -1
  247. package/dist/components/chat-components/ui/separator.d.ts +0 -6
  248. package/dist/components/chat-components/ui/separator.mjs +0 -5
  249. package/dist/components/chat-components/ui/separator.mjs.map +0 -1
  250. package/dist/components/chat-components/ui/sheet.d.ts +0 -19
  251. package/dist/components/chat-components/ui/sheet.mjs +0 -93
  252. package/dist/components/chat-components/ui/sheet.mjs.map +0 -1
  253. package/dist/components/chat-components/ui/switch.d.ts +0 -6
  254. package/dist/components/chat-components/ui/switch.mjs +0 -33
  255. package/dist/components/chat-components/ui/switch.mjs.map +0 -1
  256. package/dist/components/chat-components/ui/textarea.d.ts +0 -7
  257. package/dist/components/chat-components/ui/textarea.mjs +0 -25
  258. package/dist/components/chat-components/ui/textarea.mjs.map +0 -1
  259. package/dist/components/chat-components/ui/tooltip.d.ts +0 -9
  260. package/dist/components/chat-components/ui/tooltip.mjs +0 -5
  261. package/dist/components/chat-components/ui/tooltip.mjs.map +0 -1
  262. package/dist/components/sidebar/copilot-sidebar-ui-provider.d.ts +0 -8
  263. package/dist/components/sidebar/copilot-sidebar-ui-provider.mjs +0 -25
  264. package/dist/components/sidebar/copilot-sidebar-ui-provider.mjs.map +0 -1
  265. package/dist/components/sidebar/copilot-sidebar.d.ts +0 -6
  266. package/dist/components/sidebar/copilot-sidebar.mjs +0 -23
  267. package/dist/components/sidebar/copilot-sidebar.mjs.map +0 -1
  268. package/dist/components/sidebar/sidebar-context.d.ts +0 -9
  269. package/dist/components/sidebar/sidebar-context.mjs +0 -4
  270. package/dist/components/sidebar/sidebar-context.mjs.map +0 -1
  271. package/dist/hooks/use-at-bottom.d.ts +0 -3
  272. package/dist/hooks/use-at-bottom.mjs +0 -4
  273. package/dist/hooks/use-at-bottom.mjs.map +0 -1
  274. package/dist/hooks/use-enter-submit.d.ts +0 -8
  275. package/dist/hooks/use-enter-submit.mjs +0 -4
  276. package/dist/hooks/use-enter-submit.mjs.map +0 -1
  277. package/src/components/chat-components/chat-list.tsx +0 -28
  278. package/src/components/chat-components/chat-message-actions.tsx +0 -36
  279. package/src/components/chat-components/chat-message.tsx +0 -70
  280. package/src/components/chat-components/chat-panel.tsx +0 -64
  281. package/src/components/chat-components/chat-scroll-anchor.tsx +0 -29
  282. package/src/components/chat-components/clear-history.tsx +0 -72
  283. package/src/components/chat-components/copilot-chat.tsx +0 -57
  284. package/src/components/chat-components/default-empty-screen.tsx +0 -57
  285. package/src/components/chat-components/external-link.tsx +0 -17
  286. package/src/components/chat-components/markdown.tsx +0 -8
  287. package/src/components/chat-components/prompt-form.tsx +0 -85
  288. package/src/components/chat-components/theme-toggle.tsx +0 -31
  289. package/src/components/chat-components/toaster.tsx +0 -3
  290. package/src/components/chat-components/ui/alert-dialog.tsx +0 -126
  291. package/src/components/chat-components/ui/badge.tsx +0 -33
  292. package/src/components/chat-components/ui/button.tsx +0 -49
  293. package/src/components/chat-components/ui/codeblock.tsx +0 -137
  294. package/src/components/chat-components/ui/dialog.tsx +0 -106
  295. package/src/components/chat-components/ui/dropdown-menu.tsx +0 -117
  296. package/src/components/chat-components/ui/icons.tsx +0 -484
  297. package/src/components/chat-components/ui/input.tsx +0 -24
  298. package/src/components/chat-components/ui/label.tsx +0 -21
  299. package/src/components/chat-components/ui/select.tsx +0 -119
  300. package/src/components/chat-components/ui/separator.tsx +0 -26
  301. package/src/components/chat-components/ui/sheet.tsx +0 -106
  302. package/src/components/chat-components/ui/switch.tsx +0 -29
  303. package/src/components/chat-components/ui/textarea.tsx +0 -23
  304. package/src/components/chat-components/ui/tooltip.tsx +0 -30
  305. package/src/components/sidebar/copilot-sidebar-ui-provider.tsx +0 -73
  306. package/src/components/sidebar/copilot-sidebar.tsx +0 -38
  307. package/src/components/sidebar/sidebar-context.tsx +0 -11
  308. package/src/hooks/use-at-bottom.tsx +0 -20
  309. package/src/hooks/use-enter-submit.tsx +0 -17
  310. /package/dist/{chunk-FZRTAML3.mjs.map → chunk-JD7BAH7U.mjs.map} +0 -0
  311. /package/dist/components/{chat-components/chat-list.mjs.map → chat/props.js.map} +0 -0
  312. /package/dist/{components/chat-components/chat-message-actions.mjs.map → context/index.js.map} +0 -0
  313. /package/dist/{components/chat-components/chat-message.mjs.map → hooks/index.js.map} +0 -0
  314. /package/dist/{components/chat-components/chat-panel.mjs.map → types/index.js.map} +0 -0
  315. /package/dist/{components/chat-components/chat-scroll-anchor.mjs.map → types/types.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import { useChatContext } from './chunk-6H3Y2XEI.mjs';
1
+ import { useChatContext } from './chunk-OF66AL5Z.mjs';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
 
4
4
  var Button = ({ open, setOpen }) => {
@@ -18,4 +18,4 @@ var Button = ({ open, setOpen }) => {
18
18
 
19
19
  export { Button };
20
20
  //# sourceMappingURL=out.js.map
21
- //# sourceMappingURL=chunk-Y2RUG4B3.mjs.map
21
+ //# sourceMappingURL=chunk-5O2MCJZ2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Button.tsx"],"names":[],"mappings":";;;;;AASM,SAIE,KAJF;AANC,IAAM,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAmB;AACxD,QAAM,UAAU,eAAe;AAG/B,SACE,oBAAC,SAAI,SAAS,MAAM,QAAQ,CAAC,IAAI,GAC/B;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,oBAAoB,OAAO,SAAS;AAAA,MAC/C,cAAY,OAAO,eAAe;AAAA,MAElC;AAAA,4BAAC,SAAI,WAAU,iDACZ,kBAAQ,MAAM,UACjB;AAAA,QACA,oBAAC,SAAI,WAAU,kDACZ,kBAAQ,MAAM,WACjB;AAAA;AAAA;AAAA,EACF,GACF;AAEJ","sourcesContent":["import { ButtonProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\n\nexport const Button = ({ open, setOpen }: ButtonProps) => {\n const context = useChatContext();\n // To ensure that the mouse handler fires even when the button is scaled down\n // we wrap the button in a div and attach the handler to the div\n return (\n <div onClick={() => setOpen(!open)}>\n <button\n className={`copilotKitButton ${open ? \"open\" : \"\"}`}\n aria-label={open ? \"Close Chat\" : \"Open Chat\"}\n >\n <div className=\"copilotKitButtonIcon copilotKitButtonIconOpen\">\n {context.icons.openIcon}\n </div>\n <div className=\"copilotKitButtonIcon copilotKitButtonIconClose\">\n {context.icons.closeIcon}\n </div>\n </button>\n </div>\n );\n};\n"]}
@@ -1,9 +1,9 @@
1
- import { CopilotKitChat } from './chunk-DN3OI5WF.mjs';
1
+ import { CopilotChat } from './chunk-NNVWLSYK.mjs';
2
2
  import { __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
3
3
  import { useState } from 'react';
4
4
  import { jsxs, jsx } from 'react/jsx-runtime';
5
5
 
6
- var CopilotKitSidebar = (props) => {
6
+ var CopilotSidebar = (props) => {
7
7
  props = __spreadProps(__spreadValues({}, props), {
8
8
  className: props.className ? props.className + " copilotKitSidebar" : "copilotKitSidebar"
9
9
  });
@@ -17,10 +17,10 @@ var CopilotKitSidebar = (props) => {
17
17
  };
18
18
  return /* @__PURE__ */ jsxs("div", { className: `copilotKitSidebarContentWrapper ${expandedClassName}`, children: [
19
19
  props.children,
20
- /* @__PURE__ */ jsx(CopilotKitChat, __spreadValues(__spreadValues({}, props), { onSetOpen }))
20
+ /* @__PURE__ */ jsx(CopilotChat, __spreadValues(__spreadValues({}, props), { onSetOpen }))
21
21
  ] });
22
22
  };
23
23
 
24
- export { CopilotKitSidebar };
24
+ export { CopilotSidebar };
25
25
  //# sourceMappingURL=out.js.map
26
- //# sourceMappingURL=chunk-X3Z2EVFV.mjs.map
26
+ //# sourceMappingURL=chunk-CKJXXQ2W.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Sidebar.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,SAAgB,gBAAgB;AAsB5B,SAEE,KAFF;AAfG,IAAM,iBAAiB,CAAC,UAA+B;AAC5D,UAAQ,iCACH,QADG;AAAA,IAEN,WAAW,MAAM,YAAY,MAAM,YAAY,uBAAuB;AAAA,EACxE;AACA,QAAM,CAAC,mBAAmB,oBAAoB,IAAI;AAAA,IAChD,MAAM,cAAc,oBAAoB;AAAA,EAC1C;AAEA,QAAM,YAAY,CAAC,SAAkB;AAhBvC;AAiBI,gBAAM,cAAN,+BAAkB;AAClB,yBAAqB,OAAO,oBAAoB,EAAE;AAAA,EACpD;AAEA,SACE,qBAAC,SAAI,WAAW,mCAAmC,qBAChD;AAAA,UAAM;AAAA,IACP,oBAAC,+CAAgB,QAAW,EAAE,UAAU,EAAG;AAAA,KAC7C;AAEJ","sourcesContent":["import React, { useState } from \"react\";\nimport { CopilotChat, CopilotChatProps } from \"./Chat\";\n\ninterface CopilotSidebarProps extends CopilotChatProps {\n children?: React.ReactNode;\n}\n\nexport const CopilotSidebar = (props: CopilotSidebarProps) => {\n props = {\n ...props,\n className: props.className ? props.className + \" copilotKitSidebar\" : \"copilotKitSidebar\",\n };\n const [expandedClassName, setExpandedClassName] = useState(\n props.defaultOpen ? \"sidebarExpanded\" : \"\",\n );\n\n const onSetOpen = (open: boolean) => {\n props.onSetOpen?.(open);\n setExpandedClassName(open ? \"sidebarExpanded\" : \"\");\n };\n\n return (\n <div className={`copilotKitSidebarContentWrapper ${expandedClassName}`}>\n {props.children}\n <CopilotChat {...props} {...{ onSetOpen }} />\n </div>\n );\n};\n"]}
@@ -2,15 +2,9 @@ import { DownloadIcon, CheckIcon, CopyIcon } from './chunk-7YXG7D47.mjs';
2
2
  import { useCopyToClipboard } from './chunk-POVINPXX.mjs';
3
3
  import { memo } from 'react';
4
4
  import { Prism } from 'react-syntax-highlighter';
5
+ import { vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism';
5
6
  import { jsxs, jsx } from 'react/jsx-runtime';
6
7
 
7
- var CodeActionButton = ({ onClick, children }) => {
8
- let className = "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 ";
9
- className += "hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0 ";
10
- className += "hover:bg-accent hover:text-accent-foreground ";
11
- className += "h-10 w-10";
12
- return /* @__PURE__ */ jsx("button", { className, onClick, children });
13
- };
14
8
  var programmingLanguages = {
15
9
  javascript: ".js",
16
10
  python: ".py",
@@ -73,15 +67,15 @@ var CodeBlock = memo(({ language, value }) => {
73
67
  return;
74
68
  copyToClipboard(value);
75
69
  };
76
- return /* @__PURE__ */ jsxs("div", { className: "codeblock relative w-full bg-zinc-950 font-sans", children: [
77
- /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between bg-zinc-800 px-6 py-2 pr-4 text-zinc-100", children: [
78
- /* @__PURE__ */ jsx("span", { className: "text-xs lowercase", children: language }),
79
- /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-1", children: [
80
- /* @__PURE__ */ jsxs(CodeActionButton, { onClick: downloadAsFile, children: [
70
+ return /* @__PURE__ */ jsxs("div", { className: "copilotKitCodeBlock", children: [
71
+ /* @__PURE__ */ jsxs("div", { className: "copilotKitCodeBlockToolbar", children: [
72
+ /* @__PURE__ */ jsx("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
73
+ /* @__PURE__ */ jsxs("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
74
+ /* @__PURE__ */ jsxs("button", { className: "copilotKitCodeBlockToolbarButton", onClick: downloadAsFile, children: [
81
75
  /* @__PURE__ */ jsx(DownloadIcon, {}),
82
76
  /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Download" })
83
77
  ] }),
84
- /* @__PURE__ */ jsxs(CodeActionButton, { onClick: onCopy, children: [
78
+ /* @__PURE__ */ jsxs("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: [
85
79
  isCopied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {}),
86
80
  /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Copy code" })
87
81
  ] })
@@ -91,19 +85,12 @@ var CodeBlock = memo(({ language, value }) => {
91
85
  Prism,
92
86
  {
93
87
  language,
88
+ style: vscDarkPlus,
94
89
  PreTag: "div",
95
- showLineNumbers: true,
96
90
  customStyle: {
97
91
  margin: 0,
98
- width: "100%",
99
- background: "transparent",
100
- padding: "1.5rem 1rem"
101
- },
102
- codeTagProps: {
103
- style: {
104
- fontSize: "0.9rem",
105
- fontFamily: "var(--font-mono)"
106
- }
92
+ borderBottomLeftRadius: "0.375rem",
93
+ borderBottomRightRadius: "0.375rem"
107
94
  },
108
95
  children: value
109
96
  }
@@ -114,4 +101,4 @@ CodeBlock.displayName = "CodeBlock";
114
101
 
115
102
  export { CodeBlock, generateRandomString, programmingLanguages };
116
103
  //# sourceMappingURL=out.js.map
117
- //# sourceMappingURL=chunk-NXWVWC33.mjs.map
104
+ //# sourceMappingURL=chunk-DPRH4HX3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/CodeBlock.tsx"],"names":[],"mappings":";;;;;;;;;;AAEA,SAAa,YAAY;AACzB,SAAS,SAAS,yBAAyB;AAC3C,SAAS,eAAe,sBAAsB;AA2FtC,cAEE,YAFF;AAxED,IAAM,uBAAoC;AAAA,EAC/C,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,GAAG;AAAA,EACH,KAAK;AAAA,EACL,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,eAAe;AAAA,EACf,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,KAAK;AAAA,EACL,OAAO;AAAA,EACP,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA;AAEP;AAEO,IAAM,uBAAuB,CAAC,QAAgB,YAAY,UAAU;AACzE,QAAM,QAAQ;AACd,MAAI,SAAS;AACb,WAAS,IAAI,GAAG,IAAI,QAAQ,KAAK;AAC/B,cAAU,MAAM,OAAO,KAAK,MAAM,KAAK,OAAO,IAAI,MAAM,MAAM,CAAC;AAAA,EACjE;AACA,SAAO,YAAY,OAAO,YAAY,IAAI;AAC5C;AAEA,IAAM,YAAuB,KAAK,CAAC,EAAE,UAAU,MAAM,MAAM;AACzD,QAAM,EAAE,UAAU,gBAAgB,IAAI,mBAAmB,EAAE,SAAS,IAAK,CAAC;AAE1E,QAAM,iBAAiB,MAAM;AAC3B,QAAI,OAAO,WAAW,aAAa;AACjC;AAAA,IACF;AACA,UAAM,gBAAgB,qBAAqB,QAAQ,KAAK;AACxD,UAAM,oBAAoB,QAAQ,qBAAqB,GAAG,IAAI,IAAI;AAClE,UAAM,WAAW,OAAO,OAAO,mBAAyB,iBAAiB;AAEzE,QAAI,CAAC,UAAU;AAEb;AAAA,IACF;AAEA,UAAM,OAAO,IAAI,KAAK,CAAC,KAAK,GAAG,EAAE,MAAM,aAAa,CAAC;AACrD,UAAM,MAAM,IAAI,gBAAgB,IAAI;AACpC,UAAM,OAAO,SAAS,cAAc,GAAG;AACvC,SAAK,WAAW;AAChB,SAAK,OAAO;AACZ,SAAK,MAAM,UAAU;AACrB,aAAS,KAAK,YAAY,IAAI;AAC9B,SAAK,MAAM;AACX,aAAS,KAAK,YAAY,IAAI;AAC9B,QAAI,gBAAgB,GAAG;AAAA,EACzB;AAEA,QAAM,SAAS,MAAM;AACnB,QAAI;AAAU;AACd,oBAAgB,KAAK;AAAA,EACvB;AAEA,SACE,qBAAC,SAAI,WAAU,uBACb;AAAA,yBAAC,SAAI,WAAU,8BACb;AAAA,0BAAC,UAAK,WAAU,sCAAsC,oBAAS;AAAA,MAC/D,qBAAC,SAAI,WAAU,qCACb;AAAA,6BAAC,YAAO,WAAU,oCAAmC,SAAS,gBAC5D;AAAA,8BAAC,gBAAa;AAAA,UACd,oBAAC,UAAK,WAAU,WAAU,sBAAQ;AAAA,WACpC;AAAA,QACA,qBAAC,YAAO,WAAU,oCAAmC,SAAS,QAC3D;AAAA,qBAAW,oBAAC,aAAU,IAAK,oBAAC,YAAS;AAAA,UACtC,oBAAC,UAAK,WAAU,WAAU,uBAAS;AAAA,WACrC;AAAA,SACF;AAAA,OACF;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,OAAO;AAAA,QACP,QAAO;AAAA,QACP,aAAa;AAAA,UACX,QAAQ;AAAA,UACR,wBAAwB;AAAA,UACxB,yBAAyB;AAAA,QAC3B;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,KACF;AAEJ,CAAC;AACD,UAAU,cAAc","sourcesContent":["\"use client\";\n\nimport { FC, memo } from \"react\";\nimport { Prism as SyntaxHighlighter } from \"react-syntax-highlighter\";\nimport { vscDarkPlus as highlightStyle } from \"react-syntax-highlighter/dist/esm/styles/prism\";\n\nimport { useCopyToClipboard } from \"../../hooks/use-copy-to-clipboard\";\nimport { CheckIcon, CopyIcon, DownloadIcon } from \"./Icons\";\n\ninterface CodeActionButtonProps {\n onClick: () => void;\n children: React.ReactNode;\n}\n\ninterface Props {\n language: string;\n value: string;\n}\n\ninterface languageMap {\n [key: string]: string | undefined;\n}\n\nexport const programmingLanguages: languageMap = {\n javascript: \".js\",\n python: \".py\",\n java: \".java\",\n c: \".c\",\n cpp: \".cpp\",\n \"c++\": \".cpp\",\n \"c#\": \".cs\",\n ruby: \".rb\",\n php: \".php\",\n swift: \".swift\",\n \"objective-c\": \".m\",\n kotlin: \".kt\",\n typescript: \".ts\",\n go: \".go\",\n perl: \".pl\",\n rust: \".rs\",\n scala: \".scala\",\n haskell: \".hs\",\n lua: \".lua\",\n shell: \".sh\",\n sql: \".sql\",\n html: \".html\",\n css: \".css\",\n // add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component\n};\n\nexport const generateRandomString = (length: number, lowercase = false) => {\n const chars = \"ABCDEFGHJKLMNPQRSTUVWXY3456789\"; // excluding similar looking characters like Z, 2, I, 1, O, 0\n let result = \"\";\n for (let i = 0; i < length; i++) {\n result += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n return lowercase ? result.toLowerCase() : result;\n};\n\nconst CodeBlock: FC<Props> = memo(({ language, value }) => {\n const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2000 });\n\n const downloadAsFile = () => {\n if (typeof window === \"undefined\") {\n return;\n }\n const fileExtension = programmingLanguages[language] || \".file\";\n const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;\n const fileName = window.prompt(\"Enter file name\" || \"\", suggestedFileName);\n\n if (!fileName) {\n // User pressed cancel on prompt.\n return;\n }\n\n const blob = new Blob([value], { type: \"text/plain\" });\n const url = URL.createObjectURL(blob);\n const link = document.createElement(\"a\");\n link.download = fileName;\n link.href = url;\n link.style.display = \"none\";\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n URL.revokeObjectURL(url);\n };\n\n const onCopy = () => {\n if (isCopied) return;\n copyToClipboard(value);\n };\n\n return (\n <div className=\"copilotKitCodeBlock\">\n <div className=\"copilotKitCodeBlockToolbar\">\n <span className=\"copilotKitCodeBlockToolbarLanguage\">{language}</span>\n <div className=\"copilotKitCodeBlockToolbarButtons\">\n <button className=\"copilotKitCodeBlockToolbarButton\" onClick={downloadAsFile}>\n <DownloadIcon />\n <span className=\"sr-only\">Download</span>\n </button>\n <button className=\"copilotKitCodeBlockToolbarButton\" onClick={onCopy}>\n {isCopied ? <CheckIcon /> : <CopyIcon />}\n <span className=\"sr-only\">Copy code</span>\n </button>\n </div>\n </div>\n <SyntaxHighlighter\n language={language}\n style={highlightStyle}\n PreTag=\"div\"\n customStyle={{\n margin: 0,\n borderBottomLeftRadius: \"0.375rem\",\n borderBottomRightRadius: \"0.375rem\",\n }}\n >\n {value}\n </SyntaxHighlighter>\n </div>\n );\n});\nCodeBlock.displayName = \"CodeBlock\";\n\nexport { CodeBlock };\n"]}
@@ -1,4 +1,4 @@
1
- import { CodeBlock } from './chunk-NXWVWC33.mjs';
1
+ import { CodeBlock } from './chunk-DPRH4HX3.mjs';
2
2
  import { __objRest, __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
3
3
  import { memo } from 'react';
4
4
  import ReactMarkdown from 'react-markdown';
@@ -11,25 +11,26 @@ var MemoizedReactMarkdown = memo(
11
11
  (prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.className === nextProps.className
12
12
  );
13
13
  var Markdown = ({ content }) => {
14
- return /* @__PURE__ */ jsx(
15
- MemoizedReactMarkdown,
16
- {
17
- className: "prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0 text-sm",
18
- components,
19
- remarkPlugins: [remarkGfm, remarkMath],
20
- children: content
21
- }
22
- );
14
+ return /* @__PURE__ */ jsx("div", { className: "copilotKitMarkdown", children: /* @__PURE__ */ jsx(MemoizedReactMarkdown, { components, remarkPlugins: [remarkGfm, remarkMath], children: content }) });
23
15
  };
24
16
  var components = {
25
17
  p({ children }) {
26
- return /* @__PURE__ */ jsx("p", { className: "mb-2 last:mb-0", children });
18
+ return /* @__PURE__ */ jsx("p", { children });
27
19
  },
28
20
  code(_a) {
29
21
  var _b = _a, { children, className, inline } = _b, props = __objRest(_b, ["children", "className", "inline"]);
30
22
  if (children.length) {
31
23
  if (children[0] == "\u258D") {
32
- return /* @__PURE__ */ jsx("span", { className: "mt-1 animate-pulse cursor-default", children: "\u258D" });
24
+ return /* @__PURE__ */ jsx(
25
+ "span",
26
+ {
27
+ style: {
28
+ animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
29
+ marginTop: "0.25rem"
30
+ },
31
+ children: "\u258D"
32
+ }
33
+ );
33
34
  }
34
35
  children[0] = children[0].replace("`\u258D`", "\u258D");
35
36
  }
@@ -50,4 +51,4 @@ var components = {
50
51
 
51
52
  export { Markdown };
52
53
  //# sourceMappingURL=out.js.map
53
- //# sourceMappingURL=chunk-UIRFLYXI.mjs.map
54
+ //# sourceMappingURL=chunk-GWGHQNRI.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Markdown.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,SAAa,YAAY;AACzB,OAAO,mBAA4C;AAEnD,OAAO,eAAe;AACtB,OAAO,gBAAgB;AAejB;AAbN,IAAM,wBAAqC;AAAA,EACzC;AAAA,EACA,CAAC,WAAW,cACV,UAAU,aAAa,UAAU,YAAY,UAAU,cAAc,UAAU;AACnF;AAMO,IAAM,WAAW,CAAC,EAAE,QAAQ,MAAqB;AACtD,SACE,oBAAC,SAAI,WAAU,sBACb,8BAAC,yBAAsB,YAAwB,eAAe,CAAC,WAAW,UAAU,GACjF,mBACH,GACF;AAEJ;AAEA,IAAM,aAAyB;AAAA,EAC7B,EAAE,EAAE,SAAS,GAAG;AACd,WAAO,oBAAC,OAAG,UAAS;AAAA,EACtB;AAAA,EACA,KAAK,IAA2C;AAA3C,iBAAE,YAAU,WAAW,OA9B9B,IA8BO,IAAkC,kBAAlC,IAAkC,CAAhC,YAAU,aAAW;AAC1B,QAAI,SAAS,QAAQ;AACnB,UAAI,SAAS,CAAC,KAAK,UAAK;AACtB,eACE;AAAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,cACL,WAAW;AAAA,cACX,WAAW;AAAA,YACb;AAAA,YACD;AAAA;AAAA,QAED;AAAA,MAEJ;AAEA,eAAS,CAAC,IAAK,SAAS,CAAC,EAAa,QAAQ,YAAO,QAAG;AAAA,IAC1D;AAEA,UAAM,QAAQ,iBAAiB,KAAK,aAAa,EAAE;AAEnD,QAAI,QAAQ;AACV,aACE,oBAAC,uCAAK,aAA0B,QAA/B,EACE,WACH;AAAA,IAEJ;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QAEC,UAAW,SAAS,MAAM,CAAC,KAAM;AAAA,QACjC,OAAO,OAAO,QAAQ,EAAE,QAAQ,OAAO,EAAE;AAAA,SACrC;AAAA,MAHC,KAAK,OAAO;AAAA,IAInB;AAAA,EAEJ;AACF","sourcesContent":["import { FC, memo } from \"react\";\nimport ReactMarkdown, { Options, Components } from \"react-markdown\";\nimport { CodeBlock } from \"./CodeBlock\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkMath from \"remark-math\";\n\nconst MemoizedReactMarkdown: FC<Options> = memo(\n ReactMarkdown,\n (prevProps, nextProps) =>\n prevProps.children === nextProps.children && prevProps.className === nextProps.className,\n);\n\ntype MarkdownProps = {\n content: string;\n};\n\nexport const Markdown = ({ content }: MarkdownProps) => {\n return (\n <div className=\"copilotKitMarkdown\">\n <MemoizedReactMarkdown components={components} remarkPlugins={[remarkGfm, remarkMath]}>\n {content}\n </MemoizedReactMarkdown>\n </div>\n );\n};\n\nconst components: Components = {\n p({ children }) {\n return <p>{children}</p>;\n },\n code({ children, className, inline, ...props }) {\n if (children.length) {\n if (children[0] == \"▍\") {\n return (\n <span\n style={{\n animation: \"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite\",\n marginTop: \"0.25rem\",\n }}\n >\n ▍\n </span>\n );\n }\n\n children[0] = (children[0] as string).replace(\"`▍`\", \"▍\");\n }\n\n const match = /language-(\\w+)/.exec(className || \"\");\n\n if (inline) {\n return (\n <code className={className} {...props}>\n {children}\n </code>\n );\n }\n\n return (\n <CodeBlock\n key={Math.random()}\n language={(match && match[1]) || \"\"}\n value={String(children).replace(/\\n$/, \"\")}\n {...props}\n />\n );\n },\n};\n"]}
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=out.js.map
3
+ //# sourceMappingURL=chunk-JD7BAH7U.mjs.map
@@ -1,14 +1,14 @@
1
- import { CopilotKitChat } from './chunk-DN3OI5WF.mjs';
1
+ import { CopilotChat } from './chunk-NNVWLSYK.mjs';
2
2
  import { __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
5
- var CopilotKitPopup = (props) => {
5
+ var CopilotPopup = (props) => {
6
6
  props = __spreadProps(__spreadValues({}, props), {
7
7
  className: props.className ? props.className + " copilotKitPopup" : "copilotKitPopup"
8
8
  });
9
- return /* @__PURE__ */ jsx(CopilotKitChat, __spreadValues({}, props));
9
+ return /* @__PURE__ */ jsx(CopilotChat, __spreadValues({}, props));
10
10
  };
11
11
 
12
- export { CopilotKitPopup };
12
+ export { CopilotPopup };
13
13
  //# sourceMappingURL=out.js.map
14
- //# sourceMappingURL=chunk-X4T6ZUVM.mjs.map
14
+ //# sourceMappingURL=chunk-KBGIPFXA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Popup.tsx"],"names":[],"mappings":";;;;;;;;;AAOS;AALF,IAAM,eAAe,CAAC,UAA4B;AACvD,UAAQ,iCACH,QADG;AAAA,IAEN,WAAW,MAAM,YAAY,MAAM,YAAY,qBAAqB;AAAA,EACtE;AACA,SAAO,oBAAC,gCAAgB,MAAO;AACjC","sourcesContent":["import { CopilotChat, CopilotChatProps } from \"./Chat\";\n\nexport const CopilotPopup = (props: CopilotChatProps) => {\n props = {\n ...props,\n className: props.className ? props.className + \" copilotKitPopup\" : \"copilotKitPopup\",\n };\n return <CopilotChat {...props} />;\n};\n"]}
@@ -1,17 +1,17 @@
1
+ import { Messages } from './chunk-3M4HWSE7.mjs';
2
+ import { ResponseButton } from './chunk-Z34F3WLK.mjs';
1
3
  import { Window } from './chunk-47SYBLI2.mjs';
2
- import { Input } from './chunk-QFASQEFJ.mjs';
3
- import { Messages } from './chunk-ZVAH2Z2W.mjs';
4
- import { ResponseButton } from './chunk-GPEJCUWA.mjs';
5
- import { Button } from './chunk-Y2RUG4B3.mjs';
6
- import { Header } from './chunk-DPUPEOGG.mjs';
7
- import { ChatContextProvider } from './chunk-6H3Y2XEI.mjs';
4
+ import { Button } from './chunk-5O2MCJZ2.mjs';
5
+ import { Header } from './chunk-UWPFPWAW.mjs';
6
+ import { Input } from './chunk-NYLOXKYT.mjs';
7
+ import { ChatContextProvider } from './chunk-OF66AL5Z.mjs';
8
8
  import { __async } from './chunk-MRXNTQOX.mjs';
9
9
  import React from 'react';
10
10
  import { useCopilotChat } from '@copilotkit/react-core';
11
11
  import { nanoid } from 'nanoid';
12
12
  import { jsx, jsxs } from 'react/jsx-runtime';
13
13
 
14
- var CopilotKitChat = ({
14
+ var CopilotChat = ({
15
15
  instructions,
16
16
  defaultOpen = false,
17
17
  clickOutsideToClose = true,
@@ -67,6 +67,6 @@ var CopilotKitChat = ({
67
67
  ] }) });
68
68
  };
69
69
 
70
- export { CopilotKitChat };
70
+ export { CopilotChat };
71
71
  //# sourceMappingURL=out.js.map
72
- //# sourceMappingURL=chunk-DN3OI5WF.mjs.map
72
+ //# sourceMappingURL=chunk-NNVWLSYK.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Chat.tsx"],"names":["Window","Button","Header","Messages","Input","ResponseButton"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW;AAElB,SAAgC,sBAAsB;AActD,SAAS,cAAc;AAsJf,cACA,YADA;AA3CD,IAAM,cAAc,CAAC;AAAA,EAC1B;AAAA,EACA,cAAc;AAAA,EACd,sBAAsB;AAAA,EACtB,mBAAmB;AAAA,EACnB;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAqB;AAAA,EACrB,QAAAA,UAAS;AAAA,EACT,QAAAC,UAAS;AAAA,EACT,QAAAC,UAAS;AAAA,EACT,UAAAC,YAAW;AAAA,EACX,OAAAC,SAAQ;AAAA,EACR,gBAAAC,kBAAiB;AAAA,EACjB;AACF,MAAwB;AACtB,QAAM,EAAE,iBAAiB,QAAQ,QAAQ,MAAM,WAAW,OAAO,SAAS,IAAI,eAAe;AAAA,IAC3F,IAAI,OAAO;AAAA,IACX;AAAA,IACA,wBAAwB;AAAA,EAC1B,CAAC;AAED,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAS,WAAW;AAE5D,QAAM,UAAU,CAAC,SAAkB;AACjC,2CAAY;AACZ,iBAAa,IAAI;AAAA,EACnB;AAEA,QAAM,cAAc,CAAO,YAAoB;AAC7C,WAAO;AAAA,MACL,IAAI,OAAO;AAAA,MACX,SAAS;AAAA,MACT,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AAEA,SACE,oBAAC,uBAAoB,OAAc,QACjC,+BAAC,SAAI,WACH;AAAA,wBAACJ,SAAA,EAAO,MAAM,WAAW,SAAkB;AAAA,IAC3C;AAAA,MAACD;AAAA,MAAA;AAAA,QACC,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAEA;AAAA,8BAACE,SAAA,EAAO,MAAM,WAAW,SAAkB;AAAA,UAC3C,oBAACC,WAAA,EAAS,UAAU,iBAAiB,YAAY,WAAW;AAAA,UAC5D,oBAACC,QAAA,EAAM,YAAY,WAAW,QAAQ,aACnC,gCAAsB,gBAAgB,SAAS,KAC9C,oBAACC,iBAAA,EAAe,SAAS,YAAY,OAAO,QAAQ,YAAY,WAAW,GAE/E;AAAA;AAAA;AAAA,IACF;AAAA,KACF,GACF;AAEJ","sourcesContent":["import React from \"react\";\nimport { CopilotChatIcons, ChatContextProvider, CopilotChatLabels } from \"./ChatContext\";\nimport { SystemMessageFunction, useCopilotChat } from \"@copilotkit/react-core\";\nimport {\n ButtonProps,\n HeaderProps,\n WindowProps,\n MessagesProps,\n InputProps,\n ResponseButtonProps,\n} from \"./props\";\nimport { Window as DefaultWindow } from \"./Window\";\nimport { Button as DefaultButton } from \"./Button\";\nimport { Header as DefaultHeader } from \"./Header\";\nimport { Messages as DefaultMessages } from \"./Messages\";\nimport { Input as DefaultInput } from \"./Input\";\nimport { nanoid } from \"nanoid\";\nimport { ResponseButton as DefaultResponseButton } from \"./Response\";\n\n/**\n * Props for CopilotChat component.\n */\nexport interface CopilotChatProps {\n /**\n * Custom instructions to be added to the system message. Use this property to\n * provide additional context or guidance to the language model, influencing\n * its responses. These instructions can include specific directions,\n * preferences, or criteria that the model should consider when generating\n * its output, thereby tailoring the conversation more precisely to the\n * user's needs or the application's requirements.\n */\n instructions?: string;\n\n /**\n * Whether the chat window should be open by default.\n * @default false\n */\n defaultOpen?: boolean;\n\n /**\n * If the chat window should close when the user clicks outside of it.\n * @default true\n */\n clickOutsideToClose?: boolean;\n\n /**\n * If the chat window should close when the user hits the Escape key.\n * @default true\n */\n hitEscapeToClose?: boolean;\n\n /**\n * A callback that gets called when the chat window opens or closes.\n */\n onSetOpen?: (open: boolean) => void;\n\n /**\n * The hotkey to open the chat window.\n * Uses Command-<hotkey> on a Mac and Ctrl-<hotkey> on Windows.\n * @default \"e\"\n */\n hotkey?: string;\n\n /**\n * Icons can be used to set custom icons for the chat window.\n */\n icons?: CopilotChatIcons;\n\n /**\n * Labels can be used to set custom labels for the chat window.\n */\n labels?: CopilotChatLabels;\n\n /**\n * A function that takes in context string and instructions and returns\n * the system message to include in the chat request.\n * Use this to completely override the system message, when providing\n * instructions is not enough.\n */\n makeSystemMessage?: SystemMessageFunction;\n\n /**\n * Whether to show the response button.\n * @default true\n */\n showResponseButton?: boolean;\n\n /**\n * A custom Window component to use instead of the default.\n */\n Window?: React.ComponentType<WindowProps>;\n\n /**\n * A custom Button component to use instead of the default.\n */\n Button?: React.ComponentType<ButtonProps>;\n\n /**\n * A custom Header component to use instead of the default.\n */\n Header?: React.ComponentType<HeaderProps>;\n\n /**\n * A custom Messages component to use instead of the default.\n */\n Messages?: React.ComponentType<MessagesProps>;\n\n /**\n * A custom Input component to use instead of the default.\n */\n Input?: React.ComponentType<InputProps>;\n\n /**\n * A custom ResponseButton component to use instead of the default.\n */\n ResponseButton?: React.ComponentType<ResponseButtonProps>;\n\n /**\n * A class name to apply to the root element.\n */\n className?: string;\n}\n\nexport const CopilotChat = ({\n instructions,\n defaultOpen = false,\n clickOutsideToClose = true,\n hitEscapeToClose = true,\n onSetOpen,\n hotkey = \"e\",\n icons,\n labels,\n makeSystemMessage,\n showResponseButton = true,\n Window = DefaultWindow,\n Button = DefaultButton,\n Header = DefaultHeader,\n Messages = DefaultMessages,\n Input = DefaultInput,\n ResponseButton = DefaultResponseButton,\n className,\n}: CopilotChatProps) => {\n const { visibleMessages, append, reload, stop, isLoading, input, setInput } = useCopilotChat({\n id: nanoid(),\n makeSystemMessage,\n additionalInstructions: instructions,\n });\n\n const [openState, setOpenState] = React.useState(defaultOpen);\n\n const setOpen = (open: boolean) => {\n onSetOpen?.(open);\n setOpenState(open);\n };\n\n const sendMessage = async (message: string) => {\n append({\n id: nanoid(),\n content: message,\n role: \"user\",\n });\n };\n\n return (\n <ChatContextProvider icons={icons} labels={labels}>\n <div className={className}>\n <Button open={openState} setOpen={setOpen}></Button>\n <Window\n open={openState}\n setOpen={setOpen}\n clickOutsideToClose={clickOutsideToClose}\n hotkey={hotkey}\n hitEscapeToClose={hitEscapeToClose}\n >\n <Header open={openState} setOpen={setOpen} />\n <Messages messages={visibleMessages} inProgress={isLoading} />\n <Input inProgress={isLoading} onSend={sendMessage}>\n {showResponseButton && visibleMessages.length > 0 && (\n <ResponseButton onClick={isLoading ? stop : reload} inProgress={isLoading} />\n )}\n </Input>\n </Window>\n </div>\n </ChatContextProvider>\n );\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  import { Textarea_default } from './chunk-WM6BS77F.mjs';
2
- import { useChatContext } from './chunk-6H3Y2XEI.mjs';
2
+ import { useChatContext } from './chunk-OF66AL5Z.mjs';
3
3
  import { useRef, useState } from 'react';
4
4
  import { jsxs, jsx } from 'react/jsx-runtime';
5
5
 
@@ -48,4 +48,4 @@ var Input = ({ inProgress, onSend, children }) => {
48
48
 
49
49
  export { Input };
50
50
  //# sourceMappingURL=out.js.map
51
- //# sourceMappingURL=chunk-QFASQEFJ.mjs.map
51
+ //# sourceMappingURL=chunk-NYLOXKYT.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Input.tsx"],"names":[],"mappings":";;;;;;;;AAAA,SAAgB,QAAQ,gBAAgB;AA6BpC,SACE,KADF;AAxBG,IAAM,QAAQ,CAAC,EAAE,YAAY,QAAQ,SAAS,MAAkB;AACrE,QAAM,UAAU,eAAe;AAC/B,QAAM,cAAc,OAA4B,IAAI;AAEpD,QAAM,iBAAiB,CAAC,UAA4C;AATtE;AAWI,QAAI,MAAM,WAAW,MAAM;AAAe;AAE1C,sBAAY,YAAZ,mBAAqB;AAAA,EACvB;AAEA,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,EAAE;AACnC,QAAM,OAAO,MAAM;AAjBrB;AAkBI,QAAI;AAAY;AAChB,WAAO,IAAI;AACX,YAAQ,EAAE;AAEV,sBAAY,YAAZ,mBAAqB;AAAA,EACvB;AAEA,QAAM,OAAO,aAAa,QAAQ,MAAM,eAAe,QAAQ,MAAM;AACrE,QAAM,WAAW,cAAc,KAAK,WAAW;AAE/C,SACE,qBAAC,SAAI,WAAU,mBAAkB,SAAS,gBACxC;AAAA,wBAAC,UAAM,UAAS;AAAA,IAChB,oBAAC,YAAO,WAAU,wBAAuB,UAAoB,SAAS,MACnE,gBACH;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL,aAAa,QAAQ,OAAO;AAAA,QAC5B,WAAW;AAAA,QACX,SAAS;AAAA,QACT,OAAO;AAAA,QACP,UAAU,CAAC,UAAU,QAAQ,MAAM,OAAO,KAAK;AAAA,QAC/C,WAAW,CAAC,UAAU;AACpB,cAAI,MAAM,QAAQ,WAAW,CAAC,MAAM,UAAU;AAC5C,kBAAM,eAAe;AACrB,iBAAK;AAAA,UACP;AAAA,QACF;AAAA;AAAA,IACF;AAAA,KACF;AAEJ","sourcesContent":["import React, { useRef, useState } from \"react\";\nimport { InputProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\nimport AutoResizingTextarea from \"./Textarea\";\n\nexport const Input = ({ inProgress, onSend, children }: InputProps) => {\n const context = useChatContext();\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n const handleDivClick = (event: React.MouseEvent<HTMLDivElement>) => {\n // Check if the clicked element is not the textarea itself\n if (event.target !== event.currentTarget) return;\n\n textareaRef.current?.focus();\n };\n\n const [text, setText] = useState(\"\");\n const send = () => {\n if (inProgress) return;\n onSend(text);\n setText(\"\");\n\n textareaRef.current?.focus();\n };\n\n const icon = inProgress ? context.icons.activityIcon : context.icons.sendIcon;\n const disabled = inProgress || text.length === 0;\n\n return (\n <div className=\"copilotKitInput\" onClick={handleDivClick}>\n <span>{children}</span>\n <button className=\"copilotKitSendButton\" disabled={disabled} onClick={send}>\n {icon}\n </button>\n <AutoResizingTextarea\n ref={textareaRef}\n placeholder={context.labels.placeholder}\n autoFocus={true}\n maxRows={5}\n value={text}\n onChange={(event) => setText(event.target.value)}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n send();\n }\n }}\n />\n </div>\n );\n};\n"]}
@@ -53,4 +53,4 @@ var ChatContextProvider = ({
53
53
 
54
54
  export { ChatContext, ChatContextProvider, useChatContext };
55
55
  //# sourceMappingURL=out.js.map
56
- //# sourceMappingURL=chunk-6H3Y2XEI.mjs.map
56
+ //# sourceMappingURL=chunk-OF66AL5Z.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/ChatContext.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAO,SAAS,eAAe;AA8KtB;AA7DF,IAAM,cAAc,MAAM,cAAuC,MAAS;AAE1E,SAAS,iBAA8B;AAC5C,QAAM,UAAU,MAAM,WAAW,WAAW;AAC5C,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAWO,IAAM,sBAAsB,CAAC;AAAA;AAAA;AAAA;AAAA,EAIlC;AAAA,EACA;AAAA,EACA;AACF,MAAwB;AACtB,QAAM,UAAU;AAAA,IACd,OAAO;AAAA,MACL,QAAQ,kCACH;AAAA,QACD,SAAS;AAAA,QACT,OAAO;AAAA,QACP,aAAa;AAAA,QACb,UAAU;AAAA,QACV,MAAM;AAAA,QACN,OAAO;AAAA,QACP,gBAAgB;AAAA,QAChB,oBAAoB;AAAA,MACtB,IACG;AAAA,MAGL,OAAO,iCACF;AAAA,QACD,UAAuB;AAAA,QACvB,WAAwB;AAAA,QACxB,iBAA8B;AAAA,QAC9B,UAAuB;AAAA,QACvB,cAA2B;AAAA,QAC3B,aAA0B;AAAA,QAC1B,UAAuB;AAAA,QACvB,gBAA6B;AAAA,MAC/B,IAVK;AAAA,QAWL;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,QAAQ,KAAK;AAAA,EAChB;AACA,SAAO,oBAAC,YAAY,UAAZ,EAAqB,OAAO,SAAU,UAAS;AACzD","sourcesContent":["import React, { useMemo } from \"react\";\nimport * as DefaultIcons from \"./Icons\";\n\n/**\n * Icons for CopilotChat component.\n */\nexport interface CopilotChatIcons {\n /**\n * The icon to use for the open chat button.\n * @default <OpenIcon />\n */\n openIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button.\n * @default <CloseIcon />\n */\n closeIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button in the header.\n * @default <HeaderCloseIcon />\n */\n headerCloseIcon?: React.ReactNode;\n\n /**\n * The icon to use for the send button.\n * @default <SendIcon />\n */\n sendIcon?: React.ReactNode;\n\n /**\n * The icon to use for the activity indicator.\n * @default <ActivityIcon />\n */\n activityIcon?: React.ReactNode;\n\n /**\n * The icon to use for the spinner.\n * @default <SpinnerIcon />\n */\n spinnerIcon?: React.ReactNode;\n\n /**\n * The icon to use for the stop button.\n * @default <StopIcon />\n */\n stopIcon?: React.ReactNode;\n\n /**\n * The icon to use for the regenerate button.\n * @default <RegenerateIcon />\n */\n regenerateIcon?: React.ReactNode;\n}\n\n/**\n * Labels for CopilotChat component.\n */\nexport interface CopilotChatLabels {\n /**\n * The initial message(s) to display in the chat window.\n */\n initial?: string | string[];\n\n /**\n * The title to display in the header.\n * @default \"CopilotKit\"\n */\n title?: string;\n\n /**\n * The placeholder to display in the input.\n * @default \"Type a message...\"\n */\n placeholder?: string;\n\n /**\n * The message to display while the chat GPT is \"thinking\".\n * @default \"Thinking...\"\n */\n thinking?: string;\n\n /**\n * The message to display when the chat is done executing a function.\n * @default \"✅ Done\"\n */\n done?: string;\n\n /**\n * The message to display when an error occurs.\n * @default \"❌ An error occurred. Please try again.\"\n */\n error?: string;\n\n /**\n * The label to display on the stop button.\n * @default \"Stop generating\"\n */\n stopGenerating?: string;\n\n /**\n * The label to display on the regenerate button.\n * @default \"Regenerate response\"\n */\n regenerateResponse?: string;\n}\n\ninterface ChatContext {\n labels: Required<CopilotChatLabels>;\n icons: Required<CopilotChatIcons>;\n}\n\nexport const ChatContext = React.createContext<ChatContext | undefined>(undefined);\n\nexport function useChatContext(): ChatContext {\n const context = React.useContext(ChatContext);\n if (context === undefined) {\n throw new Error(\n \"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?\",\n );\n }\n return context;\n}\n\ninterface ChatContextProps {\n // temperature?: number;\n // instructions?: string;\n // maxFeedback?: number;\n labels?: CopilotChatLabels;\n icons?: CopilotChatIcons;\n children?: React.ReactNode;\n}\n\nexport const ChatContextProvider = ({\n // temperature,\n // instructions,\n // maxFeedback,\n labels,\n icons,\n children,\n}: ChatContextProps) => {\n const context = useMemo(\n () => ({\n labels: {\n ...{\n initial: \"\",\n title: \"CopilotKit\",\n placeholder: \"Type a message...\",\n thinking: \"Thinking...\",\n done: \"✅ Done\",\n error: \"❌ An error occurred. Please try again.\",\n stopGenerating: \"Stop generating\",\n regenerateResponse: \"Regenerate response\",\n },\n ...labels,\n },\n\n icons: {\n ...{\n openIcon: DefaultIcons.OpenIcon,\n closeIcon: DefaultIcons.CloseIcon,\n headerCloseIcon: DefaultIcons.HeaderCloseIcon,\n sendIcon: DefaultIcons.SendIcon,\n activityIcon: DefaultIcons.ActivityIcon,\n spinnerIcon: DefaultIcons.SpinnerIcon,\n stopIcon: DefaultIcons.StopIcon,\n regenerateIcon: DefaultIcons.RegenerateIcon,\n },\n icons,\n },\n }),\n [labels, icons],\n );\n return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { useChatContext } from './chunk-6H3Y2XEI.mjs';
1
+ import { useChatContext } from './chunk-OF66AL5Z.mjs';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
 
4
4
  var Header = ({ setOpen }) => {
@@ -11,4 +11,4 @@ var Header = ({ setOpen }) => {
11
11
 
12
12
  export { Header };
13
13
  //# sourceMappingURL=out.js.map
14
- //# sourceMappingURL=chunk-DPUPEOGG.mjs.map
14
+ //# sourceMappingURL=chunk-UWPFPWAW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Header.tsx"],"names":[],"mappings":";;;;;AAOI,SACE,KADF;AAJG,IAAM,SAAS,CAAC,EAAE,QAAQ,MAAmB;AAClD,QAAM,UAAU,eAAe;AAE/B,SACE,qBAAC,SAAI,WAAU,oBACb;AAAA,wBAAC,SAAK,kBAAQ,OAAO,OAAM;AAAA,IAC3B,oBAAC,YAAO,SAAS,MAAM,QAAQ,KAAK,GAAG,cAAW,SAC/C,kBAAQ,MAAM,iBACjB;AAAA,KACF;AAEJ","sourcesContent":["import { HeaderProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\n\nexport const Header = ({ setOpen }: HeaderProps) => {\n const context = useChatContext();\n\n return (\n <div className=\"copilotKitHeader\">\n <div>{context.labels.title}</div>\n <button onClick={() => setOpen(false)} aria-label=\"Close\">\n {context.icons.headerCloseIcon}\n </button>\n </div>\n );\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { useChatContext } from './chunk-6H3Y2XEI.mjs';
1
+ import { useChatContext } from './chunk-OF66AL5Z.mjs';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
 
4
4
  var ResponseButton = ({ onClick, inProgress }) => {
@@ -11,4 +11,4 @@ var ResponseButton = ({ onClick, inProgress }) => {
11
11
 
12
12
  export { ResponseButton };
13
13
  //# sourceMappingURL=out.js.map
14
- //# sourceMappingURL=chunk-GPEJCUWA.mjs.map
14
+ //# sourceMappingURL=chunk-Z34F3WLK.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Response.tsx"],"names":[],"mappings":";;;;;AAMI,SACE,KADF;AAHG,IAAM,iBAAiB,CAAC,EAAE,SAAS,WAAW,MAA2B;AAC9E,QAAM,UAAU,eAAe;AAC/B,SACE,qBAAC,YAAO,SAAkB,WAAU,4BAClC;AAAA,wBAAC,UAAM,uBAAa,QAAQ,MAAM,WAAW,QAAQ,MAAM,gBAAe;AAAA,IACzE,aAAa,QAAQ,OAAO,iBAAiB,QAAQ,OAAO;AAAA,KAC/D;AAEJ","sourcesContent":["import { useChatContext } from \"./ChatContext\";\nimport { ResponseButtonProps } from \"./props\";\n\nexport const ResponseButton = ({ onClick, inProgress }: ResponseButtonProps) => {\n const context = useChatContext();\n return (\n <button onClick={onClick} className=\"copilotKitResponseButton\">\n <span>{inProgress ? context.icons.stopIcon : context.icons.regenerateIcon}</span>\n {inProgress ? context.labels.stopGenerating : context.labels.regenerateResponse}\n </button>\n );\n};\n"]}
@@ -1,7 +1,6 @@
1
- import React__default from 'react';
2
1
  import { ButtonProps } from './props.js';
3
- import '@copilotkit/react-core';
2
+ import '@copilotkit/shared';
4
3
 
5
- declare const Button: React__default.FC<ButtonProps>;
4
+ declare const Button: ({ open, setOpen }: ButtonProps) => JSX.Element;
6
5
 
7
6
  export { Button };
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var React__default = /*#__PURE__*/_interopDefault(React);
9
+
10
+ // src/components/chat/ChatContext.tsx
11
+ var ChatContext = React__default.default.createContext(void 0);
12
+ function useChatContext() {
13
+ const context = React__default.default.useContext(ChatContext);
14
+ if (context === void 0) {
15
+ throw new Error(
16
+ "Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?"
17
+ );
18
+ }
19
+ return context;
20
+ }
21
+ var Button = ({ open, setOpen }) => {
22
+ const context = useChatContext();
23
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { onClick: () => setOpen(!open), children: /* @__PURE__ */ jsxRuntime.jsxs(
24
+ "button",
25
+ {
26
+ className: `copilotKitButton ${open ? "open" : ""}`,
27
+ "aria-label": open ? "Close Chat" : "Open Chat",
28
+ children: [
29
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "copilotKitButtonIcon copilotKitButtonIconOpen", children: context.icons.openIcon }),
30
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "copilotKitButtonIcon copilotKitButtonIconClose", children: context.icons.closeIcon })
31
+ ]
32
+ }
33
+ ) });
34
+ };
35
+
36
+ exports.Button = Button;
37
+ //# sourceMappingURL=out.js.map
38
+ //# sourceMappingURL=Button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/chat/ChatContext.tsx","../../../src/components/chat/Button.tsx"],"names":["jsx"],"mappings":";AAAA,OAAO,SAAS,eAAe;AA8KtB;AA7DF,IAAM,cAAc,MAAM,cAAuC,MAAS;AAE1E,SAAS,iBAA8B;AAC5C,QAAM,UAAU,MAAM,WAAW,WAAW;AAC5C,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;;;AClHM,SAIE,OAAAA,MAJF;AANC,IAAM,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAmB;AACxD,QAAM,UAAU,eAAe;AAG/B,SACE,gBAAAA,KAAC,SAAI,SAAS,MAAM,QAAQ,CAAC,IAAI,GAC/B;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,oBAAoB,OAAO,SAAS;AAAA,MAC/C,cAAY,OAAO,eAAe;AAAA,MAElC;AAAA,wBAAAA,KAAC,SAAI,WAAU,iDACZ,kBAAQ,MAAM,UACjB;AAAA,QACA,gBAAAA,KAAC,SAAI,WAAU,kDACZ,kBAAQ,MAAM,WACjB;AAAA;AAAA;AAAA,EACF,GACF;AAEJ","sourcesContent":["import React, { useMemo } from \"react\";\nimport * as DefaultIcons from \"./Icons\";\n\n/**\n * Icons for CopilotChat component.\n */\nexport interface CopilotChatIcons {\n /**\n * The icon to use for the open chat button.\n * @default <OpenIcon />\n */\n openIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button.\n * @default <CloseIcon />\n */\n closeIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button in the header.\n * @default <HeaderCloseIcon />\n */\n headerCloseIcon?: React.ReactNode;\n\n /**\n * The icon to use for the send button.\n * @default <SendIcon />\n */\n sendIcon?: React.ReactNode;\n\n /**\n * The icon to use for the activity indicator.\n * @default <ActivityIcon />\n */\n activityIcon?: React.ReactNode;\n\n /**\n * The icon to use for the spinner.\n * @default <SpinnerIcon />\n */\n spinnerIcon?: React.ReactNode;\n\n /**\n * The icon to use for the stop button.\n * @default <StopIcon />\n */\n stopIcon?: React.ReactNode;\n\n /**\n * The icon to use for the regenerate button.\n * @default <RegenerateIcon />\n */\n regenerateIcon?: React.ReactNode;\n}\n\n/**\n * Labels for CopilotChat component.\n */\nexport interface CopilotChatLabels {\n /**\n * The initial message(s) to display in the chat window.\n */\n initial?: string | string[];\n\n /**\n * The title to display in the header.\n * @default \"CopilotKit\"\n */\n title?: string;\n\n /**\n * The placeholder to display in the input.\n * @default \"Type a message...\"\n */\n placeholder?: string;\n\n /**\n * The message to display while the chat GPT is \"thinking\".\n * @default \"Thinking...\"\n */\n thinking?: string;\n\n /**\n * The message to display when the chat is done executing a function.\n * @default \"✅ Done\"\n */\n done?: string;\n\n /**\n * The message to display when an error occurs.\n * @default \"❌ An error occurred. Please try again.\"\n */\n error?: string;\n\n /**\n * The label to display on the stop button.\n * @default \"Stop generating\"\n */\n stopGenerating?: string;\n\n /**\n * The label to display on the regenerate button.\n * @default \"Regenerate response\"\n */\n regenerateResponse?: string;\n}\n\ninterface ChatContext {\n labels: Required<CopilotChatLabels>;\n icons: Required<CopilotChatIcons>;\n}\n\nexport const ChatContext = React.createContext<ChatContext | undefined>(undefined);\n\nexport function useChatContext(): ChatContext {\n const context = React.useContext(ChatContext);\n if (context === undefined) {\n throw new Error(\n \"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?\",\n );\n }\n return context;\n}\n\ninterface ChatContextProps {\n // temperature?: number;\n // instructions?: string;\n // maxFeedback?: number;\n labels?: CopilotChatLabels;\n icons?: CopilotChatIcons;\n children?: React.ReactNode;\n}\n\nexport const ChatContextProvider = ({\n // temperature,\n // instructions,\n // maxFeedback,\n labels,\n icons,\n children,\n}: ChatContextProps) => {\n const context = useMemo(\n () => ({\n labels: {\n ...{\n initial: \"\",\n title: \"CopilotKit\",\n placeholder: \"Type a message...\",\n thinking: \"Thinking...\",\n done: \"✅ Done\",\n error: \"❌ An error occurred. Please try again.\",\n stopGenerating: \"Stop generating\",\n regenerateResponse: \"Regenerate response\",\n },\n ...labels,\n },\n\n icons: {\n ...{\n openIcon: DefaultIcons.OpenIcon,\n closeIcon: DefaultIcons.CloseIcon,\n headerCloseIcon: DefaultIcons.HeaderCloseIcon,\n sendIcon: DefaultIcons.SendIcon,\n activityIcon: DefaultIcons.ActivityIcon,\n spinnerIcon: DefaultIcons.SpinnerIcon,\n stopIcon: DefaultIcons.StopIcon,\n regenerateIcon: DefaultIcons.RegenerateIcon,\n },\n icons,\n },\n }),\n [labels, icons],\n );\n return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;\n};\n","import { ButtonProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\n\nexport const Button = ({ open, setOpen }: ButtonProps) => {\n const context = useChatContext();\n // To ensure that the mouse handler fires even when the button is scaled down\n // we wrap the button in a div and attach the handler to the div\n return (\n <div onClick={() => setOpen(!open)}>\n <button\n className={`copilotKitButton ${open ? \"open\" : \"\"}`}\n aria-label={open ? \"Close Chat\" : \"Open Chat\"}\n >\n <div className=\"copilotKitButtonIcon copilotKitButtonIconOpen\">\n {context.icons.openIcon}\n </div>\n <div className=\"copilotKitButtonIcon copilotKitButtonIconClose\">\n {context.icons.closeIcon}\n </div>\n </button>\n </div>\n );\n};\n"]}
@@ -1,5 +1,5 @@
1
- export { Button } from '../../chunk-Y2RUG4B3.mjs';
2
- import '../../chunk-6H3Y2XEI.mjs';
1
+ export { Button } from '../../chunk-5O2MCJZ2.mjs';
2
+ import '../../chunk-OF66AL5Z.mjs';
3
3
  import '../../chunk-7YXG7D47.mjs';
4
4
  import '../../chunk-MRXNTQOX.mjs';
5
5
  //# sourceMappingURL=out.js.map
@@ -1,12 +1,13 @@
1
- import React__default from 'react';
2
- import { CopilotKitChatIcons, CopilotKitChatLabels } from './ChatContext.js';
1
+ import React from 'react';
2
+ import { CopilotChatIcons, CopilotChatLabels } from './ChatContext.js';
3
3
  import { SystemMessageFunction } from '@copilotkit/react-core';
4
4
  import { WindowProps, ButtonProps, HeaderProps, MessagesProps, InputProps, ResponseButtonProps } from './props.js';
5
+ import '@copilotkit/shared';
5
6
 
6
7
  /**
7
- * Props for CopilotKitChat component.
8
+ * Props for CopilotChat component.
8
9
  */
9
- interface CopilotKitChatProps {
10
+ interface CopilotChatProps {
10
11
  /**
11
12
  * Custom instructions to be added to the system message. Use this property to
12
13
  * provide additional context or guidance to the language model, influencing
@@ -44,11 +45,11 @@ interface CopilotKitChatProps {
44
45
  /**
45
46
  * Icons can be used to set custom icons for the chat window.
46
47
  */
47
- icons?: CopilotKitChatIcons;
48
+ icons?: CopilotChatIcons;
48
49
  /**
49
50
  * Labels can be used to set custom labels for the chat window.
50
51
  */
51
- labels?: CopilotKitChatLabels;
52
+ labels?: CopilotChatLabels;
52
53
  /**
53
54
  * A function that takes in context string and instructions and returns
54
55
  * the system message to include in the chat request.
@@ -64,32 +65,32 @@ interface CopilotKitChatProps {
64
65
  /**
65
66
  * A custom Window component to use instead of the default.
66
67
  */
67
- Window?: React__default.ComponentType<WindowProps>;
68
+ Window?: React.ComponentType<WindowProps>;
68
69
  /**
69
70
  * A custom Button component to use instead of the default.
70
71
  */
71
- Button?: React__default.ComponentType<ButtonProps>;
72
+ Button?: React.ComponentType<ButtonProps>;
72
73
  /**
73
74
  * A custom Header component to use instead of the default.
74
75
  */
75
- Header?: React__default.ComponentType<HeaderProps>;
76
+ Header?: React.ComponentType<HeaderProps>;
76
77
  /**
77
78
  * A custom Messages component to use instead of the default.
78
79
  */
79
- Messages?: React__default.ComponentType<MessagesProps>;
80
+ Messages?: React.ComponentType<MessagesProps>;
80
81
  /**
81
82
  * A custom Input component to use instead of the default.
82
83
  */
83
- Input?: React__default.ComponentType<InputProps>;
84
+ Input?: React.ComponentType<InputProps>;
84
85
  /**
85
86
  * A custom ResponseButton component to use instead of the default.
86
87
  */
87
- ResponseButton?: React__default.ComponentType<ResponseButtonProps>;
88
+ ResponseButton?: React.ComponentType<ResponseButtonProps>;
88
89
  /**
89
90
  * A class name to apply to the root element.
90
91
  */
91
92
  className?: string;
92
93
  }
93
- declare const CopilotKitChat: React__default.FC<CopilotKitChatProps>;
94
+ declare const CopilotChat: ({ instructions, defaultOpen, clickOutsideToClose, hitEscapeToClose, onSetOpen, hotkey, icons, labels, makeSystemMessage, showResponseButton, Window, Button, Header, Messages, Input, ResponseButton, className, }: CopilotChatProps) => JSX.Element;
94
95
 
95
- export { CopilotKitChat, CopilotKitChatProps };
96
+ export { CopilotChat, CopilotChatProps };