@copilotkit/react-textarea 0.19.0-alpha.2 → 0.19.0-alpha.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 (232) hide show
  1. package/.turbo/turbo-build.log +292 -288
  2. package/CHANGELOG.md +17 -0
  3. package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +1870 -33
  4. package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs.map +1 -1
  5. package/dist/components/base-copilot-textarea/render-element.mjs +52 -3
  6. package/dist/components/base-copilot-textarea/render-element.mjs.map +1 -1
  7. package/dist/components/base-copilot-textarea/render-placeholder.mjs +46 -3
  8. package/dist/components/base-copilot-textarea/render-placeholder.mjs.map +1 -1
  9. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +86 -4
  10. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs.map +1 -1
  11. package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +57 -3
  12. package/dist/components/base-copilot-textarea/use-add-branding-css.mjs.map +1 -1
  13. package/dist/components/copilot-textarea/copilot-textarea.mjs +2339 -43
  14. package/dist/components/copilot-textarea/copilot-textarea.mjs.map +1 -1
  15. package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +22 -3
  16. package/dist/components/hovering-toolbar/hovering-editor-provider.mjs.map +1 -1
  17. package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +125 -3
  18. package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs.map +1 -1
  19. package/dist/components/hovering-toolbar/hovering-toolbar.mjs +1015 -16
  20. package/dist/components/hovering-toolbar/hovering-toolbar.mjs.map +1 -1
  21. package/dist/components/hovering-toolbar/text-insertion-prompt-box/{mode-suggestion-appearing.d.ts → hovering-insertion-prompt-box-core.d.ts} +5 -13
  22. package/dist/{chunk-ITZHK3YV.mjs → components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs} +488 -243
  23. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs.map +1 -0
  24. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +734 -11
  25. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs.map +1 -1
  26. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +734 -12
  27. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs.map +1 -1
  28. package/dist/components/index.mjs +2340 -44
  29. package/dist/components/index.mjs.map +1 -1
  30. package/dist/components/manual-ui/chip-with-icon.mjs +5 -6
  31. package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -1
  32. package/dist/components/source-search-box/source-search-box.mjs +323 -9
  33. package/dist/components/source-search-box/source-search-box.mjs.map +1 -1
  34. package/dist/components/ui/button.d.ts +1 -1
  35. package/dist/components/ui/button.mjs +88 -4
  36. package/dist/components/ui/button.mjs.map +1 -1
  37. package/dist/components/ui/card.mjs +53 -7
  38. package/dist/components/ui/card.mjs.map +1 -1
  39. package/dist/components/ui/command.mjs +266 -5
  40. package/dist/components/ui/command.mjs.map +1 -1
  41. package/dist/components/ui/dialog.mjs +164 -4
  42. package/dist/components/ui/dialog.mjs.map +1 -1
  43. package/dist/components/ui/label.mjs +63 -4
  44. package/dist/components/ui/label.mjs.map +1 -1
  45. package/dist/components/ui/separator.mjs +50 -8
  46. package/dist/components/ui/separator.mjs.map +1 -1
  47. package/dist/components/ui/textarea.mjs +48 -7
  48. package/dist/components/ui/textarea.mjs.map +1 -1
  49. package/dist/context/index.mjs +0 -2
  50. package/dist/context/index.mjs.map +1 -1
  51. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +168 -6
  52. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs.map +1 -1
  53. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +168 -4
  54. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs.map +1 -1
  55. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +155 -5
  56. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map +1 -1
  57. package/dist/hooks/index.mjs +0 -2
  58. package/dist/hooks/index.mjs.map +1 -1
  59. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +90 -4
  60. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs.map +1 -1
  61. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +143 -4
  62. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs.map +1 -1
  63. package/dist/hooks/misc/use-autosize-textarea.mjs +15 -3
  64. package/dist/hooks/misc/use-autosize-textarea.mjs.map +1 -1
  65. package/dist/index.css +3 -27
  66. package/dist/index.css.map +1 -1
  67. package/dist/index.mjs +2343 -48
  68. package/dist/index.mjs.map +1 -1
  69. package/dist/lib/debouncer.mjs +51 -3
  70. package/dist/lib/debouncer.mjs.map +1 -1
  71. package/dist/lib/editor-to-text.mjs +43 -3
  72. package/dist/lib/editor-to-text.mjs.map +1 -1
  73. package/dist/lib/get-text-around-cursor.mjs +109 -3
  74. package/dist/lib/get-text-around-cursor.mjs.map +1 -1
  75. package/dist/lib/retry.mjs +17 -3
  76. package/dist/lib/retry.mjs.map +1 -1
  77. package/dist/lib/slatejs-edits/add-autocompletions.mjs +25 -3
  78. package/dist/lib/slatejs-edits/add-autocompletions.mjs.map +1 -1
  79. package/dist/lib/slatejs-edits/clear-autocompletions.mjs +23 -3
  80. package/dist/lib/slatejs-edits/clear-autocompletions.mjs.map +1 -1
  81. package/dist/lib/slatejs-edits/replace-text.mjs +27 -3
  82. package/dist/lib/slatejs-edits/replace-text.mjs.map +1 -1
  83. package/dist/lib/slatejs-edits/with-partial-history.mjs +106 -3
  84. package/dist/lib/slatejs-edits/with-partial-history.mjs.map +1 -1
  85. package/dist/lib/stream-promise-flatten.d.ts +3 -0
  86. package/dist/lib/stream-promise-flatten.mjs +48 -0
  87. package/dist/lib/stream-promise-flatten.mjs.map +1 -0
  88. package/dist/lib/utils.mjs +71 -3
  89. package/dist/lib/utils.mjs.map +1 -1
  90. package/dist/lib/utils.test.mjs +0 -1
  91. package/dist/lib/utils.test.mjs.map +1 -1
  92. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs +0 -2
  93. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs.map +1 -1
  94. package/dist/types/autosuggestions-config/autosuggestions-config.mjs +312 -9
  95. package/dist/types/autosuggestions-config/autosuggestions-config.mjs.map +1 -1
  96. package/dist/types/autosuggestions-config/editing-api-config.mjs +155 -4
  97. package/dist/types/autosuggestions-config/editing-api-config.mjs.map +1 -1
  98. package/dist/types/autosuggestions-config/index.mjs +313 -10
  99. package/dist/types/autosuggestions-config/index.mjs.map +1 -1
  100. package/dist/types/autosuggestions-config/insertions-api-config.mjs +149 -4
  101. package/dist/types/autosuggestions-config/insertions-api-config.mjs.map +1 -1
  102. package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.mjs +71 -3
  103. package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.mjs.map +1 -1
  104. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs +0 -2
  105. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs.map +1 -1
  106. package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.mjs +0 -2
  107. package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.mjs.map +1 -1
  108. package/dist/types/autosuggestions-config/suggestions-api-config.mjs +137 -4
  109. package/dist/types/autosuggestions-config/suggestions-api-config.mjs.map +1 -1
  110. package/dist/types/base/autosuggestion-state.mjs +0 -2
  111. package/dist/types/base/autosuggestion-state.mjs.map +1 -1
  112. package/dist/types/base/autosuggestions-bare-function.mjs +0 -2
  113. package/dist/types/base/autosuggestions-bare-function.mjs.map +1 -1
  114. package/dist/types/base/base-autosuggestions-config.mjs +11 -3
  115. package/dist/types/base/base-autosuggestions-config.mjs.map +1 -1
  116. package/dist/types/base/base-copilot-textarea-props.mjs +0 -2
  117. package/dist/types/base/base-copilot-textarea-props.mjs.map +1 -1
  118. package/dist/types/base/custom-editor.mjs +0 -2
  119. package/dist/types/base/custom-editor.mjs.map +1 -1
  120. package/dist/types/base/editor-autocomplete-state.mjs +17 -4
  121. package/dist/types/base/editor-autocomplete-state.mjs.map +1 -1
  122. package/dist/types/base/index.mjs +11 -4
  123. package/dist/types/base/index.mjs.map +1 -1
  124. package/dist/types/html-copilot-textarea-element.mjs +0 -2
  125. package/dist/types/html-copilot-textarea-element.mjs.map +1 -1
  126. package/dist/types/index.mjs +314 -12
  127. package/dist/types/index.mjs.map +1 -1
  128. package/package.json +3 -3
  129. package/src/components/hovering-toolbar/text-insertion-prompt-box/{mode-suggestion-appearing.tsx → hovering-insertion-prompt-box-core.tsx} +59 -65
  130. package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.tsx +9 -52
  131. package/src/components/source-search-box/source-search-box.tsx +7 -10
  132. package/src/components/ui/command.tsx +1 -1
  133. package/src/lib/stream-promise-flatten.ts +25 -0
  134. package/dist/chunk-2NURR2DX.mjs +0 -47
  135. package/dist/chunk-2NURR2DX.mjs.map +0 -1
  136. package/dist/chunk-3YJ63D5D.mjs +0 -106
  137. package/dist/chunk-3YJ63D5D.mjs.map +0 -1
  138. package/dist/chunk-4S5ZJH3I.mjs +0 -18
  139. package/dist/chunk-4S5ZJH3I.mjs.map +0 -1
  140. package/dist/chunk-55EGOC5T.mjs +0 -87
  141. package/dist/chunk-55EGOC5T.mjs.map +0 -1
  142. package/dist/chunk-5ARCOTW3.mjs +0 -34
  143. package/dist/chunk-5ARCOTW3.mjs.map +0 -1
  144. package/dist/chunk-5EJ5XOGP.mjs +0 -22
  145. package/dist/chunk-5EJ5XOGP.mjs.map +0 -1
  146. package/dist/chunk-5FO6ISW4.mjs +0 -3
  147. package/dist/chunk-5FO6ISW4.mjs.map +0 -1
  148. package/dist/chunk-7SMDOAG2.mjs +0 -201
  149. package/dist/chunk-7SMDOAG2.mjs.map +0 -1
  150. package/dist/chunk-A2RRLD23.mjs +0 -69
  151. package/dist/chunk-A2RRLD23.mjs.map +0 -1
  152. package/dist/chunk-CDB7HFCY.mjs +0 -65
  153. package/dist/chunk-CDB7HFCY.mjs.map +0 -1
  154. package/dist/chunk-CSGFJU3L.mjs +0 -65
  155. package/dist/chunk-CSGFJU3L.mjs.map +0 -1
  156. package/dist/chunk-D7SEV5PR.mjs +0 -12
  157. package/dist/chunk-D7SEV5PR.mjs.map +0 -1
  158. package/dist/chunk-DE5K76I2.mjs +0 -3
  159. package/dist/chunk-DE5K76I2.mjs.map +0 -1
  160. package/dist/chunk-F3MHL6ZY.mjs +0 -25
  161. package/dist/chunk-F3MHL6ZY.mjs.map +0 -1
  162. package/dist/chunk-H4VKQGVU.mjs +0 -3
  163. package/dist/chunk-H4VKQGVU.mjs.map +0 -1
  164. package/dist/chunk-HAFHLU4N.mjs +0 -55
  165. package/dist/chunk-HAFHLU4N.mjs.map +0 -1
  166. package/dist/chunk-ITZHK3YV.mjs.map +0 -1
  167. package/dist/chunk-IU3WTXLQ.mjs +0 -3
  168. package/dist/chunk-IU3WTXLQ.mjs.map +0 -1
  169. package/dist/chunk-IXJ2HCOA.mjs +0 -101
  170. package/dist/chunk-IXJ2HCOA.mjs.map +0 -1
  171. package/dist/chunk-JAFCXEPU.mjs +0 -10
  172. package/dist/chunk-JAFCXEPU.mjs.map +0 -1
  173. package/dist/chunk-KCHYD3EB.mjs +0 -107
  174. package/dist/chunk-KCHYD3EB.mjs.map +0 -1
  175. package/dist/chunk-KGKLUWKW.mjs +0 -47
  176. package/dist/chunk-KGKLUWKW.mjs.map +0 -1
  177. package/dist/chunk-L7VVZH4Q.mjs +0 -3
  178. package/dist/chunk-L7VVZH4Q.mjs.map +0 -1
  179. package/dist/chunk-LNAIMEB2.mjs +0 -34
  180. package/dist/chunk-LNAIMEB2.mjs.map +0 -1
  181. package/dist/chunk-MMVDU6DF.mjs +0 -3
  182. package/dist/chunk-MMVDU6DF.mjs.map +0 -1
  183. package/dist/chunk-MPME5BW2.mjs +0 -59
  184. package/dist/chunk-MPME5BW2.mjs.map +0 -1
  185. package/dist/chunk-MRXNTQOX.mjs +0 -55
  186. package/dist/chunk-MRXNTQOX.mjs.map +0 -1
  187. package/dist/chunk-ND5PXTAW.mjs +0 -17
  188. package/dist/chunk-ND5PXTAW.mjs.map +0 -1
  189. package/dist/chunk-NKW5OU2S.mjs +0 -33
  190. package/dist/chunk-NKW5OU2S.mjs.map +0 -1
  191. package/dist/chunk-O5OWT5GE.mjs +0 -114
  192. package/dist/chunk-O5OWT5GE.mjs.map +0 -1
  193. package/dist/chunk-OD7ZMOVE.mjs +0 -45
  194. package/dist/chunk-OD7ZMOVE.mjs.map +0 -1
  195. package/dist/chunk-OELUUJZY.mjs +0 -16
  196. package/dist/chunk-OELUUJZY.mjs.map +0 -1
  197. package/dist/chunk-OM5WQQOU.mjs +0 -47
  198. package/dist/chunk-OM5WQQOU.mjs.map +0 -1
  199. package/dist/chunk-PF3XRNDB.mjs +0 -44
  200. package/dist/chunk-PF3XRNDB.mjs.map +0 -1
  201. package/dist/chunk-QL2GYGG5.mjs +0 -19
  202. package/dist/chunk-QL2GYGG5.mjs.map +0 -1
  203. package/dist/chunk-RPDVSCLO.mjs +0 -107
  204. package/dist/chunk-RPDVSCLO.mjs.map +0 -1
  205. package/dist/chunk-RQHOUUXQ.mjs +0 -29
  206. package/dist/chunk-RQHOUUXQ.mjs.map +0 -1
  207. package/dist/chunk-UHD44NC5.mjs +0 -101
  208. package/dist/chunk-UHD44NC5.mjs.map +0 -1
  209. package/dist/chunk-VBIJPE3H.mjs +0 -108
  210. package/dist/chunk-VBIJPE3H.mjs.map +0 -1
  211. package/dist/chunk-WADHCMPK.mjs +0 -3
  212. package/dist/chunk-WADHCMPK.mjs.map +0 -1
  213. package/dist/chunk-WJHSY5T6.mjs +0 -3
  214. package/dist/chunk-WJHSY5T6.mjs.map +0 -1
  215. package/dist/chunk-WJYQWL4I.mjs +0 -27
  216. package/dist/chunk-WJYQWL4I.mjs.map +0 -1
  217. package/dist/chunk-XDT7BF3V.mjs +0 -81
  218. package/dist/chunk-XDT7BF3V.mjs.map +0 -1
  219. package/dist/chunk-XHUMROEY.mjs +0 -91
  220. package/dist/chunk-XHUMROEY.mjs.map +0 -1
  221. package/dist/chunk-YQU7WG7T.mjs +0 -83
  222. package/dist/chunk-YQU7WG7T.mjs.map +0 -1
  223. package/dist/chunk-YTOPHPSG.mjs +0 -45
  224. package/dist/chunk-YTOPHPSG.mjs.map +0 -1
  225. package/dist/chunk-YW3REYX6.mjs +0 -23
  226. package/dist/chunk-YW3REYX6.mjs.map +0 -1
  227. package/dist/components/hovering-toolbar/text-insertion-prompt-box/mode-pre-suggestion.d.ts +0 -16
  228. package/dist/components/hovering-toolbar/text-insertion-prompt-box/mode-pre-suggestion.mjs +0 -5
  229. package/dist/components/hovering-toolbar/text-insertion-prompt-box/mode-pre-suggestion.mjs.map +0 -1
  230. package/dist/components/hovering-toolbar/text-insertion-prompt-box/mode-suggestion-appearing.mjs +0 -10
  231. package/dist/components/hovering-toolbar/text-insertion-prompt-box/mode-suggestion-appearing.mjs.map +0 -1
  232. package/src/components/hovering-toolbar/text-insertion-prompt-box/mode-pre-suggestion.tsx +0 -83
@@ -1,45 +1,402 @@
1
- import { use_autosize_textarea_default } from './chunk-ND5PXTAW.mjs';
2
- import { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandSeparator } from './chunk-3YJ63D5D.mjs';
3
- import { Label } from './chunk-5EJ5XOGP.mjs';
4
- import { Button } from './chunk-2NURR2DX.mjs';
5
- import { __objRest, __spreadProps, __spreadValues, __async } from './chunk-MRXNTQOX.mjs';
6
- import { useState, useRef, useEffect } from 'react';
7
- import { Calendar, Smile, Calculator } from 'lucide-react';
8
- import Chip from '@mui/material/Chip';
9
- import Avatar from '@mui/material/Avatar';
10
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ var __async = (__this, __arguments, generator) => {
33
+ return new Promise((resolve, reject) => {
34
+ var fulfilled = (value) => {
35
+ try {
36
+ step(generator.next(value));
37
+ } catch (e) {
38
+ reject(e);
39
+ }
40
+ };
41
+ var rejected = (value) => {
42
+ try {
43
+ step(generator.throw(value));
44
+ } catch (e) {
45
+ reject(e);
46
+ }
47
+ };
48
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
49
+ step((generator = generator.apply(__this, __arguments)).next());
50
+ });
51
+ };
11
52
 
12
- var SuggestionAppearing = ({
13
- performInsertion,
14
- state,
15
- goBack,
16
- insertionOrEditingFunction,
17
- onGeneratedText
18
- }) => {
19
- useState([state.initialSuggestion]);
20
- const [editSuggestion, setEditSuggestion] = useState("");
21
- const [suggestionIsLoading, setSuggestionIsLoading] = useState(false);
22
- const [adjustmentPrompt, setAdjustmentPrompt] = useState("");
23
- const [adjustmentLoading, setAdjustmentLoading] = useState(false);
24
- const suggestionTextAreaRef = useRef(null);
53
+ // src/hooks/misc/use-autosize-textarea.tsx
54
+ import { useEffect } from "react";
55
+ var useAutosizeTextArea = (textAreaRef, value) => {
56
+ useEffect(() => {
57
+ if (textAreaRef.current !== null) {
58
+ textAreaRef.current.style.height = "0px";
59
+ const scrollHeight = textAreaRef.current.scrollHeight;
60
+ textAreaRef.current.style.height = scrollHeight + "px";
61
+ }
62
+ }, [textAreaRef, value]);
63
+ };
64
+ var use_autosize_textarea_default = useAutosizeTextArea;
65
+
66
+ // src/components/source-search-box/source-search-box.tsx
67
+ import { useState } from "react";
68
+
69
+ // src/components/ui/command.tsx
70
+ import * as React from "react";
71
+ import { Command as CommandPrimitive } from "cmdk";
72
+
73
+ // src/lib/utils.ts
74
+ import { clsx } from "clsx";
75
+ import { customAlphabet } from "nanoid";
76
+ import { twMerge } from "tailwind-merge";
77
+ function cn(...inputs) {
78
+ return twMerge(clsx(inputs));
79
+ }
80
+ var nanoid = customAlphabet(
81
+ "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
82
+ 7
83
+ );
84
+
85
+ // src/components/ui/command.tsx
86
+ import { jsx } from "react/jsx-runtime";
87
+ "use client";
88
+ var Command = React.forwardRef((_a, ref) => {
89
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
90
+ return /* @__PURE__ */ jsx(CommandPrimitive, __spreadValues({
91
+ ref,
92
+ className: cn(
93
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
94
+ className
95
+ )
96
+ }, props));
97
+ });
98
+ Command.displayName = CommandPrimitive.displayName;
99
+ var CommandInput = React.forwardRef((_a, ref) => {
100
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
101
+ return /* @__PURE__ */ jsx("div", {
102
+ className: "flex items-center border-b px-3",
103
+ "cmdk-input-wrapper": "",
104
+ children: /* @__PURE__ */ jsx(CommandPrimitive.Input, __spreadValues({
105
+ ref,
106
+ className: cn(
107
+ "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
108
+ className
109
+ )
110
+ }, props))
111
+ });
112
+ });
113
+ CommandInput.displayName = CommandPrimitive.Input.displayName;
114
+ var CommandList = React.forwardRef((_a, ref) => {
115
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
116
+ return /* @__PURE__ */ jsx(CommandPrimitive.List, __spreadValues({
117
+ ref,
118
+ className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)
119
+ }, props));
120
+ });
121
+ CommandList.displayName = CommandPrimitive.List.displayName;
122
+ var CommandEmpty = React.forwardRef((props, ref) => /* @__PURE__ */ jsx(CommandPrimitive.Empty, __spreadValues({
123
+ ref,
124
+ className: "py-6 text-center text-sm"
125
+ }, props)));
126
+ CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
127
+ var CommandGroup = React.forwardRef((_a, ref) => {
128
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
129
+ return /* @__PURE__ */ jsx(CommandPrimitive.Group, __spreadValues({
130
+ ref,
131
+ className: cn(
132
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
133
+ className
134
+ )
135
+ }, props));
136
+ });
137
+ CommandGroup.displayName = CommandPrimitive.Group.displayName;
138
+ var CommandSeparator = React.forwardRef((_a, ref) => {
139
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
140
+ return /* @__PURE__ */ jsx(CommandPrimitive.Separator, __spreadValues({
141
+ ref,
142
+ className: cn("-mx-1 h-px bg-border", className)
143
+ }, props));
144
+ });
145
+ CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
146
+ var CommandItem = React.forwardRef((_a, ref) => {
147
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
148
+ return /* @__PURE__ */ jsx(CommandPrimitive.Item, __spreadValues({
149
+ ref,
150
+ className: cn(
151
+ "relative flex cursor-default select-none items-center rounded-sm text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
152
+ className
153
+ )
154
+ }, props));
155
+ });
156
+ CommandItem.displayName = CommandPrimitive.Item.displayName;
157
+ var CommandShortcut = (_a) => {
158
+ var _b = _a, {
159
+ className
160
+ } = _b, props = __objRest(_b, [
161
+ "className"
162
+ ]);
163
+ return /* @__PURE__ */ jsx("span", __spreadValues({
164
+ className: cn(
165
+ "ml-auto text-xs tracking-widest text-muted-foreground",
166
+ className
167
+ )
168
+ }, props));
169
+ };
170
+ CommandShortcut.displayName = "CommandShortcut";
171
+
172
+ // src/components/source-search-box/source-search-box.tsx
173
+ import {
174
+ Calculator,
175
+ Calendar,
176
+ Smile
177
+ } from "lucide-react";
178
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
179
+ function SourceSearchBox(props) {
180
+ const [selectedValue, setSelectedValue] = useState("");
181
+ return /* @__PURE__ */ jsxs(Command, {
182
+ className: "rounded-lg border shadow-md",
183
+ value: selectedValue,
184
+ onValueChange: (value) => {
185
+ setSelectedValue(value);
186
+ },
187
+ filter: (value, search) => {
188
+ if (props.searchTerm === "")
189
+ return 1;
190
+ if (value.startsWith(props.searchTerm))
191
+ return 1;
192
+ return 0;
193
+ },
194
+ children: [
195
+ /* @__PURE__ */ jsx2(CommandInput, {
196
+ value: props.searchTerm,
197
+ className: "rounded-t-lg hidden",
198
+ placeholder: "Search for a command..."
199
+ }),
200
+ /* @__PURE__ */ jsxs(CommandList, {
201
+ children: [
202
+ /* @__PURE__ */ jsx2(CommandEmpty, {
203
+ children: "No results found."
204
+ }),
205
+ /* @__PURE__ */ jsx2(CommandGroup, {
206
+ heading: "Recents",
207
+ children: props.recentFiles.map((filePointer) => {
208
+ return /* @__PURE__ */ jsx2(CommandItem, {
209
+ value: filePointer.name,
210
+ onSelect: (value) => {
211
+ console.log(filePointer.name);
212
+ props.onSelectedFile(filePointer);
213
+ },
214
+ children: /* @__PURE__ */ jsxs("div", {
215
+ className: "flex flex-row gap-3 items-center",
216
+ children: [
217
+ /* @__PURE__ */ jsx2(Logo, {
218
+ size: "30px",
219
+ children: /* @__PURE__ */ jsx2(IconForFilePointer, {
220
+ filePointer,
221
+ className: "mx-auto my-auto"
222
+ })
223
+ }),
224
+ filePointer.name
225
+ ]
226
+ })
227
+ }, `word-${filePointer.sourceApplication}.${filePointer.name}`);
228
+ })
229
+ }),
230
+ /* @__PURE__ */ jsxs(CommandGroup, {
231
+ heading: "Suggestions",
232
+ children: [
233
+ /* @__PURE__ */ jsxs(CommandItem, {
234
+ onSelect: (value) => {
235
+ console.log(value);
236
+ console.log(value);
237
+ },
238
+ children: [
239
+ /* @__PURE__ */ jsx2(Calendar, {
240
+ className: "mr-2 h-4 w-4"
241
+ }),
242
+ /* @__PURE__ */ jsx2("span", {
243
+ children: "Calendar"
244
+ })
245
+ ]
246
+ }),
247
+ /* @__PURE__ */ jsxs(CommandItem, {
248
+ children: [
249
+ /* @__PURE__ */ jsx2(Smile, {
250
+ className: "mr-2 h-4 w-4"
251
+ }),
252
+ /* @__PURE__ */ jsx2("span", {
253
+ children: "Search Emoji"
254
+ })
255
+ ]
256
+ }),
257
+ /* @__PURE__ */ jsxs(CommandItem, {
258
+ children: [
259
+ /* @__PURE__ */ jsx2(Calculator, {
260
+ className: "mr-2 h-4 w-4"
261
+ }),
262
+ /* @__PURE__ */ jsx2("span", {
263
+ children: "Calculator"
264
+ })
265
+ ]
266
+ })
267
+ ]
268
+ }),
269
+ /* @__PURE__ */ jsx2(CommandSeparator, {})
270
+ ]
271
+ })
272
+ ]
273
+ });
274
+ }
275
+ function Logo({
276
+ children,
277
+ size = "30px"
278
+ }) {
279
+ return /* @__PURE__ */ jsx2("div", {
280
+ className: "flex items-center justify-center",
281
+ style: { width: size, height: size },
282
+ children
283
+ });
284
+ }
285
+
286
+ // src/components/ui/button.tsx
287
+ import * as React2 from "react";
288
+ import { Slot } from "@radix-ui/react-slot";
289
+ import { cva } from "class-variance-authority";
290
+ import { jsx as jsx3 } from "react/jsx-runtime";
291
+ var buttonVariants = cva(
292
+ "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
293
+ {
294
+ variants: {
295
+ variant: {
296
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
297
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
298
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
299
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
300
+ ghost: "hover:bg-accent hover:text-accent-foreground",
301
+ link: "text-primary underline-offset-4 hover:underline"
302
+ },
303
+ size: {
304
+ default: "h-10 px-4 py-2",
305
+ sm: "h-9 rounded-md px-3",
306
+ lg: "h-11 rounded-md px-8",
307
+ icon: "h-10 w-10"
308
+ }
309
+ },
310
+ defaultVariants: {
311
+ variant: "default",
312
+ size: "default"
313
+ }
314
+ }
315
+ );
316
+ var Button = React2.forwardRef(
317
+ (_a, ref) => {
318
+ var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest(_b, ["className", "variant", "size", "asChild"]);
319
+ const Comp = asChild ? Slot : "button";
320
+ return /* @__PURE__ */ jsx3(Comp, __spreadValues({
321
+ className: cn(buttonVariants({ variant, size, className })),
322
+ ref
323
+ }, props));
324
+ }
325
+ );
326
+ Button.displayName = "Button";
327
+
328
+ // src/components/ui/label.tsx
329
+ import * as React3 from "react";
330
+ import * as LabelPrimitive from "@radix-ui/react-label";
331
+ import { cva as cva2 } from "class-variance-authority";
332
+ import { jsx as jsx4 } from "react/jsx-runtime";
333
+ "use client";
334
+ var labelVariants = cva2(
335
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
336
+ );
337
+ var Label = React3.forwardRef((_a, ref) => {
338
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
339
+ return /* @__PURE__ */ jsx4(LabelPrimitive.Root, __spreadValues({
340
+ ref,
341
+ className: cn(labelVariants(), className)
342
+ }, props));
343
+ });
344
+ Label.displayName = LabelPrimitive.Root.displayName;
345
+
346
+ // src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
347
+ import { useEffect as useEffect2, useRef, useState as useState2 } from "react";
348
+ import Chip from "@mui/material/Chip";
349
+ import Avatar from "@mui/material/Avatar";
350
+
351
+ // src/lib/stream-promise-flatten.ts
352
+ function streamPromiseFlatten(promise) {
353
+ return new ReadableStream({
354
+ start(controller) {
355
+ return __async(this, null, function* () {
356
+ try {
357
+ const stream = yield promise;
358
+ const reader = stream.getReader();
359
+ while (true) {
360
+ const { done, value } = yield reader.read();
361
+ if (done) {
362
+ controller.close();
363
+ return;
364
+ }
365
+ controller.enqueue(value);
366
+ }
367
+ } catch (error) {
368
+ controller.error(error);
369
+ }
370
+ });
371
+ }
372
+ });
373
+ }
374
+
375
+ // src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
376
+ import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
377
+ var HoveringInsertionPromptBoxCore = ({ performInsertion, state, insertionOrEditingFunction }) => {
378
+ const [editSuggestion, setEditSuggestion] = useState2("");
379
+ const [suggestionIsLoading, setSuggestionIsLoading] = useState2(false);
380
+ const [adjustmentPrompt, setAdjustmentPrompt] = useState2("");
381
+ const [generatingSuggestion, setGeneratingSuggestion] = useState2(null);
25
382
  const adjustmentTextAreaRef = useRef(null);
26
- const [filePointers, setFilePointers] = useState([]);
383
+ const suggestionTextAreaRef = useRef(null);
384
+ const [filePointers, setFilePointers] = useState2([]);
27
385
  use_autosize_textarea_default(suggestionTextAreaRef, editSuggestion || "");
28
386
  use_autosize_textarea_default(adjustmentTextAreaRef, adjustmentPrompt || "");
29
- useEffect(() => {
30
- var _a, _b;
31
- (_a = suggestionTextAreaRef.current) == null ? void 0 : _a.focus();
32
- (_b = suggestionTextAreaRef.current) == null ? void 0 : _b.setSelectionRange(
33
- editSuggestion.length,
34
- editSuggestion.length
35
- );
387
+ useEffect2(() => {
388
+ var _a;
389
+ (_a = adjustmentTextAreaRef.current) == null ? void 0 : _a.focus();
36
390
  }, []);
37
- useEffect(() => {
38
- if (state.initialSuggestion.generatingSuggestion.locked) {
391
+ useEffect2(() => {
392
+ if (!generatingSuggestion) {
393
+ return;
394
+ }
395
+ if (generatingSuggestion.locked) {
39
396
  return;
40
397
  }
41
398
  setEditSuggestion("");
42
- const reader = state.initialSuggestion.generatingSuggestion.getReader();
399
+ const reader = generatingSuggestion.getReader();
43
400
  const read = () => __async(void 0, null, function* () {
44
401
  setSuggestionIsLoading(true);
45
402
  while (true) {
@@ -68,33 +425,39 @@ var SuggestionAppearing = ({
68
425
  });
69
426
  releaseLockIfNotClosed();
70
427
  };
71
- }, [state]);
72
- const generateAdjustment = () => __async(void 0, null, function* () {
428
+ }, [generatingSuggestion]);
429
+ const begingGeneratingAdjustment = () => __async(void 0, null, function* () {
73
430
  if (!adjustmentPrompt.trim()) {
74
431
  return;
75
432
  }
76
- setAdjustmentLoading(true);
77
- const adjustmentSuggestionTextStream = yield insertionOrEditingFunction(
78
- __spreadProps(__spreadValues({}, state.initialSuggestion.editorState), {
79
- selectedText: editSuggestion
80
- }),
433
+ let editorState = state.editorState;
434
+ if (editSuggestion !== "") {
435
+ editorState.selectedText = editSuggestion;
436
+ }
437
+ const adjustmentSuggestionTextStreamPromise = insertionOrEditingFunction(
438
+ editorState,
81
439
  adjustmentPrompt,
82
440
  new AbortController().signal
83
441
  );
84
- setAdjustmentLoading(false);
85
- onGeneratedText(adjustmentSuggestionTextStream);
442
+ const adjustmentSuggestionTextStream = streamPromiseFlatten(
443
+ adjustmentSuggestionTextStreamPromise
444
+ );
445
+ setGeneratingSuggestion(adjustmentSuggestionTextStream);
86
446
  });
87
- const showLoading = suggestionIsLoading || adjustmentLoading;
88
- const AdjustmentPromptComponent = /* @__PURE__ */ jsxs(Fragment, {
447
+ const isLoading = suggestionIsLoading;
448
+ const textToEdit = editSuggestion || state.editorState.selectedText;
449
+ const adjustmentLabel = textToEdit === "" ? "Describe the text you want to insert" : "Describe adjustments to the suggested text";
450
+ const placeholder = textToEdit === "" ? "e.g. 'summarize the client's top 3 pain-points from @CallTranscript'" : "e.g. 'make it more formal', 'be more specific', ...";
451
+ const AdjustmentPromptComponent = /* @__PURE__ */ jsxs2(Fragment, {
89
452
  children: [
90
- /* @__PURE__ */ jsx(Label, {
453
+ /* @__PURE__ */ jsx5(Label, {
91
454
  className: "",
92
- children: "Describe adjustments to the suggested text:"
455
+ children: adjustmentLabel
93
456
  }),
94
- /* @__PURE__ */ jsxs("div", {
457
+ /* @__PURE__ */ jsxs2("div", {
95
458
  className: "relative w-full flex items-center",
96
459
  children: [
97
- /* @__PURE__ */ jsx("textarea", {
460
+ /* @__PURE__ */ jsx5("textarea", {
98
461
  disabled: suggestionIsLoading,
99
462
  ref: adjustmentTextAreaRef,
100
463
  value: adjustmentPrompt,
@@ -105,18 +468,18 @@ var SuggestionAppearing = ({
105
468
  setAdjustmentPrompt(adjustmentPrompt + "\n");
106
469
  } else if (e.key === "Enter") {
107
470
  e.preventDefault();
108
- generateAdjustment();
471
+ begingGeneratingAdjustment();
109
472
  }
110
473
  },
111
- placeholder: '"make it more formal", "be more specific", ...',
474
+ placeholder,
112
475
  style: { minHeight: "3rem" },
113
476
  className: "w-full bg-slate-100 h-auto h-min-14 text-sm p-2 rounded-md resize-none overflow-visible focus:outline-none focus:ring-0 focus:border-non pr-[3rem]",
114
477
  rows: 1
115
478
  }),
116
- /* @__PURE__ */ jsx("button", {
117
- onClick: generateAdjustment,
479
+ /* @__PURE__ */ jsx5("button", {
480
+ onClick: begingGeneratingAdjustment,
118
481
  className: "absolute right-2 bg-blue-500 text-white w-8 h-8 rounded-full flex items-center justify-center",
119
- children: /* @__PURE__ */ jsx("i", {
482
+ children: /* @__PURE__ */ jsx5("i", {
120
483
  className: "material-icons",
121
484
  children: "arrow_forward"
122
485
  })
@@ -125,23 +488,23 @@ var SuggestionAppearing = ({
125
488
  })
126
489
  ]
127
490
  });
128
- const SuggestionComponent = /* @__PURE__ */ jsxs(Fragment, {
491
+ const SuggestionComponent = /* @__PURE__ */ jsxs2(Fragment, {
129
492
  children: [
130
- /* @__PURE__ */ jsxs("div", {
493
+ /* @__PURE__ */ jsxs2("div", {
131
494
  className: "flex justify-between items-end w-full",
132
495
  children: [
133
- /* @__PURE__ */ jsx(Label, {
496
+ /* @__PURE__ */ jsx5(Label, {
134
497
  className: "mt-4",
135
498
  children: "Suggested:"
136
499
  }),
137
- /* @__PURE__ */ jsx("div", {
500
+ /* @__PURE__ */ jsx5("div", {
138
501
  className: "ml-auto",
139
- children: showLoading && /* @__PURE__ */ jsx("div", {
502
+ children: isLoading && /* @__PURE__ */ jsx5("div", {
140
503
  className: "flex justify-center items-center",
141
- children: /* @__PURE__ */ jsx("div", {
504
+ children: /* @__PURE__ */ jsx5("div", {
142
505
  className: "inline-block h-4 w-4 animate-spin rounded-full border-4 border-solid border-current border-r-transparent align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite]",
143
506
  role: "status",
144
- children: /* @__PURE__ */ jsx("span", {
507
+ children: /* @__PURE__ */ jsx5("span", {
145
508
  className: "!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]",
146
509
  children: "Loading..."
147
510
  })
@@ -150,58 +513,43 @@ var SuggestionAppearing = ({
150
513
  })
151
514
  ]
152
515
  }),
153
- /* @__PURE__ */ jsx("textarea", {
516
+ /* @__PURE__ */ jsx5("textarea", {
154
517
  ref: suggestionTextAreaRef,
155
518
  value: editSuggestion,
156
- disabled: adjustmentLoading,
519
+ disabled: suggestionIsLoading,
157
520
  onChange: (e) => setEditSuggestion(e.target.value),
158
521
  className: "w-full text-base p-2 border border-gray-300 rounded-md resize-none bg-green-50",
159
522
  style: { overflow: "auto", maxHeight: "10em" }
160
523
  })
161
524
  ]
162
525
  });
163
- const SubmitComponent = /* @__PURE__ */ jsxs("div", {
526
+ const SubmitComponent = /* @__PURE__ */ jsx5("div", {
164
527
  className: "flex w-full gap-4 justify-start",
165
- children: [
166
- /* @__PURE__ */ jsxs(Button, {
167
- className: " bg-gray-300",
168
- onClick: () => {
169
- goBack();
170
- },
171
- children: [
172
- /* @__PURE__ */ jsx("i", {
173
- className: "material-icons",
174
- children: "arrow_back"
175
- }),
176
- " Back"
177
- ]
178
- }),
179
- /* @__PURE__ */ jsxs(Button, {
180
- className: " bg-green-700 text-white",
181
- onClick: () => {
182
- performInsertion(editSuggestion);
183
- },
184
- children: [
185
- "Insert ",
186
- /* @__PURE__ */ jsx("i", {
187
- className: "material-icons",
188
- children: "check"
189
- })
190
- ]
191
- })
192
- ]
528
+ children: /* @__PURE__ */ jsxs2(Button, {
529
+ className: " bg-green-700 text-white",
530
+ onClick: () => {
531
+ performInsertion(editSuggestion);
532
+ },
533
+ children: [
534
+ "Insert ",
535
+ /* @__PURE__ */ jsx5("i", {
536
+ className: "material-icons",
537
+ children: "check"
538
+ })
539
+ ]
540
+ })
193
541
  });
194
542
  const sourceSearchCandidate = adjustmentPrompt.split(" ").pop();
195
543
  const sourceSearchWord = (sourceSearchCandidate == null ? void 0 : sourceSearchCandidate.startsWith("@")) ? sourceSearchCandidate.slice(1) : void 0;
196
- return /* @__PURE__ */ jsxs("div", {
544
+ return /* @__PURE__ */ jsxs2("div", {
197
545
  className: "w-full flex flex-col items-start relative gap-2",
198
546
  children: [
199
547
  AdjustmentPromptComponent,
200
- filePointers.length > 0 && /* @__PURE__ */ jsx(IncludedFilesPreview, {
548
+ filePointers.length > 0 && /* @__PURE__ */ jsx5(IncludedFilesPreview, {
201
549
  includedFiles: filePointers,
202
550
  setIncludedFiles: setFilePointers
203
551
  }),
204
- sourceSearchWord !== void 0 && /* @__PURE__ */ jsx(SourceSearchBox, {
552
+ sourceSearchWord !== void 0 && /* @__PURE__ */ jsx5(SourceSearchBox, {
205
553
  searchTerm: sourceSearchWord,
206
554
  recentFiles: mockFiles,
207
555
  onSelectedFile: (filePointer) => {
@@ -213,8 +561,8 @@ var SuggestionAppearing = ({
213
561
  (_a = adjustmentTextAreaRef.current) == null ? void 0 : _a.focus();
214
562
  }
215
563
  }),
216
- SuggestionComponent,
217
- SubmitComponent
564
+ generatingSuggestion ? SuggestionComponent : null,
565
+ generatingSuggestion ? SubmitComponent : null
218
566
  ]
219
567
  });
220
568
  };
@@ -222,33 +570,39 @@ var IncludedFilesPreview = ({
222
570
  includedFiles,
223
571
  setIncludedFiles
224
572
  }) => {
225
- return /* @__PURE__ */ jsx("div", {
226
- className: "flex flex-col gap-2",
227
- children: /* @__PURE__ */ jsx("div", {
228
- className: "flex flex-wrap gap-2",
229
- children: includedFiles.map((filePointer, index) => {
230
- return /* @__PURE__ */ jsx(FileChipPreview, {
231
- filePointer,
232
- onDelete: () => {
233
- setIncludedFiles(
234
- (prev) => prev.filter((fp) => fp !== filePointer)
235
- );
236
- }
237
- }, `file-${filePointer.sourceApplication}.${filePointer.name}`);
573
+ return /* @__PURE__ */ jsxs2("div", {
574
+ className: "flex flex-col gap-2 mt-2",
575
+ children: [
576
+ /* @__PURE__ */ jsx5(Label, {
577
+ className: "",
578
+ children: "Included context:"
579
+ }),
580
+ /* @__PURE__ */ jsx5("div", {
581
+ className: "flex flex-wrap gap-2",
582
+ children: includedFiles.map((filePointer, index) => {
583
+ return /* @__PURE__ */ jsx5(FileChipPreview, {
584
+ filePointer,
585
+ onDelete: () => {
586
+ setIncludedFiles(
587
+ (prev) => prev.filter((fp) => fp !== filePointer)
588
+ );
589
+ }
590
+ }, `file-${filePointer.sourceApplication}.${filePointer.name}`);
591
+ })
238
592
  })
239
- })
593
+ ]
240
594
  });
241
595
  };
242
596
  var FileChipPreview = ({
243
597
  filePointer,
244
598
  onDelete
245
599
  }) => {
246
- return /* @__PURE__ */ jsx(Chip, {
600
+ return /* @__PURE__ */ jsx5(Chip, {
247
601
  label: filePointer.name,
248
602
  onDelete,
249
- avatar: /* @__PURE__ */ jsx(Avatar, {
603
+ avatar: /* @__PURE__ */ jsx5(Avatar, {
250
604
  sx: { backgroundColor: "transparent" },
251
- children: /* @__PURE__ */ jsx(IconForFilePointer, {
605
+ children: /* @__PURE__ */ jsx5(IconForFilePointer, {
252
606
  filePointer,
253
607
  className: "w-4 h-4 object-contain"
254
608
  })
@@ -260,53 +614,53 @@ function IconForFilePointer({
260
614
  className
261
615
  }) {
262
616
  if (filePointer.sourceApplication === "Salesforce") {
263
- return /* @__PURE__ */ jsx(IconSalesforce, {
617
+ return /* @__PURE__ */ jsx5(IconSalesforce, {
264
618
  className
265
619
  });
266
620
  } else {
267
- return /* @__PURE__ */ jsx(IconSalesforce, {
621
+ return /* @__PURE__ */ jsx5(IconSalesforce, {
268
622
  className
269
623
  });
270
624
  }
271
625
  }
272
626
  function IconSalesforce(_a) {
273
- var _b = _a, props = __objRest(_b, ["className"]);
274
- return /* @__PURE__ */ jsxs("svg", __spreadProps(__spreadValues({
627
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
628
+ return /* @__PURE__ */ jsxs2("svg", __spreadProps(__spreadValues({
275
629
  xmlns: "http://www.w3.org/2000/svg",
276
630
  xmlnsXlink: "http://www.w3.org/1999/xlink",
277
631
  preserveAspectRatio: "xMidYMid meet",
278
632
  viewBox: "0 0 273 191"
279
633
  }, props), {
280
634
  children: [
281
- /* @__PURE__ */ jsx("title", {
635
+ /* @__PURE__ */ jsx5("title", {
282
636
  children: "Salesforce.com logo"
283
637
  }),
284
- /* @__PURE__ */ jsx("defs", {
285
- children: /* @__PURE__ */ jsx("path", {
638
+ /* @__PURE__ */ jsx5("defs", {
639
+ children: /* @__PURE__ */ jsx5("path", {
286
640
  id: "a",
287
641
  d: "M.06.5h272v190H.06z"
288
642
  })
289
643
  }),
290
- /* @__PURE__ */ jsxs("g", {
644
+ /* @__PURE__ */ jsxs2("g", {
291
645
  fillRule: "evenodd",
292
646
  children: [
293
- /* @__PURE__ */ jsx("mask", {
647
+ /* @__PURE__ */ jsx5("mask", {
294
648
  id: "b",
295
649
  fill: "#fff",
296
- children: /* @__PURE__ */ jsx("use", {
650
+ children: /* @__PURE__ */ jsx5("use", {
297
651
  xlinkHref: "#a"
298
652
  })
299
653
  }),
300
- /* @__PURE__ */ jsx("path", {
654
+ /* @__PURE__ */ jsx5("path", {
301
655
  fill: "#00A1E0",
302
656
  d: "M113 21.3c8.78-9.14 21-14.8 34.5-14.8 18 0 33.6 10 42 24.9a58 58 0 0 1 23.7-5.05c32.4 0 58.7 26.5 58.7 59.2s-26.3 59.2-58.7 59.2c-3.96 0-7.82-.398-11.6-1.15-7.35 13.1-21.4 22-37.4 22a42.7 42.7 0 0 1-18.8-4.32c-7.45 17.5-24.8 29.8-45 29.8-21.1 0-39-13.3-45.9-32a45.1 45.1 0 0 1-9.34.972c-25.1 0-45.4-20.6-45.4-45.9 0-17 9.14-31.8 22.7-39.8a52.6 52.6 0 0 1-4.35-21c0-29.2 23.7-52.8 52.9-52.8 17.1 0 32.4 8.15 42 20.8",
303
657
  mask: "url(#b)"
304
658
  }),
305
- /* @__PURE__ */ jsx("path", {
659
+ /* @__PURE__ */ jsx5("path", {
306
660
  fill: "#FFFFFE",
307
661
  d: "M39.4 99.3c-.171.446.061.539.116.618.511.37 1.03.638 1.55.939 2.78 1.47 5.4 1.9 8.14 1.9 5.58 0 9.05-2.97 9.05-7.75v-.094c0-4.42-3.92-6.03-7.58-7.18l-.479-.155c-2.77-.898-5.16-1.68-5.16-3.5v-.093c0-1.56 1.4-2.71 3.56-2.71 2.4 0 5.26.799 7.09 1.81 0 0 .542.35.739-.173.107-.283 1.04-2.78 1.14-3.06.106-.293-.08-.514-.271-.628-2.1-1.28-5-2.15-8-2.15l-.557.002c-5.11 0-8.68 3.09-8.68 7.51v.095c0 4.66 3.94 6.18 7.62 7.23l.592.184c2.68.824 5 1.54 5 3.42v.094c0 1.73-1.51 3.02-3.93 3.02-.941 0-3.94-.016-7.19-2.07-.393-.229-.617-.394-.92-.579-.16-.097-.56-.272-.734.252l-1.1 3.06m81.7 0c-.171.446.061.539.118.618.509.37 1.03.638 1.55.939 2.78 1.47 5.4 1.9 8.14 1.9 5.58 0 9.05-2.97 9.05-7.75v-.094c0-4.42-3.91-6.03-7.58-7.18l-.479-.155c-2.77-.898-5.16-1.68-5.16-3.5v-.093c0-1.56 1.4-2.71 3.56-2.71 2.4 0 5.25.799 7.09 1.81 0 0 .542.35.74-.173.106-.283 1.04-2.78 1.13-3.06.107-.293-.08-.514-.27-.628-2.1-1.28-5-2.15-8-2.15l-.558.002c-5.11 0-8.68 3.09-8.68 7.51v.095c0 4.66 3.94 6.18 7.62 7.23l.591.184c2.69.824 5 1.54 5 3.42v.094c0 1.73-1.51 3.02-3.93 3.02-.943 0-3.95-.016-7.19-2.07-.393-.229-.623-.387-.921-.579-.101-.064-.572-.248-.733.252l-1.1 3.06m55.8-9.36c0 2.7-.504 4.83-1.49 6.34-.984 1.49-2.47 2.22-4.54 2.22s-3.55-.724-4.52-2.21c-.977-1.5-1.47-3.64-1.47-6.34 0-2.7.496-4.82 1.47-6.31.968-1.48 2.44-2.19 4.52-2.19s3.56.717 4.54 2.19c.992 1.49 1.49 3.61 1.49 6.31m4.66-5.01c-.459-1.55-1.17-2.91-2.12-4.05a10.151 10.151 0 0 0-3.58-2.72c-1.42-.665-3.1-1-5-1s-3.57.337-5 1c-1.42.664-2.63 1.58-3.58 2.72-.948 1.14-1.66 2.5-2.12 4.05-.455 1.54-.686 3.22-.686 5.01 0 1.79.231 3.47.686 5.01.457 1.55 1.17 2.91 2.12 4.05.951 1.14 2.16 2.05 3.58 2.7 1.43.648 3.11.978 5 .978 1.89 0 3.57-.33 4.99-.978 1.42-.648 2.63-1.56 3.58-2.7.949-1.14 1.66-2.5 2.12-4.05.454-1.54.685-3.22.685-5.01 0-1.78-.231-3.47-.685-5.01m38.3 12.8c-.153-.453-.595-.282-.595-.282-.677.259-1.4.499-2.17.619-.776.122-1.64.183-2.55.183-2.25 0-4.05-.671-5.33-2-1.29-1.33-2.01-3.47-2-6.37.007-2.64.645-4.62 1.79-6.14 1.13-1.5 2.87-2.28 5.17-2.28 1.92 0 3.39.223 4.93.705 0 0 .365.159.54-.322.409-1.13.711-1.94 1.15-3.18.124-.355-.18-.505-.291-.548-.604-.236-2.03-.623-3.11-.786-1.01-.154-2.18-.234-3.5-.234-1.96 0-3.7.335-5.19.999-1.49.663-2.75 1.58-3.75 2.72-1 1.14-1.76 2.5-2.27 4.05-.505 1.54-.76 3.23-.76 5.02 0 3.86 1.04 6.99 3.1 9.28 2.06 2.3 5.16 3.46 9.2 3.46 2.39 0 4.84-.483 6.6-1.18 0 0 .336-.162.19-.554l-1.15-3.16m8.15-10.4c.223-1.5.634-2.75 1.28-3.72.967-1.48 2.44-2.29 4.51-2.29s3.44.814 4.42 2.29c.65.975.934 2.27 1.04 3.72l-11.3-.002zm15.7-3.3c-.397-1.49-1.38-3-2.02-3.69-1.02-1.09-2.01-1.86-3-2.28a11.5 11.5 0 0 0-4.52-.917c-1.97 0-3.76.333-5.21 1.01-1.45.682-2.67 1.61-3.63 2.77-.959 1.16-1.68 2.53-2.14 4.1-.46 1.55-.692 3.25-.692 5.03 0 1.82.241 3.51.715 5.04.479 1.54 1.25 2.89 2.29 4.01 1.04 1.13 2.37 2.01 3.97 2.63 1.59.615 3.52.934 5.73.927 4.56-.015 6.96-1.03 7.94-1.58.175-.098.34-.267.134-.754l-1.03-2.89c-.158-.431-.594-.275-.594-.275-1.13.422-2.73 1.18-6.48 1.17-2.45-.004-4.26-.727-5.4-1.86-1.16-1.16-1.74-2.85-1.83-5.25l15.8.012s.416-.004.459-.41c.017-.168.541-3.24-.471-6.79zm-142 3.3c.223-1.5.635-2.75 1.28-3.72.968-1.48 2.44-2.29 4.51-2.29s3.44.814 4.42 2.29c.649.975.933 2.27 1.04 3.72l-11.3-.002zm15.7-3.3c-.396-1.49-1.38-3-2.02-3.69-1.02-1.09-2.01-1.86-3-2.28a11.5 11.5 0 0 0-4.52-.917c-1.97 0-3.76.333-5.21 1.01-1.45.682-2.67 1.61-3.63 2.77-.957 1.16-1.68 2.53-2.14 4.1-.459 1.55-.69 3.25-.69 5.03 0 1.82.239 3.51.716 5.04.478 1.54 1.25 2.89 2.28 4.01 1.04 1.13 2.37 2.01 3.97 2.63 1.59.615 3.51.934 5.73.927 4.56-.015 6.96-1.03 7.94-1.58.174-.098.34-.267.133-.754l-1.03-2.89c-.159-.431-.595-.275-.595-.275-1.13.422-2.73 1.18-6.48 1.17-2.44-.004-4.26-.727-5.4-1.86-1.16-1.16-1.74-2.85-1.83-5.25l15.8.012s.416-.004.459-.41c.017-.168.541-3.24-.472-6.79zm-49.8 13.6c-.619-.494-.705-.615-.91-.936-.313-.483-.473-1.17-.473-2.05 0-1.38.46-2.38 1.41-3.05-.01.002 1.36-1.18 4.58-1.14a32 32 0 0 1 4.28.365v7.17h.002s-2 .431-4.26.567c-3.21.193-4.63-.924-4.62-.921zm6.28-11.1c-.64-.047-1.47-.07-2.46-.07-1.35 0-2.66.168-3.88.498-1.23.332-2.34.846-3.29 1.53a7.63 7.63 0 0 0-2.29 2.6c-.559 1.04-.844 2.26-.844 3.64 0 1.4.243 2.61.723 3.6a6.54 6.54 0 0 0 2.06 2.47c.877.638 1.96 1.11 3.21 1.39 1.24.283 2.64.426 4.18.426 1.62 0 3.23-.136 4.79-.399a95.1 95.1 0 0 0 3.97-.772c.526-.121 1.11-.28 1.11-.28.39-.099.36-.516.36-.516l-.009-14.4c0-3.16-.844-5.51-2.51-6.96-1.66-1.45-4.09-2.18-7.24-2.18-1.18 0-3.09.16-4.23.389 0 0-3.44.668-4.86 1.78 0 0-.312.192-.142.627l1.12 3c.139.389.518.256.518.256s.119-.047.259-.13c3.03-1.65 6.87-1.6 6.87-1.6 1.7 0 3.02.345 3.9 1.02.861.661 1.3 1.66 1.3 3.76v.667c-1.35-.196-2.6-.309-2.6-.309zm127-8.13a.428.428 0 0 0-.237-.568c-.269-.102-1.61-.385-2.64-.449-1.98-.124-3.08.21-4.07.654-.978.441-2.06 1.15-2.66 1.97l-.002-1.92c0-.264-.187-.477-.453-.477h-4.04c-.262 0-.452.213-.452.477v23.5a.48.48 0 0 0 .479.479h4.14a.479.479 0 0 0 .478-.479v-11.8c0-1.58.174-3.15.521-4.14.342-.979.807-1.76 1.38-2.32a4.79 4.79 0 0 1 1.95-1.17 7.68 7.68 0 0 1 2.12-.298c.825 0 1.73.212 1.73.212.304.034.473-.152.576-.426.271-.721 1.04-2.88 1.19-3.31"
308
662
  }),
309
- /* @__PURE__ */ jsx("path", {
663
+ /* @__PURE__ */ jsx5("path", {
310
664
  fill: "#FFFFFE",
311
665
  d: "M162.201 67.548a13.258 13.258 0 0 0-1.559-.37 12.217 12.217 0 0 0-2.144-.166c-2.853 0-5.102.806-6.681 2.398-1.568 1.58-2.635 3.987-3.17 7.154l-.193 1.069h-3.581s-.437-.018-.529.459l-.588 3.28c-.041.314.094.51.514.508h3.486l-3.537 19.743c-.277 1.59-.594 2.898-.945 3.889-.346.978-.684 1.711-1.1 2.243-.403.515-.785.894-1.444 1.115-.544.183-1.17.267-1.856.267-.382 0-.89-.064-1.265-.139-.375-.074-.57-.158-.851-.276 0 0-.409-.156-.57.254-.131.335-1.06 2.89-1.17 3.206-.112.312.045.558.243.629.464.166.809.272 1.441.421.878.207 1.618.22 2.311.22 1.452 0 2.775-.204 3.872-.6 1.104-.399 2.065-1.094 2.915-2.035.919-1.015 1.497-2.078 2.05-3.528.547-1.437 1.013-3.221 1.386-5.3l3.554-20.109h5.196s.438.016.529-.459l.588-3.28c.041-.314-.093-.51-.515-.508h-5.043c.025-.114.254-1.888.833-3.558.247-.713.712-1.288 1.106-1.683a3.273 3.273 0 0 1 1.321-.822 5.48 5.48 0 0 1 1.693-.244c.475 0 .941.057 1.296.131.489.104.679.159.807.197.514.157.583.005.684-.244l1.206-3.312c.124-.356-.178-.506-.29-.55m-70.474 34.117c0 .264-.188.479-.452.479h-4.183c-.265 0-.453-.215-.453-.479V67.997c0-.263.188-.476.453-.476h4.183c.264 0 .452.213.452.476v33.668"
312
666
  })
@@ -359,119 +713,10 @@ var mockFiles = [
359
713
  })
360
714
  }
361
715
  ];
362
- function SourceSearchBox(props) {
363
- const [selectedValue, setSelectedValue] = useState("");
364
- return /* @__PURE__ */ jsxs(Command, {
365
- className: "rounded-lg border shadow-md",
366
- value: selectedValue,
367
- onValueChange: (value) => {
368
- setSelectedValue(value);
369
- },
370
- filter: (value, search) => {
371
- if (props.searchTerm === "")
372
- return 1;
373
- if (value.startsWith(props.searchTerm))
374
- return 1;
375
- return 0;
376
- },
377
- children: [
378
- /* @__PURE__ */ jsx(CommandInput, {
379
- value: props.searchTerm,
380
- className: "rounded-t-lg hidden",
381
- placeholder: "Search for a command..."
382
- }),
383
- /* @__PURE__ */ jsxs(CommandList, {
384
- children: [
385
- /* @__PURE__ */ jsx(CommandEmpty, {
386
- children: "No results found."
387
- }),
388
- /* @__PURE__ */ jsx(CommandGroup, {
389
- heading: "Recents",
390
- children: props.recentFiles.map((filePointer) => {
391
- return /* @__PURE__ */ jsx(CommandItem, {
392
- value: filePointer.name,
393
- onSelect: (value) => {
394
- console.log(filePointer.name);
395
- props.onSelectedFile(filePointer);
396
- },
397
- children: /* @__PURE__ */ jsxs("div", {
398
- className: "flex flex-row gap-3 items-center bg-slate-400 ",
399
- children: [
400
- /* @__PURE__ */ jsx(Logo, {
401
- size: "40px",
402
- children: /* @__PURE__ */ jsx(IconForFilePointer, {
403
- filePointer,
404
- className: "mx-auto my-auto"
405
- })
406
- }),
407
- filePointer.name
408
- ]
409
- })
410
- }, `word-${filePointer.sourceApplication}.${filePointer.name}`);
411
- })
412
- }),
413
- /* @__PURE__ */ jsxs(CommandGroup, {
414
- heading: "Suggestions",
415
- children: [
416
- /* @__PURE__ */ jsxs(CommandItem, {
417
- onSelect: (value) => {
418
- console.log(value);
419
- console.log(value);
420
- },
421
- children: [
422
- /* @__PURE__ */ jsx(Calendar, {
423
- className: "mr-2 h-4 w-4"
424
- }),
425
- /* @__PURE__ */ jsx("span", {
426
- children: "Calendar"
427
- })
428
- ]
429
- }),
430
- /* @__PURE__ */ jsxs(CommandItem, {
431
- children: [
432
- /* @__PURE__ */ jsx(Smile, {
433
- className: "mr-2 h-4 w-4"
434
- }),
435
- /* @__PURE__ */ jsx("span", {
436
- children: "Search Emoji"
437
- })
438
- ]
439
- }),
440
- /* @__PURE__ */ jsxs(CommandItem, {
441
- children: [
442
- /* @__PURE__ */ jsx(Calculator, {
443
- className: "mr-2 h-4 w-4"
444
- }),
445
- /* @__PURE__ */ jsx("span", {
446
- children: "Calculator"
447
- })
448
- ]
449
- })
450
- ]
451
- }),
452
- /* @__PURE__ */ jsx(CommandSeparator, {})
453
- ]
454
- })
455
- ]
456
- });
457
- }
458
- function Logo({
459
- children,
460
- size = "20px"
461
- }) {
462
- return /* @__PURE__ */ jsx("div", {
463
- className: "",
464
- style: {
465
- width: size,
466
- height: size
467
- },
468
- children: /* @__PURE__ */ jsx("div", {
469
- className: "",
470
- children
471
- })
472
- });
473
- }
474
-
475
- export { FileChipPreview, IconForFilePointer, IncludedFilesPreview, Logo, SourceSearchBox, SuggestionAppearing };
476
- //# sourceMappingURL=out.js.map
477
- //# sourceMappingURL=chunk-ITZHK3YV.mjs.map
716
+ export {
717
+ FileChipPreview,
718
+ HoveringInsertionPromptBoxCore,
719
+ IconForFilePointer,
720
+ IncludedFilesPreview
721
+ };
722
+ //# sourceMappingURL=hovering-insertion-prompt-box-core.mjs.map