@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,38 +0,0 @@
1
- import {
2
- ActivityIcon,
3
- CheckIcon,
4
- CloseIcon,
5
- CopyIcon,
6
- DownloadIcon,
7
- HeaderCloseIcon,
8
- MicrophoneIcon,
9
- OpenIcon,
10
- RegenerateIcon,
11
- SendIcon,
12
- SmallSpinnerIcon,
13
- SpinnerIcon,
14
- StopIcon,
15
- ThumbsDownIcon,
16
- ThumbsUpIcon,
17
- UploadIcon
18
- } from "../../chunk-GBAPANZE.mjs";
19
- import "../../chunk-MRXNTQOX.mjs";
20
- export {
21
- ActivityIcon,
22
- CheckIcon,
23
- CloseIcon,
24
- CopyIcon,
25
- DownloadIcon,
26
- HeaderCloseIcon,
27
- MicrophoneIcon,
28
- OpenIcon,
29
- RegenerateIcon,
30
- SendIcon,
31
- SmallSpinnerIcon,
32
- SpinnerIcon,
33
- StopIcon,
34
- ThumbsDownIcon,
35
- ThumbsUpIcon,
36
- UploadIcon
37
- };
38
- //# sourceMappingURL=Icons.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,13 +0,0 @@
1
- import React__default from 'react';
2
-
3
- interface ImageUploadQueueProps {
4
- images: Array<{
5
- contentType: string;
6
- bytes: string;
7
- }>;
8
- onRemoveImage: (index: number) => void;
9
- className?: string;
10
- }
11
- declare const ImageUploadQueue: React__default.FC<ImageUploadQueueProps>;
12
-
13
- export { ImageUploadQueue };
@@ -1,106 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/components/chat/ImageUploadQueue.tsx
21
- var ImageUploadQueue_exports = {};
22
- __export(ImageUploadQueue_exports, {
23
- ImageUploadQueue: () => ImageUploadQueue
24
- });
25
- module.exports = __toCommonJS(ImageUploadQueue_exports);
26
- var import_jsx_runtime = require("react/jsx-runtime");
27
- var ImageUploadQueue = ({
28
- images,
29
- onRemoveImage,
30
- className = ""
31
- }) => {
32
- if (images.length === 0)
33
- return null;
34
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
35
- "div",
36
- {
37
- className: `copilotKitImageUploadQueue ${className}`,
38
- style: {
39
- display: "flex",
40
- flexWrap: "wrap",
41
- gap: "8px",
42
- margin: "8px",
43
- padding: "8px"
44
- },
45
- children: images.map((image, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
46
- "div",
47
- {
48
- className: "copilotKitImageUploadQueueItem",
49
- style: {
50
- position: "relative",
51
- display: "inline-block",
52
- width: "60px",
53
- height: "60px",
54
- borderRadius: "4px",
55
- overflow: "hidden"
56
- },
57
- children: [
58
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
59
- "img",
60
- {
61
- src: `data:${image.contentType};base64,${image.bytes}`,
62
- alt: `Selected image ${index + 1}`,
63
- style: {
64
- width: "100%",
65
- height: "100%",
66
- objectFit: "cover"
67
- }
68
- }
69
- ),
70
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
71
- "button",
72
- {
73
- onClick: () => onRemoveImage(index),
74
- className: "copilotKitImageUploadQueueRemoveButton",
75
- style: {
76
- position: "absolute",
77
- top: "2px",
78
- right: "2px",
79
- background: "rgba(0,0,0,0.6)",
80
- color: "white",
81
- border: "none",
82
- borderRadius: "50%",
83
- width: "18px",
84
- height: "18px",
85
- display: "flex",
86
- alignItems: "center",
87
- justifyContent: "center",
88
- cursor: "pointer",
89
- fontSize: "10px",
90
- padding: 0
91
- },
92
- children: "\u2715"
93
- }
94
- )
95
- ]
96
- },
97
- index
98
- ))
99
- }
100
- );
101
- };
102
- // Annotate the CommonJS export names for ESM import in node:
103
- 0 && (module.exports = {
104
- ImageUploadQueue
105
- });
106
- //# sourceMappingURL=ImageUploadQueue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/chat/ImageUploadQueue.tsx"],"sourcesContent":["import React from \"react\";\n\ninterface ImageUploadQueueProps {\n images: Array<{ contentType: string; bytes: string }>;\n onRemoveImage: (index: number) => void;\n className?: string;\n}\n\nexport const ImageUploadQueue: React.FC<ImageUploadQueueProps> = ({\n images,\n onRemoveImage,\n className = \"\",\n}) => {\n if (images.length === 0) return null;\n\n return (\n <div\n className={`copilotKitImageUploadQueue ${className}`}\n style={{\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: \"8px\",\n margin: \"8px\",\n padding: \"8px\",\n }}\n >\n {images.map((image, index) => (\n <div\n key={index}\n className=\"copilotKitImageUploadQueueItem\"\n style={{\n position: \"relative\",\n display: \"inline-block\",\n width: \"60px\",\n height: \"60px\",\n borderRadius: \"4px\",\n overflow: \"hidden\",\n }}\n >\n {/* eslint-disable-next-line @next/next/no-img-element */}\n <img\n src={`data:${image.contentType};base64,${image.bytes}`}\n alt={`Selected image ${index + 1}`}\n style={{\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n }}\n />\n <button\n onClick={() => onRemoveImage(index)}\n className=\"copilotKitImageUploadQueueRemoveButton\"\n style={{\n position: \"absolute\",\n top: \"2px\",\n right: \"2px\",\n background: \"rgba(0,0,0,0.6)\",\n color: \"white\",\n border: \"none\",\n borderRadius: \"50%\",\n width: \"18px\",\n height: \"18px\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n cursor: \"pointer\",\n fontSize: \"10px\",\n padding: 0,\n }}\n >\n ✕\n </button>\n </div>\n ))}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BQ;AAnBD,IAAM,mBAAoD,CAAC;AAAA,EAChE;AAAA,EACA;AAAA,EACA,YAAY;AACd,MAAM;AACJ,MAAI,OAAO,WAAW;AAAG,WAAO;AAEhC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,8BAA8B;AAAA,MACzC,OAAO;AAAA,QACL,SAAS;AAAA,QACT,UAAU;AAAA,QACV,KAAK;AAAA,QACL,QAAQ;AAAA,QACR,SAAS;AAAA,MACX;AAAA,MAEC,iBAAO,IAAI,CAAC,OAAO,UAClB;AAAA,QAAC;AAAA;AAAA,UAEC,WAAU;AAAA,UACV,OAAO;AAAA,YACL,UAAU;AAAA,YACV,SAAS;AAAA,YACT,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,cAAc;AAAA,YACd,UAAU;AAAA,UACZ;AAAA,UAGA;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,KAAK,QAAQ,MAAM,sBAAsB,MAAM;AAAA,gBAC/C,KAAK,kBAAkB,QAAQ;AAAA,gBAC/B,OAAO;AAAA,kBACL,OAAO;AAAA,kBACP,QAAQ;AAAA,kBACR,WAAW;AAAA,gBACb;AAAA;AAAA,YACF;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,SAAS,MAAM,cAAc,KAAK;AAAA,gBAClC,WAAU;AAAA,gBACV,OAAO;AAAA,kBACL,UAAU;AAAA,kBACV,KAAK;AAAA,kBACL,OAAO;AAAA,kBACP,YAAY;AAAA,kBACZ,OAAO;AAAA,kBACP,QAAQ;AAAA,kBACR,cAAc;AAAA,kBACd,OAAO;AAAA,kBACP,QAAQ;AAAA,kBACR,SAAS;AAAA,kBACT,YAAY;AAAA,kBACZ,gBAAgB;AAAA,kBAChB,QAAQ;AAAA,kBACR,UAAU;AAAA,kBACV,SAAS;AAAA,gBACX;AAAA,gBACD;AAAA;AAAA,YAED;AAAA;AAAA;AAAA,QA3CK;AAAA,MA4CP,CACD;AAAA;AAAA,EACH;AAEJ;","names":[]}
@@ -1,8 +0,0 @@
1
- import {
2
- ImageUploadQueue
3
- } from "../../chunk-PLHTVHUW.mjs";
4
- import "../../chunk-MRXNTQOX.mjs";
5
- export {
6
- ImageUploadQueue
7
- };
8
- //# sourceMappingURL=ImageUploadQueue.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,9 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { InputProps } from './props.js';
3
- import '@copilotkit/shared';
4
- import '../../types/suggestions.js';
5
- import 'react';
6
-
7
- declare const Input: ({ inProgress, onSend, chatReady, onStop, onUpload, hideStopButton, }: InputProps) => react_jsx_runtime.JSX.Element;
8
-
9
- export { Input };
@@ -1,424 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __spreadValues = (a, b) => {
12
- for (var prop in b || (b = {}))
13
- if (__hasOwnProp.call(b, prop))
14
- __defNormalProp(a, prop, b[prop]);
15
- if (__getOwnPropSymbols)
16
- for (var prop of __getOwnPropSymbols(b)) {
17
- if (__propIsEnum.call(b, prop))
18
- __defNormalProp(a, prop, b[prop]);
19
- }
20
- return a;
21
- };
22
- var __export = (target, all) => {
23
- for (var name in all)
24
- __defProp(target, name, { get: all[name], enumerable: true });
25
- };
26
- var __copyProps = (to, from, except, desc) => {
27
- if (from && typeof from === "object" || typeof from === "function") {
28
- for (let key of __getOwnPropNames(from))
29
- if (!__hasOwnProp.call(to, key) && key !== except)
30
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
31
- }
32
- return to;
33
- };
34
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
35
- // If the importer is in node compatibility mode or this is not an ESM
36
- // file that has been converted to a CommonJS file using a Babel-
37
- // compatible transform (i.e. "__esModule" has not been set), then set
38
- // "default" to the CommonJS "module.exports" for node compatibility.
39
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
40
- mod
41
- ));
42
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
43
- var __async = (__this, __arguments, generator) => {
44
- return new Promise((resolve, reject) => {
45
- var fulfilled = (value) => {
46
- try {
47
- step(generator.next(value));
48
- } catch (e) {
49
- reject(e);
50
- }
51
- };
52
- var rejected = (value) => {
53
- try {
54
- step(generator.throw(value));
55
- } catch (e) {
56
- reject(e);
57
- }
58
- };
59
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
60
- step((generator = generator.apply(__this, __arguments)).next());
61
- });
62
- };
63
-
64
- // src/components/chat/Input.tsx
65
- var Input_exports = {};
66
- __export(Input_exports, {
67
- Input: () => Input
68
- });
69
- module.exports = __toCommonJS(Input_exports);
70
- var import_react5 = require("react");
71
-
72
- // src/components/chat/ChatContext.tsx
73
- var import_react = __toESM(require("react"));
74
- var import_jsx_runtime = require("react/jsx-runtime");
75
- var ChatContext = import_react.default.createContext(
76
- void 0
77
- );
78
- function useChatContext() {
79
- const context = import_react.default.useContext(ChatContext);
80
- if (context === void 0) {
81
- throw new Error(
82
- "Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?"
83
- );
84
- }
85
- return context;
86
- }
87
-
88
- // src/components/chat/Textarea.tsx
89
- var import_react2 = require("react");
90
- var import_jsx_runtime2 = require("react/jsx-runtime");
91
- var AutoResizingTextarea = (0, import_react2.forwardRef)(
92
- ({
93
- maxRows = 1,
94
- placeholder,
95
- value,
96
- onChange,
97
- onKeyDown,
98
- onCompositionStart,
99
- onCompositionEnd,
100
- autoFocus
101
- }, ref) => {
102
- const internalTextareaRef = (0, import_react2.useRef)(null);
103
- const [maxHeight, setMaxHeight] = (0, import_react2.useState)(0);
104
- (0, import_react2.useImperativeHandle)(
105
- ref,
106
- () => internalTextareaRef.current
107
- );
108
- (0, import_react2.useEffect)(() => {
109
- const calculateMaxHeight = () => {
110
- const textarea = internalTextareaRef.current;
111
- if (textarea) {
112
- textarea.style.height = "auto";
113
- const singleRowHeight = textarea.scrollHeight;
114
- setMaxHeight(singleRowHeight * maxRows);
115
- if (autoFocus) {
116
- textarea.focus();
117
- }
118
- }
119
- };
120
- calculateMaxHeight();
121
- }, [maxRows]);
122
- (0, import_react2.useEffect)(() => {
123
- const textarea = internalTextareaRef.current;
124
- if (textarea) {
125
- textarea.style.height = "auto";
126
- textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight)}px`;
127
- }
128
- }, [value, maxHeight]);
129
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
130
- "textarea",
131
- {
132
- ref: internalTextareaRef,
133
- value,
134
- onChange,
135
- onKeyDown,
136
- onCompositionStart,
137
- onCompositionEnd,
138
- placeholder,
139
- style: {
140
- overflow: "auto",
141
- resize: "none",
142
- maxHeight: `${maxHeight}px`
143
- },
144
- rows: 1
145
- }
146
- );
147
- }
148
- );
149
- var Textarea_default = AutoResizingTextarea;
150
-
151
- // src/hooks/use-push-to-talk.tsx
152
- var import_react_core = require("@copilotkit/react-core");
153
- var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
154
- var import_react3 = require("react");
155
- var startRecording = (mediaStreamRef, mediaRecorderRef, audioContextRef, recordedChunks, onStop) => __async(void 0, null, function* () {
156
- if (!mediaStreamRef.current || !audioContextRef.current) {
157
- mediaStreamRef.current = yield navigator.mediaDevices.getUserMedia({
158
- audio: true
159
- });
160
- audioContextRef.current = new window.AudioContext();
161
- yield audioContextRef.current.resume();
162
- }
163
- mediaRecorderRef.current = new MediaRecorder(mediaStreamRef.current);
164
- mediaRecorderRef.current.start(1e3);
165
- mediaRecorderRef.current.ondataavailable = (event) => {
166
- recordedChunks.push(event.data);
167
- };
168
- mediaRecorderRef.current.onstop = onStop;
169
- });
170
- var stopRecording = (mediaRecorderRef) => {
171
- if (mediaRecorderRef.current && mediaRecorderRef.current.state !== "inactive") {
172
- mediaRecorderRef.current.stop();
173
- }
174
- };
175
- var transcribeAudio = (recordedChunks, transcribeAudioUrl) => __async(void 0, null, function* () {
176
- const completeBlob = new Blob(recordedChunks, { type: "audio/mp4" });
177
- const formData = new FormData();
178
- formData.append("file", completeBlob, "recording.mp4");
179
- const response = yield fetch(transcribeAudioUrl, {
180
- method: "POST",
181
- body: formData
182
- });
183
- if (!response.ok) {
184
- throw new Error(`Error: ${response.statusText}`);
185
- }
186
- const transcription = yield response.json();
187
- return transcription.text;
188
- });
189
- var playAudioResponse = (text, textToSpeechUrl, audioContext) => {
190
- const encodedText = encodeURIComponent(text);
191
- const url = `${textToSpeechUrl}?text=${encodedText}`;
192
- fetch(url).then((response) => response.arrayBuffer()).then((arrayBuffer) => audioContext.decodeAudioData(arrayBuffer)).then((audioBuffer) => {
193
- const source = audioContext.createBufferSource();
194
- source.buffer = audioBuffer;
195
- source.connect(audioContext.destination);
196
- source.start(0);
197
- }).catch((error) => {
198
- console.error("Error with decoding audio data", error);
199
- });
200
- };
201
- var usePushToTalk = ({
202
- sendFunction,
203
- inProgress
204
- }) => {
205
- const [pushToTalkState, setPushToTalkState] = (0, import_react3.useState)("idle");
206
- const mediaStreamRef = (0, import_react3.useRef)(null);
207
- const audioContextRef = (0, import_react3.useRef)(null);
208
- const mediaRecorderRef = (0, import_react3.useRef)(null);
209
- const recordedChunks = (0, import_react3.useRef)([]);
210
- const generalContext = (0, import_react_core.useCopilotContext)();
211
- const messagesContext = (0, import_react_core.useCopilotMessagesContext)();
212
- const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
213
- const [startReadingFromMessageId, setStartReadingFromMessageId] = (0, import_react3.useState)(null);
214
- (0, import_react3.useEffect)(() => {
215
- if (pushToTalkState === "recording") {
216
- startRecording(
217
- mediaStreamRef,
218
- mediaRecorderRef,
219
- audioContextRef,
220
- recordedChunks.current,
221
- () => {
222
- setPushToTalkState("transcribing");
223
- }
224
- );
225
- } else {
226
- stopRecording(mediaRecorderRef);
227
- if (pushToTalkState === "transcribing") {
228
- transcribeAudio(
229
- recordedChunks.current,
230
- context.copilotApiConfig.transcribeAudioUrl
231
- ).then((transcription) => __async(void 0, null, function* () {
232
- recordedChunks.current = [];
233
- setPushToTalkState("idle");
234
- const message = yield sendFunction(transcription);
235
- setStartReadingFromMessageId(message.id);
236
- }));
237
- }
238
- }
239
- return () => {
240
- stopRecording(mediaRecorderRef);
241
- };
242
- }, [pushToTalkState]);
243
- (0, import_react3.useEffect)(() => {
244
- if (inProgress === false && startReadingFromMessageId) {
245
- const lastMessageIndex = context.messages.findIndex(
246
- (message) => message.id === startReadingFromMessageId
247
- );
248
- const aguiMessages = (0, import_runtime_client_gql.gqlToAGUI)(context.messages);
249
- const messagesAfterLast = aguiMessages.slice(lastMessageIndex + 1).filter((message) => message.role === "assistant");
250
- const text = messagesAfterLast.map((message) => message.content).join("\n");
251
- playAudioResponse(
252
- text,
253
- context.copilotApiConfig.textToSpeechUrl,
254
- audioContextRef.current
255
- );
256
- setStartReadingFromMessageId(null);
257
- }
258
- }, [startReadingFromMessageId, inProgress]);
259
- return { pushToTalkState, setPushToTalkState };
260
- };
261
-
262
- // src/components/chat/Input.tsx
263
- var import_react_core2 = require("@copilotkit/react-core");
264
-
265
- // src/components/chat/PoweredByTag.tsx
266
- var import_react4 = require("react");
267
-
268
- // src/hooks/use-dark-mode.ts
269
- var useDarkMode = () => {
270
- if (typeof window === "undefined")
271
- return false;
272
- return document.documentElement.classList.contains("dark") || document.body.classList.contains("dark") || document.documentElement.getAttribute("data-theme") === "dark" || document.body.getAttribute("data-theme") === "dark" || window.matchMedia("(prefers-color-scheme: dark)").matches;
273
- };
274
-
275
- // src/components/chat/PoweredByTag.tsx
276
- var import_jsx_runtime3 = require("react/jsx-runtime");
277
- function PoweredByTag({
278
- showPoweredBy = true
279
- }) {
280
- const [mounted, setMounted] = (0, import_react4.useState)(false);
281
- const isDark = useDarkMode();
282
- (0, import_react4.useEffect)(() => {
283
- setMounted(true);
284
- }, []);
285
- if (!showPoweredBy) {
286
- return null;
287
- }
288
- const poweredByStyle = {
289
- visibility: "visible",
290
- display: "block",
291
- position: "static",
292
- textAlign: "center",
293
- fontSize: "12px",
294
- padding: "3px 0",
295
- color: mounted && isDark ? "rgb(69, 69, 69)" : "rgb(214, 214, 214)"
296
- };
297
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "poweredBy", style: poweredByStyle, children: "Powered by CopilotKit" }) });
298
- }
299
-
300
- // src/components/chat/Input.tsx
301
- var import_jsx_runtime4 = require("react/jsx-runtime");
302
- var MAX_NEWLINES = 6;
303
- var Input = ({
304
- inProgress,
305
- onSend,
306
- chatReady = false,
307
- onStop,
308
- onUpload,
309
- hideStopButton = false
310
- }) => {
311
- var _a;
312
- const context = useChatContext();
313
- const copilotContext = (0, import_react_core2.useCopilotContext)();
314
- const showPoweredBy = !((_a = copilotContext.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
315
- const pushToTalkConfigured = copilotContext.copilotApiConfig.textToSpeechUrl !== void 0 && copilotContext.copilotApiConfig.transcribeAudioUrl !== void 0;
316
- const textareaRef = (0, import_react5.useRef)(null);
317
- const [isComposing, setIsComposing] = (0, import_react5.useState)(false);
318
- const handleDivClick = (event) => {
319
- var _a2;
320
- const target = event.target;
321
- if (target.closest("button"))
322
- return;
323
- if (target.tagName === "TEXTAREA")
324
- return;
325
- (_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
326
- };
327
- const [text, setText] = (0, import_react5.useState)("");
328
- const send = () => {
329
- var _a2;
330
- if (inProgress)
331
- return;
332
- onSend(text);
333
- setText("");
334
- (_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
335
- };
336
- const { pushToTalkState, setPushToTalkState } = usePushToTalk({
337
- sendFunction: onSend,
338
- inProgress
339
- });
340
- const isInProgress = inProgress || pushToTalkState === "transcribing";
341
- const { buttonIcon, buttonAlt } = (0, import_react5.useMemo)(() => {
342
- if (!chatReady)
343
- return { buttonIcon: context.icons.spinnerIcon, buttonAlt: "Loading" };
344
- return isInProgress && !hideStopButton && chatReady ? { buttonIcon: context.icons.stopIcon, buttonAlt: "Stop" } : { buttonIcon: context.icons.sendIcon, buttonAlt: "Send" };
345
- }, [
346
- isInProgress,
347
- chatReady,
348
- hideStopButton,
349
- context.icons.stopIcon,
350
- context.icons.sendIcon
351
- ]);
352
- const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
353
- const { interrupt } = (0, import_react_core2.useCopilotChatInternal)();
354
- const canSend = (0, import_react5.useMemo)(() => {
355
- return !isInProgress && text.trim().length > 0 && pushToTalkState === "idle" && !interrupt;
356
- }, [interrupt, isInProgress, text, pushToTalkState]);
357
- const canStop = (0, import_react5.useMemo)(() => {
358
- return isInProgress && !hideStopButton;
359
- }, [isInProgress, hideStopButton]);
360
- const sendDisabled = !canSend && !canStop;
361
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
362
- "div",
363
- {
364
- className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`,
365
- children: [
366
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
367
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
368
- Textarea_default,
369
- {
370
- ref: textareaRef,
371
- placeholder: context.labels.placeholder,
372
- autoFocus: false,
373
- maxRows: MAX_NEWLINES,
374
- value: text,
375
- onChange: (event) => setText(event.target.value),
376
- onCompositionStart: () => setIsComposing(true),
377
- onCompositionEnd: () => setIsComposing(false),
378
- onKeyDown: (event) => {
379
- if (event.key === "Enter" && !event.shiftKey && !isComposing) {
380
- event.preventDefault();
381
- if (canSend) {
382
- send();
383
- }
384
- }
385
- }
386
- }
387
- ),
388
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "copilotKitInputControls", children: [
389
- onUpload && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { onClick: onUpload, className: "copilotKitInputControlButton", children: context.icons.uploadIcon }),
390
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { flexGrow: 1 } }),
391
- showPushToTalk && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
392
- "button",
393
- {
394
- onClick: () => setPushToTalkState(
395
- pushToTalkState === "idle" ? "recording" : "transcribing"
396
- ),
397
- className: pushToTalkState === "recording" ? "copilotKitInputControlButton copilotKitPushToTalkRecording" : "copilotKitInputControlButton",
398
- children: context.icons.pushToTalkIcon
399
- }
400
- ),
401
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
402
- "button",
403
- {
404
- disabled: sendDisabled,
405
- onClick: isInProgress && !hideStopButton ? onStop : send,
406
- "data-copilotkit-in-progress": inProgress,
407
- "data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
408
- className: "copilotKitInputControlButton",
409
- "aria-label": buttonAlt,
410
- children: buttonIcon
411
- }
412
- )
413
- ] })
414
- ] }),
415
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PoweredByTag, { showPoweredBy })
416
- ]
417
- }
418
- );
419
- };
420
- // Annotate the CommonJS export names for ESM import in node:
421
- 0 && (module.exports = {
422
- Input
423
- });
424
- //# sourceMappingURL=Input.js.map