@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.
- package/dist/chunk-32YJ5VJ4.mjs +157 -0
- package/dist/chunk-32YJ5VJ4.mjs.map +1 -0
- package/dist/chunk-36HFWACS.mjs +1 -0
- package/dist/chunk-36HFWACS.mjs.map +1 -0
- package/dist/chunk-3TA5QBSZ.mjs +122 -0
- package/dist/chunk-3TA5QBSZ.mjs.map +1 -0
- package/dist/chunk-46BZRXWT.mjs +16 -0
- package/dist/chunk-46BZRXWT.mjs.map +1 -0
- package/dist/chunk-4UDBR75C.mjs +106 -0
- package/dist/chunk-4UDBR75C.mjs.map +1 -0
- package/dist/chunk-4XJK5IVQ.mjs +83 -0
- package/dist/chunk-4XJK5IVQ.mjs.map +1 -0
- package/dist/chunk-5AAT4Z3C.mjs +107 -0
- package/dist/chunk-5AAT4Z3C.mjs.map +1 -0
- package/dist/chunk-5JNWVLQI.mjs +72 -0
- package/dist/chunk-5JNWVLQI.mjs.map +1 -0
- package/dist/chunk-5SC3CO5Q.mjs +69 -0
- package/dist/chunk-5SC3CO5Q.mjs.map +1 -0
- package/dist/chunk-6VUKDHOD.mjs +1 -0
- package/dist/chunk-6VUKDHOD.mjs.map +1 -0
- package/dist/chunk-AEFM73CL.mjs +32 -0
- package/dist/chunk-AEFM73CL.mjs.map +1 -0
- package/dist/chunk-AI3Z3CHN.mjs +97 -0
- package/dist/chunk-AI3Z3CHN.mjs.map +1 -0
- package/dist/chunk-AXFRCGH6.mjs +107 -0
- package/dist/chunk-AXFRCGH6.mjs.map +1 -0
- package/dist/chunk-BT6C5OPU.mjs +278 -0
- package/dist/chunk-BT6C5OPU.mjs.map +1 -0
- package/dist/chunk-CGLGXQAU.mjs +78 -0
- package/dist/chunk-CGLGXQAU.mjs.map +1 -0
- package/dist/chunk-CSHBUHRW.mjs +69 -0
- package/dist/chunk-CSHBUHRW.mjs.map +1 -0
- package/dist/chunk-CZ3GI3IF.mjs +283 -0
- package/dist/chunk-CZ3GI3IF.mjs.map +1 -0
- package/dist/chunk-DVUQO72Z.mjs +1 -0
- package/dist/chunk-DVUQO72Z.mjs.map +1 -0
- package/dist/chunk-E4HD4M7R.mjs +76 -0
- package/dist/chunk-E4HD4M7R.mjs.map +1 -0
- package/dist/chunk-E56GYBP3.mjs +101 -0
- package/dist/chunk-E56GYBP3.mjs.map +1 -0
- package/dist/chunk-EJ5ZEAAN.mjs +57 -0
- package/dist/chunk-EJ5ZEAAN.mjs.map +1 -0
- package/dist/chunk-ETWJDCGE.mjs +1 -0
- package/dist/chunk-ETWJDCGE.mjs.map +1 -0
- package/dist/chunk-F43IPGPA.mjs +311 -0
- package/dist/chunk-F43IPGPA.mjs.map +1 -0
- package/dist/chunk-FIBK3DYE.mjs +26 -0
- package/dist/chunk-FIBK3DYE.mjs.map +1 -0
- package/dist/chunk-FVURPXQK.mjs +45 -0
- package/dist/chunk-FVURPXQK.mjs.map +1 -0
- package/dist/chunk-FZR2XQKR.mjs +44 -0
- package/dist/chunk-FZR2XQKR.mjs.map +1 -0
- package/dist/chunk-IA4CLXDM.mjs +76 -0
- package/dist/chunk-IA4CLXDM.mjs.map +1 -0
- package/dist/chunk-IH5VFJ4L.mjs +60 -0
- package/dist/chunk-IH5VFJ4L.mjs.map +1 -0
- package/dist/chunk-IICUCI5S.mjs +43 -0
- package/dist/chunk-IICUCI5S.mjs.map +1 -0
- package/dist/chunk-JLVGSNAO.mjs +311 -0
- package/dist/chunk-JLVGSNAO.mjs.map +1 -0
- package/dist/chunk-JWOIINVV.mjs +237 -0
- package/dist/chunk-JWOIINVV.mjs.map +1 -0
- package/dist/chunk-KCVDFZJX.mjs +873 -0
- package/dist/chunk-KCVDFZJX.mjs.map +1 -0
- package/dist/chunk-KPRUSQ3K.mjs +1 -0
- package/dist/chunk-KPRUSQ3K.mjs.map +1 -0
- package/dist/chunk-MWC5OV7Z.mjs +1 -0
- package/dist/chunk-MWC5OV7Z.mjs.map +1 -0
- package/dist/chunk-N5EP5OD5.mjs +1 -0
- package/dist/chunk-N5EP5OD5.mjs.map +1 -0
- package/dist/chunk-NASFZS3N.mjs +43 -0
- package/dist/chunk-NASFZS3N.mjs.map +1 -0
- package/dist/chunk-NB2GZAKG.mjs +131 -0
- package/dist/chunk-NB2GZAKG.mjs.map +1 -0
- package/dist/chunk-NB4DFAZH.mjs +185 -0
- package/dist/chunk-NB4DFAZH.mjs.map +1 -0
- package/dist/chunk-NNAYEAP2.mjs +49 -0
- package/dist/chunk-NNAYEAP2.mjs.map +1 -0
- package/dist/chunk-NNPKBGD6.mjs +37 -0
- package/dist/chunk-NNPKBGD6.mjs.map +1 -0
- package/dist/chunk-OMPVTGXH.mjs +122 -0
- package/dist/chunk-OMPVTGXH.mjs.map +1 -0
- package/dist/chunk-QFBM3ZT2.mjs +45 -0
- package/dist/chunk-QFBM3ZT2.mjs.map +1 -0
- package/dist/chunk-QJ6DZ645.mjs +78 -0
- package/dist/chunk-QJ6DZ645.mjs.map +1 -0
- package/dist/chunk-R5OLAA3L.mjs +135 -0
- package/dist/chunk-R5OLAA3L.mjs.map +1 -0
- package/dist/chunk-RF2CGPHQ.mjs +215 -0
- package/dist/chunk-RF2CGPHQ.mjs.map +1 -0
- package/dist/chunk-RGD2L3Z4.mjs +96 -0
- package/dist/chunk-RGD2L3Z4.mjs.map +1 -0
- package/dist/chunk-RK5P2LG6.mjs +57 -0
- package/dist/chunk-RK5P2LG6.mjs.map +1 -0
- package/dist/chunk-RRXDJCXI.mjs +60 -0
- package/dist/chunk-RRXDJCXI.mjs.map +1 -0
- package/dist/chunk-SPDE34WC.mjs +283 -0
- package/dist/chunk-SPDE34WC.mjs.map +1 -0
- package/dist/chunk-TAUOEJH2.mjs +120 -0
- package/dist/chunk-TAUOEJH2.mjs.map +1 -0
- package/dist/chunk-TKFOXPXF.mjs +157 -0
- package/dist/chunk-TKFOXPXF.mjs.map +1 -0
- package/dist/chunk-UOX5D73C.mjs +22 -0
- package/dist/chunk-UOX5D73C.mjs.map +1 -0
- package/dist/chunk-US4KNAAV.mjs +1 -0
- package/dist/chunk-US4KNAAV.mjs.map +1 -0
- package/dist/chunk-UZB3CTOY.mjs +873 -0
- package/dist/chunk-UZB3CTOY.mjs.map +1 -0
- package/dist/chunk-VBI6JXPC.mjs +1 -0
- package/dist/chunk-VBI6JXPC.mjs.map +1 -0
- package/dist/chunk-VE3SBLU7.mjs +215 -0
- package/dist/chunk-VE3SBLU7.mjs.map +1 -0
- package/dist/chunk-VUHFLJWI.mjs +185 -0
- package/dist/chunk-VUHFLJWI.mjs.map +1 -0
- package/dist/chunk-VVAXSF3M.mjs +61 -0
- package/dist/chunk-VVAXSF3M.mjs.map +1 -0
- package/dist/chunk-W5DUKRCI.mjs +97 -0
- package/dist/chunk-W5DUKRCI.mjs.map +1 -0
- package/dist/chunk-WNRDFAZ5.mjs +22 -0
- package/dist/chunk-WNRDFAZ5.mjs.map +1 -0
- package/dist/chunk-XO4IRKSC.mjs +11 -0
- package/dist/chunk-XO4IRKSC.mjs.map +1 -0
- package/dist/chunk-XU5CEPYQ.mjs +75 -0
- package/dist/chunk-XU5CEPYQ.mjs.map +1 -0
- package/dist/chunk-YPH4BHOY.mjs +39 -0
- package/dist/chunk-YPH4BHOY.mjs.map +1 -0
- package/dist/chunk-YVPPF62K.mjs +32 -0
- package/dist/chunk-YVPPF62K.mjs.map +1 -0
- package/dist/chunk-YZUPVMHC.mjs +1 -0
- package/dist/chunk-YZUPVMHC.mjs.map +1 -0
- package/dist/chunk-Z3OIGQCZ.mjs +75 -0
- package/dist/chunk-Z3OIGQCZ.mjs.map +1 -0
- package/dist/chunk-ZIDT52TM.mjs +131 -0
- package/dist/chunk-ZIDT52TM.mjs.map +1 -0
- package/dist/components/CopilotKitInspector.d.mts +13 -0
- package/dist/components/CopilotKitInspector.d.ts +13 -0
- package/dist/components/CopilotKitInspector.js +69 -0
- package/dist/components/CopilotKitInspector.js.map +1 -0
- package/dist/components/CopilotKitInspector.mjs +7 -0
- package/dist/components/CopilotKitInspector.mjs.map +1 -0
- package/dist/components/WildcardToolCallRender.d.mts +7 -0
- package/dist/components/WildcardToolCallRender.d.ts +7 -0
- package/dist/components/WildcardToolCallRender.js +106 -0
- package/dist/components/WildcardToolCallRender.js.map +1 -0
- package/dist/components/WildcardToolCallRender.mjs +8 -0
- package/dist/components/WildcardToolCallRender.mjs.map +1 -0
- package/dist/components/chat/CopilotChat.d.mts +30 -0
- package/dist/components/chat/CopilotChat.d.ts +30 -0
- package/dist/components/chat/CopilotChat.js +2934 -0
- package/dist/components/chat/CopilotChat.js.map +1 -0
- package/dist/components/chat/CopilotChat.mjs +37 -0
- package/dist/components/chat/CopilotChat.mjs.map +1 -0
- package/dist/components/chat/CopilotChatAssistantMessage.d.mts +45 -0
- package/dist/components/chat/CopilotChatAssistantMessage.d.ts +45 -0
- package/dist/components/chat/CopilotChatAssistantMessage.js +735 -0
- package/dist/components/chat/CopilotChatAssistantMessage.js.map +1 -0
- package/dist/components/chat/CopilotChatAssistantMessage.mjs +29 -0
- package/dist/components/chat/CopilotChatAssistantMessage.mjs.map +1 -0
- package/dist/components/chat/CopilotChatAudioRecorder.d.mts +11 -0
- package/dist/components/chat/CopilotChatAudioRecorder.d.ts +11 -0
- package/dist/components/chat/CopilotChatAudioRecorder.js +131 -0
- package/dist/components/chat/CopilotChatAudioRecorder.js.map +1 -0
- package/dist/components/chat/CopilotChatAudioRecorder.mjs +9 -0
- package/dist/components/chat/CopilotChatAudioRecorder.mjs.map +1 -0
- package/dist/components/chat/CopilotChatInput.d.mts +67 -0
- package/dist/components/chat/CopilotChatInput.d.ts +67 -0
- package/dist/components/chat/CopilotChatInput.js +1305 -0
- package/dist/components/chat/CopilotChatInput.js.map +1 -0
- package/dist/components/chat/CopilotChatInput.mjs +16 -0
- package/dist/components/chat/CopilotChatInput.mjs.map +1 -0
- package/dist/components/chat/CopilotChatMessageView.d.mts +29 -0
- package/dist/components/chat/CopilotChatMessageView.d.ts +29 -0
- package/dist/components/chat/CopilotChatMessageView.js +1164 -0
- package/dist/components/chat/CopilotChatMessageView.js.map +1 -0
- package/dist/components/chat/CopilotChatMessageView.mjs +31 -0
- package/dist/components/chat/CopilotChatMessageView.mjs.map +1 -0
- package/dist/components/chat/CopilotChatSuggestionPill.d.mts +11 -0
- package/dist/components/chat/CopilotChatSuggestionPill.d.ts +11 -0
- package/dist/components/chat/CopilotChatSuggestionPill.js +76 -0
- package/dist/components/chat/CopilotChatSuggestionPill.js.map +1 -0
- package/dist/components/chat/CopilotChatSuggestionPill.mjs +10 -0
- package/dist/components/chat/CopilotChatSuggestionPill.mjs.map +1 -0
- package/dist/components/chat/CopilotChatSuggestionView.d.mts +33 -0
- package/dist/components/chat/CopilotChatSuggestionView.d.ts +33 -0
- package/dist/components/chat/CopilotChatSuggestionView.js +179 -0
- package/dist/components/chat/CopilotChatSuggestionView.js.map +1 -0
- package/dist/components/chat/CopilotChatSuggestionView.mjs +12 -0
- package/dist/components/chat/CopilotChatSuggestionView.mjs.map +1 -0
- package/dist/components/chat/CopilotChatToggleButton.d.mts +14 -0
- package/dist/components/chat/CopilotChatToggleButton.d.ts +14 -0
- package/dist/components/chat/CopilotChatToggleButton.js +222 -0
- package/dist/components/chat/CopilotChatToggleButton.js.map +1 -0
- package/dist/components/chat/CopilotChatToggleButton.mjs +16 -0
- package/dist/components/chat/CopilotChatToggleButton.mjs.map +1 -0
- package/dist/components/chat/CopilotChatToolCallsView.d.mts +10 -0
- package/dist/components/chat/CopilotChatToolCallsView.d.ts +10 -0
- package/dist/components/chat/CopilotChatToolCallsView.js +264 -0
- package/dist/components/chat/CopilotChatToolCallsView.js.map +1 -0
- package/dist/components/chat/CopilotChatToolCallsView.mjs +24 -0
- package/dist/components/chat/CopilotChatToolCallsView.mjs.map +1 -0
- package/dist/components/chat/CopilotChatUserMessage.d.mts +52 -0
- package/dist/components/chat/CopilotChatUserMessage.d.ts +52 -0
- package/dist/components/chat/CopilotChatUserMessage.js +523 -0
- package/dist/components/chat/CopilotChatUserMessage.js.map +1 -0
- package/dist/components/chat/CopilotChatUserMessage.mjs +14 -0
- package/dist/components/chat/CopilotChatUserMessage.mjs.map +1 -0
- package/dist/components/chat/CopilotChatView.d.mts +54 -0
- package/dist/components/chat/CopilotChatView.d.ts +54 -0
- package/dist/components/chat/CopilotChatView.js +2640 -0
- package/dist/components/chat/CopilotChatView.js.map +1 -0
- package/dist/components/chat/CopilotChatView.mjs +38 -0
- package/dist/components/chat/CopilotChatView.mjs.map +1 -0
- package/dist/components/chat/CopilotModalHeader.d.mts +22 -0
- package/dist/components/chat/CopilotModalHeader.d.ts +22 -0
- package/dist/components/chat/CopilotModalHeader.js +186 -0
- package/dist/components/chat/CopilotModalHeader.js.map +1 -0
- package/dist/components/chat/CopilotModalHeader.mjs +12 -0
- package/dist/components/chat/CopilotModalHeader.mjs.map +1 -0
- package/dist/components/chat/CopilotPopup.d.mts +33 -0
- package/dist/components/chat/CopilotPopup.d.ts +33 -0
- package/dist/components/chat/CopilotPopup.js +3343 -0
- package/dist/components/chat/CopilotPopup.js.map +1 -0
- package/dist/components/chat/CopilotPopup.mjs +43 -0
- package/dist/components/chat/CopilotPopup.mjs.map +1 -0
- package/dist/components/chat/CopilotPopupView.d.mts +30 -0
- package/dist/components/chat/CopilotPopupView.d.ts +30 -0
- package/dist/components/chat/CopilotPopupView.js +3003 -0
- package/dist/components/chat/CopilotPopupView.js.map +1 -0
- package/dist/components/chat/CopilotPopupView.mjs +41 -0
- package/dist/components/chat/CopilotPopupView.mjs.map +1 -0
- package/dist/components/chat/CopilotSidebar.d.mts +31 -0
- package/dist/components/chat/CopilotSidebar.d.ts +31 -0
- package/dist/components/chat/CopilotSidebar.js +3266 -0
- package/dist/components/chat/CopilotSidebar.js.map +1 -0
- package/dist/components/chat/CopilotSidebar.mjs +43 -0
- package/dist/components/chat/CopilotSidebar.mjs.map +1 -0
- package/dist/components/chat/CopilotSidebarView.d.mts +28 -0
- package/dist/components/chat/CopilotSidebarView.d.ts +28 -0
- package/dist/components/chat/CopilotSidebarView.js +2941 -0
- package/dist/components/chat/CopilotSidebarView.js.map +1 -0
- package/dist/components/chat/CopilotSidebarView.mjs +41 -0
- package/dist/components/chat/CopilotSidebarView.mjs.map +1 -0
- package/dist/components/chat/index.d.mts +23 -0
- package/dist/components/chat/index.d.ts +23 -0
- package/dist/components/chat/index.js +3503 -0
- package/dist/components/chat/index.js.map +1 -0
- package/dist/components/chat/index.mjs +95 -0
- package/dist/components/chat/index.mjs.map +1 -0
- package/dist/components/index.d.mts +29 -0
- package/dist/components/index.d.ts +29 -0
- package/dist/components/index.js +3583 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +104 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/components/ui/button.d.mts +14 -0
- package/dist/components/ui/button.d.ts +14 -0
- package/dist/components/ui/button.js +150 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/button.mjs +10 -0
- package/dist/components/ui/button.mjs.map +1 -0
- package/dist/components/ui/dropdown-menu.d.mts +28 -0
- package/dist/components/ui/dropdown-menu.d.ts +28 -0
- package/dist/components/ui/dropdown-menu.js +291 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/dropdown-menu.mjs +37 -0
- package/dist/components/ui/dropdown-menu.mjs.map +1 -0
- package/dist/components/ui/tooltip.d.mts +10 -0
- package/dist/components/ui/tooltip.d.ts +10 -0
- package/dist/components/ui/tooltip.js +103 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/components/ui/tooltip.mjs +14 -0
- package/dist/components/ui/tooltip.mjs.map +1 -0
- package/dist/hooks/index.d.mts +19 -0
- package/dist/hooks/index.d.ts +19 -0
- package/dist/hooks/index.js +691 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +45 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/hooks/use-agent-context.d.mts +5 -0
- package/dist/hooks/use-agent-context.d.ts +5 -0
- package/dist/hooks/use-agent-context.js +116 -0
- package/dist/hooks/use-agent-context.js.map +1 -0
- package/dist/hooks/use-agent-context.mjs +10 -0
- package/dist/hooks/use-agent-context.mjs.map +1 -0
- package/dist/hooks/use-agent.d.mts +16 -0
- package/dist/hooks/use-agent.d.ts +16 -0
- package/dist/hooks/use-agent.js +171 -0
- package/dist/hooks/use-agent.js.map +1 -0
- package/dist/hooks/use-agent.mjs +12 -0
- package/dist/hooks/use-agent.mjs.map +1 -0
- package/dist/hooks/use-configure-suggestions.d.mts +13 -0
- package/dist/hooks/use-configure-suggestions.d.ts +13 -0
- package/dist/hooks/use-configure-suggestions.js +232 -0
- package/dist/hooks/use-configure-suggestions.js.map +1 -0
- package/dist/hooks/use-configure-suggestions.mjs +11 -0
- package/dist/hooks/use-configure-suggestions.mjs.map +1 -0
- package/dist/hooks/use-frontend-tool.d.mts +8 -0
- package/dist/hooks/use-frontend-tool.d.ts +8 -0
- package/dist/hooks/use-frontend-tool.js +137 -0
- package/dist/hooks/use-frontend-tool.js.map +1 -0
- package/dist/hooks/use-frontend-tool.mjs +10 -0
- package/dist/hooks/use-frontend-tool.mjs.map +1 -0
- package/dist/hooks/use-human-in-the-loop.d.mts +7 -0
- package/dist/hooks/use-human-in-the-loop.d.ts +7 -0
- package/dist/hooks/use-human-in-the-loop.js +206 -0
- package/dist/hooks/use-human-in-the-loop.js.map +1 -0
- package/dist/hooks/use-human-in-the-loop.mjs +11 -0
- package/dist/hooks/use-human-in-the-loop.mjs.map +1 -0
- package/dist/hooks/use-keyboard-height.d.mts +15 -0
- package/dist/hooks/use-keyboard-height.d.ts +15 -0
- package/dist/hooks/use-keyboard-height.js +68 -0
- package/dist/hooks/use-keyboard-height.js.map +1 -0
- package/dist/hooks/use-keyboard-height.mjs +7 -0
- package/dist/hooks/use-keyboard-height.mjs.map +1 -0
- package/dist/hooks/use-render-activity-message.d.mts +5 -0
- package/dist/hooks/use-render-activity-message.d.ts +5 -0
- package/dist/hooks/use-render-activity-message.js +158 -0
- package/dist/hooks/use-render-activity-message.js.map +1 -0
- package/dist/hooks/use-render-activity-message.mjs +12 -0
- package/dist/hooks/use-render-activity-message.mjs.map +1 -0
- package/dist/hooks/use-render-custom-messages.d.mts +11 -0
- package/dist/hooks/use-render-custom-messages.d.ts +11 -0
- package/dist/hooks/use-render-custom-messages.js +170 -0
- package/dist/hooks/use-render-custom-messages.js.map +1 -0
- package/dist/hooks/use-render-custom-messages.mjs +12 -0
- package/dist/hooks/use-render-custom-messages.mjs.map +1 -0
- package/dist/hooks/use-render-tool-call.d.mts +16 -0
- package/dist/hooks/use-render-tool-call.d.ts +16 -0
- package/dist/hooks/use-render-tool-call.js +208 -0
- package/dist/hooks/use-render-tool-call.js.map +1 -0
- package/dist/hooks/use-render-tool-call.mjs +11 -0
- package/dist/hooks/use-render-tool-call.mjs.map +1 -0
- package/dist/hooks/use-suggestions.d.mts +14 -0
- package/dist/hooks/use-suggestions.d.ts +14 -0
- package/dist/hooks/use-suggestions.js +176 -0
- package/dist/hooks/use-suggestions.js.map +1 -0
- package/dist/hooks/use-suggestions.mjs +11 -0
- package/dist/hooks/use-suggestions.mjs.map +1 -0
- package/dist/index.d.mts +46 -635
- package/dist/index.d.ts +46 -635
- package/dist/index.mjs +110 -3960
- package/dist/index.mjs.map +1 -1
- package/dist/lib/react-core.d.mts +33 -0
- package/dist/lib/react-core.d.ts +33 -0
- package/dist/lib/react-core.js +73 -0
- package/dist/lib/react-core.js.map +1 -0
- package/dist/lib/react-core.mjs +7 -0
- package/dist/lib/react-core.mjs.map +1 -0
- package/dist/lib/slots.d.mts +16 -0
- package/dist/lib/slots.d.ts +16 -0
- package/dist/lib/slots.js +60 -0
- package/dist/lib/slots.js.map +1 -0
- package/dist/lib/slots.mjs +7 -0
- package/dist/lib/slots.mjs.map +1 -0
- package/dist/lib/utils.d.mts +5 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +35 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/utils.mjs +7 -0
- package/dist/lib/utils.mjs.map +1 -0
- package/dist/providers/CopilotChatConfigurationProvider.d.mts +43 -0
- package/dist/providers/CopilotChatConfigurationProvider.d.ts +43 -0
- package/dist/providers/CopilotChatConfigurationProvider.js +109 -0
- package/dist/providers/CopilotChatConfigurationProvider.js.map +1 -0
- package/dist/providers/CopilotChatConfigurationProvider.mjs +11 -0
- package/dist/providers/CopilotChatConfigurationProvider.mjs.map +1 -0
- package/dist/providers/CopilotKitProvider.d.mts +33 -0
- package/dist/providers/CopilotKitProvider.d.ts +33 -0
- package/dist/providers/CopilotKitProvider.js +314 -0
- package/dist/providers/CopilotKitProvider.js.map +1 -0
- package/dist/providers/CopilotKitProvider.mjs +12 -0
- package/dist/providers/CopilotKitProvider.mjs.map +1 -0
- package/dist/providers/index.d.mts +13 -0
- package/dist/providers/index.d.ts +13 -0
- package/dist/providers/index.js +396 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/index.mjs +18 -0
- package/dist/providers/index.mjs.map +1 -0
- package/dist/types/defineToolCallRenderer.d.mts +41 -0
- package/dist/types/defineToolCallRenderer.d.ts +41 -0
- package/dist/types/defineToolCallRenderer.js +40 -0
- package/dist/types/defineToolCallRenderer.js.map +1 -0
- package/dist/types/defineToolCallRenderer.mjs +7 -0
- package/dist/types/defineToolCallRenderer.mjs.map +1 -0
- package/dist/types/frontend-tool.d.mts +9 -0
- package/dist/types/frontend-tool.d.ts +9 -0
- package/dist/types/frontend-tool.js +19 -0
- package/dist/types/frontend-tool.js.map +1 -0
- package/dist/types/frontend-tool.mjs +2 -0
- package/dist/types/frontend-tool.mjs.map +1 -0
- package/dist/types/human-in-the-loop.d.mts +29 -0
- package/dist/types/human-in-the-loop.d.ts +29 -0
- package/dist/types/human-in-the-loop.js +19 -0
- package/dist/types/human-in-the-loop.js.map +1 -0
- package/dist/types/human-in-the-loop.mjs +2 -0
- package/dist/types/human-in-the-loop.mjs.map +1 -0
- package/dist/types/index.d.mts +11 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.js +42 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +13 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/types/react-activity-message-renderer.d.mts +29 -0
- package/dist/types/react-activity-message-renderer.d.ts +29 -0
- package/dist/types/react-activity-message-renderer.js +19 -0
- package/dist/types/react-activity-message-renderer.js.map +1 -0
- package/dist/types/react-activity-message-renderer.mjs +2 -0
- package/dist/types/react-activity-message-renderer.mjs.map +1 -0
- package/dist/types/react-custom-message-renderer.d.mts +18 -0
- package/dist/types/react-custom-message-renderer.d.ts +18 -0
- package/dist/types/react-custom-message-renderer.js +19 -0
- package/dist/types/react-custom-message-renderer.js.map +1 -0
- package/dist/types/react-custom-message-renderer.mjs +2 -0
- package/dist/types/react-custom-message-renderer.mjs.map +1 -0
- package/dist/types/react-tool-call-renderer.d.mts +30 -0
- package/dist/types/react-tool-call-renderer.d.ts +30 -0
- package/dist/types/react-tool-call-renderer.js +19 -0
- package/dist/types/react-tool-call-renderer.js.map +1 -0
- package/dist/types/react-tool-call-renderer.mjs +2 -0
- package/dist/types/react-tool-call-renderer.mjs.map +1 -0
- package/package.json +8 -7
|
@@ -0,0 +1,1305 @@
|
|
|
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 __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/components/chat/CopilotChatInput.tsx
|
|
31
|
+
var CopilotChatInput_exports = {};
|
|
32
|
+
__export(CopilotChatInput_exports, {
|
|
33
|
+
CopilotChatInput: () => CopilotChatInput,
|
|
34
|
+
default: () => CopilotChatInput_default
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(CopilotChatInput_exports);
|
|
37
|
+
var import_react4 = require("react");
|
|
38
|
+
var import_tailwind_merge3 = require("tailwind-merge");
|
|
39
|
+
var import_lucide_react2 = require("lucide-react");
|
|
40
|
+
|
|
41
|
+
// src/providers/CopilotChatConfigurationProvider.tsx
|
|
42
|
+
var import_react = require("react");
|
|
43
|
+
var import_shared = require("@copilotkitnext/shared");
|
|
44
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
+
var CopilotChatDefaultLabels = {
|
|
46
|
+
chatInputPlaceholder: "Type a message...",
|
|
47
|
+
chatInputToolbarStartTranscribeButtonLabel: "Transcribe",
|
|
48
|
+
chatInputToolbarCancelTranscribeButtonLabel: "Cancel",
|
|
49
|
+
chatInputToolbarFinishTranscribeButtonLabel: "Finish",
|
|
50
|
+
chatInputToolbarAddButtonLabel: "Add photos or files",
|
|
51
|
+
chatInputToolbarToolsButtonLabel: "Tools",
|
|
52
|
+
assistantMessageToolbarCopyCodeLabel: "Copy",
|
|
53
|
+
assistantMessageToolbarCopyCodeCopiedLabel: "Copied",
|
|
54
|
+
assistantMessageToolbarCopyMessageLabel: "Copy",
|
|
55
|
+
assistantMessageToolbarThumbsUpLabel: "Good response",
|
|
56
|
+
assistantMessageToolbarThumbsDownLabel: "Bad response",
|
|
57
|
+
assistantMessageToolbarReadAloudLabel: "Read aloud",
|
|
58
|
+
assistantMessageToolbarRegenerateLabel: "Regenerate",
|
|
59
|
+
userMessageToolbarCopyMessageLabel: "Copy",
|
|
60
|
+
userMessageToolbarEditMessageLabel: "Edit",
|
|
61
|
+
chatDisclaimerText: "AI can make mistakes. Please verify important information.",
|
|
62
|
+
chatToggleOpenLabel: "Open chat",
|
|
63
|
+
chatToggleCloseLabel: "Close chat",
|
|
64
|
+
modalHeaderTitle: "CopilotKit Chat"
|
|
65
|
+
};
|
|
66
|
+
var CopilotChatConfiguration = (0, import_react.createContext)(null);
|
|
67
|
+
var useCopilotChatConfiguration = () => {
|
|
68
|
+
const configuration = (0, import_react.useContext)(CopilotChatConfiguration);
|
|
69
|
+
return configuration;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// src/components/ui/button.tsx
|
|
73
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
74
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
75
|
+
|
|
76
|
+
// src/lib/utils.ts
|
|
77
|
+
var import_clsx = require("clsx");
|
|
78
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
79
|
+
function cn(...inputs) {
|
|
80
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// src/components/ui/button.tsx
|
|
84
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
85
|
+
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
86
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
87
|
+
{
|
|
88
|
+
variants: {
|
|
89
|
+
variant: {
|
|
90
|
+
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
|
91
|
+
destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
92
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
93
|
+
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
94
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50 cursor-pointer",
|
|
95
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
96
|
+
assistantMessageToolbarButton: [
|
|
97
|
+
"cursor-pointer",
|
|
98
|
+
// Background and text
|
|
99
|
+
"p-0 text-[rgb(93,93,93)] hover:bg-[#E8E8E8]",
|
|
100
|
+
// Dark mode - lighter gray for better contrast
|
|
101
|
+
"dark:text-[rgb(243,243,243)] dark:hover:bg-[#303030]",
|
|
102
|
+
// Shape and sizing
|
|
103
|
+
"h-8 w-8",
|
|
104
|
+
// Interactions
|
|
105
|
+
"transition-colors",
|
|
106
|
+
// Hover states
|
|
107
|
+
"hover:text-[rgb(93,93,93)]",
|
|
108
|
+
"dark:hover:text-[rgb(243,243,243)]"
|
|
109
|
+
],
|
|
110
|
+
chatInputToolbarPrimary: [
|
|
111
|
+
"cursor-pointer",
|
|
112
|
+
// Background and text
|
|
113
|
+
"bg-black text-white",
|
|
114
|
+
// Dark mode
|
|
115
|
+
"dark:bg-white dark:text-black dark:focus-visible:outline-white",
|
|
116
|
+
// Shape and sizing
|
|
117
|
+
"rounded-full",
|
|
118
|
+
// Interactions
|
|
119
|
+
"transition-colors",
|
|
120
|
+
// Focus states
|
|
121
|
+
"focus:outline-none",
|
|
122
|
+
// Hover states
|
|
123
|
+
"hover:opacity-70 disabled:hover:opacity-100",
|
|
124
|
+
// Disabled states
|
|
125
|
+
"disabled:cursor-not-allowed disabled:bg-[#00000014] disabled:text-[rgb(13,13,13)]",
|
|
126
|
+
"dark:disabled:bg-[#454545] dark:disabled:text-white "
|
|
127
|
+
],
|
|
128
|
+
chatInputToolbarSecondary: [
|
|
129
|
+
"cursor-pointer",
|
|
130
|
+
// Background and text
|
|
131
|
+
"bg-transparent text-[#444444]",
|
|
132
|
+
// Dark mode
|
|
133
|
+
"dark:text-white dark:border-[#404040]",
|
|
134
|
+
// Shape and sizing
|
|
135
|
+
"rounded-full",
|
|
136
|
+
// Interactions
|
|
137
|
+
"transition-colors",
|
|
138
|
+
// Focus states
|
|
139
|
+
"focus:outline-none",
|
|
140
|
+
// Hover states
|
|
141
|
+
"hover:bg-[#f8f8f8] hover:text-[#333333]",
|
|
142
|
+
"dark:hover:bg-[#404040] dark:hover:text-[#FFFFFF]",
|
|
143
|
+
// Disabled states
|
|
144
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
145
|
+
"disabled:hover:bg-transparent disabled:hover:text-[#444444]",
|
|
146
|
+
"dark:disabled:hover:bg-transparent dark:disabled:hover:text-[#CCCCCC]"
|
|
147
|
+
]
|
|
148
|
+
},
|
|
149
|
+
size: {
|
|
150
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
151
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
152
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
153
|
+
icon: "size-9",
|
|
154
|
+
chatInputToolbarIcon: [
|
|
155
|
+
// Shape and sizing
|
|
156
|
+
"h-9 w-9 rounded-full"
|
|
157
|
+
],
|
|
158
|
+
chatInputToolbarIconLabel: [
|
|
159
|
+
// Shape and sizing
|
|
160
|
+
"h-9 px-3 rounded-full",
|
|
161
|
+
// Layout
|
|
162
|
+
"gap-2",
|
|
163
|
+
// Typography
|
|
164
|
+
"font-normal"
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
defaultVariants: {
|
|
169
|
+
variant: "default",
|
|
170
|
+
size: "default"
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
function Button({
|
|
175
|
+
className,
|
|
176
|
+
variant,
|
|
177
|
+
size,
|
|
178
|
+
asChild = false,
|
|
179
|
+
...props
|
|
180
|
+
}) {
|
|
181
|
+
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
183
|
+
Comp,
|
|
184
|
+
{
|
|
185
|
+
"data-slot": "button",
|
|
186
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
187
|
+
...props
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// src/components/ui/tooltip.tsx
|
|
193
|
+
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
|
|
194
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
195
|
+
function TooltipProvider({
|
|
196
|
+
delayDuration = 0,
|
|
197
|
+
...props
|
|
198
|
+
}) {
|
|
199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
200
|
+
TooltipPrimitive.Provider,
|
|
201
|
+
{
|
|
202
|
+
"data-slot": "tooltip-provider",
|
|
203
|
+
delayDuration,
|
|
204
|
+
...props
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
function Tooltip({
|
|
209
|
+
...props
|
|
210
|
+
}) {
|
|
211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
|
|
212
|
+
}
|
|
213
|
+
function TooltipTrigger({
|
|
214
|
+
...props
|
|
215
|
+
}) {
|
|
216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
217
|
+
}
|
|
218
|
+
function TooltipContent({
|
|
219
|
+
className,
|
|
220
|
+
sideOffset = 0,
|
|
221
|
+
children,
|
|
222
|
+
...props
|
|
223
|
+
}) {
|
|
224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
225
|
+
TooltipPrimitive.Content,
|
|
226
|
+
{
|
|
227
|
+
"data-slot": "tooltip-content",
|
|
228
|
+
sideOffset,
|
|
229
|
+
className: cn(
|
|
230
|
+
"bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
|
|
231
|
+
className
|
|
232
|
+
),
|
|
233
|
+
...props,
|
|
234
|
+
children: [
|
|
235
|
+
children,
|
|
236
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipPrimitive.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
) });
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// src/components/ui/dropdown-menu.tsx
|
|
243
|
+
var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
244
|
+
var import_lucide_react = require("lucide-react");
|
|
245
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
246
|
+
function DropdownMenu({
|
|
247
|
+
...props
|
|
248
|
+
}) {
|
|
249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
|
|
250
|
+
}
|
|
251
|
+
function DropdownMenuTrigger({
|
|
252
|
+
...props
|
|
253
|
+
}) {
|
|
254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
255
|
+
DropdownMenuPrimitive.Trigger,
|
|
256
|
+
{
|
|
257
|
+
"data-slot": "dropdown-menu-trigger",
|
|
258
|
+
...props
|
|
259
|
+
}
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
function DropdownMenuContent({
|
|
263
|
+
className,
|
|
264
|
+
sideOffset = 4,
|
|
265
|
+
...props
|
|
266
|
+
}) {
|
|
267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
268
|
+
DropdownMenuPrimitive.Content,
|
|
269
|
+
{
|
|
270
|
+
"data-slot": "dropdown-menu-content",
|
|
271
|
+
sideOffset,
|
|
272
|
+
className: cn(
|
|
273
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
|
|
274
|
+
className
|
|
275
|
+
),
|
|
276
|
+
...props
|
|
277
|
+
}
|
|
278
|
+
) });
|
|
279
|
+
}
|
|
280
|
+
function DropdownMenuItem({
|
|
281
|
+
className,
|
|
282
|
+
inset,
|
|
283
|
+
variant = "default",
|
|
284
|
+
...props
|
|
285
|
+
}) {
|
|
286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
287
|
+
DropdownMenuPrimitive.Item,
|
|
288
|
+
{
|
|
289
|
+
"data-slot": "dropdown-menu-item",
|
|
290
|
+
"data-inset": inset,
|
|
291
|
+
"data-variant": variant,
|
|
292
|
+
className: cn(
|
|
293
|
+
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
294
|
+
className
|
|
295
|
+
),
|
|
296
|
+
...props
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
function DropdownMenuSeparator({
|
|
301
|
+
className,
|
|
302
|
+
...props
|
|
303
|
+
}) {
|
|
304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
305
|
+
DropdownMenuPrimitive.Separator,
|
|
306
|
+
{
|
|
307
|
+
"data-slot": "dropdown-menu-separator",
|
|
308
|
+
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
309
|
+
...props
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
function DropdownMenuSub({
|
|
314
|
+
...props
|
|
315
|
+
}) {
|
|
316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DropdownMenuPrimitive.Sub, { "data-slot": "dropdown-menu-sub", ...props });
|
|
317
|
+
}
|
|
318
|
+
function DropdownMenuSubTrigger({
|
|
319
|
+
className,
|
|
320
|
+
inset,
|
|
321
|
+
children,
|
|
322
|
+
...props
|
|
323
|
+
}) {
|
|
324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
325
|
+
DropdownMenuPrimitive.SubTrigger,
|
|
326
|
+
{
|
|
327
|
+
"data-slot": "dropdown-menu-sub-trigger",
|
|
328
|
+
"data-inset": inset,
|
|
329
|
+
className: cn(
|
|
330
|
+
"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",
|
|
331
|
+
className
|
|
332
|
+
),
|
|
333
|
+
...props,
|
|
334
|
+
children: [
|
|
335
|
+
children,
|
|
336
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.ChevronRightIcon, { className: "ml-auto size-4" })
|
|
337
|
+
]
|
|
338
|
+
}
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
function DropdownMenuSubContent({
|
|
342
|
+
className,
|
|
343
|
+
...props
|
|
344
|
+
}) {
|
|
345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
346
|
+
DropdownMenuPrimitive.SubContent,
|
|
347
|
+
{
|
|
348
|
+
"data-slot": "dropdown-menu-sub-content",
|
|
349
|
+
className: cn(
|
|
350
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
|
|
351
|
+
className
|
|
352
|
+
),
|
|
353
|
+
...props
|
|
354
|
+
}
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// src/components/chat/CopilotChatAudioRecorder.tsx
|
|
359
|
+
var import_react2 = require("react");
|
|
360
|
+
var import_tailwind_merge2 = require("tailwind-merge");
|
|
361
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
362
|
+
var CopilotChatAudioRecorder = (0, import_react2.forwardRef)((props, ref) => {
|
|
363
|
+
const { className, ...divProps } = props;
|
|
364
|
+
const canvasRef = (0, import_react2.useRef)(null);
|
|
365
|
+
const getLoudness = (n) => {
|
|
366
|
+
const elapsed = Date.now() / 1e3;
|
|
367
|
+
const samples = [];
|
|
368
|
+
for (let i = 0; i < n; i++) {
|
|
369
|
+
const position = i / n * 10 + elapsed * 0.5;
|
|
370
|
+
const wave1 = Math.sin(position * 2) * 0.3;
|
|
371
|
+
const wave2 = Math.sin(position * 5 + elapsed) * 0.2;
|
|
372
|
+
const wave3 = Math.sin(position * 0.5 + elapsed * 0.3) * 0.4;
|
|
373
|
+
const noise = (Math.random() - 0.5) * 0.1;
|
|
374
|
+
const envelope = Math.sin(elapsed * 0.7) * 0.5 + 0.5;
|
|
375
|
+
let amplitude = (wave1 + wave2 + wave3 + noise) * envelope;
|
|
376
|
+
amplitude = Math.max(0, Math.min(1, amplitude * 0.5 + 0.3));
|
|
377
|
+
samples.push(amplitude);
|
|
378
|
+
}
|
|
379
|
+
return samples;
|
|
380
|
+
};
|
|
381
|
+
(0, import_react2.useEffect)(() => {
|
|
382
|
+
const canvas = canvasRef.current;
|
|
383
|
+
if (!canvas) return;
|
|
384
|
+
const ctx = canvas.getContext("2d");
|
|
385
|
+
if (!ctx) return;
|
|
386
|
+
let animationId;
|
|
387
|
+
const draw = () => {
|
|
388
|
+
const rect = canvas.getBoundingClientRect();
|
|
389
|
+
const dpr = window.devicePixelRatio || 1;
|
|
390
|
+
if (canvas.width !== rect.width * dpr || canvas.height !== rect.height * dpr) {
|
|
391
|
+
canvas.width = rect.width * dpr;
|
|
392
|
+
canvas.height = rect.height * dpr;
|
|
393
|
+
ctx.scale(dpr, dpr);
|
|
394
|
+
ctx.imageSmoothingEnabled = false;
|
|
395
|
+
}
|
|
396
|
+
const barWidth = 2;
|
|
397
|
+
const minHeight = 2;
|
|
398
|
+
const maxHeight = 20;
|
|
399
|
+
const gap = 2;
|
|
400
|
+
const numSamples = Math.ceil(rect.width / (barWidth + gap));
|
|
401
|
+
const loudnessData = getLoudness(numSamples);
|
|
402
|
+
ctx.clearRect(0, 0, rect.width, rect.height);
|
|
403
|
+
const computedStyle = getComputedStyle(canvas);
|
|
404
|
+
const currentForeground = computedStyle.color;
|
|
405
|
+
ctx.fillStyle = currentForeground;
|
|
406
|
+
const centerY = rect.height / 2;
|
|
407
|
+
for (let i = 0; i < loudnessData.length; i++) {
|
|
408
|
+
const sample = loudnessData[i] ?? 0;
|
|
409
|
+
const barHeight = Math.round(
|
|
410
|
+
sample * (maxHeight - minHeight) + minHeight
|
|
411
|
+
);
|
|
412
|
+
const x = Math.round(i * (barWidth + gap));
|
|
413
|
+
const y = Math.round(centerY - barHeight / 2);
|
|
414
|
+
ctx.fillRect(x, y, barWidth, barHeight);
|
|
415
|
+
}
|
|
416
|
+
animationId = requestAnimationFrame(draw);
|
|
417
|
+
};
|
|
418
|
+
draw();
|
|
419
|
+
return () => {
|
|
420
|
+
if (animationId) {
|
|
421
|
+
cancelAnimationFrame(animationId);
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
}, []);
|
|
425
|
+
(0, import_react2.useImperativeHandle)(
|
|
426
|
+
ref,
|
|
427
|
+
() => ({
|
|
428
|
+
get state() {
|
|
429
|
+
return "idle";
|
|
430
|
+
},
|
|
431
|
+
start: async () => {
|
|
432
|
+
},
|
|
433
|
+
stop: () => new Promise((resolve) => {
|
|
434
|
+
const emptyBlob = new Blob([], { type: "audio/webm" });
|
|
435
|
+
resolve(emptyBlob);
|
|
436
|
+
}),
|
|
437
|
+
dispose: () => {
|
|
438
|
+
}
|
|
439
|
+
}),
|
|
440
|
+
[]
|
|
441
|
+
);
|
|
442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: (0, import_tailwind_merge2.twMerge)("h-[44px] w-full px-5", className), ...divProps, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
443
|
+
"canvas",
|
|
444
|
+
{
|
|
445
|
+
ref: canvasRef,
|
|
446
|
+
className: "w-full h-full",
|
|
447
|
+
style: { imageRendering: "pixelated" }
|
|
448
|
+
}
|
|
449
|
+
) });
|
|
450
|
+
});
|
|
451
|
+
CopilotChatAudioRecorder.displayName = "WebAudioRecorder";
|
|
452
|
+
|
|
453
|
+
// src/lib/slots.tsx
|
|
454
|
+
var import_react3 = __toESM(require("react"));
|
|
455
|
+
function renderSlot(slot, DefaultComponent, props) {
|
|
456
|
+
if (typeof slot === "string") {
|
|
457
|
+
return import_react3.default.createElement(DefaultComponent, {
|
|
458
|
+
...props,
|
|
459
|
+
className: slot
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
if (typeof slot === "function") {
|
|
463
|
+
const Comp = slot;
|
|
464
|
+
return import_react3.default.createElement(Comp, props);
|
|
465
|
+
}
|
|
466
|
+
if (slot && typeof slot === "object" && !import_react3.default.isValidElement(slot)) {
|
|
467
|
+
return import_react3.default.createElement(DefaultComponent, {
|
|
468
|
+
...props,
|
|
469
|
+
...slot
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
return import_react3.default.createElement(DefaultComponent, props);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// src/components/chat/CopilotChatInput.tsx
|
|
476
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
477
|
+
var SLASH_MENU_MAX_VISIBLE_ITEMS = 5;
|
|
478
|
+
var SLASH_MENU_ITEM_HEIGHT_PX = 40;
|
|
479
|
+
function CopilotChatInput({
|
|
480
|
+
mode = "input",
|
|
481
|
+
onSubmitMessage,
|
|
482
|
+
onStop,
|
|
483
|
+
isRunning = false,
|
|
484
|
+
onStartTranscribe,
|
|
485
|
+
onCancelTranscribe,
|
|
486
|
+
onFinishTranscribe,
|
|
487
|
+
onAddFile,
|
|
488
|
+
onChange,
|
|
489
|
+
value,
|
|
490
|
+
toolsMenu,
|
|
491
|
+
autoFocus = true,
|
|
492
|
+
textArea,
|
|
493
|
+
sendButton,
|
|
494
|
+
startTranscribeButton,
|
|
495
|
+
cancelTranscribeButton,
|
|
496
|
+
finishTranscribeButton,
|
|
497
|
+
addMenuButton,
|
|
498
|
+
audioRecorder,
|
|
499
|
+
children,
|
|
500
|
+
className,
|
|
501
|
+
...props
|
|
502
|
+
}) {
|
|
503
|
+
const isControlled = value !== void 0;
|
|
504
|
+
const [internalValue, setInternalValue] = (0, import_react4.useState)(() => value ?? "");
|
|
505
|
+
(0, import_react4.useEffect)(() => {
|
|
506
|
+
if (!isControlled && value !== void 0) {
|
|
507
|
+
setInternalValue(value);
|
|
508
|
+
}
|
|
509
|
+
}, [isControlled, value]);
|
|
510
|
+
const resolvedValue = isControlled ? value ?? "" : internalValue;
|
|
511
|
+
const [layout, setLayout] = (0, import_react4.useState)("compact");
|
|
512
|
+
const ignoreResizeRef = (0, import_react4.useRef)(false);
|
|
513
|
+
const resizeEvaluationRafRef = (0, import_react4.useRef)(null);
|
|
514
|
+
const isExpanded = mode === "input" && layout === "expanded";
|
|
515
|
+
const [commandQuery, setCommandQuery] = (0, import_react4.useState)(null);
|
|
516
|
+
const [slashHighlightIndex, setSlashHighlightIndex] = (0, import_react4.useState)(0);
|
|
517
|
+
const inputRef = (0, import_react4.useRef)(null);
|
|
518
|
+
const gridRef = (0, import_react4.useRef)(null);
|
|
519
|
+
const addButtonContainerRef = (0, import_react4.useRef)(null);
|
|
520
|
+
const actionsContainerRef = (0, import_react4.useRef)(null);
|
|
521
|
+
const audioRecorderRef = (0, import_react4.useRef)(null);
|
|
522
|
+
const slashMenuRef = (0, import_react4.useRef)(null);
|
|
523
|
+
const config = useCopilotChatConfiguration();
|
|
524
|
+
const labels = config?.labels ?? CopilotChatDefaultLabels;
|
|
525
|
+
const previousModalStateRef = (0, import_react4.useRef)(void 0);
|
|
526
|
+
const measurementCanvasRef = (0, import_react4.useRef)(null);
|
|
527
|
+
const measurementsRef = (0, import_react4.useRef)({
|
|
528
|
+
singleLineHeight: 0,
|
|
529
|
+
maxHeight: 0,
|
|
530
|
+
paddingLeft: 0,
|
|
531
|
+
paddingRight: 0
|
|
532
|
+
});
|
|
533
|
+
const commandItems = (0, import_react4.useMemo)(() => {
|
|
534
|
+
const entries = [];
|
|
535
|
+
const seen = /* @__PURE__ */ new Set();
|
|
536
|
+
const pushItem = (item) => {
|
|
537
|
+
if (item === "-") {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
if (item.items && item.items.length > 0) {
|
|
541
|
+
for (const nested of item.items) {
|
|
542
|
+
pushItem(nested);
|
|
543
|
+
}
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
if (!seen.has(item.label)) {
|
|
547
|
+
seen.add(item.label);
|
|
548
|
+
entries.push(item);
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
if (onAddFile) {
|
|
552
|
+
pushItem({
|
|
553
|
+
label: labels.chatInputToolbarAddButtonLabel,
|
|
554
|
+
action: onAddFile
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
if (toolsMenu && toolsMenu.length > 0) {
|
|
558
|
+
for (const item of toolsMenu) {
|
|
559
|
+
pushItem(item);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
return entries;
|
|
563
|
+
}, [labels.chatInputToolbarAddButtonLabel, onAddFile, toolsMenu]);
|
|
564
|
+
const filteredCommands = (0, import_react4.useMemo)(() => {
|
|
565
|
+
if (commandQuery === null) {
|
|
566
|
+
return [];
|
|
567
|
+
}
|
|
568
|
+
if (commandItems.length === 0) {
|
|
569
|
+
return [];
|
|
570
|
+
}
|
|
571
|
+
const query = commandQuery.trim().toLowerCase();
|
|
572
|
+
if (query.length === 0) {
|
|
573
|
+
return commandItems;
|
|
574
|
+
}
|
|
575
|
+
const startsWith = [];
|
|
576
|
+
const contains = [];
|
|
577
|
+
for (const item of commandItems) {
|
|
578
|
+
const label = item.label.toLowerCase();
|
|
579
|
+
if (label.startsWith(query)) {
|
|
580
|
+
startsWith.push(item);
|
|
581
|
+
} else if (label.includes(query)) {
|
|
582
|
+
contains.push(item);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
return [...startsWith, ...contains];
|
|
586
|
+
}, [commandItems, commandQuery]);
|
|
587
|
+
(0, import_react4.useEffect)(() => {
|
|
588
|
+
if (!autoFocus) {
|
|
589
|
+
previousModalStateRef.current = config?.isModalOpen;
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
if (config?.isModalOpen && !previousModalStateRef.current) {
|
|
593
|
+
inputRef.current?.focus();
|
|
594
|
+
}
|
|
595
|
+
previousModalStateRef.current = config?.isModalOpen;
|
|
596
|
+
}, [config?.isModalOpen, autoFocus]);
|
|
597
|
+
(0, import_react4.useEffect)(() => {
|
|
598
|
+
if (commandItems.length === 0 && commandQuery !== null) {
|
|
599
|
+
setCommandQuery(null);
|
|
600
|
+
}
|
|
601
|
+
}, [commandItems.length, commandQuery]);
|
|
602
|
+
const previousCommandQueryRef = (0, import_react4.useRef)(null);
|
|
603
|
+
(0, import_react4.useEffect)(() => {
|
|
604
|
+
if (commandQuery !== null && commandQuery !== previousCommandQueryRef.current && filteredCommands.length > 0) {
|
|
605
|
+
setSlashHighlightIndex(0);
|
|
606
|
+
}
|
|
607
|
+
previousCommandQueryRef.current = commandQuery;
|
|
608
|
+
}, [commandQuery, filteredCommands.length]);
|
|
609
|
+
(0, import_react4.useEffect)(() => {
|
|
610
|
+
if (commandQuery === null) {
|
|
611
|
+
setSlashHighlightIndex(0);
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
if (filteredCommands.length === 0) {
|
|
615
|
+
setSlashHighlightIndex(-1);
|
|
616
|
+
} else if (slashHighlightIndex < 0 || slashHighlightIndex >= filteredCommands.length) {
|
|
617
|
+
setSlashHighlightIndex(0);
|
|
618
|
+
}
|
|
619
|
+
}, [commandQuery, filteredCommands, slashHighlightIndex]);
|
|
620
|
+
(0, import_react4.useEffect)(() => {
|
|
621
|
+
const recorder = audioRecorderRef.current;
|
|
622
|
+
if (!recorder) {
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
if (mode === "transcribe") {
|
|
626
|
+
recorder.start().catch(console.error);
|
|
627
|
+
} else {
|
|
628
|
+
if (recorder.state === "recording") {
|
|
629
|
+
recorder.stop().catch(console.error);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}, [mode]);
|
|
633
|
+
(0, import_react4.useEffect)(() => {
|
|
634
|
+
if (mode !== "input") {
|
|
635
|
+
setLayout("compact");
|
|
636
|
+
setCommandQuery(null);
|
|
637
|
+
}
|
|
638
|
+
}, [mode]);
|
|
639
|
+
const updateSlashState = (0, import_react4.useCallback)(
|
|
640
|
+
(value2) => {
|
|
641
|
+
if (commandItems.length === 0) {
|
|
642
|
+
setCommandQuery((prev) => prev === null ? prev : null);
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
if (value2.startsWith("/")) {
|
|
646
|
+
const firstLine = value2.split(/\r?\n/, 1)[0] ?? "";
|
|
647
|
+
const query = firstLine.slice(1);
|
|
648
|
+
setCommandQuery((prev) => prev === query ? prev : query);
|
|
649
|
+
} else {
|
|
650
|
+
setCommandQuery((prev) => prev === null ? prev : null);
|
|
651
|
+
}
|
|
652
|
+
},
|
|
653
|
+
[commandItems.length]
|
|
654
|
+
);
|
|
655
|
+
(0, import_react4.useEffect)(() => {
|
|
656
|
+
updateSlashState(resolvedValue);
|
|
657
|
+
}, [resolvedValue, updateSlashState]);
|
|
658
|
+
const handleChange = (e) => {
|
|
659
|
+
const nextValue = e.target.value;
|
|
660
|
+
if (!isControlled) {
|
|
661
|
+
setInternalValue(nextValue);
|
|
662
|
+
}
|
|
663
|
+
onChange?.(nextValue);
|
|
664
|
+
updateSlashState(nextValue);
|
|
665
|
+
};
|
|
666
|
+
const clearInputValue = (0, import_react4.useCallback)(() => {
|
|
667
|
+
if (!isControlled) {
|
|
668
|
+
setInternalValue("");
|
|
669
|
+
}
|
|
670
|
+
if (onChange) {
|
|
671
|
+
onChange("");
|
|
672
|
+
}
|
|
673
|
+
}, [isControlled, onChange]);
|
|
674
|
+
const runCommand = (0, import_react4.useCallback)(
|
|
675
|
+
(item) => {
|
|
676
|
+
clearInputValue();
|
|
677
|
+
item.action?.();
|
|
678
|
+
setCommandQuery(null);
|
|
679
|
+
setSlashHighlightIndex(0);
|
|
680
|
+
requestAnimationFrame(() => {
|
|
681
|
+
inputRef.current?.focus();
|
|
682
|
+
});
|
|
683
|
+
},
|
|
684
|
+
[clearInputValue]
|
|
685
|
+
);
|
|
686
|
+
const handleKeyDown = (e) => {
|
|
687
|
+
if (commandQuery !== null && mode === "input") {
|
|
688
|
+
if (e.key === "ArrowDown") {
|
|
689
|
+
if (filteredCommands.length > 0) {
|
|
690
|
+
e.preventDefault();
|
|
691
|
+
setSlashHighlightIndex((prev) => {
|
|
692
|
+
if (filteredCommands.length === 0) {
|
|
693
|
+
return prev;
|
|
694
|
+
}
|
|
695
|
+
const next = prev === -1 ? 0 : (prev + 1) % filteredCommands.length;
|
|
696
|
+
return next;
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
if (e.key === "ArrowUp") {
|
|
702
|
+
if (filteredCommands.length > 0) {
|
|
703
|
+
e.preventDefault();
|
|
704
|
+
setSlashHighlightIndex((prev) => {
|
|
705
|
+
if (filteredCommands.length === 0) {
|
|
706
|
+
return prev;
|
|
707
|
+
}
|
|
708
|
+
if (prev === -1) {
|
|
709
|
+
return filteredCommands.length - 1;
|
|
710
|
+
}
|
|
711
|
+
return prev <= 0 ? filteredCommands.length - 1 : prev - 1;
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
if (e.key === "Enter") {
|
|
717
|
+
const selected = slashHighlightIndex >= 0 ? filteredCommands[slashHighlightIndex] : void 0;
|
|
718
|
+
if (selected) {
|
|
719
|
+
e.preventDefault();
|
|
720
|
+
runCommand(selected);
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
if (e.key === "Escape") {
|
|
725
|
+
e.preventDefault();
|
|
726
|
+
setCommandQuery(null);
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
731
|
+
e.preventDefault();
|
|
732
|
+
if (isProcessing) {
|
|
733
|
+
onStop?.();
|
|
734
|
+
} else {
|
|
735
|
+
send();
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
const send = () => {
|
|
740
|
+
if (!onSubmitMessage) {
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
const trimmed = resolvedValue.trim();
|
|
744
|
+
if (!trimmed) {
|
|
745
|
+
return;
|
|
746
|
+
}
|
|
747
|
+
onSubmitMessage(trimmed);
|
|
748
|
+
if (!isControlled) {
|
|
749
|
+
setInternalValue("");
|
|
750
|
+
onChange?.("");
|
|
751
|
+
}
|
|
752
|
+
if (inputRef.current) {
|
|
753
|
+
inputRef.current.focus();
|
|
754
|
+
}
|
|
755
|
+
};
|
|
756
|
+
const BoundTextArea = renderSlot(textArea, CopilotChatInput.TextArea, {
|
|
757
|
+
ref: inputRef,
|
|
758
|
+
value: resolvedValue,
|
|
759
|
+
onChange: handleChange,
|
|
760
|
+
onKeyDown: handleKeyDown,
|
|
761
|
+
autoFocus,
|
|
762
|
+
className: (0, import_tailwind_merge3.twMerge)(
|
|
763
|
+
"w-full py-3",
|
|
764
|
+
isExpanded ? "px-5" : "pr-5"
|
|
765
|
+
)
|
|
766
|
+
});
|
|
767
|
+
const isProcessing = mode !== "transcribe" && isRunning;
|
|
768
|
+
const canSend = resolvedValue.trim().length > 0 && !!onSubmitMessage;
|
|
769
|
+
const canStop = !!onStop;
|
|
770
|
+
const handleSendButtonClick = () => {
|
|
771
|
+
if (isProcessing) {
|
|
772
|
+
onStop?.();
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
send();
|
|
776
|
+
};
|
|
777
|
+
const BoundAudioRecorder = renderSlot(audioRecorder, CopilotChatAudioRecorder, {
|
|
778
|
+
ref: audioRecorderRef
|
|
779
|
+
});
|
|
780
|
+
const BoundSendButton = renderSlot(sendButton, CopilotChatInput.SendButton, {
|
|
781
|
+
onClick: handleSendButtonClick,
|
|
782
|
+
disabled: isProcessing ? !canStop : !canSend,
|
|
783
|
+
children: isProcessing && canStop ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Square, { className: "size-[18px] fill-current" }) : void 0
|
|
784
|
+
});
|
|
785
|
+
const BoundStartTranscribeButton = renderSlot(startTranscribeButton, CopilotChatInput.StartTranscribeButton, {
|
|
786
|
+
onClick: onStartTranscribe
|
|
787
|
+
});
|
|
788
|
+
const BoundCancelTranscribeButton = renderSlot(cancelTranscribeButton, CopilotChatInput.CancelTranscribeButton, {
|
|
789
|
+
onClick: onCancelTranscribe
|
|
790
|
+
});
|
|
791
|
+
const BoundFinishTranscribeButton = renderSlot(finishTranscribeButton, CopilotChatInput.FinishTranscribeButton, {
|
|
792
|
+
onClick: onFinishTranscribe
|
|
793
|
+
});
|
|
794
|
+
const BoundAddMenuButton = renderSlot(addMenuButton, CopilotChatInput.AddMenuButton, {
|
|
795
|
+
disabled: mode === "transcribe",
|
|
796
|
+
onAddFile,
|
|
797
|
+
toolsMenu
|
|
798
|
+
});
|
|
799
|
+
if (children) {
|
|
800
|
+
const childProps = {
|
|
801
|
+
textArea: BoundTextArea,
|
|
802
|
+
audioRecorder: BoundAudioRecorder,
|
|
803
|
+
sendButton: BoundSendButton,
|
|
804
|
+
startTranscribeButton: BoundStartTranscribeButton,
|
|
805
|
+
cancelTranscribeButton: BoundCancelTranscribeButton,
|
|
806
|
+
finishTranscribeButton: BoundFinishTranscribeButton,
|
|
807
|
+
addMenuButton: BoundAddMenuButton,
|
|
808
|
+
onSubmitMessage,
|
|
809
|
+
onStop,
|
|
810
|
+
isRunning,
|
|
811
|
+
onStartTranscribe,
|
|
812
|
+
onCancelTranscribe,
|
|
813
|
+
onFinishTranscribe,
|
|
814
|
+
onAddFile,
|
|
815
|
+
mode,
|
|
816
|
+
toolsMenu,
|
|
817
|
+
autoFocus
|
|
818
|
+
};
|
|
819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: children(childProps) });
|
|
820
|
+
}
|
|
821
|
+
const handleContainerClick = (e) => {
|
|
822
|
+
const target = e.target;
|
|
823
|
+
if (target.tagName !== "BUTTON" && !target.closest("button") && inputRef.current && mode === "input") {
|
|
824
|
+
inputRef.current.focus();
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
const ensureMeasurements = (0, import_react4.useCallback)(() => {
|
|
828
|
+
const textarea = inputRef.current;
|
|
829
|
+
if (!textarea) {
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
832
|
+
const previousValue = textarea.value;
|
|
833
|
+
const previousHeight = textarea.style.height;
|
|
834
|
+
textarea.style.height = "auto";
|
|
835
|
+
const computedStyle = window.getComputedStyle(textarea);
|
|
836
|
+
const paddingLeft = parseFloat(computedStyle.paddingLeft) || 0;
|
|
837
|
+
const paddingRight = parseFloat(computedStyle.paddingRight) || 0;
|
|
838
|
+
const paddingTop = parseFloat(computedStyle.paddingTop) || 0;
|
|
839
|
+
const paddingBottom = parseFloat(computedStyle.paddingBottom) || 0;
|
|
840
|
+
textarea.value = "";
|
|
841
|
+
const singleLineHeight = textarea.scrollHeight;
|
|
842
|
+
textarea.value = previousValue;
|
|
843
|
+
const contentHeight = singleLineHeight - paddingTop - paddingBottom;
|
|
844
|
+
const maxHeight = contentHeight * 5 + paddingTop + paddingBottom;
|
|
845
|
+
measurementsRef.current = {
|
|
846
|
+
singleLineHeight,
|
|
847
|
+
maxHeight,
|
|
848
|
+
paddingLeft,
|
|
849
|
+
paddingRight
|
|
850
|
+
};
|
|
851
|
+
textarea.style.height = previousHeight;
|
|
852
|
+
textarea.style.maxHeight = `${maxHeight}px`;
|
|
853
|
+
}, []);
|
|
854
|
+
const adjustTextareaHeight = (0, import_react4.useCallback)(() => {
|
|
855
|
+
const textarea = inputRef.current;
|
|
856
|
+
if (!textarea) {
|
|
857
|
+
return 0;
|
|
858
|
+
}
|
|
859
|
+
if (measurementsRef.current.singleLineHeight === 0) {
|
|
860
|
+
ensureMeasurements();
|
|
861
|
+
}
|
|
862
|
+
const { maxHeight } = measurementsRef.current;
|
|
863
|
+
if (maxHeight) {
|
|
864
|
+
textarea.style.maxHeight = `${maxHeight}px`;
|
|
865
|
+
}
|
|
866
|
+
textarea.style.height = "auto";
|
|
867
|
+
const scrollHeight = textarea.scrollHeight;
|
|
868
|
+
if (maxHeight) {
|
|
869
|
+
textarea.style.height = `${Math.min(scrollHeight, maxHeight)}px`;
|
|
870
|
+
} else {
|
|
871
|
+
textarea.style.height = `${scrollHeight}px`;
|
|
872
|
+
}
|
|
873
|
+
return scrollHeight;
|
|
874
|
+
}, [ensureMeasurements]);
|
|
875
|
+
const updateLayout = (0, import_react4.useCallback)((nextLayout) => {
|
|
876
|
+
setLayout((prev) => {
|
|
877
|
+
if (prev === nextLayout) {
|
|
878
|
+
return prev;
|
|
879
|
+
}
|
|
880
|
+
ignoreResizeRef.current = true;
|
|
881
|
+
return nextLayout;
|
|
882
|
+
});
|
|
883
|
+
}, []);
|
|
884
|
+
const evaluateLayout = (0, import_react4.useCallback)(() => {
|
|
885
|
+
if (mode !== "input") {
|
|
886
|
+
updateLayout("compact");
|
|
887
|
+
return;
|
|
888
|
+
}
|
|
889
|
+
if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
|
|
890
|
+
const isMobileViewport = window.matchMedia("(max-width: 767px)").matches;
|
|
891
|
+
if (isMobileViewport) {
|
|
892
|
+
ensureMeasurements();
|
|
893
|
+
adjustTextareaHeight();
|
|
894
|
+
updateLayout("expanded");
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
const textarea = inputRef.current;
|
|
899
|
+
const grid = gridRef.current;
|
|
900
|
+
const addContainer = addButtonContainerRef.current;
|
|
901
|
+
const actionsContainer = actionsContainerRef.current;
|
|
902
|
+
if (!textarea || !grid || !addContainer || !actionsContainer) {
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
905
|
+
if (measurementsRef.current.singleLineHeight === 0) {
|
|
906
|
+
ensureMeasurements();
|
|
907
|
+
}
|
|
908
|
+
const scrollHeight = adjustTextareaHeight();
|
|
909
|
+
const baseline = measurementsRef.current.singleLineHeight;
|
|
910
|
+
const hasExplicitBreak = resolvedValue.includes("\n");
|
|
911
|
+
const renderedMultiline = baseline > 0 ? scrollHeight > baseline + 1 : false;
|
|
912
|
+
let shouldExpand = hasExplicitBreak || renderedMultiline;
|
|
913
|
+
if (!shouldExpand) {
|
|
914
|
+
const gridStyles = window.getComputedStyle(grid);
|
|
915
|
+
const paddingLeft = parseFloat(gridStyles.paddingLeft) || 0;
|
|
916
|
+
const paddingRight = parseFloat(gridStyles.paddingRight) || 0;
|
|
917
|
+
const columnGap = parseFloat(gridStyles.columnGap) || 0;
|
|
918
|
+
const gridAvailableWidth = grid.clientWidth - paddingLeft - paddingRight;
|
|
919
|
+
if (gridAvailableWidth > 0) {
|
|
920
|
+
const addWidth = addContainer.getBoundingClientRect().width;
|
|
921
|
+
const actionsWidth = actionsContainer.getBoundingClientRect().width;
|
|
922
|
+
const compactWidth = Math.max(gridAvailableWidth - addWidth - actionsWidth - columnGap * 2, 0);
|
|
923
|
+
const canvas = measurementCanvasRef.current ?? document.createElement("canvas");
|
|
924
|
+
if (!measurementCanvasRef.current) {
|
|
925
|
+
measurementCanvasRef.current = canvas;
|
|
926
|
+
}
|
|
927
|
+
const context = canvas.getContext("2d");
|
|
928
|
+
if (context) {
|
|
929
|
+
const textareaStyles = window.getComputedStyle(textarea);
|
|
930
|
+
const font = textareaStyles.font || `${textareaStyles.fontStyle} ${textareaStyles.fontVariant} ${textareaStyles.fontWeight} ${textareaStyles.fontSize}/${textareaStyles.lineHeight} ${textareaStyles.fontFamily}`;
|
|
931
|
+
context.font = font;
|
|
932
|
+
const compactInnerWidth = Math.max(
|
|
933
|
+
compactWidth - (measurementsRef.current.paddingLeft || 0) - (measurementsRef.current.paddingRight || 0),
|
|
934
|
+
0
|
|
935
|
+
);
|
|
936
|
+
if (compactInnerWidth > 0) {
|
|
937
|
+
const lines = resolvedValue.length > 0 ? resolvedValue.split("\n") : [""];
|
|
938
|
+
let longestWidth = 0;
|
|
939
|
+
for (const line of lines) {
|
|
940
|
+
const metrics = context.measureText(line || " ");
|
|
941
|
+
if (metrics.width > longestWidth) {
|
|
942
|
+
longestWidth = metrics.width;
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
if (longestWidth > compactInnerWidth) {
|
|
946
|
+
shouldExpand = true;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
const nextLayout = shouldExpand ? "expanded" : "compact";
|
|
953
|
+
updateLayout(nextLayout);
|
|
954
|
+
}, [adjustTextareaHeight, ensureMeasurements, mode, resolvedValue, updateLayout]);
|
|
955
|
+
(0, import_react4.useLayoutEffect)(() => {
|
|
956
|
+
evaluateLayout();
|
|
957
|
+
}, [evaluateLayout]);
|
|
958
|
+
(0, import_react4.useEffect)(() => {
|
|
959
|
+
if (typeof ResizeObserver === "undefined") {
|
|
960
|
+
return;
|
|
961
|
+
}
|
|
962
|
+
const textarea = inputRef.current;
|
|
963
|
+
const grid = gridRef.current;
|
|
964
|
+
const addContainer = addButtonContainerRef.current;
|
|
965
|
+
const actionsContainer = actionsContainerRef.current;
|
|
966
|
+
if (!textarea || !grid || !addContainer || !actionsContainer) {
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
const scheduleEvaluation = () => {
|
|
970
|
+
if (ignoreResizeRef.current) {
|
|
971
|
+
ignoreResizeRef.current = false;
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
if (typeof window === "undefined") {
|
|
975
|
+
evaluateLayout();
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
978
|
+
if (resizeEvaluationRafRef.current !== null) {
|
|
979
|
+
cancelAnimationFrame(resizeEvaluationRafRef.current);
|
|
980
|
+
}
|
|
981
|
+
resizeEvaluationRafRef.current = window.requestAnimationFrame(() => {
|
|
982
|
+
resizeEvaluationRafRef.current = null;
|
|
983
|
+
evaluateLayout();
|
|
984
|
+
});
|
|
985
|
+
};
|
|
986
|
+
const observer = new ResizeObserver(() => {
|
|
987
|
+
scheduleEvaluation();
|
|
988
|
+
});
|
|
989
|
+
observer.observe(grid);
|
|
990
|
+
observer.observe(addContainer);
|
|
991
|
+
observer.observe(actionsContainer);
|
|
992
|
+
observer.observe(textarea);
|
|
993
|
+
return () => {
|
|
994
|
+
observer.disconnect();
|
|
995
|
+
if (typeof window !== "undefined" && resizeEvaluationRafRef.current !== null) {
|
|
996
|
+
cancelAnimationFrame(resizeEvaluationRafRef.current);
|
|
997
|
+
resizeEvaluationRafRef.current = null;
|
|
998
|
+
}
|
|
999
|
+
};
|
|
1000
|
+
}, [evaluateLayout]);
|
|
1001
|
+
const slashMenuVisible = commandQuery !== null && commandItems.length > 0;
|
|
1002
|
+
(0, import_react4.useEffect)(() => {
|
|
1003
|
+
if (!slashMenuVisible || slashHighlightIndex < 0) {
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
const active = slashMenuRef.current?.querySelector(
|
|
1007
|
+
`[data-slash-index="${slashHighlightIndex}"]`
|
|
1008
|
+
);
|
|
1009
|
+
active?.scrollIntoView({ block: "nearest" });
|
|
1010
|
+
}, [slashMenuVisible, slashHighlightIndex]);
|
|
1011
|
+
const slashMenu = slashMenuVisible ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1012
|
+
"div",
|
|
1013
|
+
{
|
|
1014
|
+
"data-testid": "copilot-slash-menu",
|
|
1015
|
+
role: "listbox",
|
|
1016
|
+
"aria-label": "Slash commands",
|
|
1017
|
+
ref: slashMenuRef,
|
|
1018
|
+
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]",
|
|
1019
|
+
style: { maxHeight: `${SLASH_MENU_MAX_VISIBLE_ITEMS * SLASH_MENU_ITEM_HEIGHT_PX}px` },
|
|
1020
|
+
children: filteredCommands.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "px-3 py-2 text-sm text-muted-foreground", children: "No commands found" }) : filteredCommands.map((item, index) => {
|
|
1021
|
+
const isActive = index === slashHighlightIndex;
|
|
1022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1023
|
+
"button",
|
|
1024
|
+
{
|
|
1025
|
+
type: "button",
|
|
1026
|
+
role: "option",
|
|
1027
|
+
"aria-selected": isActive,
|
|
1028
|
+
"data-active": isActive ? "true" : void 0,
|
|
1029
|
+
"data-slash-index": index,
|
|
1030
|
+
className: (0, import_tailwind_merge3.twMerge)(
|
|
1031
|
+
"w-full px-3 py-2 text-left text-sm transition-colors",
|
|
1032
|
+
"hover:bg-muted dark:hover:bg-[#2f2f2f]",
|
|
1033
|
+
isActive ? "bg-muted dark:bg-[#2f2f2f]" : "bg-transparent"
|
|
1034
|
+
),
|
|
1035
|
+
onMouseEnter: () => setSlashHighlightIndex(index),
|
|
1036
|
+
onMouseDown: (event) => {
|
|
1037
|
+
event.preventDefault();
|
|
1038
|
+
runCommand(item);
|
|
1039
|
+
},
|
|
1040
|
+
children: item.label
|
|
1041
|
+
},
|
|
1042
|
+
`${item.label}-${index}`
|
|
1043
|
+
);
|
|
1044
|
+
})
|
|
1045
|
+
}
|
|
1046
|
+
) : null;
|
|
1047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1048
|
+
"div",
|
|
1049
|
+
{
|
|
1050
|
+
className: (0, import_tailwind_merge3.twMerge)(
|
|
1051
|
+
// Layout
|
|
1052
|
+
"flex w-full flex-col items-center justify-center",
|
|
1053
|
+
// Interaction
|
|
1054
|
+
"cursor-text",
|
|
1055
|
+
// Overflow and clipping
|
|
1056
|
+
"overflow-visible bg-clip-padding contain-inline-size",
|
|
1057
|
+
// Background
|
|
1058
|
+
"bg-white dark:bg-[#303030]",
|
|
1059
|
+
// Visual effects
|
|
1060
|
+
"shadow-[0_4px_4px_0_#0000000a,0_0_1px_0_#0000009e] rounded-[28px]",
|
|
1061
|
+
className
|
|
1062
|
+
),
|
|
1063
|
+
onClick: handleContainerClick,
|
|
1064
|
+
...props,
|
|
1065
|
+
"data-layout": isExpanded ? "expanded" : "compact",
|
|
1066
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1067
|
+
"div",
|
|
1068
|
+
{
|
|
1069
|
+
ref: gridRef,
|
|
1070
|
+
className: (0, import_tailwind_merge3.twMerge)(
|
|
1071
|
+
"grid w-full gap-x-3 gap-y-3 px-3 py-2",
|
|
1072
|
+
isExpanded ? "grid-cols-[auto_minmax(0,1fr)_auto] grid-rows-[auto_auto]" : "grid-cols-[auto_minmax(0,1fr)_auto] items-center"
|
|
1073
|
+
),
|
|
1074
|
+
"data-layout": isExpanded ? "expanded" : "compact",
|
|
1075
|
+
children: [
|
|
1076
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1077
|
+
"div",
|
|
1078
|
+
{
|
|
1079
|
+
ref: addButtonContainerRef,
|
|
1080
|
+
className: (0, import_tailwind_merge3.twMerge)(
|
|
1081
|
+
"flex items-center",
|
|
1082
|
+
isExpanded ? "row-start-2" : "row-start-1",
|
|
1083
|
+
"col-start-1"
|
|
1084
|
+
),
|
|
1085
|
+
children: BoundAddMenuButton
|
|
1086
|
+
}
|
|
1087
|
+
),
|
|
1088
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1089
|
+
"div",
|
|
1090
|
+
{
|
|
1091
|
+
className: (0, import_tailwind_merge3.twMerge)(
|
|
1092
|
+
"relative flex min-w-0 flex-col",
|
|
1093
|
+
isExpanded ? "col-span-3 row-start-1" : "col-start-2 row-start-1"
|
|
1094
|
+
),
|
|
1095
|
+
children: mode === "transcribe" ? BoundAudioRecorder : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1096
|
+
BoundTextArea,
|
|
1097
|
+
slashMenu
|
|
1098
|
+
] })
|
|
1099
|
+
}
|
|
1100
|
+
),
|
|
1101
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1102
|
+
"div",
|
|
1103
|
+
{
|
|
1104
|
+
ref: actionsContainerRef,
|
|
1105
|
+
className: (0, import_tailwind_merge3.twMerge)(
|
|
1106
|
+
"flex items-center justify-end gap-2",
|
|
1107
|
+
isExpanded ? "col-start-3 row-start-2" : "col-start-3 row-start-1"
|
|
1108
|
+
),
|
|
1109
|
+
children: mode === "transcribe" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1110
|
+
onCancelTranscribe && BoundCancelTranscribeButton,
|
|
1111
|
+
onFinishTranscribe && BoundFinishTranscribeButton
|
|
1112
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1113
|
+
onStartTranscribe && BoundStartTranscribeButton,
|
|
1114
|
+
BoundSendButton
|
|
1115
|
+
] })
|
|
1116
|
+
}
|
|
1117
|
+
)
|
|
1118
|
+
]
|
|
1119
|
+
}
|
|
1120
|
+
)
|
|
1121
|
+
}
|
|
1122
|
+
);
|
|
1123
|
+
}
|
|
1124
|
+
((CopilotChatInput2) => {
|
|
1125
|
+
CopilotChatInput2.SendButton = ({ className, children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mr-[10px]", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1126
|
+
Button,
|
|
1127
|
+
{
|
|
1128
|
+
type: "button",
|
|
1129
|
+
variant: "chatInputToolbarPrimary",
|
|
1130
|
+
size: "chatInputToolbarIcon",
|
|
1131
|
+
className,
|
|
1132
|
+
...props,
|
|
1133
|
+
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.ArrowUp, { className: "size-[18px]" })
|
|
1134
|
+
}
|
|
1135
|
+
) });
|
|
1136
|
+
CopilotChatInput2.ToolbarButton = ({ icon, labelKey, defaultClassName, className, ...props }) => {
|
|
1137
|
+
const config = useCopilotChatConfiguration();
|
|
1138
|
+
const labels = config?.labels ?? CopilotChatDefaultLabels;
|
|
1139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Tooltip, { children: [
|
|
1140
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1141
|
+
Button,
|
|
1142
|
+
{
|
|
1143
|
+
type: "button",
|
|
1144
|
+
variant: "chatInputToolbarSecondary",
|
|
1145
|
+
size: "chatInputToolbarIcon",
|
|
1146
|
+
className: (0, import_tailwind_merge3.twMerge)(defaultClassName, className),
|
|
1147
|
+
...props,
|
|
1148
|
+
children: icon
|
|
1149
|
+
}
|
|
1150
|
+
) }),
|
|
1151
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TooltipContent, { side: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: labels[labelKey] }) })
|
|
1152
|
+
] });
|
|
1153
|
+
};
|
|
1154
|
+
CopilotChatInput2.StartTranscribeButton = (props) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1155
|
+
CopilotChatInput2.ToolbarButton,
|
|
1156
|
+
{
|
|
1157
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Mic, { className: "size-[18px]" }),
|
|
1158
|
+
labelKey: "chatInputToolbarStartTranscribeButtonLabel",
|
|
1159
|
+
defaultClassName: "mr-2",
|
|
1160
|
+
...props
|
|
1161
|
+
}
|
|
1162
|
+
);
|
|
1163
|
+
CopilotChatInput2.CancelTranscribeButton = (props) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1164
|
+
CopilotChatInput2.ToolbarButton,
|
|
1165
|
+
{
|
|
1166
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.X, { className: "size-[18px]" }),
|
|
1167
|
+
labelKey: "chatInputToolbarCancelTranscribeButtonLabel",
|
|
1168
|
+
defaultClassName: "mr-2",
|
|
1169
|
+
...props
|
|
1170
|
+
}
|
|
1171
|
+
);
|
|
1172
|
+
CopilotChatInput2.FinishTranscribeButton = (props) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1173
|
+
CopilotChatInput2.ToolbarButton,
|
|
1174
|
+
{
|
|
1175
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Check, { className: "size-[18px]" }),
|
|
1176
|
+
labelKey: "chatInputToolbarFinishTranscribeButtonLabel",
|
|
1177
|
+
defaultClassName: "mr-[10px]",
|
|
1178
|
+
...props
|
|
1179
|
+
}
|
|
1180
|
+
);
|
|
1181
|
+
CopilotChatInput2.AddMenuButton = ({ className, toolsMenu, onAddFile, disabled, ...props }) => {
|
|
1182
|
+
const config = useCopilotChatConfiguration();
|
|
1183
|
+
const labels = config?.labels ?? CopilotChatDefaultLabels;
|
|
1184
|
+
const menuItems = (0, import_react4.useMemo)(() => {
|
|
1185
|
+
const items = [];
|
|
1186
|
+
if (onAddFile) {
|
|
1187
|
+
items.push({
|
|
1188
|
+
label: labels.chatInputToolbarAddButtonLabel,
|
|
1189
|
+
action: onAddFile
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
if (toolsMenu && toolsMenu.length > 0) {
|
|
1193
|
+
if (items.length > 0) {
|
|
1194
|
+
items.push("-");
|
|
1195
|
+
}
|
|
1196
|
+
for (const item of toolsMenu) {
|
|
1197
|
+
if (item === "-") {
|
|
1198
|
+
if (items.length === 0 || items[items.length - 1] === "-") {
|
|
1199
|
+
continue;
|
|
1200
|
+
}
|
|
1201
|
+
items.push(item);
|
|
1202
|
+
} else {
|
|
1203
|
+
items.push(item);
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
while (items.length > 0 && items[items.length - 1] === "-") {
|
|
1207
|
+
items.pop();
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
return items;
|
|
1211
|
+
}, [onAddFile, toolsMenu, labels.chatInputToolbarAddButtonLabel]);
|
|
1212
|
+
const renderMenuItems = (0, import_react4.useCallback)(
|
|
1213
|
+
(items) => items.map((item, index) => {
|
|
1214
|
+
if (item === "-") {
|
|
1215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuSeparator, {}, `separator-${index}`);
|
|
1216
|
+
}
|
|
1217
|
+
if (item.items && item.items.length > 0) {
|
|
1218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(DropdownMenuSub, { children: [
|
|
1219
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuSubTrigger, { children: item.label }),
|
|
1220
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuSubContent, { children: renderMenuItems(item.items) })
|
|
1221
|
+
] }, `group-${index}`);
|
|
1222
|
+
}
|
|
1223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuItem, { onClick: item.action, children: item.label }, `item-${index}`);
|
|
1224
|
+
}),
|
|
1225
|
+
[]
|
|
1226
|
+
);
|
|
1227
|
+
const hasMenuItems = menuItems.length > 0;
|
|
1228
|
+
const isDisabled = disabled || !hasMenuItems;
|
|
1229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(DropdownMenu, { children: [
|
|
1230
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Tooltip, { children: [
|
|
1231
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1232
|
+
Button,
|
|
1233
|
+
{
|
|
1234
|
+
type: "button",
|
|
1235
|
+
variant: "chatInputToolbarSecondary",
|
|
1236
|
+
size: "chatInputToolbarIcon",
|
|
1237
|
+
className: (0, import_tailwind_merge3.twMerge)("ml-1", className),
|
|
1238
|
+
disabled: isDisabled,
|
|
1239
|
+
...props,
|
|
1240
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Plus, { className: "size-[20px]" })
|
|
1241
|
+
}
|
|
1242
|
+
) }) }),
|
|
1243
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TooltipContent, { side: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "flex items-center gap-1 text-xs font-medium", children: [
|
|
1244
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Add files and more" }),
|
|
1245
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("code", { className: "rounded bg-[#4a4a4a] px-1 py-[1px] font-mono text-[11px] text-white dark:bg-[#e0e0e0] dark:text-black", children: "/" })
|
|
1246
|
+
] }) })
|
|
1247
|
+
] }),
|
|
1248
|
+
hasMenuItems && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuContent, { side: "top", align: "start", children: renderMenuItems(menuItems) })
|
|
1249
|
+
] });
|
|
1250
|
+
};
|
|
1251
|
+
CopilotChatInput2.TextArea = (0, import_react4.forwardRef)(function TextArea2({ style, className, autoFocus, ...props }, ref) {
|
|
1252
|
+
const internalTextareaRef = (0, import_react4.useRef)(null);
|
|
1253
|
+
const config = useCopilotChatConfiguration();
|
|
1254
|
+
const labels = config?.labels ?? CopilotChatDefaultLabels;
|
|
1255
|
+
(0, import_react4.useImperativeHandle)(ref, () => internalTextareaRef.current);
|
|
1256
|
+
(0, import_react4.useEffect)(() => {
|
|
1257
|
+
const textarea = internalTextareaRef.current;
|
|
1258
|
+
if (!textarea) return;
|
|
1259
|
+
const handleFocus = () => {
|
|
1260
|
+
setTimeout(() => {
|
|
1261
|
+
textarea.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
1262
|
+
}, 300);
|
|
1263
|
+
};
|
|
1264
|
+
textarea.addEventListener("focus", handleFocus);
|
|
1265
|
+
return () => textarea.removeEventListener("focus", handleFocus);
|
|
1266
|
+
}, []);
|
|
1267
|
+
(0, import_react4.useEffect)(() => {
|
|
1268
|
+
if (autoFocus) {
|
|
1269
|
+
internalTextareaRef.current?.focus();
|
|
1270
|
+
}
|
|
1271
|
+
}, [autoFocus]);
|
|
1272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1273
|
+
"textarea",
|
|
1274
|
+
{
|
|
1275
|
+
ref: internalTextareaRef,
|
|
1276
|
+
...props,
|
|
1277
|
+
style: {
|
|
1278
|
+
overflow: "auto",
|
|
1279
|
+
resize: "none",
|
|
1280
|
+
...style
|
|
1281
|
+
},
|
|
1282
|
+
placeholder: labels.chatInputPlaceholder,
|
|
1283
|
+
className: (0, import_tailwind_merge3.twMerge)(
|
|
1284
|
+
"bg-transparent outline-none antialiased font-regular leading-relaxed text-[16px] placeholder:text-[#00000077] dark:placeholder:text-[#fffc]",
|
|
1285
|
+
className
|
|
1286
|
+
),
|
|
1287
|
+
rows: 1
|
|
1288
|
+
}
|
|
1289
|
+
);
|
|
1290
|
+
});
|
|
1291
|
+
CopilotChatInput2.AudioRecorder = CopilotChatAudioRecorder;
|
|
1292
|
+
})(CopilotChatInput || (CopilotChatInput = {}));
|
|
1293
|
+
CopilotChatInput.TextArea.displayName = "CopilotChatInput.TextArea";
|
|
1294
|
+
CopilotChatInput.SendButton.displayName = "CopilotChatInput.SendButton";
|
|
1295
|
+
CopilotChatInput.ToolbarButton.displayName = "CopilotChatInput.ToolbarButton";
|
|
1296
|
+
CopilotChatInput.StartTranscribeButton.displayName = "CopilotChatInput.StartTranscribeButton";
|
|
1297
|
+
CopilotChatInput.CancelTranscribeButton.displayName = "CopilotChatInput.CancelTranscribeButton";
|
|
1298
|
+
CopilotChatInput.FinishTranscribeButton.displayName = "CopilotChatInput.FinishTranscribeButton";
|
|
1299
|
+
CopilotChatInput.AddMenuButton.displayName = "CopilotChatInput.AddMenuButton";
|
|
1300
|
+
var CopilotChatInput_default = CopilotChatInput;
|
|
1301
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1302
|
+
0 && (module.exports = {
|
|
1303
|
+
CopilotChatInput
|
|
1304
|
+
});
|
|
1305
|
+
//# sourceMappingURL=CopilotChatInput.js.map
|