@copilotkitnext/react 0.0.22-alpha.1 → 0.0.22-alpha.3

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 (421) hide show
  1. package/dist/chunk-32YJ5VJ4.mjs +157 -0
  2. package/dist/chunk-32YJ5VJ4.mjs.map +1 -0
  3. package/dist/chunk-36HFWACS.mjs +1 -0
  4. package/dist/chunk-36HFWACS.mjs.map +1 -0
  5. package/dist/chunk-3TA5QBSZ.mjs +122 -0
  6. package/dist/chunk-3TA5QBSZ.mjs.map +1 -0
  7. package/dist/chunk-46BZRXWT.mjs +16 -0
  8. package/dist/chunk-46BZRXWT.mjs.map +1 -0
  9. package/dist/chunk-4UDBR75C.mjs +106 -0
  10. package/dist/chunk-4UDBR75C.mjs.map +1 -0
  11. package/dist/chunk-4XJK5IVQ.mjs +83 -0
  12. package/dist/chunk-4XJK5IVQ.mjs.map +1 -0
  13. package/dist/chunk-5AAT4Z3C.mjs +107 -0
  14. package/dist/chunk-5AAT4Z3C.mjs.map +1 -0
  15. package/dist/chunk-5JNWVLQI.mjs +72 -0
  16. package/dist/chunk-5JNWVLQI.mjs.map +1 -0
  17. package/dist/chunk-5SC3CO5Q.mjs +69 -0
  18. package/dist/chunk-5SC3CO5Q.mjs.map +1 -0
  19. package/dist/chunk-6VUKDHOD.mjs +1 -0
  20. package/dist/chunk-6VUKDHOD.mjs.map +1 -0
  21. package/dist/chunk-AEFM73CL.mjs +32 -0
  22. package/dist/chunk-AEFM73CL.mjs.map +1 -0
  23. package/dist/chunk-AI3Z3CHN.mjs +97 -0
  24. package/dist/chunk-AI3Z3CHN.mjs.map +1 -0
  25. package/dist/chunk-AXFRCGH6.mjs +107 -0
  26. package/dist/chunk-AXFRCGH6.mjs.map +1 -0
  27. package/dist/chunk-BT6C5OPU.mjs +278 -0
  28. package/dist/chunk-BT6C5OPU.mjs.map +1 -0
  29. package/dist/chunk-CGLGXQAU.mjs +78 -0
  30. package/dist/chunk-CGLGXQAU.mjs.map +1 -0
  31. package/dist/chunk-CSHBUHRW.mjs +69 -0
  32. package/dist/chunk-CSHBUHRW.mjs.map +1 -0
  33. package/dist/chunk-CZ3GI3IF.mjs +283 -0
  34. package/dist/chunk-CZ3GI3IF.mjs.map +1 -0
  35. package/dist/chunk-DVUQO72Z.mjs +1 -0
  36. package/dist/chunk-DVUQO72Z.mjs.map +1 -0
  37. package/dist/chunk-E4HD4M7R.mjs +76 -0
  38. package/dist/chunk-E4HD4M7R.mjs.map +1 -0
  39. package/dist/chunk-E56GYBP3.mjs +101 -0
  40. package/dist/chunk-E56GYBP3.mjs.map +1 -0
  41. package/dist/chunk-EJ5ZEAAN.mjs +57 -0
  42. package/dist/chunk-EJ5ZEAAN.mjs.map +1 -0
  43. package/dist/chunk-ETWJDCGE.mjs +1 -0
  44. package/dist/chunk-ETWJDCGE.mjs.map +1 -0
  45. package/dist/chunk-F43IPGPA.mjs +311 -0
  46. package/dist/chunk-F43IPGPA.mjs.map +1 -0
  47. package/dist/chunk-FIBK3DYE.mjs +26 -0
  48. package/dist/chunk-FIBK3DYE.mjs.map +1 -0
  49. package/dist/chunk-FVURPXQK.mjs +45 -0
  50. package/dist/chunk-FVURPXQK.mjs.map +1 -0
  51. package/dist/chunk-FZR2XQKR.mjs +44 -0
  52. package/dist/chunk-FZR2XQKR.mjs.map +1 -0
  53. package/dist/chunk-IA4CLXDM.mjs +76 -0
  54. package/dist/chunk-IA4CLXDM.mjs.map +1 -0
  55. package/dist/chunk-IH5VFJ4L.mjs +60 -0
  56. package/dist/chunk-IH5VFJ4L.mjs.map +1 -0
  57. package/dist/chunk-IICUCI5S.mjs +43 -0
  58. package/dist/chunk-IICUCI5S.mjs.map +1 -0
  59. package/dist/chunk-JLVGSNAO.mjs +311 -0
  60. package/dist/chunk-JLVGSNAO.mjs.map +1 -0
  61. package/dist/chunk-JWOIINVV.mjs +237 -0
  62. package/dist/chunk-JWOIINVV.mjs.map +1 -0
  63. package/dist/chunk-KCVDFZJX.mjs +873 -0
  64. package/dist/chunk-KCVDFZJX.mjs.map +1 -0
  65. package/dist/chunk-KPRUSQ3K.mjs +1 -0
  66. package/dist/chunk-KPRUSQ3K.mjs.map +1 -0
  67. package/dist/chunk-MWC5OV7Z.mjs +1 -0
  68. package/dist/chunk-MWC5OV7Z.mjs.map +1 -0
  69. package/dist/chunk-N5EP5OD5.mjs +1 -0
  70. package/dist/chunk-N5EP5OD5.mjs.map +1 -0
  71. package/dist/chunk-NASFZS3N.mjs +43 -0
  72. package/dist/chunk-NASFZS3N.mjs.map +1 -0
  73. package/dist/chunk-NB2GZAKG.mjs +131 -0
  74. package/dist/chunk-NB2GZAKG.mjs.map +1 -0
  75. package/dist/chunk-NB4DFAZH.mjs +185 -0
  76. package/dist/chunk-NB4DFAZH.mjs.map +1 -0
  77. package/dist/chunk-NNAYEAP2.mjs +49 -0
  78. package/dist/chunk-NNAYEAP2.mjs.map +1 -0
  79. package/dist/chunk-NNPKBGD6.mjs +37 -0
  80. package/dist/chunk-NNPKBGD6.mjs.map +1 -0
  81. package/dist/chunk-OMPVTGXH.mjs +122 -0
  82. package/dist/chunk-OMPVTGXH.mjs.map +1 -0
  83. package/dist/chunk-QFBM3ZT2.mjs +45 -0
  84. package/dist/chunk-QFBM3ZT2.mjs.map +1 -0
  85. package/dist/chunk-QJ6DZ645.mjs +78 -0
  86. package/dist/chunk-QJ6DZ645.mjs.map +1 -0
  87. package/dist/chunk-R5OLAA3L.mjs +135 -0
  88. package/dist/chunk-R5OLAA3L.mjs.map +1 -0
  89. package/dist/chunk-RF2CGPHQ.mjs +215 -0
  90. package/dist/chunk-RF2CGPHQ.mjs.map +1 -0
  91. package/dist/chunk-RGD2L3Z4.mjs +96 -0
  92. package/dist/chunk-RGD2L3Z4.mjs.map +1 -0
  93. package/dist/chunk-RK5P2LG6.mjs +57 -0
  94. package/dist/chunk-RK5P2LG6.mjs.map +1 -0
  95. package/dist/chunk-RRXDJCXI.mjs +60 -0
  96. package/dist/chunk-RRXDJCXI.mjs.map +1 -0
  97. package/dist/chunk-SPDE34WC.mjs +283 -0
  98. package/dist/chunk-SPDE34WC.mjs.map +1 -0
  99. package/dist/chunk-TAUOEJH2.mjs +120 -0
  100. package/dist/chunk-TAUOEJH2.mjs.map +1 -0
  101. package/dist/chunk-TKFOXPXF.mjs +157 -0
  102. package/dist/chunk-TKFOXPXF.mjs.map +1 -0
  103. package/dist/chunk-UOX5D73C.mjs +22 -0
  104. package/dist/chunk-UOX5D73C.mjs.map +1 -0
  105. package/dist/chunk-US4KNAAV.mjs +1 -0
  106. package/dist/chunk-US4KNAAV.mjs.map +1 -0
  107. package/dist/chunk-UZB3CTOY.mjs +873 -0
  108. package/dist/chunk-UZB3CTOY.mjs.map +1 -0
  109. package/dist/chunk-VBI6JXPC.mjs +1 -0
  110. package/dist/chunk-VBI6JXPC.mjs.map +1 -0
  111. package/dist/chunk-VE3SBLU7.mjs +215 -0
  112. package/dist/chunk-VE3SBLU7.mjs.map +1 -0
  113. package/dist/chunk-VUHFLJWI.mjs +185 -0
  114. package/dist/chunk-VUHFLJWI.mjs.map +1 -0
  115. package/dist/chunk-VVAXSF3M.mjs +61 -0
  116. package/dist/chunk-VVAXSF3M.mjs.map +1 -0
  117. package/dist/chunk-W5DUKRCI.mjs +97 -0
  118. package/dist/chunk-W5DUKRCI.mjs.map +1 -0
  119. package/dist/chunk-WNRDFAZ5.mjs +22 -0
  120. package/dist/chunk-WNRDFAZ5.mjs.map +1 -0
  121. package/dist/chunk-XO4IRKSC.mjs +11 -0
  122. package/dist/chunk-XO4IRKSC.mjs.map +1 -0
  123. package/dist/chunk-XU5CEPYQ.mjs +75 -0
  124. package/dist/chunk-XU5CEPYQ.mjs.map +1 -0
  125. package/dist/chunk-YPH4BHOY.mjs +39 -0
  126. package/dist/chunk-YPH4BHOY.mjs.map +1 -0
  127. package/dist/chunk-YVPPF62K.mjs +32 -0
  128. package/dist/chunk-YVPPF62K.mjs.map +1 -0
  129. package/dist/chunk-YZUPVMHC.mjs +1 -0
  130. package/dist/chunk-YZUPVMHC.mjs.map +1 -0
  131. package/dist/chunk-Z3OIGQCZ.mjs +75 -0
  132. package/dist/chunk-Z3OIGQCZ.mjs.map +1 -0
  133. package/dist/chunk-ZIDT52TM.mjs +131 -0
  134. package/dist/chunk-ZIDT52TM.mjs.map +1 -0
  135. package/dist/components/CopilotKitInspector.d.mts +13 -0
  136. package/dist/components/CopilotKitInspector.d.ts +13 -0
  137. package/dist/components/CopilotKitInspector.js +69 -0
  138. package/dist/components/CopilotKitInspector.js.map +1 -0
  139. package/dist/components/CopilotKitInspector.mjs +7 -0
  140. package/dist/components/CopilotKitInspector.mjs.map +1 -0
  141. package/dist/components/WildcardToolCallRender.d.mts +7 -0
  142. package/dist/components/WildcardToolCallRender.d.ts +7 -0
  143. package/dist/components/WildcardToolCallRender.js +106 -0
  144. package/dist/components/WildcardToolCallRender.js.map +1 -0
  145. package/dist/components/WildcardToolCallRender.mjs +8 -0
  146. package/dist/components/WildcardToolCallRender.mjs.map +1 -0
  147. package/dist/components/chat/CopilotChat.d.mts +30 -0
  148. package/dist/components/chat/CopilotChat.d.ts +30 -0
  149. package/dist/components/chat/CopilotChat.js +2934 -0
  150. package/dist/components/chat/CopilotChat.js.map +1 -0
  151. package/dist/components/chat/CopilotChat.mjs +37 -0
  152. package/dist/components/chat/CopilotChat.mjs.map +1 -0
  153. package/dist/components/chat/CopilotChatAssistantMessage.d.mts +45 -0
  154. package/dist/components/chat/CopilotChatAssistantMessage.d.ts +45 -0
  155. package/dist/components/chat/CopilotChatAssistantMessage.js +735 -0
  156. package/dist/components/chat/CopilotChatAssistantMessage.js.map +1 -0
  157. package/dist/components/chat/CopilotChatAssistantMessage.mjs +29 -0
  158. package/dist/components/chat/CopilotChatAssistantMessage.mjs.map +1 -0
  159. package/dist/components/chat/CopilotChatAudioRecorder.d.mts +11 -0
  160. package/dist/components/chat/CopilotChatAudioRecorder.d.ts +11 -0
  161. package/dist/components/chat/CopilotChatAudioRecorder.js +131 -0
  162. package/dist/components/chat/CopilotChatAudioRecorder.js.map +1 -0
  163. package/dist/components/chat/CopilotChatAudioRecorder.mjs +9 -0
  164. package/dist/components/chat/CopilotChatAudioRecorder.mjs.map +1 -0
  165. package/dist/components/chat/CopilotChatInput.d.mts +67 -0
  166. package/dist/components/chat/CopilotChatInput.d.ts +67 -0
  167. package/dist/components/chat/CopilotChatInput.js +1305 -0
  168. package/dist/components/chat/CopilotChatInput.js.map +1 -0
  169. package/dist/components/chat/CopilotChatInput.mjs +16 -0
  170. package/dist/components/chat/CopilotChatInput.mjs.map +1 -0
  171. package/dist/components/chat/CopilotChatMessageView.d.mts +29 -0
  172. package/dist/components/chat/CopilotChatMessageView.d.ts +29 -0
  173. package/dist/components/chat/CopilotChatMessageView.js +1164 -0
  174. package/dist/components/chat/CopilotChatMessageView.js.map +1 -0
  175. package/dist/components/chat/CopilotChatMessageView.mjs +31 -0
  176. package/dist/components/chat/CopilotChatMessageView.mjs.map +1 -0
  177. package/dist/components/chat/CopilotChatSuggestionPill.d.mts +11 -0
  178. package/dist/components/chat/CopilotChatSuggestionPill.d.ts +11 -0
  179. package/dist/components/chat/CopilotChatSuggestionPill.js +76 -0
  180. package/dist/components/chat/CopilotChatSuggestionPill.js.map +1 -0
  181. package/dist/components/chat/CopilotChatSuggestionPill.mjs +10 -0
  182. package/dist/components/chat/CopilotChatSuggestionPill.mjs.map +1 -0
  183. package/dist/components/chat/CopilotChatSuggestionView.d.mts +33 -0
  184. package/dist/components/chat/CopilotChatSuggestionView.d.ts +33 -0
  185. package/dist/components/chat/CopilotChatSuggestionView.js +179 -0
  186. package/dist/components/chat/CopilotChatSuggestionView.js.map +1 -0
  187. package/dist/components/chat/CopilotChatSuggestionView.mjs +12 -0
  188. package/dist/components/chat/CopilotChatSuggestionView.mjs.map +1 -0
  189. package/dist/components/chat/CopilotChatToggleButton.d.mts +14 -0
  190. package/dist/components/chat/CopilotChatToggleButton.d.ts +14 -0
  191. package/dist/components/chat/CopilotChatToggleButton.js +222 -0
  192. package/dist/components/chat/CopilotChatToggleButton.js.map +1 -0
  193. package/dist/components/chat/CopilotChatToggleButton.mjs +16 -0
  194. package/dist/components/chat/CopilotChatToggleButton.mjs.map +1 -0
  195. package/dist/components/chat/CopilotChatToolCallsView.d.mts +10 -0
  196. package/dist/components/chat/CopilotChatToolCallsView.d.ts +10 -0
  197. package/dist/components/chat/CopilotChatToolCallsView.js +264 -0
  198. package/dist/components/chat/CopilotChatToolCallsView.js.map +1 -0
  199. package/dist/components/chat/CopilotChatToolCallsView.mjs +24 -0
  200. package/dist/components/chat/CopilotChatToolCallsView.mjs.map +1 -0
  201. package/dist/components/chat/CopilotChatUserMessage.d.mts +52 -0
  202. package/dist/components/chat/CopilotChatUserMessage.d.ts +52 -0
  203. package/dist/components/chat/CopilotChatUserMessage.js +523 -0
  204. package/dist/components/chat/CopilotChatUserMessage.js.map +1 -0
  205. package/dist/components/chat/CopilotChatUserMessage.mjs +14 -0
  206. package/dist/components/chat/CopilotChatUserMessage.mjs.map +1 -0
  207. package/dist/components/chat/CopilotChatView.d.mts +54 -0
  208. package/dist/components/chat/CopilotChatView.d.ts +54 -0
  209. package/dist/components/chat/CopilotChatView.js +2640 -0
  210. package/dist/components/chat/CopilotChatView.js.map +1 -0
  211. package/dist/components/chat/CopilotChatView.mjs +38 -0
  212. package/dist/components/chat/CopilotChatView.mjs.map +1 -0
  213. package/dist/components/chat/CopilotModalHeader.d.mts +22 -0
  214. package/dist/components/chat/CopilotModalHeader.d.ts +22 -0
  215. package/dist/components/chat/CopilotModalHeader.js +186 -0
  216. package/dist/components/chat/CopilotModalHeader.js.map +1 -0
  217. package/dist/components/chat/CopilotModalHeader.mjs +12 -0
  218. package/dist/components/chat/CopilotModalHeader.mjs.map +1 -0
  219. package/dist/components/chat/CopilotPopup.d.mts +33 -0
  220. package/dist/components/chat/CopilotPopup.d.ts +33 -0
  221. package/dist/components/chat/CopilotPopup.js +3343 -0
  222. package/dist/components/chat/CopilotPopup.js.map +1 -0
  223. package/dist/components/chat/CopilotPopup.mjs +43 -0
  224. package/dist/components/chat/CopilotPopup.mjs.map +1 -0
  225. package/dist/components/chat/CopilotPopupView.d.mts +30 -0
  226. package/dist/components/chat/CopilotPopupView.d.ts +30 -0
  227. package/dist/components/chat/CopilotPopupView.js +3003 -0
  228. package/dist/components/chat/CopilotPopupView.js.map +1 -0
  229. package/dist/components/chat/CopilotPopupView.mjs +41 -0
  230. package/dist/components/chat/CopilotPopupView.mjs.map +1 -0
  231. package/dist/components/chat/CopilotSidebar.d.mts +31 -0
  232. package/dist/components/chat/CopilotSidebar.d.ts +31 -0
  233. package/dist/components/chat/CopilotSidebar.js +3266 -0
  234. package/dist/components/chat/CopilotSidebar.js.map +1 -0
  235. package/dist/components/chat/CopilotSidebar.mjs +43 -0
  236. package/dist/components/chat/CopilotSidebar.mjs.map +1 -0
  237. package/dist/components/chat/CopilotSidebarView.d.mts +28 -0
  238. package/dist/components/chat/CopilotSidebarView.d.ts +28 -0
  239. package/dist/components/chat/CopilotSidebarView.js +2941 -0
  240. package/dist/components/chat/CopilotSidebarView.js.map +1 -0
  241. package/dist/components/chat/CopilotSidebarView.mjs +41 -0
  242. package/dist/components/chat/CopilotSidebarView.mjs.map +1 -0
  243. package/dist/components/chat/index.d.mts +23 -0
  244. package/dist/components/chat/index.d.ts +23 -0
  245. package/dist/components/chat/index.js +3503 -0
  246. package/dist/components/chat/index.js.map +1 -0
  247. package/dist/components/chat/index.mjs +95 -0
  248. package/dist/components/chat/index.mjs.map +1 -0
  249. package/dist/components/index.d.mts +29 -0
  250. package/dist/components/index.d.ts +29 -0
  251. package/dist/components/index.js +3583 -0
  252. package/dist/components/index.js.map +1 -0
  253. package/dist/components/index.mjs +104 -0
  254. package/dist/components/index.mjs.map +1 -0
  255. package/dist/components/ui/button.d.mts +14 -0
  256. package/dist/components/ui/button.d.ts +14 -0
  257. package/dist/components/ui/button.js +150 -0
  258. package/dist/components/ui/button.js.map +1 -0
  259. package/dist/components/ui/button.mjs +10 -0
  260. package/dist/components/ui/button.mjs.map +1 -0
  261. package/dist/components/ui/dropdown-menu.d.mts +28 -0
  262. package/dist/components/ui/dropdown-menu.d.ts +28 -0
  263. package/dist/components/ui/dropdown-menu.js +291 -0
  264. package/dist/components/ui/dropdown-menu.js.map +1 -0
  265. package/dist/components/ui/dropdown-menu.mjs +37 -0
  266. package/dist/components/ui/dropdown-menu.mjs.map +1 -0
  267. package/dist/components/ui/tooltip.d.mts +10 -0
  268. package/dist/components/ui/tooltip.d.ts +10 -0
  269. package/dist/components/ui/tooltip.js +103 -0
  270. package/dist/components/ui/tooltip.js.map +1 -0
  271. package/dist/components/ui/tooltip.mjs +14 -0
  272. package/dist/components/ui/tooltip.mjs.map +1 -0
  273. package/dist/hooks/index.d.mts +19 -0
  274. package/dist/hooks/index.d.ts +19 -0
  275. package/dist/hooks/index.js +691 -0
  276. package/dist/hooks/index.js.map +1 -0
  277. package/dist/hooks/index.mjs +45 -0
  278. package/dist/hooks/index.mjs.map +1 -0
  279. package/dist/hooks/use-agent-context.d.mts +5 -0
  280. package/dist/hooks/use-agent-context.d.ts +5 -0
  281. package/dist/hooks/use-agent-context.js +116 -0
  282. package/dist/hooks/use-agent-context.js.map +1 -0
  283. package/dist/hooks/use-agent-context.mjs +10 -0
  284. package/dist/hooks/use-agent-context.mjs.map +1 -0
  285. package/dist/hooks/use-agent.d.mts +16 -0
  286. package/dist/hooks/use-agent.d.ts +16 -0
  287. package/dist/hooks/use-agent.js +171 -0
  288. package/dist/hooks/use-agent.js.map +1 -0
  289. package/dist/hooks/use-agent.mjs +12 -0
  290. package/dist/hooks/use-agent.mjs.map +1 -0
  291. package/dist/hooks/use-configure-suggestions.d.mts +13 -0
  292. package/dist/hooks/use-configure-suggestions.d.ts +13 -0
  293. package/dist/hooks/use-configure-suggestions.js +232 -0
  294. package/dist/hooks/use-configure-suggestions.js.map +1 -0
  295. package/dist/hooks/use-configure-suggestions.mjs +11 -0
  296. package/dist/hooks/use-configure-suggestions.mjs.map +1 -0
  297. package/dist/hooks/use-frontend-tool.d.mts +8 -0
  298. package/dist/hooks/use-frontend-tool.d.ts +8 -0
  299. package/dist/hooks/use-frontend-tool.js +137 -0
  300. package/dist/hooks/use-frontend-tool.js.map +1 -0
  301. package/dist/hooks/use-frontend-tool.mjs +10 -0
  302. package/dist/hooks/use-frontend-tool.mjs.map +1 -0
  303. package/dist/hooks/use-human-in-the-loop.d.mts +7 -0
  304. package/dist/hooks/use-human-in-the-loop.d.ts +7 -0
  305. package/dist/hooks/use-human-in-the-loop.js +206 -0
  306. package/dist/hooks/use-human-in-the-loop.js.map +1 -0
  307. package/dist/hooks/use-human-in-the-loop.mjs +11 -0
  308. package/dist/hooks/use-human-in-the-loop.mjs.map +1 -0
  309. package/dist/hooks/use-keyboard-height.d.mts +15 -0
  310. package/dist/hooks/use-keyboard-height.d.ts +15 -0
  311. package/dist/hooks/use-keyboard-height.js +68 -0
  312. package/dist/hooks/use-keyboard-height.js.map +1 -0
  313. package/dist/hooks/use-keyboard-height.mjs +7 -0
  314. package/dist/hooks/use-keyboard-height.mjs.map +1 -0
  315. package/dist/hooks/use-render-activity-message.d.mts +5 -0
  316. package/dist/hooks/use-render-activity-message.d.ts +5 -0
  317. package/dist/hooks/use-render-activity-message.js +158 -0
  318. package/dist/hooks/use-render-activity-message.js.map +1 -0
  319. package/dist/hooks/use-render-activity-message.mjs +12 -0
  320. package/dist/hooks/use-render-activity-message.mjs.map +1 -0
  321. package/dist/hooks/use-render-custom-messages.d.mts +11 -0
  322. package/dist/hooks/use-render-custom-messages.d.ts +11 -0
  323. package/dist/hooks/use-render-custom-messages.js +170 -0
  324. package/dist/hooks/use-render-custom-messages.js.map +1 -0
  325. package/dist/hooks/use-render-custom-messages.mjs +12 -0
  326. package/dist/hooks/use-render-custom-messages.mjs.map +1 -0
  327. package/dist/hooks/use-render-tool-call.d.mts +16 -0
  328. package/dist/hooks/use-render-tool-call.d.ts +16 -0
  329. package/dist/hooks/use-render-tool-call.js +208 -0
  330. package/dist/hooks/use-render-tool-call.js.map +1 -0
  331. package/dist/hooks/use-render-tool-call.mjs +11 -0
  332. package/dist/hooks/use-render-tool-call.mjs.map +1 -0
  333. package/dist/hooks/use-suggestions.d.mts +14 -0
  334. package/dist/hooks/use-suggestions.d.ts +14 -0
  335. package/dist/hooks/use-suggestions.js +176 -0
  336. package/dist/hooks/use-suggestions.js.map +1 -0
  337. package/dist/hooks/use-suggestions.mjs +11 -0
  338. package/dist/hooks/use-suggestions.mjs.map +1 -0
  339. package/dist/index.d.mts +46 -635
  340. package/dist/index.d.ts +46 -635
  341. package/dist/index.mjs +110 -3960
  342. package/dist/index.mjs.map +1 -1
  343. package/dist/lib/react-core.d.mts +33 -0
  344. package/dist/lib/react-core.d.ts +33 -0
  345. package/dist/lib/react-core.js +73 -0
  346. package/dist/lib/react-core.js.map +1 -0
  347. package/dist/lib/react-core.mjs +7 -0
  348. package/dist/lib/react-core.mjs.map +1 -0
  349. package/dist/lib/slots.d.mts +16 -0
  350. package/dist/lib/slots.d.ts +16 -0
  351. package/dist/lib/slots.js +60 -0
  352. package/dist/lib/slots.js.map +1 -0
  353. package/dist/lib/slots.mjs +7 -0
  354. package/dist/lib/slots.mjs.map +1 -0
  355. package/dist/lib/utils.d.mts +5 -0
  356. package/dist/lib/utils.d.ts +5 -0
  357. package/dist/lib/utils.js +35 -0
  358. package/dist/lib/utils.js.map +1 -0
  359. package/dist/lib/utils.mjs +7 -0
  360. package/dist/lib/utils.mjs.map +1 -0
  361. package/dist/providers/CopilotChatConfigurationProvider.d.mts +43 -0
  362. package/dist/providers/CopilotChatConfigurationProvider.d.ts +43 -0
  363. package/dist/providers/CopilotChatConfigurationProvider.js +109 -0
  364. package/dist/providers/CopilotChatConfigurationProvider.js.map +1 -0
  365. package/dist/providers/CopilotChatConfigurationProvider.mjs +11 -0
  366. package/dist/providers/CopilotChatConfigurationProvider.mjs.map +1 -0
  367. package/dist/providers/CopilotKitProvider.d.mts +33 -0
  368. package/dist/providers/CopilotKitProvider.d.ts +33 -0
  369. package/dist/providers/CopilotKitProvider.js +314 -0
  370. package/dist/providers/CopilotKitProvider.js.map +1 -0
  371. package/dist/providers/CopilotKitProvider.mjs +12 -0
  372. package/dist/providers/CopilotKitProvider.mjs.map +1 -0
  373. package/dist/providers/index.d.mts +13 -0
  374. package/dist/providers/index.d.ts +13 -0
  375. package/dist/providers/index.js +396 -0
  376. package/dist/providers/index.js.map +1 -0
  377. package/dist/providers/index.mjs +18 -0
  378. package/dist/providers/index.mjs.map +1 -0
  379. package/dist/types/defineToolCallRenderer.d.mts +41 -0
  380. package/dist/types/defineToolCallRenderer.d.ts +41 -0
  381. package/dist/types/defineToolCallRenderer.js +40 -0
  382. package/dist/types/defineToolCallRenderer.js.map +1 -0
  383. package/dist/types/defineToolCallRenderer.mjs +7 -0
  384. package/dist/types/defineToolCallRenderer.mjs.map +1 -0
  385. package/dist/types/frontend-tool.d.mts +9 -0
  386. package/dist/types/frontend-tool.d.ts +9 -0
  387. package/dist/types/frontend-tool.js +19 -0
  388. package/dist/types/frontend-tool.js.map +1 -0
  389. package/dist/types/frontend-tool.mjs +2 -0
  390. package/dist/types/frontend-tool.mjs.map +1 -0
  391. package/dist/types/human-in-the-loop.d.mts +29 -0
  392. package/dist/types/human-in-the-loop.d.ts +29 -0
  393. package/dist/types/human-in-the-loop.js +19 -0
  394. package/dist/types/human-in-the-loop.js.map +1 -0
  395. package/dist/types/human-in-the-loop.mjs +2 -0
  396. package/dist/types/human-in-the-loop.mjs.map +1 -0
  397. package/dist/types/index.d.mts +11 -0
  398. package/dist/types/index.d.ts +11 -0
  399. package/dist/types/index.js +42 -0
  400. package/dist/types/index.js.map +1 -0
  401. package/dist/types/index.mjs +13 -0
  402. package/dist/types/index.mjs.map +1 -0
  403. package/dist/types/react-activity-message-renderer.d.mts +29 -0
  404. package/dist/types/react-activity-message-renderer.d.ts +29 -0
  405. package/dist/types/react-activity-message-renderer.js +19 -0
  406. package/dist/types/react-activity-message-renderer.js.map +1 -0
  407. package/dist/types/react-activity-message-renderer.mjs +2 -0
  408. package/dist/types/react-activity-message-renderer.mjs.map +1 -0
  409. package/dist/types/react-custom-message-renderer.d.mts +18 -0
  410. package/dist/types/react-custom-message-renderer.d.ts +18 -0
  411. package/dist/types/react-custom-message-renderer.js +19 -0
  412. package/dist/types/react-custom-message-renderer.js.map +1 -0
  413. package/dist/types/react-custom-message-renderer.mjs +2 -0
  414. package/dist/types/react-custom-message-renderer.mjs.map +1 -0
  415. package/dist/types/react-tool-call-renderer.d.mts +30 -0
  416. package/dist/types/react-tool-call-renderer.d.ts +30 -0
  417. package/dist/types/react-tool-call-renderer.js +19 -0
  418. package/dist/types/react-tool-call-renderer.js.map +1 -0
  419. package/dist/types/react-tool-call-renderer.mjs +2 -0
  420. package/dist/types/react-tool-call-renderer.mjs.map +1 -0
  421. package/package.json +8 -7
@@ -0,0 +1,873 @@
1
+ import {
2
+ CopilotChatAudioRecorder
3
+ } from "./chunk-4UDBR75C.mjs";
4
+ import {
5
+ Button
6
+ } from "./chunk-TAUOEJH2.mjs";
7
+ import {
8
+ DropdownMenu,
9
+ DropdownMenuContent,
10
+ DropdownMenuItem,
11
+ DropdownMenuSeparator,
12
+ DropdownMenuSub,
13
+ DropdownMenuSubContent,
14
+ DropdownMenuSubTrigger,
15
+ DropdownMenuTrigger
16
+ } from "./chunk-JWOIINVV.mjs";
17
+ import {
18
+ Tooltip,
19
+ TooltipContent,
20
+ TooltipTrigger
21
+ } from "./chunk-VVAXSF3M.mjs";
22
+ import {
23
+ renderSlot
24
+ } from "./chunk-FIBK3DYE.mjs";
25
+ import {
26
+ CopilotChatDefaultLabels,
27
+ useCopilotChatConfiguration
28
+ } from "./chunk-4XJK5IVQ.mjs";
29
+
30
+ // src/components/chat/CopilotChatInput.tsx
31
+ import {
32
+ useState,
33
+ useRef,
34
+ useEffect,
35
+ useLayoutEffect,
36
+ forwardRef,
37
+ useImperativeHandle,
38
+ useCallback,
39
+ useMemo
40
+ } from "react";
41
+ import { twMerge } from "tailwind-merge";
42
+ import { Plus, Mic, ArrowUp, X, Check, Square } from "lucide-react";
43
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
44
+ var SLASH_MENU_MAX_VISIBLE_ITEMS = 5;
45
+ var SLASH_MENU_ITEM_HEIGHT_PX = 40;
46
+ function CopilotChatInput({
47
+ mode = "input",
48
+ onSubmitMessage,
49
+ onStop,
50
+ isRunning = false,
51
+ onStartTranscribe,
52
+ onCancelTranscribe,
53
+ onFinishTranscribe,
54
+ onAddFile,
55
+ onChange,
56
+ value,
57
+ toolsMenu,
58
+ autoFocus = true,
59
+ textArea,
60
+ sendButton,
61
+ startTranscribeButton,
62
+ cancelTranscribeButton,
63
+ finishTranscribeButton,
64
+ addMenuButton,
65
+ audioRecorder,
66
+ children,
67
+ className,
68
+ ...props
69
+ }) {
70
+ const isControlled = value !== void 0;
71
+ const [internalValue, setInternalValue] = useState(() => value ?? "");
72
+ useEffect(() => {
73
+ if (!isControlled && value !== void 0) {
74
+ setInternalValue(value);
75
+ }
76
+ }, [isControlled, value]);
77
+ const resolvedValue = isControlled ? value ?? "" : internalValue;
78
+ const [layout, setLayout] = useState("compact");
79
+ const ignoreResizeRef = useRef(false);
80
+ const resizeEvaluationRafRef = useRef(null);
81
+ const isExpanded = mode === "input" && layout === "expanded";
82
+ const [commandQuery, setCommandQuery] = useState(null);
83
+ const [slashHighlightIndex, setSlashHighlightIndex] = useState(0);
84
+ const inputRef = useRef(null);
85
+ const gridRef = useRef(null);
86
+ const addButtonContainerRef = useRef(null);
87
+ const actionsContainerRef = useRef(null);
88
+ const audioRecorderRef = useRef(null);
89
+ const slashMenuRef = useRef(null);
90
+ const config = useCopilotChatConfiguration();
91
+ const labels = config?.labels ?? CopilotChatDefaultLabels;
92
+ const previousModalStateRef = useRef(void 0);
93
+ const measurementCanvasRef = useRef(null);
94
+ const measurementsRef = useRef({
95
+ singleLineHeight: 0,
96
+ maxHeight: 0,
97
+ paddingLeft: 0,
98
+ paddingRight: 0
99
+ });
100
+ const commandItems = useMemo(() => {
101
+ const entries = [];
102
+ const seen = /* @__PURE__ */ new Set();
103
+ const pushItem = (item) => {
104
+ if (item === "-") {
105
+ return;
106
+ }
107
+ if (item.items && item.items.length > 0) {
108
+ for (const nested of item.items) {
109
+ pushItem(nested);
110
+ }
111
+ return;
112
+ }
113
+ if (!seen.has(item.label)) {
114
+ seen.add(item.label);
115
+ entries.push(item);
116
+ }
117
+ };
118
+ if (onAddFile) {
119
+ pushItem({
120
+ label: labels.chatInputToolbarAddButtonLabel,
121
+ action: onAddFile
122
+ });
123
+ }
124
+ if (toolsMenu && toolsMenu.length > 0) {
125
+ for (const item of toolsMenu) {
126
+ pushItem(item);
127
+ }
128
+ }
129
+ return entries;
130
+ }, [labels.chatInputToolbarAddButtonLabel, onAddFile, toolsMenu]);
131
+ const filteredCommands = useMemo(() => {
132
+ if (commandQuery === null) {
133
+ return [];
134
+ }
135
+ if (commandItems.length === 0) {
136
+ return [];
137
+ }
138
+ const query = commandQuery.trim().toLowerCase();
139
+ if (query.length === 0) {
140
+ return commandItems;
141
+ }
142
+ const startsWith = [];
143
+ const contains = [];
144
+ for (const item of commandItems) {
145
+ const label = item.label.toLowerCase();
146
+ if (label.startsWith(query)) {
147
+ startsWith.push(item);
148
+ } else if (label.includes(query)) {
149
+ contains.push(item);
150
+ }
151
+ }
152
+ return [...startsWith, ...contains];
153
+ }, [commandItems, commandQuery]);
154
+ useEffect(() => {
155
+ if (!autoFocus) {
156
+ previousModalStateRef.current = config?.isModalOpen;
157
+ return;
158
+ }
159
+ if (config?.isModalOpen && !previousModalStateRef.current) {
160
+ inputRef.current?.focus();
161
+ }
162
+ previousModalStateRef.current = config?.isModalOpen;
163
+ }, [config?.isModalOpen, autoFocus]);
164
+ useEffect(() => {
165
+ if (commandItems.length === 0 && commandQuery !== null) {
166
+ setCommandQuery(null);
167
+ }
168
+ }, [commandItems.length, commandQuery]);
169
+ const previousCommandQueryRef = useRef(null);
170
+ useEffect(() => {
171
+ if (commandQuery !== null && commandQuery !== previousCommandQueryRef.current && filteredCommands.length > 0) {
172
+ setSlashHighlightIndex(0);
173
+ }
174
+ previousCommandQueryRef.current = commandQuery;
175
+ }, [commandQuery, filteredCommands.length]);
176
+ useEffect(() => {
177
+ if (commandQuery === null) {
178
+ setSlashHighlightIndex(0);
179
+ return;
180
+ }
181
+ if (filteredCommands.length === 0) {
182
+ setSlashHighlightIndex(-1);
183
+ } else if (slashHighlightIndex < 0 || slashHighlightIndex >= filteredCommands.length) {
184
+ setSlashHighlightIndex(0);
185
+ }
186
+ }, [commandQuery, filteredCommands, slashHighlightIndex]);
187
+ useEffect(() => {
188
+ const recorder = audioRecorderRef.current;
189
+ if (!recorder) {
190
+ return;
191
+ }
192
+ if (mode === "transcribe") {
193
+ recorder.start().catch(console.error);
194
+ } else {
195
+ if (recorder.state === "recording") {
196
+ recorder.stop().catch(console.error);
197
+ }
198
+ }
199
+ }, [mode]);
200
+ useEffect(() => {
201
+ if (mode !== "input") {
202
+ setLayout("compact");
203
+ setCommandQuery(null);
204
+ }
205
+ }, [mode]);
206
+ const updateSlashState = useCallback(
207
+ (value2) => {
208
+ if (commandItems.length === 0) {
209
+ setCommandQuery((prev) => prev === null ? prev : null);
210
+ return;
211
+ }
212
+ if (value2.startsWith("/")) {
213
+ const firstLine = value2.split(/\r?\n/, 1)[0] ?? "";
214
+ const query = firstLine.slice(1);
215
+ setCommandQuery((prev) => prev === query ? prev : query);
216
+ } else {
217
+ setCommandQuery((prev) => prev === null ? prev : null);
218
+ }
219
+ },
220
+ [commandItems.length]
221
+ );
222
+ useEffect(() => {
223
+ updateSlashState(resolvedValue);
224
+ }, [resolvedValue, updateSlashState]);
225
+ const handleChange = (e) => {
226
+ const nextValue = e.target.value;
227
+ if (!isControlled) {
228
+ setInternalValue(nextValue);
229
+ }
230
+ onChange?.(nextValue);
231
+ updateSlashState(nextValue);
232
+ };
233
+ const clearInputValue = useCallback(() => {
234
+ if (!isControlled) {
235
+ setInternalValue("");
236
+ }
237
+ if (onChange) {
238
+ onChange("");
239
+ }
240
+ }, [isControlled, onChange]);
241
+ const runCommand = useCallback(
242
+ (item) => {
243
+ clearInputValue();
244
+ item.action?.();
245
+ setCommandQuery(null);
246
+ setSlashHighlightIndex(0);
247
+ requestAnimationFrame(() => {
248
+ inputRef.current?.focus();
249
+ });
250
+ },
251
+ [clearInputValue]
252
+ );
253
+ const handleKeyDown = (e) => {
254
+ if (commandQuery !== null && mode === "input") {
255
+ if (e.key === "ArrowDown") {
256
+ if (filteredCommands.length > 0) {
257
+ e.preventDefault();
258
+ setSlashHighlightIndex((prev) => {
259
+ if (filteredCommands.length === 0) {
260
+ return prev;
261
+ }
262
+ const next = prev === -1 ? 0 : (prev + 1) % filteredCommands.length;
263
+ return next;
264
+ });
265
+ }
266
+ return;
267
+ }
268
+ if (e.key === "ArrowUp") {
269
+ if (filteredCommands.length > 0) {
270
+ e.preventDefault();
271
+ setSlashHighlightIndex((prev) => {
272
+ if (filteredCommands.length === 0) {
273
+ return prev;
274
+ }
275
+ if (prev === -1) {
276
+ return filteredCommands.length - 1;
277
+ }
278
+ return prev <= 0 ? filteredCommands.length - 1 : prev - 1;
279
+ });
280
+ }
281
+ return;
282
+ }
283
+ if (e.key === "Enter") {
284
+ const selected = slashHighlightIndex >= 0 ? filteredCommands[slashHighlightIndex] : void 0;
285
+ if (selected) {
286
+ e.preventDefault();
287
+ runCommand(selected);
288
+ return;
289
+ }
290
+ }
291
+ if (e.key === "Escape") {
292
+ e.preventDefault();
293
+ setCommandQuery(null);
294
+ return;
295
+ }
296
+ }
297
+ if (e.key === "Enter" && !e.shiftKey) {
298
+ e.preventDefault();
299
+ if (isProcessing) {
300
+ onStop?.();
301
+ } else {
302
+ send();
303
+ }
304
+ }
305
+ };
306
+ const send = () => {
307
+ if (!onSubmitMessage) {
308
+ return;
309
+ }
310
+ const trimmed = resolvedValue.trim();
311
+ if (!trimmed) {
312
+ return;
313
+ }
314
+ onSubmitMessage(trimmed);
315
+ if (!isControlled) {
316
+ setInternalValue("");
317
+ onChange?.("");
318
+ }
319
+ if (inputRef.current) {
320
+ inputRef.current.focus();
321
+ }
322
+ };
323
+ const BoundTextArea = renderSlot(textArea, CopilotChatInput.TextArea, {
324
+ ref: inputRef,
325
+ value: resolvedValue,
326
+ onChange: handleChange,
327
+ onKeyDown: handleKeyDown,
328
+ autoFocus,
329
+ className: twMerge(
330
+ "w-full py-3",
331
+ isExpanded ? "px-5" : "pr-5"
332
+ )
333
+ });
334
+ const isProcessing = mode !== "transcribe" && isRunning;
335
+ const canSend = resolvedValue.trim().length > 0 && !!onSubmitMessage;
336
+ const canStop = !!onStop;
337
+ const handleSendButtonClick = () => {
338
+ if (isProcessing) {
339
+ onStop?.();
340
+ return;
341
+ }
342
+ send();
343
+ };
344
+ const BoundAudioRecorder = renderSlot(audioRecorder, CopilotChatAudioRecorder, {
345
+ ref: audioRecorderRef
346
+ });
347
+ const BoundSendButton = renderSlot(sendButton, CopilotChatInput.SendButton, {
348
+ onClick: handleSendButtonClick,
349
+ disabled: isProcessing ? !canStop : !canSend,
350
+ children: isProcessing && canStop ? /* @__PURE__ */ jsx(Square, { className: "size-[18px] fill-current" }) : void 0
351
+ });
352
+ const BoundStartTranscribeButton = renderSlot(startTranscribeButton, CopilotChatInput.StartTranscribeButton, {
353
+ onClick: onStartTranscribe
354
+ });
355
+ const BoundCancelTranscribeButton = renderSlot(cancelTranscribeButton, CopilotChatInput.CancelTranscribeButton, {
356
+ onClick: onCancelTranscribe
357
+ });
358
+ const BoundFinishTranscribeButton = renderSlot(finishTranscribeButton, CopilotChatInput.FinishTranscribeButton, {
359
+ onClick: onFinishTranscribe
360
+ });
361
+ const BoundAddMenuButton = renderSlot(addMenuButton, CopilotChatInput.AddMenuButton, {
362
+ disabled: mode === "transcribe",
363
+ onAddFile,
364
+ toolsMenu
365
+ });
366
+ if (children) {
367
+ const childProps = {
368
+ textArea: BoundTextArea,
369
+ audioRecorder: BoundAudioRecorder,
370
+ sendButton: BoundSendButton,
371
+ startTranscribeButton: BoundStartTranscribeButton,
372
+ cancelTranscribeButton: BoundCancelTranscribeButton,
373
+ finishTranscribeButton: BoundFinishTranscribeButton,
374
+ addMenuButton: BoundAddMenuButton,
375
+ onSubmitMessage,
376
+ onStop,
377
+ isRunning,
378
+ onStartTranscribe,
379
+ onCancelTranscribe,
380
+ onFinishTranscribe,
381
+ onAddFile,
382
+ mode,
383
+ toolsMenu,
384
+ autoFocus
385
+ };
386
+ return /* @__PURE__ */ jsx(Fragment, { children: children(childProps) });
387
+ }
388
+ const handleContainerClick = (e) => {
389
+ const target = e.target;
390
+ if (target.tagName !== "BUTTON" && !target.closest("button") && inputRef.current && mode === "input") {
391
+ inputRef.current.focus();
392
+ }
393
+ };
394
+ const ensureMeasurements = useCallback(() => {
395
+ const textarea = inputRef.current;
396
+ if (!textarea) {
397
+ return;
398
+ }
399
+ const previousValue = textarea.value;
400
+ const previousHeight = textarea.style.height;
401
+ textarea.style.height = "auto";
402
+ const computedStyle = window.getComputedStyle(textarea);
403
+ const paddingLeft = parseFloat(computedStyle.paddingLeft) || 0;
404
+ const paddingRight = parseFloat(computedStyle.paddingRight) || 0;
405
+ const paddingTop = parseFloat(computedStyle.paddingTop) || 0;
406
+ const paddingBottom = parseFloat(computedStyle.paddingBottom) || 0;
407
+ textarea.value = "";
408
+ const singleLineHeight = textarea.scrollHeight;
409
+ textarea.value = previousValue;
410
+ const contentHeight = singleLineHeight - paddingTop - paddingBottom;
411
+ const maxHeight = contentHeight * 5 + paddingTop + paddingBottom;
412
+ measurementsRef.current = {
413
+ singleLineHeight,
414
+ maxHeight,
415
+ paddingLeft,
416
+ paddingRight
417
+ };
418
+ textarea.style.height = previousHeight;
419
+ textarea.style.maxHeight = `${maxHeight}px`;
420
+ }, []);
421
+ const adjustTextareaHeight = useCallback(() => {
422
+ const textarea = inputRef.current;
423
+ if (!textarea) {
424
+ return 0;
425
+ }
426
+ if (measurementsRef.current.singleLineHeight === 0) {
427
+ ensureMeasurements();
428
+ }
429
+ const { maxHeight } = measurementsRef.current;
430
+ if (maxHeight) {
431
+ textarea.style.maxHeight = `${maxHeight}px`;
432
+ }
433
+ textarea.style.height = "auto";
434
+ const scrollHeight = textarea.scrollHeight;
435
+ if (maxHeight) {
436
+ textarea.style.height = `${Math.min(scrollHeight, maxHeight)}px`;
437
+ } else {
438
+ textarea.style.height = `${scrollHeight}px`;
439
+ }
440
+ return scrollHeight;
441
+ }, [ensureMeasurements]);
442
+ const updateLayout = useCallback((nextLayout) => {
443
+ setLayout((prev) => {
444
+ if (prev === nextLayout) {
445
+ return prev;
446
+ }
447
+ ignoreResizeRef.current = true;
448
+ return nextLayout;
449
+ });
450
+ }, []);
451
+ const evaluateLayout = useCallback(() => {
452
+ if (mode !== "input") {
453
+ updateLayout("compact");
454
+ return;
455
+ }
456
+ if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
457
+ const isMobileViewport = window.matchMedia("(max-width: 767px)").matches;
458
+ if (isMobileViewport) {
459
+ ensureMeasurements();
460
+ adjustTextareaHeight();
461
+ updateLayout("expanded");
462
+ return;
463
+ }
464
+ }
465
+ const textarea = inputRef.current;
466
+ const grid = gridRef.current;
467
+ const addContainer = addButtonContainerRef.current;
468
+ const actionsContainer = actionsContainerRef.current;
469
+ if (!textarea || !grid || !addContainer || !actionsContainer) {
470
+ return;
471
+ }
472
+ if (measurementsRef.current.singleLineHeight === 0) {
473
+ ensureMeasurements();
474
+ }
475
+ const scrollHeight = adjustTextareaHeight();
476
+ const baseline = measurementsRef.current.singleLineHeight;
477
+ const hasExplicitBreak = resolvedValue.includes("\n");
478
+ const renderedMultiline = baseline > 0 ? scrollHeight > baseline + 1 : false;
479
+ let shouldExpand = hasExplicitBreak || renderedMultiline;
480
+ if (!shouldExpand) {
481
+ const gridStyles = window.getComputedStyle(grid);
482
+ const paddingLeft = parseFloat(gridStyles.paddingLeft) || 0;
483
+ const paddingRight = parseFloat(gridStyles.paddingRight) || 0;
484
+ const columnGap = parseFloat(gridStyles.columnGap) || 0;
485
+ const gridAvailableWidth = grid.clientWidth - paddingLeft - paddingRight;
486
+ if (gridAvailableWidth > 0) {
487
+ const addWidth = addContainer.getBoundingClientRect().width;
488
+ const actionsWidth = actionsContainer.getBoundingClientRect().width;
489
+ const compactWidth = Math.max(gridAvailableWidth - addWidth - actionsWidth - columnGap * 2, 0);
490
+ const canvas = measurementCanvasRef.current ?? document.createElement("canvas");
491
+ if (!measurementCanvasRef.current) {
492
+ measurementCanvasRef.current = canvas;
493
+ }
494
+ const context = canvas.getContext("2d");
495
+ if (context) {
496
+ const textareaStyles = window.getComputedStyle(textarea);
497
+ const font = textareaStyles.font || `${textareaStyles.fontStyle} ${textareaStyles.fontVariant} ${textareaStyles.fontWeight} ${textareaStyles.fontSize}/${textareaStyles.lineHeight} ${textareaStyles.fontFamily}`;
498
+ context.font = font;
499
+ const compactInnerWidth = Math.max(
500
+ compactWidth - (measurementsRef.current.paddingLeft || 0) - (measurementsRef.current.paddingRight || 0),
501
+ 0
502
+ );
503
+ if (compactInnerWidth > 0) {
504
+ const lines = resolvedValue.length > 0 ? resolvedValue.split("\n") : [""];
505
+ let longestWidth = 0;
506
+ for (const line of lines) {
507
+ const metrics = context.measureText(line || " ");
508
+ if (metrics.width > longestWidth) {
509
+ longestWidth = metrics.width;
510
+ }
511
+ }
512
+ if (longestWidth > compactInnerWidth) {
513
+ shouldExpand = true;
514
+ }
515
+ }
516
+ }
517
+ }
518
+ }
519
+ const nextLayout = shouldExpand ? "expanded" : "compact";
520
+ updateLayout(nextLayout);
521
+ }, [adjustTextareaHeight, ensureMeasurements, mode, resolvedValue, updateLayout]);
522
+ useLayoutEffect(() => {
523
+ evaluateLayout();
524
+ }, [evaluateLayout]);
525
+ useEffect(() => {
526
+ if (typeof ResizeObserver === "undefined") {
527
+ return;
528
+ }
529
+ const textarea = inputRef.current;
530
+ const grid = gridRef.current;
531
+ const addContainer = addButtonContainerRef.current;
532
+ const actionsContainer = actionsContainerRef.current;
533
+ if (!textarea || !grid || !addContainer || !actionsContainer) {
534
+ return;
535
+ }
536
+ const scheduleEvaluation = () => {
537
+ if (ignoreResizeRef.current) {
538
+ ignoreResizeRef.current = false;
539
+ return;
540
+ }
541
+ if (typeof window === "undefined") {
542
+ evaluateLayout();
543
+ return;
544
+ }
545
+ if (resizeEvaluationRafRef.current !== null) {
546
+ cancelAnimationFrame(resizeEvaluationRafRef.current);
547
+ }
548
+ resizeEvaluationRafRef.current = window.requestAnimationFrame(() => {
549
+ resizeEvaluationRafRef.current = null;
550
+ evaluateLayout();
551
+ });
552
+ };
553
+ const observer = new ResizeObserver(() => {
554
+ scheduleEvaluation();
555
+ });
556
+ observer.observe(grid);
557
+ observer.observe(addContainer);
558
+ observer.observe(actionsContainer);
559
+ observer.observe(textarea);
560
+ return () => {
561
+ observer.disconnect();
562
+ if (typeof window !== "undefined" && resizeEvaluationRafRef.current !== null) {
563
+ cancelAnimationFrame(resizeEvaluationRafRef.current);
564
+ resizeEvaluationRafRef.current = null;
565
+ }
566
+ };
567
+ }, [evaluateLayout]);
568
+ const slashMenuVisible = commandQuery !== null && commandItems.length > 0;
569
+ useEffect(() => {
570
+ if (!slashMenuVisible || slashHighlightIndex < 0) {
571
+ return;
572
+ }
573
+ const active = slashMenuRef.current?.querySelector(
574
+ `[data-slash-index="${slashHighlightIndex}"]`
575
+ );
576
+ active?.scrollIntoView({ block: "nearest" });
577
+ }, [slashMenuVisible, slashHighlightIndex]);
578
+ const slashMenu = slashMenuVisible ? /* @__PURE__ */ jsx(
579
+ "div",
580
+ {
581
+ "data-testid": "copilot-slash-menu",
582
+ role: "listbox",
583
+ "aria-label": "Slash commands",
584
+ ref: slashMenuRef,
585
+ className: "absolute bottom-full left-0 right-0 z-30 mb-2 max-h-64 overflow-y-auto rounded-lg border border-border bg-white shadow-lg dark:border-[#3a3a3a] dark:bg-[#1f1f1f]",
586
+ style: { maxHeight: `${SLASH_MENU_MAX_VISIBLE_ITEMS * SLASH_MENU_ITEM_HEIGHT_PX}px` },
587
+ children: filteredCommands.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-sm text-muted-foreground", children: "No commands found" }) : filteredCommands.map((item, index) => {
588
+ const isActive = index === slashHighlightIndex;
589
+ return /* @__PURE__ */ jsx(
590
+ "button",
591
+ {
592
+ type: "button",
593
+ role: "option",
594
+ "aria-selected": isActive,
595
+ "data-active": isActive ? "true" : void 0,
596
+ "data-slash-index": index,
597
+ className: twMerge(
598
+ "w-full px-3 py-2 text-left text-sm transition-colors",
599
+ "hover:bg-muted dark:hover:bg-[#2f2f2f]",
600
+ isActive ? "bg-muted dark:bg-[#2f2f2f]" : "bg-transparent"
601
+ ),
602
+ onMouseEnter: () => setSlashHighlightIndex(index),
603
+ onMouseDown: (event) => {
604
+ event.preventDefault();
605
+ runCommand(item);
606
+ },
607
+ children: item.label
608
+ },
609
+ `${item.label}-${index}`
610
+ );
611
+ })
612
+ }
613
+ ) : null;
614
+ return /* @__PURE__ */ jsx(
615
+ "div",
616
+ {
617
+ className: twMerge(
618
+ // Layout
619
+ "flex w-full flex-col items-center justify-center",
620
+ // Interaction
621
+ "cursor-text",
622
+ // Overflow and clipping
623
+ "overflow-visible bg-clip-padding contain-inline-size",
624
+ // Background
625
+ "bg-white dark:bg-[#303030]",
626
+ // Visual effects
627
+ "shadow-[0_4px_4px_0_#0000000a,0_0_1px_0_#0000009e] rounded-[28px]",
628
+ className
629
+ ),
630
+ onClick: handleContainerClick,
631
+ ...props,
632
+ "data-layout": isExpanded ? "expanded" : "compact",
633
+ children: /* @__PURE__ */ jsxs(
634
+ "div",
635
+ {
636
+ ref: gridRef,
637
+ className: twMerge(
638
+ "grid w-full gap-x-3 gap-y-3 px-3 py-2",
639
+ isExpanded ? "grid-cols-[auto_minmax(0,1fr)_auto] grid-rows-[auto_auto]" : "grid-cols-[auto_minmax(0,1fr)_auto] items-center"
640
+ ),
641
+ "data-layout": isExpanded ? "expanded" : "compact",
642
+ children: [
643
+ /* @__PURE__ */ jsx(
644
+ "div",
645
+ {
646
+ ref: addButtonContainerRef,
647
+ className: twMerge(
648
+ "flex items-center",
649
+ isExpanded ? "row-start-2" : "row-start-1",
650
+ "col-start-1"
651
+ ),
652
+ children: BoundAddMenuButton
653
+ }
654
+ ),
655
+ /* @__PURE__ */ jsx(
656
+ "div",
657
+ {
658
+ className: twMerge(
659
+ "relative flex min-w-0 flex-col",
660
+ isExpanded ? "col-span-3 row-start-1" : "col-start-2 row-start-1"
661
+ ),
662
+ children: mode === "transcribe" ? BoundAudioRecorder : /* @__PURE__ */ jsxs(Fragment, { children: [
663
+ BoundTextArea,
664
+ slashMenu
665
+ ] })
666
+ }
667
+ ),
668
+ /* @__PURE__ */ jsx(
669
+ "div",
670
+ {
671
+ ref: actionsContainerRef,
672
+ className: twMerge(
673
+ "flex items-center justify-end gap-2",
674
+ isExpanded ? "col-start-3 row-start-2" : "col-start-3 row-start-1"
675
+ ),
676
+ children: mode === "transcribe" ? /* @__PURE__ */ jsxs(Fragment, { children: [
677
+ onCancelTranscribe && BoundCancelTranscribeButton,
678
+ onFinishTranscribe && BoundFinishTranscribeButton
679
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
680
+ onStartTranscribe && BoundStartTranscribeButton,
681
+ BoundSendButton
682
+ ] })
683
+ }
684
+ )
685
+ ]
686
+ }
687
+ )
688
+ }
689
+ );
690
+ }
691
+ ((CopilotChatInput2) => {
692
+ CopilotChatInput2.SendButton = ({ className, children, ...props }) => /* @__PURE__ */ jsx("div", { className: "mr-[10px]", children: /* @__PURE__ */ jsx(
693
+ Button,
694
+ {
695
+ type: "button",
696
+ variant: "chatInputToolbarPrimary",
697
+ size: "chatInputToolbarIcon",
698
+ className,
699
+ ...props,
700
+ children: children ?? /* @__PURE__ */ jsx(ArrowUp, { className: "size-[18px]" })
701
+ }
702
+ ) });
703
+ CopilotChatInput2.ToolbarButton = ({ icon, labelKey, defaultClassName, className, ...props }) => {
704
+ const config = useCopilotChatConfiguration();
705
+ const labels = config?.labels ?? CopilotChatDefaultLabels;
706
+ return /* @__PURE__ */ jsxs(Tooltip, { children: [
707
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
708
+ Button,
709
+ {
710
+ type: "button",
711
+ variant: "chatInputToolbarSecondary",
712
+ size: "chatInputToolbarIcon",
713
+ className: twMerge(defaultClassName, className),
714
+ ...props,
715
+ children: icon
716
+ }
717
+ ) }),
718
+ /* @__PURE__ */ jsx(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsx("p", { children: labels[labelKey] }) })
719
+ ] });
720
+ };
721
+ CopilotChatInput2.StartTranscribeButton = (props) => /* @__PURE__ */ jsx(
722
+ CopilotChatInput2.ToolbarButton,
723
+ {
724
+ icon: /* @__PURE__ */ jsx(Mic, { className: "size-[18px]" }),
725
+ labelKey: "chatInputToolbarStartTranscribeButtonLabel",
726
+ defaultClassName: "mr-2",
727
+ ...props
728
+ }
729
+ );
730
+ CopilotChatInput2.CancelTranscribeButton = (props) => /* @__PURE__ */ jsx(
731
+ CopilotChatInput2.ToolbarButton,
732
+ {
733
+ icon: /* @__PURE__ */ jsx(X, { className: "size-[18px]" }),
734
+ labelKey: "chatInputToolbarCancelTranscribeButtonLabel",
735
+ defaultClassName: "mr-2",
736
+ ...props
737
+ }
738
+ );
739
+ CopilotChatInput2.FinishTranscribeButton = (props) => /* @__PURE__ */ jsx(
740
+ CopilotChatInput2.ToolbarButton,
741
+ {
742
+ icon: /* @__PURE__ */ jsx(Check, { className: "size-[18px]" }),
743
+ labelKey: "chatInputToolbarFinishTranscribeButtonLabel",
744
+ defaultClassName: "mr-[10px]",
745
+ ...props
746
+ }
747
+ );
748
+ CopilotChatInput2.AddMenuButton = ({ className, toolsMenu, onAddFile, disabled, ...props }) => {
749
+ const config = useCopilotChatConfiguration();
750
+ const labels = config?.labels ?? CopilotChatDefaultLabels;
751
+ const menuItems = useMemo(() => {
752
+ const items = [];
753
+ if (onAddFile) {
754
+ items.push({
755
+ label: labels.chatInputToolbarAddButtonLabel,
756
+ action: onAddFile
757
+ });
758
+ }
759
+ if (toolsMenu && toolsMenu.length > 0) {
760
+ if (items.length > 0) {
761
+ items.push("-");
762
+ }
763
+ for (const item of toolsMenu) {
764
+ if (item === "-") {
765
+ if (items.length === 0 || items[items.length - 1] === "-") {
766
+ continue;
767
+ }
768
+ items.push(item);
769
+ } else {
770
+ items.push(item);
771
+ }
772
+ }
773
+ while (items.length > 0 && items[items.length - 1] === "-") {
774
+ items.pop();
775
+ }
776
+ }
777
+ return items;
778
+ }, [onAddFile, toolsMenu, labels.chatInputToolbarAddButtonLabel]);
779
+ const renderMenuItems = useCallback(
780
+ (items) => items.map((item, index) => {
781
+ if (item === "-") {
782
+ return /* @__PURE__ */ jsx(DropdownMenuSeparator, {}, `separator-${index}`);
783
+ }
784
+ if (item.items && item.items.length > 0) {
785
+ return /* @__PURE__ */ jsxs(DropdownMenuSub, { children: [
786
+ /* @__PURE__ */ jsx(DropdownMenuSubTrigger, { children: item.label }),
787
+ /* @__PURE__ */ jsx(DropdownMenuSubContent, { children: renderMenuItems(item.items) })
788
+ ] }, `group-${index}`);
789
+ }
790
+ return /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: item.action, children: item.label }, `item-${index}`);
791
+ }),
792
+ []
793
+ );
794
+ const hasMenuItems = menuItems.length > 0;
795
+ const isDisabled = disabled || !hasMenuItems;
796
+ return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
797
+ /* @__PURE__ */ jsxs(Tooltip, { children: [
798
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
799
+ Button,
800
+ {
801
+ type: "button",
802
+ variant: "chatInputToolbarSecondary",
803
+ size: "chatInputToolbarIcon",
804
+ className: twMerge("ml-1", className),
805
+ disabled: isDisabled,
806
+ ...props,
807
+ children: /* @__PURE__ */ jsx(Plus, { className: "size-[20px]" })
808
+ }
809
+ ) }) }),
810
+ /* @__PURE__ */ jsx(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsxs("p", { className: "flex items-center gap-1 text-xs font-medium", children: [
811
+ /* @__PURE__ */ jsx("span", { children: "Add files and more" }),
812
+ /* @__PURE__ */ jsx("code", { className: "rounded bg-[#4a4a4a] px-1 py-[1px] font-mono text-[11px] text-white dark:bg-[#e0e0e0] dark:text-black", children: "/" })
813
+ ] }) })
814
+ ] }),
815
+ hasMenuItems && /* @__PURE__ */ jsx(DropdownMenuContent, { side: "top", align: "start", children: renderMenuItems(menuItems) })
816
+ ] });
817
+ };
818
+ CopilotChatInput2.TextArea = forwardRef(function TextArea2({ style, className, autoFocus, ...props }, ref) {
819
+ const internalTextareaRef = useRef(null);
820
+ const config = useCopilotChatConfiguration();
821
+ const labels = config?.labels ?? CopilotChatDefaultLabels;
822
+ useImperativeHandle(ref, () => internalTextareaRef.current);
823
+ useEffect(() => {
824
+ const textarea = internalTextareaRef.current;
825
+ if (!textarea) return;
826
+ const handleFocus = () => {
827
+ setTimeout(() => {
828
+ textarea.scrollIntoView({ behavior: "smooth", block: "nearest" });
829
+ }, 300);
830
+ };
831
+ textarea.addEventListener("focus", handleFocus);
832
+ return () => textarea.removeEventListener("focus", handleFocus);
833
+ }, []);
834
+ useEffect(() => {
835
+ if (autoFocus) {
836
+ internalTextareaRef.current?.focus();
837
+ }
838
+ }, [autoFocus]);
839
+ return /* @__PURE__ */ jsx(
840
+ "textarea",
841
+ {
842
+ ref: internalTextareaRef,
843
+ ...props,
844
+ style: {
845
+ overflow: "auto",
846
+ resize: "none",
847
+ ...style
848
+ },
849
+ placeholder: labels.chatInputPlaceholder,
850
+ className: twMerge(
851
+ "bg-transparent outline-none antialiased font-regular leading-relaxed text-[16px] placeholder:text-[#00000077] dark:placeholder:text-[#fffc]",
852
+ className
853
+ ),
854
+ rows: 1
855
+ }
856
+ );
857
+ });
858
+ CopilotChatInput2.AudioRecorder = CopilotChatAudioRecorder;
859
+ })(CopilotChatInput || (CopilotChatInput = {}));
860
+ CopilotChatInput.TextArea.displayName = "CopilotChatInput.TextArea";
861
+ CopilotChatInput.SendButton.displayName = "CopilotChatInput.SendButton";
862
+ CopilotChatInput.ToolbarButton.displayName = "CopilotChatInput.ToolbarButton";
863
+ CopilotChatInput.StartTranscribeButton.displayName = "CopilotChatInput.StartTranscribeButton";
864
+ CopilotChatInput.CancelTranscribeButton.displayName = "CopilotChatInput.CancelTranscribeButton";
865
+ CopilotChatInput.FinishTranscribeButton.displayName = "CopilotChatInput.FinishTranscribeButton";
866
+ CopilotChatInput.AddMenuButton.displayName = "CopilotChatInput.AddMenuButton";
867
+ var CopilotChatInput_default = CopilotChatInput;
868
+
869
+ export {
870
+ CopilotChatInput,
871
+ CopilotChatInput_default
872
+ };
873
+ //# sourceMappingURL=chunk-KCVDFZJX.mjs.map