@copilotkit/react-textarea 1.51.4-next.7 → 1.51.4

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 (250) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +18 -12
  3. package/dist/{chunk-D47EKHIF.mjs → chunk-2X3CZVEP.mjs} +9 -3
  4. package/dist/chunk-2X3CZVEP.mjs.map +1 -0
  5. package/dist/{chunk-GU5LTWGL.mjs → chunk-3WLGLZTY.mjs} +19 -13
  6. package/dist/chunk-3WLGLZTY.mjs.map +1 -0
  7. package/dist/{chunk-DRV2FOHZ.mjs → chunk-7GZWOXE4.mjs} +2 -2
  8. package/dist/chunk-7GZWOXE4.mjs.map +1 -0
  9. package/dist/{chunk-NAFNY4FL.mjs → chunk-7V4ORVQX.mjs} +1 -1
  10. package/dist/chunk-7V4ORVQX.mjs.map +1 -0
  11. package/dist/{chunk-ECR45NSD.mjs → chunk-A6YGJFQI.mjs} +9 -2
  12. package/dist/chunk-A6YGJFQI.mjs.map +1 -0
  13. package/dist/{chunk-WGWQRALG.mjs → chunk-AHNPJMBR.mjs} +10 -3
  14. package/dist/chunk-AHNPJMBR.mjs.map +1 -0
  15. package/dist/{chunk-VSVQZUPW.mjs → chunk-ARLBRSB7.mjs} +23 -7
  16. package/dist/chunk-ARLBRSB7.mjs.map +1 -0
  17. package/dist/{chunk-72GJNLCO.mjs → chunk-AZ7RF6ED.mjs} +5 -5
  18. package/dist/chunk-AZ7RF6ED.mjs.map +1 -0
  19. package/dist/{chunk-I72DKFHD.mjs → chunk-CFCMZVQ2.mjs} +29 -7
  20. package/dist/chunk-CFCMZVQ2.mjs.map +1 -0
  21. package/dist/{chunk-T6MTDQZ7.mjs → chunk-CMKGYQFX.mjs} +1 -1
  22. package/dist/chunk-CMKGYQFX.mjs.map +1 -0
  23. package/dist/{chunk-DFTV4TST.mjs → chunk-DZMQBOPG.mjs} +1 -1
  24. package/dist/chunk-DZMQBOPG.mjs.map +1 -0
  25. package/dist/{chunk-CLGAJCZ5.mjs → chunk-E7C63KQP.mjs} +10 -6
  26. package/dist/chunk-E7C63KQP.mjs.map +1 -0
  27. package/dist/{chunk-GQN2HYFJ.mjs → chunk-EGBZSVLK.mjs} +5 -2
  28. package/dist/{chunk-GQN2HYFJ.mjs.map → chunk-EGBZSVLK.mjs.map} +1 -1
  29. package/dist/{chunk-3QJOFG3V.mjs → chunk-FTG7P3NP.mjs} +1 -1
  30. package/dist/chunk-FTG7P3NP.mjs.map +1 -0
  31. package/dist/{chunk-KMVGEY7Q.mjs → chunk-IBZTDP72.mjs} +9 -4
  32. package/dist/chunk-IBZTDP72.mjs.map +1 -0
  33. package/dist/{chunk-4PDYALMP.mjs → chunk-LYNGBKJR.mjs} +9 -3
  34. package/dist/chunk-LYNGBKJR.mjs.map +1 -0
  35. package/dist/{chunk-DL3JWL2E.mjs → chunk-M7GTVHFB.mjs} +26 -8
  36. package/dist/chunk-M7GTVHFB.mjs.map +1 -0
  37. package/dist/chunk-MQBPYOOZ.mjs +97 -0
  38. package/dist/chunk-MQBPYOOZ.mjs.map +1 -0
  39. package/dist/{chunk-6SGWO63I.mjs → chunk-MQXYWOE2.mjs} +3 -3
  40. package/dist/chunk-MQXYWOE2.mjs.map +1 -0
  41. package/dist/{chunk-F2ULK22F.mjs → chunk-NFMCLTJU.mjs} +1 -1
  42. package/dist/chunk-NFMCLTJU.mjs.map +1 -0
  43. package/dist/{chunk-F6RLSVG3.mjs → chunk-O4WCM57A.mjs} +1 -1
  44. package/dist/chunk-O4WCM57A.mjs.map +1 -0
  45. package/dist/{chunk-4NHVQZ67.mjs → chunk-PDFIUPCS.mjs} +1 -1
  46. package/dist/chunk-PDFIUPCS.mjs.map +1 -0
  47. package/dist/{chunk-7NOLZ5T3.mjs → chunk-SWX3MRZ4.mjs} +31 -22
  48. package/dist/chunk-SWX3MRZ4.mjs.map +1 -0
  49. package/dist/{chunk-QJNFNPWH.mjs → chunk-TGN3YVSO.mjs} +2 -2
  50. package/dist/chunk-TGN3YVSO.mjs.map +1 -0
  51. package/dist/{chunk-LYB4B6MK.mjs → chunk-UB4Y22EF.mjs} +4 -2
  52. package/dist/chunk-UB4Y22EF.mjs.map +1 -0
  53. package/dist/{chunk-ZQSEYPNN.mjs → chunk-UIBUYQPG.mjs} +7 -2
  54. package/dist/chunk-UIBUYQPG.mjs.map +1 -0
  55. package/dist/{chunk-AJ5OMEXM.mjs → chunk-VBPZTMXB.mjs} +2 -2
  56. package/dist/{chunk-EJGGLWWR.mjs → chunk-VH7INUR5.mjs} +1 -1
  57. package/dist/{chunk-EJGGLWWR.mjs.map → chunk-VH7INUR5.mjs.map} +1 -1
  58. package/dist/{chunk-7LSRNPNI.mjs → chunk-VVRGAA43.mjs} +1 -1
  59. package/dist/chunk-VVRGAA43.mjs.map +1 -0
  60. package/dist/{chunk-YLFAIYRY.mjs → chunk-VYLLLBUP.mjs} +1 -1
  61. package/dist/chunk-VYLLLBUP.mjs.map +1 -0
  62. package/dist/{chunk-2QDCE7PD.mjs → chunk-WXKPRNNO.mjs} +1 -1
  63. package/dist/chunk-WXKPRNNO.mjs.map +1 -0
  64. package/dist/{chunk-JLOABKLH.mjs → chunk-YINY56BI.mjs} +2 -2
  65. package/dist/{chunk-23Q6A46J.mjs → chunk-ZBP4SABT.mjs} +22 -8
  66. package/dist/chunk-ZBP4SABT.mjs.map +1 -0
  67. package/dist/{chunk-H5ZNEKUR.mjs → chunk-ZWI5KPQ5.mjs} +2 -2
  68. package/dist/components/base-copilot-textarea/base-copilot-textarea.js +154 -86
  69. package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -1
  70. package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +29 -29
  71. package/dist/components/base-copilot-textarea/render-element.js.map +1 -1
  72. package/dist/components/base-copilot-textarea/render-element.mjs +1 -1
  73. package/dist/components/base-copilot-textarea/render-placeholder.js.map +1 -1
  74. package/dist/components/base-copilot-textarea/render-placeholder.mjs +1 -1
  75. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js.map +1 -1
  76. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +2 -2
  77. package/dist/components/base-copilot-textarea/use-add-branding-css.js.map +1 -1
  78. package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +1 -1
  79. package/dist/components/copilot-textarea/copilot-textarea.js +190 -95
  80. package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -1
  81. package/dist/components/copilot-textarea/copilot-textarea.mjs +34 -34
  82. package/dist/components/hovering-toolbar/hovering-editor-provider.d.ts +1 -1
  83. package/dist/components/hovering-toolbar/hovering-editor-provider.js +3 -1
  84. package/dist/components/hovering-toolbar/hovering-editor-provider.js.map +1 -1
  85. package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +1 -1
  86. package/dist/components/hovering-toolbar/hovering-toolbar-components.js +57 -63
  87. package/dist/components/hovering-toolbar/hovering-toolbar-components.js.map +1 -1
  88. package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +1 -1
  89. package/dist/components/hovering-toolbar/hovering-toolbar.js +117 -77
  90. package/dist/components/hovering-toolbar/hovering-toolbar.js.map +1 -1
  91. package/dist/components/hovering-toolbar/hovering-toolbar.mjs +15 -15
  92. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js +60 -14
  93. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js.map +1 -1
  94. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +11 -11
  95. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +60 -14
  96. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js.map +1 -1
  97. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +12 -12
  98. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.d.ts +1 -1
  99. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js +14 -3
  100. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js.map +1 -1
  101. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs +3 -3
  102. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js +60 -14
  103. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js.map +1 -1
  104. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +12 -12
  105. package/dist/components/index.js +190 -95
  106. package/dist/components/index.js.map +1 -1
  107. package/dist/components/index.mjs +34 -34
  108. package/dist/components/manual-ui/chip-with-icon.d.ts +1 -1
  109. package/dist/components/manual-ui/chip-with-icon.js +13 -2
  110. package/dist/components/manual-ui/chip-with-icon.js.map +1 -1
  111. package/dist/components/manual-ui/chip-with-icon.mjs +13 -2
  112. package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -1
  113. package/dist/components/source-search-box/source-search-box.js +28 -5
  114. package/dist/components/source-search-box/source-search-box.js.map +1 -1
  115. package/dist/components/source-search-box/source-search-box.mjs +4 -4
  116. package/dist/components/ui/button.js +7 -1
  117. package/dist/components/ui/button.js.map +1 -1
  118. package/dist/components/ui/button.mjs +2 -2
  119. package/dist/components/ui/command.js +47 -9
  120. package/dist/components/ui/command.js.map +1 -1
  121. package/dist/components/ui/command.mjs +3 -3
  122. package/dist/components/ui/dialog.js +27 -5
  123. package/dist/components/ui/dialog.js.map +1 -1
  124. package/dist/components/ui/dialog.mjs +2 -2
  125. package/dist/components/ui/label.js +7 -1
  126. package/dist/components/ui/label.js.map +1 -1
  127. package/dist/components/ui/label.mjs +2 -2
  128. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js +18 -4
  129. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js.map +1 -1
  130. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +4 -4
  131. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js.map +1 -1
  132. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +2 -2
  133. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js.map +1 -1
  134. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +2 -2
  135. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js +6 -1
  136. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js.map +1 -1
  137. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +1 -1
  138. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js +25 -7
  139. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js.map +1 -1
  140. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +1 -1
  141. package/dist/hooks/misc/use-autosize-textarea.js.map +1 -1
  142. package/dist/hooks/misc/use-autosize-textarea.mjs +1 -1
  143. package/dist/index.js +190 -95
  144. package/dist/index.js.map +1 -1
  145. package/dist/index.mjs +35 -35
  146. package/dist/index.umd.js +16 -16
  147. package/dist/index.umd.js.map +1 -1
  148. package/dist/lib/debouncer.js.map +1 -1
  149. package/dist/lib/debouncer.mjs +1 -1
  150. package/dist/lib/editor-to-text.js.map +1 -1
  151. package/dist/lib/editor-to-text.mjs +1 -1
  152. package/dist/lib/get-text-around-cursor.js.map +1 -1
  153. package/dist/lib/get-text-around-cursor.mjs +1 -1
  154. package/dist/lib/slatejs-edits/clear-autocompletions.js +4 -1
  155. package/dist/lib/slatejs-edits/clear-autocompletions.js.map +1 -1
  156. package/dist/lib/slatejs-edits/clear-autocompletions.mjs +1 -1
  157. package/dist/lib/slatejs-edits/with-partial-history.js.map +1 -1
  158. package/dist/lib/slatejs-edits/with-partial-history.mjs +1 -1
  159. package/dist/lib/stream-promise-flatten.js.map +1 -1
  160. package/dist/lib/stream-promise-flatten.mjs +1 -1
  161. package/dist/lib/utils.js.map +1 -1
  162. package/dist/lib/utils.mjs +1 -1
  163. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js.map +1 -1
  164. package/dist/types/autosuggestions-config/autosuggestions-config.js.map +1 -1
  165. package/dist/types/autosuggestions-config/autosuggestions-config.mjs +3 -3
  166. package/dist/types/autosuggestions-config/editing-api-config.js.map +1 -1
  167. package/dist/types/autosuggestions-config/editing-api-config.mjs +1 -1
  168. package/dist/types/autosuggestions-config/index.js.map +1 -1
  169. package/dist/types/autosuggestions-config/index.mjs +3 -3
  170. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js.map +1 -1
  171. package/dist/types/base/base-autosuggestions-config.js.map +1 -1
  172. package/dist/types/base/base-autosuggestions-config.mjs +1 -1
  173. package/dist/types/base/base-copilot-textarea-props.js.map +1 -1
  174. package/dist/types/base/editor-autocomplete-state.js.map +1 -1
  175. package/dist/types/base/editor-autocomplete-state.mjs +2 -2
  176. package/dist/types/base/index.js.map +1 -1
  177. package/dist/types/base/index.mjs +1 -1
  178. package/dist/types/index.js.map +1 -1
  179. package/dist/types/index.mjs +3 -3
  180. package/package.json +8 -8
  181. package/src/components/base-copilot-textarea/base-copilot-textarea.tsx +30 -10
  182. package/src/components/base-copilot-textarea/render-element.tsx +6 -2
  183. package/src/components/base-copilot-textarea/render-placeholder.tsx +3 -1
  184. package/src/components/base-copilot-textarea/use-add-branding-css.tsx +3 -1
  185. package/src/components/copilot-textarea/copilot-textarea.tsx +15 -9
  186. package/src/components/hovering-toolbar/hovering-editor-provider.tsx +3 -1
  187. package/src/components/hovering-toolbar/hovering-toolbar-components.tsx +63 -52
  188. package/src/components/hovering-toolbar/hovering-toolbar.tsx +21 -5
  189. package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx +13 -7
  190. package/src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx +7 -2
  191. package/src/components/manual-ui/chip-with-icon.tsx +12 -3
  192. package/src/components/source-search-box/source-search-box.tsx +12 -2
  193. package/src/components/ui/button.tsx +13 -5
  194. package/src/components/ui/command.tsx +17 -4
  195. package/src/components/ui/dialog.tsx +23 -5
  196. package/src/components/ui/label.tsx +7 -2
  197. package/src/hooks/base-copilot-textarea-implementation/use-autosuggestions.ts +35 -9
  198. package/src/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx +5 -1
  199. package/src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts +5 -1
  200. package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +9 -2
  201. package/src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx +24 -6
  202. package/src/hooks/misc/use-autosize-textarea.tsx +4 -1
  203. package/src/lib/debouncer.ts +3 -1
  204. package/src/lib/editor-to-text.ts +5 -2
  205. package/src/lib/get-text-around-cursor.ts +14 -2
  206. package/src/lib/slatejs-edits/clear-autocompletions.ts +4 -1
  207. package/src/lib/slatejs-edits/with-partial-history.ts +10 -3
  208. package/src/lib/stream-promise-flatten.ts +3 -1
  209. package/src/lib/utils.ts +6 -2
  210. package/src/types/autosuggestions-config/autosuggestions-config-user-specified.tsx +3 -2
  211. package/src/types/autosuggestions-config/autosuggestions-config.tsx +20 -5
  212. package/src/types/autosuggestions-config/editing-api-config.tsx +2 -1
  213. package/src/types/autosuggestions-config/subtypes/make-system-prompt.ts +4 -1
  214. package/src/types/base/base-autosuggestions-config.tsx +10 -4
  215. package/src/types/base/base-copilot-textarea-props.tsx +4 -2
  216. package/tsconfig.json +1 -1
  217. package/tsup.config.ts +5 -1
  218. package/dist/chunk-23Q6A46J.mjs.map +0 -1
  219. package/dist/chunk-2IWVZ4PP.mjs +0 -103
  220. package/dist/chunk-2IWVZ4PP.mjs.map +0 -1
  221. package/dist/chunk-2QDCE7PD.mjs.map +0 -1
  222. package/dist/chunk-3QJOFG3V.mjs.map +0 -1
  223. package/dist/chunk-4NHVQZ67.mjs.map +0 -1
  224. package/dist/chunk-4PDYALMP.mjs.map +0 -1
  225. package/dist/chunk-6SGWO63I.mjs.map +0 -1
  226. package/dist/chunk-72GJNLCO.mjs.map +0 -1
  227. package/dist/chunk-7LSRNPNI.mjs.map +0 -1
  228. package/dist/chunk-7NOLZ5T3.mjs.map +0 -1
  229. package/dist/chunk-CLGAJCZ5.mjs.map +0 -1
  230. package/dist/chunk-D47EKHIF.mjs.map +0 -1
  231. package/dist/chunk-DFTV4TST.mjs.map +0 -1
  232. package/dist/chunk-DL3JWL2E.mjs.map +0 -1
  233. package/dist/chunk-DRV2FOHZ.mjs.map +0 -1
  234. package/dist/chunk-ECR45NSD.mjs.map +0 -1
  235. package/dist/chunk-F2ULK22F.mjs.map +0 -1
  236. package/dist/chunk-F6RLSVG3.mjs.map +0 -1
  237. package/dist/chunk-GU5LTWGL.mjs.map +0 -1
  238. package/dist/chunk-I72DKFHD.mjs.map +0 -1
  239. package/dist/chunk-KMVGEY7Q.mjs.map +0 -1
  240. package/dist/chunk-LYB4B6MK.mjs.map +0 -1
  241. package/dist/chunk-NAFNY4FL.mjs.map +0 -1
  242. package/dist/chunk-QJNFNPWH.mjs.map +0 -1
  243. package/dist/chunk-T6MTDQZ7.mjs.map +0 -1
  244. package/dist/chunk-VSVQZUPW.mjs.map +0 -1
  245. package/dist/chunk-WGWQRALG.mjs.map +0 -1
  246. package/dist/chunk-YLFAIYRY.mjs.map +0 -1
  247. package/dist/chunk-ZQSEYPNN.mjs.map +0 -1
  248. /package/dist/{chunk-AJ5OMEXM.mjs.map → chunk-VBPZTMXB.mjs.map} +0 -0
  249. /package/dist/{chunk-JLOABKLH.mjs.map → chunk-YINY56BI.mjs.map} +0 -0
  250. /package/dist/{chunk-H5ZNEKUR.mjs.map → chunk-ZWI5KPQ5.mjs.map} +0 -0
@@ -110,7 +110,12 @@ function useMakeStandardAutosuggestionFunction(textareaPurpose, contextCategorie
110
110
  const runtimeClient = { generateCopilotResponse: (...args) => {
111
111
  } };
112
112
  const { getContextString, copilotApiConfig } = (0, import_react_core.useCopilotContext)();
113
- const { chatApiEndpoint: url, publicApiKey, credentials, properties } = copilotApiConfig;
113
+ const {
114
+ chatApiEndpoint: url,
115
+ publicApiKey,
116
+ credentials,
117
+ properties
118
+ } = copilotApiConfig;
114
119
  const headers = __spreadValues(__spreadValues({}, copilotApiConfig.headers), publicApiKey ? { [import_shared.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: publicApiKey } : {});
115
120
  const { maxTokens, stop, temperature = 0 } = apiConfig;
116
121
  return (0, import_react.useCallback)(
@@ -467,7 +472,10 @@ function useAutosuggestions(debounceTime, shouldAcceptAutosuggestionOnKeyPress,
467
472
  if (disableWhenEmpty && editorAutocompleteState.textBeforeCursor === "" && editorAutocompleteState.textAfterCursor === "") {
468
473
  return;
469
474
  }
470
- const suggestion = yield autosuggestionFunction(editorAutocompleteState, abortSignal);
475
+ const suggestion = yield autosuggestionFunction(
476
+ editorAutocompleteState,
477
+ abortSignal
478
+ );
471
479
  if (!suggestion || abortSignal.aborted) {
472
480
  throw new DOMException("Aborted", "AbortError");
473
481
  }
@@ -476,10 +484,17 @@ function useAutosuggestions(debounceTime, shouldAcceptAutosuggestionOnKeyPress,
476
484
  point: editorAutocompleteState.cursorPoint
477
485
  });
478
486
  }),
479
- [autosuggestionFunction, setCurrentAutocompleteSuggestion, disableWhenEmpty, disabled]
487
+ [
488
+ autosuggestionFunction,
489
+ setCurrentAutocompleteSuggestion,
490
+ disableWhenEmpty,
491
+ disabled
492
+ ]
480
493
  );
481
494
  const debouncedFunction = (0, import_react2.useMemo)(
482
- () => new Debouncer(debounceTime),
495
+ () => new Debouncer(
496
+ debounceTime
497
+ ),
483
498
  [debounceTime]
484
499
  );
485
500
  (0, import_react2.useEffect)(() => {
@@ -517,7 +532,11 @@ function useAutosuggestions(debounceTime, shouldAcceptAutosuggestionOnKeyPress,
517
532
  const keyDownOrTouchHandler = (0, import_react2.useCallback)(
518
533
  (event) => {
519
534
  if (currentAutocompleteSuggestion) {
520
- const shouldAcceptSuggestion = event.type === "touchstart" ? shouldAcceptAutosuggestionOnTouch(event) : shouldAcceptAutosuggestionOnKeyPress(event);
535
+ const shouldAcceptSuggestion = event.type === "touchstart" ? shouldAcceptAutosuggestionOnTouch(
536
+ event
537
+ ) : shouldAcceptAutosuggestionOnKeyPress(
538
+ event
539
+ );
521
540
  if (shouldAcceptSuggestion) {
522
541
  event.preventDefault();
523
542
  insertAutocompleteSuggestion(currentAutocompleteSuggestion);
@@ -940,7 +959,10 @@ function clearAutocompletionsFromEditor(editor) {
940
959
  try {
941
960
  import_slate6.Transforms.removeNodes(editor, { at: path });
942
961
  } catch (e) {
943
- console.log("CopilotTextarea.clearAutocompletionsFromEditor: error removing node", e);
962
+ console.log(
963
+ "CopilotTextarea.clearAutocompletionsFromEditor: error removing node",
964
+ e
965
+ );
944
966
  }
945
967
  }
946
968
  }
@@ -958,7 +980,9 @@ var HoveringEditorContext = (0, import_react5.createContext)({
958
980
  setIsDisplayed: () => {
959
981
  }
960
982
  });
961
- var HoveringEditorProvider = ({ children }) => {
983
+ var HoveringEditorProvider = ({
984
+ children
985
+ }) => {
962
986
  const [isDisplayed, setIsDisplayed] = (0, import_react5.useState)(false);
963
987
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HoveringEditorContext.Provider, { value: { isDisplayed, setIsDisplayed }, children });
964
988
  };
@@ -985,73 +1009,67 @@ var Button = import_react6.default.forwardRef((_a, ref) => {
985
1009
  })
986
1010
  );
987
1011
  });
988
- var Icon = import_react6.default.forwardRef(
989
- (_a, ref) => {
990
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
991
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
992
- "span",
993
- __spreadProps(__spreadValues({}, props), {
994
- ref,
995
- className: (0, import_css.cx)(
996
- "material-icons",
997
- className,
998
- import_css.css`
999
- font-size: 18px;
1000
- vertical-align: text-bottom;
1001
- `
1002
- )
1003
- })
1004
- );
1005
- }
1006
- );
1007
- var Menu = import_react6.default.forwardRef(
1008
- (_a, ref) => {
1009
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
1010
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1011
- "div",
1012
- __spreadProps(__spreadValues({}, props), {
1013
- "data-testid": "menu",
1014
- ref,
1015
- className: (0, import_css.cx)(
1016
- className,
1017
- import_css.css`
1018
- & > * {
1019
- display: inline-block;
1020
- }
1012
+ var Icon = import_react6.default.forwardRef((_a, ref) => {
1013
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
1014
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1015
+ "span",
1016
+ __spreadProps(__spreadValues({}, props), {
1017
+ ref,
1018
+ className: (0, import_css.cx)(
1019
+ "material-icons",
1020
+ className,
1021
+ import_css.css`
1022
+ font-size: 18px;
1023
+ vertical-align: text-bottom;
1024
+ `
1025
+ )
1026
+ })
1027
+ );
1028
+ });
1029
+ var Menu = import_react6.default.forwardRef((_a, ref) => {
1030
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
1031
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1032
+ "div",
1033
+ __spreadProps(__spreadValues({}, props), {
1034
+ "data-testid": "menu",
1035
+ ref,
1036
+ className: (0, import_css.cx)(
1037
+ className,
1038
+ import_css.css`
1039
+ & > * {
1040
+ display: inline-block;
1041
+ }
1021
1042
 
1022
- & > * + * {
1023
- margin-left: 15px;
1024
- }
1025
- `
1026
- )
1027
- })
1028
- );
1029
- }
1030
- );
1043
+ & > * + * {
1044
+ margin-left: 15px;
1045
+ }
1046
+ `
1047
+ )
1048
+ })
1049
+ );
1050
+ });
1031
1051
  var Portal = ({ children }) => {
1032
1052
  return typeof document === "object" ? import_react_dom.default.createPortal(children, document.body) : null;
1033
1053
  };
1034
- var Toolbar = import_react6.default.forwardRef(
1035
- (_a, ref) => {
1036
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
1037
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1038
- Menu,
1039
- __spreadProps(__spreadValues({}, props), {
1040
- ref,
1041
- className: (0, import_css.cx)(
1042
- className,
1043
- import_css.css`
1044
- position: relative;
1045
- padding: 1px 18px 17px;
1046
- margin: 0 -20px;
1047
- border-bottom: 2px solid #eee;
1048
- margin-bottom: 20px;
1049
- `
1050
- )
1051
- })
1052
- );
1053
- }
1054
- );
1054
+ var Toolbar = import_react6.default.forwardRef((_a, ref) => {
1055
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
1056
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1057
+ Menu,
1058
+ __spreadProps(__spreadValues({}, props), {
1059
+ ref,
1060
+ className: (0, import_css.cx)(
1061
+ className,
1062
+ import_css.css`
1063
+ position: relative;
1064
+ padding: 1px 18px 17px;
1065
+ margin: 0 -20px;
1066
+ border-bottom: 2px solid #eee;
1067
+ margin-bottom: 20px;
1068
+ `
1069
+ )
1070
+ })
1071
+ );
1072
+ });
1055
1073
 
1056
1074
  // src/hooks/misc/use-autosize-textarea.tsx
1057
1075
  var import_react7 = require("react");
@@ -1107,12 +1125,21 @@ var CommandList = React3.forwardRef((_a, ref) => {
1107
1125
  import_cmdk.Command.List,
1108
1126
  __spreadValues({
1109
1127
  ref,
1110
- className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden pb-2", className)
1128
+ className: cn(
1129
+ "max-h-[300px] overflow-y-auto overflow-x-hidden pb-2",
1130
+ className
1131
+ )
1111
1132
  }, props)
1112
1133
  );
1113
1134
  });
1114
1135
  CommandList.displayName = import_cmdk.Command.List.displayName;
1115
- var CommandEmpty = React3.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_cmdk.Command.Empty, __spreadValues({ ref, className: "py-6 text-center text-sm" }, props)));
1136
+ var CommandEmpty = React3.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1137
+ import_cmdk.Command.Empty,
1138
+ __spreadValues({
1139
+ ref,
1140
+ className: "py-6 text-center text-sm"
1141
+ }, props)
1142
+ ));
1116
1143
  CommandEmpty.displayName = import_cmdk.Command.Empty.displayName;
1117
1144
  var CommandGroup = React3.forwardRef((_a, ref) => {
1118
1145
  var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
@@ -1154,11 +1181,18 @@ var CommandItem = React3.forwardRef((_a, ref) => {
1154
1181
  });
1155
1182
  CommandItem.displayName = import_cmdk.Command.Item.displayName;
1156
1183
  var CommandShortcut = (_a) => {
1157
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
1184
+ var _b = _a, {
1185
+ className
1186
+ } = _b, props = __objRest(_b, [
1187
+ "className"
1188
+ ]);
1158
1189
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1159
1190
  "span",
1160
1191
  __spreadValues({
1161
- className: cn("ml-auto text-xs tracking-widest text-muted-foreground", className)
1192
+ className: cn(
1193
+ "ml-auto text-xs tracking-widest text-muted-foreground",
1194
+ className
1195
+ )
1162
1196
  }, props)
1163
1197
  );
1164
1198
  };
@@ -1228,7 +1262,14 @@ function Logo({
1228
1262
  width,
1229
1263
  height
1230
1264
  }) {
1231
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex items-center justify-center", style: { width, height }, children });
1265
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1266
+ "div",
1267
+ {
1268
+ className: "flex items-center justify-center",
1269
+ style: { width, height },
1270
+ children
1271
+ }
1272
+ );
1232
1273
  }
1233
1274
 
1234
1275
  // src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
@@ -1268,7 +1309,13 @@ var Button2 = React4.forwardRef(
1268
1309
  (_a, ref) => {
1269
1310
  var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest(_b, ["className", "variant", "size", "asChild"]);
1270
1311
  const Comp = asChild ? import_react_slot.Slot : "button";
1271
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Comp, __spreadValues({ className: cn(buttonVariants({ variant, size, className })), ref }, props));
1312
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1313
+ Comp,
1314
+ __spreadValues({
1315
+ className: cn(buttonVariants({ variant, size, className })),
1316
+ ref
1317
+ }, props)
1318
+ );
1272
1319
  }
1273
1320
  );
1274
1321
  Button2.displayName = "Button";
@@ -1283,7 +1330,13 @@ var labelVariants = (0, import_class_variance_authority2.cva)(
1283
1330
  );
1284
1331
  var Label = React5.forwardRef((_a, ref) => {
1285
1332
  var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
1286
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(LabelPrimitive.Root, __spreadValues({ ref, className: cn(labelVariants(), className) }, props));
1333
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1334
+ LabelPrimitive.Root,
1335
+ __spreadValues({
1336
+ ref,
1337
+ className: cn(labelVariants(), className)
1338
+ }, props)
1339
+ );
1287
1340
  });
1288
1341
  Label.displayName = LabelPrimitive.Root.displayName;
1289
1342
 
@@ -1330,7 +1383,9 @@ var IncludedFilesPreview = ({
1330
1383
  {
1331
1384
  filePointer,
1332
1385
  onDelete: () => {
1333
- setIncludedFiles((prev) => prev.filter((fp) => fp !== filePointer));
1386
+ setIncludedFiles(
1387
+ (prev) => prev.filter((fp) => fp !== filePointer)
1388
+ );
1334
1389
  }
1335
1390
  },
1336
1391
  `file-${filePointer.sourceApplication}.${filePointer.name}`
@@ -1338,7 +1393,10 @@ var IncludedFilesPreview = ({
1338
1393
  }) })
1339
1394
  ] });
1340
1395
  };
1341
- var FileChipPreview = ({ filePointer, onDelete }) => {
1396
+ var FileChipPreview = ({
1397
+ filePointer,
1398
+ onDelete
1399
+ }) => {
1342
1400
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1343
1401
  import_Chip.default,
1344
1402
  {
@@ -1368,9 +1426,7 @@ var HoveringInsertionPromptBoxCore = ({
1368
1426
  const [editSuggestion, setEditSuggestion] = (0, import_react9.useState)("");
1369
1427
  const [suggestionIsLoading, setSuggestionIsLoading] = (0, import_react9.useState)(false);
1370
1428
  const [adjustmentPrompt, setAdjustmentPrompt] = (0, import_react9.useState)("");
1371
- const [generatingSuggestion, setGeneratingSuggestion] = (0, import_react9.useState)(
1372
- null
1373
- );
1429
+ const [generatingSuggestion, setGeneratingSuggestion] = (0, import_react9.useState)(null);
1374
1430
  const adjustmentTextAreaRef = (0, import_react9.useRef)(null);
1375
1431
  const suggestionTextAreaRef = (0, import_react9.useRef)(null);
1376
1432
  const [filePointers, setFilePointers] = (0, import_react9.useState)([]);
@@ -1532,7 +1588,13 @@ var HoveringInsertionPromptBoxCore = ({
1532
1588
  const sourceSearchWord = (sourceSearchCandidate == null ? void 0 : sourceSearchCandidate.startsWith("@")) ? sourceSearchCandidate.slice(1) : void 0;
1533
1589
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "w-full flex flex-col items-start relative gap-2", children: [
1534
1590
  AdjustmentPromptComponent,
1535
- filePointers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IncludedFilesPreview, { includedFiles: filePointers, setIncludedFiles: setFilePointers }),
1591
+ filePointers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1592
+ IncludedFilesPreview,
1593
+ {
1594
+ includedFiles: filePointers,
1595
+ setIncludedFiles: setFilePointers
1596
+ }
1597
+ ),
1536
1598
  sourceSearchWord !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1537
1599
  SourceSearchBox,
1538
1600
  {
@@ -1540,7 +1602,9 @@ var HoveringInsertionPromptBoxCore = ({
1540
1602
  suggestedFiles,
1541
1603
  onSelectedFile: (filePointer) => {
1542
1604
  var _a;
1543
- setAdjustmentPrompt(adjustmentPrompt.replace(new RegExp(`@${sourceSearchWord}$`), ""));
1605
+ setAdjustmentPrompt(
1606
+ adjustmentPrompt.replace(new RegExp(`@${sourceSearchWord}$`), "")
1607
+ );
1544
1608
  setFilePointers((prev) => [...prev, filePointer]);
1545
1609
  (_a = adjustmentTextAreaRef.current) == null ? void 0 : _a.focus();
1546
1610
  }
@@ -1882,7 +1946,10 @@ var BaseCopilotTextareaWithHoveringContext = import_react13.default.forwardRef(
1882
1946
  ];
1883
1947
  }, [valueOnInitialRender]);
1884
1948
  const editor = useCopilotTextareaEditor();
1885
- const { isDisplayed: hoveringEditorIsDisplayed, setIsDisplayed: setHoveringEditorIsDisplayed } = useHoveringEditorContext();
1949
+ const {
1950
+ isDisplayed: hoveringEditorIsDisplayed,
1951
+ setIsDisplayed: setHoveringEditorIsDisplayed
1952
+ } = useHoveringEditorContext();
1886
1953
  const insertText = (0, import_react13.useCallback)(
1887
1954
  (autosuggestion) => {
1888
1955
  import_slate10.Editor.insertText(editor, autosuggestion.text, {
@@ -1915,7 +1982,10 @@ var BaseCopilotTextareaWithHoveringContext = import_react13.default.forwardRef(
1915
1982
  const onKeyDownHandlerForHoveringEditor = (0, import_react13.useCallback)(
1916
1983
  (event) => {
1917
1984
  var _a2;
1918
- if (autosuggestionsConfig.shouldToggleHoveringEditorOnKeyPress(event, (_a2 = props.shortcut) != null ? _a2 : "k")) {
1985
+ if (autosuggestionsConfig.shouldToggleHoveringEditorOnKeyPress(
1986
+ event,
1987
+ (_a2 = props.shortcut) != null ? _a2 : "k"
1988
+ )) {
1919
1989
  event.preventDefault();
1920
1990
  setHoveringEditorIsDisplayed(!hoveringEditorIsDisplayed);
1921
1991
  }
@@ -1987,7 +2057,10 @@ var BaseCopilotTextareaWithHoveringContext = import_react13.default.forwardRef(
1987
2057
  const baseClassName = "copilot-textarea";
1988
2058
  const brandingClass = disableBranding ? "no-branding" : "with-branding";
1989
2059
  const defaultTailwindClassName = "bg-white overflow-y-auto resize-y";
1990
- const mergedClassName = (0, import_tailwind_merge2.twMerge)(defaultTailwindClassName, className != null ? className : "");
2060
+ const mergedClassName = (0, import_tailwind_merge2.twMerge)(
2061
+ defaultTailwindClassName,
2062
+ className != null ? className : ""
2063
+ );
1991
2064
  return `${baseClassName} ${brandingClass} ${mergedClassName}`;
1992
2065
  })();
1993
2066
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
@@ -2073,8 +2146,10 @@ var import_react_core5 = require("@copilotkit/react-core");
2073
2146
  var import_react14 = require("react");
2074
2147
  var import_runtime_client_gql5 = require("@copilotkit/runtime-client-gql");
2075
2148
  function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCategories, insertionApiConfig, editingApiConfig) {
2076
- const runtimeClient = { generateCopilotResponse: (...args) => {
2077
- } };
2149
+ const runtimeClient = {
2150
+ generateCopilotResponse: (...args) => {
2151
+ }
2152
+ };
2078
2153
  const { getContextString, copilotApiConfig } = (0, import_react_core5.useCopilotContext)();
2079
2154
  const headers = __spreadValues({}, copilotApiConfig.publicApiKey ? { [import_shared3.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: copilotApiConfig.publicApiKey } : {});
2080
2155
  function runtimeClientResponseToStringStream(responsePromise) {
@@ -2090,7 +2165,9 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
2090
2165
  if (done) {
2091
2166
  break;
2092
2167
  }
2093
- const messages = (0, import_runtime_client_gql5.convertGqlOutputToMessages)(value.generateCopilotResponse.messages);
2168
+ const messages = (0, import_runtime_client_gql5.convertGqlOutputToMessages)(
2169
+ value.generateCopilotResponse.messages
2170
+ );
2094
2171
  let newContent = "";
2095
2172
  for (const message of messages) {
2096
2173
  if (message.isTextMessage()) {
@@ -2141,7 +2218,9 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
2141
2218
  actions: [],
2142
2219
  url: window.location.href
2143
2220
  },
2144
- messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)((0, import_runtime_client_gql5.filterAgentStateMessages)(messages)),
2221
+ messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)(
2222
+ (0, import_runtime_client_gql5.filterAgentStateMessages)(messages)
2223
+ ),
2145
2224
  metadata: {
2146
2225
  requestType: import_runtime_client_gql5.CopilotRequestType.TextareaCompletion
2147
2226
  }
@@ -2191,7 +2270,9 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
2191
2270
  actions: [],
2192
2271
  url: window.location.href
2193
2272
  },
2194
- messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)((0, import_runtime_client_gql5.filterAgentStateMessages)(messages)),
2273
+ messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)(
2274
+ (0, import_runtime_client_gql5.filterAgentStateMessages)(messages)
2275
+ ),
2195
2276
  metadata: {
2196
2277
  requestType: import_runtime_client_gql5.CopilotRequestType.TextareaCompletion
2197
2278
  }
@@ -2208,9 +2289,19 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
2208
2289
  const insertionOrEditingFunction = (0, import_react14.useCallback)(
2209
2290
  (editorState2, insertionPrompt, documents, abortSignal) => __async(this, null, function* () {
2210
2291
  if (editorState2.selectedText === "") {
2211
- return yield insertionFunction(editorState2, insertionPrompt, documents, abortSignal);
2292
+ return yield insertionFunction(
2293
+ editorState2,
2294
+ insertionPrompt,
2295
+ documents,
2296
+ abortSignal
2297
+ );
2212
2298
  } else {
2213
- return yield editingFunction(editorState2, insertionPrompt, documents, abortSignal);
2299
+ return yield editingFunction(
2300
+ editorState2,
2301
+ insertionPrompt,
2302
+ documents,
2303
+ abortSignal
2304
+ );
2214
2305
  }
2215
2306
  }),
2216
2307
  [insertionFunction, editingFunction]
@@ -2223,7 +2314,11 @@ var import_lodash = __toESM(require("lodash.merge"));
2223
2314
  var import_jsx_runtime15 = require("react/jsx-runtime");
2224
2315
  var CopilotTextarea = import_react15.default.forwardRef(
2225
2316
  (props, ref) => {
2226
- const _a = props, { autosuggestionsConfig: autosuggestionsConfigUserSpecified } = _a, forwardedProps = __objRest(_a, ["autosuggestionsConfig"]);
2317
+ const _a = props, {
2318
+ autosuggestionsConfig: autosuggestionsConfigUserSpecified
2319
+ } = _a, forwardedProps = __objRest(_a, [
2320
+ "autosuggestionsConfig"
2321
+ ]);
2227
2322
  const autosuggestionsConfig = (0, import_lodash.default)(
2228
2323
  defaultAutosuggestionsConfig,
2229
2324
  autosuggestionsConfigUserSpecified