reachat 2.1.0-alpha.4 → 2.1.0-alpha.5

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 (50) hide show
  1. package/dist/AppBar/AppBar.d.ts +1 -1
  2. package/dist/{CSVFileRenderer-DodyJ8ty.js → CSVFileRenderer-Bh5dmsTS.js} +15 -14
  3. package/dist/CSVFileRenderer-Bh5dmsTS.js.map +1 -0
  4. package/dist/Chat.d.ts +3 -3
  5. package/dist/ChatBubble/ChatBubble.d.ts +1 -1
  6. package/dist/ChatContext.d.ts +2 -2
  7. package/dist/ChatInput/ChatInput.d.ts +4 -0
  8. package/dist/ChatInput/FileInput.d.ts +1 -1
  9. package/dist/{DefaultFileRenderer-CjPMoUSC.js → DefaultFileRenderer-CeV73ofi.js} +2 -2
  10. package/dist/DefaultFileRenderer-CeV73ofi.js.map +1 -0
  11. package/dist/ImageFileRenderer-C8tVW3I8.js.map +1 -1
  12. package/dist/Markdown/Table.d.ts +1 -1
  13. package/dist/Markdown/index.d.ts +2 -2
  14. package/dist/Markdown/plugins/remarkCve.d.ts +1 -1
  15. package/dist/PDFFileRenderer-BBn2EVrV.js +16 -0
  16. package/dist/PDFFileRenderer-BBn2EVrV.js.map +1 -0
  17. package/dist/SessionMessages/SessionEmpty.d.ts +1 -4
  18. package/dist/SessionMessages/SessionMessage/MessageFile/renderers/index.d.ts +1 -1
  19. package/dist/SessionMessages/SessionMessage/MessageFiles.d.ts +1 -1
  20. package/dist/SessionMessages/SessionMessage/MessageSources.d.ts +1 -1
  21. package/dist/SessionMessages/SessionMessage/index.d.ts +2 -2
  22. package/dist/SessionMessages/SessionMessages.d.ts +1 -1
  23. package/dist/SessionMessages/index.d.ts +2 -2
  24. package/dist/SessionsList/index.d.ts +2 -2
  25. package/dist/docs.json +20 -20
  26. package/dist/{index-B0_s-rPq.js → index-nY4fLD9h.js} +1117 -1132
  27. package/dist/index-nY4fLD9h.js.map +1 -0
  28. package/dist/index.css +6296 -738
  29. package/dist/index.d.ts +6 -6
  30. package/dist/index.js +31 -31
  31. package/dist/index.umd.cjs +1097 -1104
  32. package/dist/index.umd.cjs.map +1 -1
  33. package/dist/stories/Changelog.mdx +1 -1
  34. package/dist/stories/Chat.stories.tsx +5 -5
  35. package/dist/stories/ChatBubble.stories.tsx +3 -3
  36. package/dist/stories/Companion.stories.tsx +6 -6
  37. package/dist/stories/Console.stories.tsx +22 -22
  38. package/dist/stories/Integration.stories.tsx +2 -2
  39. package/dist/stories/Intro.mdx +1 -1
  40. package/dist/stories/assets/logo.svg +38 -19
  41. package/dist/stories/assets/paperclip.svg +4 -1
  42. package/dist/stories/assets/search.svg +5 -1
  43. package/dist/stories/examples.ts +20 -13
  44. package/dist/theme.d.ts +13 -0
  45. package/package.json +62 -46
  46. package/dist/CSVFileRenderer-DodyJ8ty.js.map +0 -1
  47. package/dist/DefaultFileRenderer-CjPMoUSC.js.map +0 -1
  48. package/dist/PDFFileRenderer-DQdFS2l6.js +0 -9
  49. package/dist/PDFFileRenderer-DQdFS2l6.js.map +0 -1
  50. package/dist/index-B0_s-rPq.js.map +0 -1
@@ -11,8 +11,8 @@
11
11
  }
12
12
  })();
13
13
  (function(global, factory) {
14
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("reablocks"), require("react"), require("motion/react"), require("@radix-ui/react-slot"), require("react-markdown"), require("react-syntax-highlighter"), require("rehype-katex"), require("mdast-util-find-and-replace"), require("reakeys"), require("remark-gfm"), require("remark-youtube"), require("remark-math"), require("date-fns"), require("@floating-ui/react")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "reablocks", "react", "motion/react", "@radix-ui/react-slot", "react-markdown", "react-syntax-highlighter", "rehype-katex", "mdast-util-find-and-replace", "reakeys", "remark-gfm", "remark-youtube", "remark-math", "date-fns", "@floating-ui/react"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.reachat = {}, global.jsxRuntime, global.reablocks, global.React, global.react, global.reactSlot, global.ReactMarkdown, global.reactSyntaxHighlighter, global.rehypeKatex, global.mdastUtilFindAndReplace, global.reakeys, global.remarkGfm, global.remarkYoutube, global.remarkMath, global.dateFns, global.react$1));
15
- })(this, function(exports2, jsxRuntime, reablocks, React, react, reactSlot, ReactMarkdown, reactSyntaxHighlighter, rehypeKatex, mdastUtilFindAndReplace, reakeys, remarkGfm, remarkYoutube, remarkMath, dateFns, react$1) {
14
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("motion/react"), require("reablocks"), require("react"), require("reakeys"), require("remark-gfm"), require("remark-math"), require("remark-youtube"), require("@floating-ui/react"), require("react-syntax-highlighter"), require("react-markdown"), require("rehype-katex"), require("mdast-util-find-and-replace"), require("@radix-ui/react-slot"), require("date-fns")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "motion/react", "reablocks", "react", "reakeys", "remark-gfm", "remark-math", "remark-youtube", "@floating-ui/react", "react-syntax-highlighter", "react-markdown", "rehype-katex", "mdast-util-find-and-replace", "@radix-ui/react-slot", "date-fns"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.reachat = {}, global.jsxRuntime, global.react, global.reablocks, global.React, global.reakeys, global.remarkGfm, global.remarkMath, global.remarkYoutube, global.react$1, global.reactSyntaxHighlighter, global.ReactMarkdown, global.rehypeKatex, global.mdastUtilFindAndReplace, global.reactSlot, global.dateFns));
15
+ })(this, (function(exports2, jsxRuntime, react, reablocks, React, reakeys, remarkGfm, remarkMath, remarkYoutube, react$1, reactSyntaxHighlighter, ReactMarkdown, rehypeKatex, mdastUtilFindAndReplace, reactSlot, dateFns) {
16
16
  "use strict";
17
17
  function _interopNamespaceDefault(e) {
18
18
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -31,13 +31,276 @@
31
31
  return Object.freeze(n);
32
32
  }
33
33
  const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
34
- const SvgSend = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: 17, height: 17, viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("g", { id: "send" }, /* @__PURE__ */ React__namespace.createElement("path", { id: "Vector", d: "M14.6111 2.33327C14.5349 2.3339 14.4598 2.35194 14.3917 2.386L2.39168 8.386C2.31456 8.42456 2.24872 8.4824 2.20055 8.55391C2.15238 8.62543 2.12352 8.70818 2.11677 8.79414C2.11002 8.88009 2.12561 8.96634 2.16203 9.04449C2.19845 9.12264 2.25446 9.19005 2.32462 9.24017L4.52514 10.8124L5.47371 13.6581C5.50257 13.7447 5.55457 13.8217 5.62406 13.8808C5.69355 13.9399 5.7779 13.9789 5.86796 13.9935C5.95802 14.0082 6.05036 13.9979 6.13499 13.9638C6.21962 13.9297 6.2933 13.873 6.34806 13.8001L7.05249 12.8606L10.3207 15.2376C10.3843 15.2839 10.4579 15.3146 10.5355 15.3271C10.6132 15.3396 10.6927 15.3336 10.7676 15.3097C10.8425 15.2857 10.9107 15.2444 10.9667 15.1891C11.0226 15.1338 11.0647 15.0661 11.0896 14.9915L15.0896 2.99147C15.1148 2.91597 15.1216 2.83555 15.1094 2.7569C15.0972 2.67825 15.0665 2.60363 15.0197 2.53926C14.9729 2.47488 14.9114 2.42261 14.8403 2.38678C14.7693 2.35096 14.6907 2.33261 14.6111 2.33327ZM13.2478 5.35345L10.3565 14.0266L7.67293 12.0755L13.2478 5.35345ZM10.684 5.35801L4.934 9.87559L3.58113 8.90879L10.684 5.35801ZM11.2784 6.16205L6.56746 11.843C6.56681 11.8437 6.56616 11.8443 6.56551 11.845L6.56355 11.8476C6.55841 11.8538 6.55342 11.8601 6.54858 11.8665C6.54319 11.8733 6.53798 11.8802 6.53295 11.8873L6.12085 12.4361L5.53426 10.6751L11.2784 6.16205Z", fill: "currentColor" })));
35
- const SvgStop = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1, strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-octagon-x", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "m15 9-6 6" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "m9 9 6 6" }));
34
+ const chatTheme = {
35
+ base: "text-content-text-neutral-base",
36
+ console: "flex w-full gap-4 h-full",
37
+ companion: "w-full h-full overflow-hidden",
38
+ empty: "text-center flex-1",
39
+ appbar: "flex p-5",
40
+ sessions: {
41
+ base: "overflow-auto",
42
+ console: "min-w-[150px] w-[30%] max-w-[300px] bg-gradient-neutral-200 p-5 rounded-3xl",
43
+ companion: "w-full h-full",
44
+ group: "text-xs text-content-text-neutral-3 mt-4 hover:bg-transparent mb-1",
45
+ create: "relative mb-4 rounded-[10px] text-white",
46
+ session: {
47
+ base: "group my-1 rounded-[10px] p-2 text-content-text-neutral-1 border border-transparent",
48
+ active: "border-select-menu-items-color-item-stroke-row-hover [&_button]:opacity-100!",
49
+ delete: "[&>svg]:w-4 [&>svg]:h-4 opacity-0 group-hover:opacity-50!"
50
+ }
51
+ },
52
+ messages: {
53
+ base: "",
54
+ console: "flex flex-col mx-5 flex-1 overflow-hidden",
55
+ companion: "flex w-full h-full",
56
+ back: "self-start pl-0 my-2 ",
57
+ inner: "flex-1 h-full flex flex-col",
58
+ title: "text-base font-bold",
59
+ date: "text-xs whitespace-nowrap text-content-text-neutral-2",
60
+ content: "mt-2 flex-1 overflow-auto",
61
+ header: "flex justify-between items-center gap-2",
62
+ showMore: "mb-4",
63
+ message: {
64
+ base: "mt-4 mb-4 flex flex-col p-0 rounded-sm border-none bg-transparent",
65
+ question: "relative font-semibold mb-4 px-4 py-4 pb-2 rounded-3xl rounded-br-none text-typography border bg-(--background-neutral-raised-5) border-(--stroke-neutral-5)",
66
+ response: "relative data-[compact=false]:px-4 text-content-text-neutral-base",
67
+ overlay: "overflow-y-hidden max-h-[350px] after:content-[''] after:absolute after:inset-x-0 after:bottom-0 after:h-16 after:bg-linear-to-b after:from-transparent after:to-effects-shadows-base-2-xl",
68
+ cursor: "inline-block w-1 h-4 bg-current",
69
+ expand: "absolute bottom-0 right-1 z-10",
70
+ files: {
71
+ base: "mb-2 flex flex-wrap gap-3 ",
72
+ file: {
73
+ base: "flex items-center gap-2 border border-stroke-neutral-4 px-3 py-2 rounded-lg cursor-pointer",
74
+ name: "text-sm text-content-text-neutral-4"
75
+ }
76
+ },
77
+ sources: {
78
+ base: "my-4 flex flex-wrap gap-3",
79
+ source: {
80
+ base: "flex gap-2 border border-stroke-neutral-4 px-4 py-2 rounded-lg cursor-pointer",
81
+ companion: "flex-1 px-3 py-1.5",
82
+ image: "max-w-10 max-h-10 rounded-md w-full h-fit self-center",
83
+ title: "text-md block",
84
+ url: "text-sm text-buttons-colors-link-primary-text-resting underline"
85
+ }
86
+ },
87
+ markdown: {
88
+ copy: "sticky py-1 [&>svg]:w-4 [&>svg]:h-4 opacity-50",
89
+ p: "mb-2",
90
+ a: "text-buttons-colors-link-primary-text-resting underline",
91
+ table: "table-auto w-full m-2",
92
+ th: "px-4 py-2 text-left font-bold border-b border-stroke-neutral-4",
93
+ td: "px-4 py-2",
94
+ code: "m-2 rounded-b relative",
95
+ toolbar: "text-xs flex items-center justify-between px-2 py-1 rounded-t sticky top-0 backdrop-blur-md bg-gradient-neutral-500/50",
96
+ li: "mb-2 ml-6",
97
+ ul: "mb-4 list-disc",
98
+ ol: "mb-4 list-decimal"
99
+ },
100
+ csvPreview: {
101
+ base: "flex flex-col gap-2",
102
+ header: {
103
+ base: "flex justify-between items-center gap-4",
104
+ icon: "csv-icon flex items-center",
105
+ actions: "csv-actions flex items-center gap-6"
106
+ },
107
+ tableContainer: "flex justify-between",
108
+ dialog: {
109
+ base: "fixed inset-0 bg-background-neutral-canvas-base/70 flex justify-center items-center z-50",
110
+ container: "bg-background-neutral-canvas-base rounded-md w-11/12 h-5/6 overflow-auto"
111
+ }
112
+ },
113
+ footer: {
114
+ base: "mt-3 flex gap-1.5",
115
+ copy: "p-3 rounded-[10px] [&>svg]:size-4 opacity-50 hover:opacity-100!",
116
+ upvote: "p-3 rounded-[10px] [&>svg]:size-4 opacity-50 hover:opacity-100!",
117
+ downvote: "p-3 rounded-[10px] [&>svg]:size-4 opacity-50 hover:opacity-100!",
118
+ refresh: "p-3 rounded-[10px] [&>svg]:size-4 opacity-50 hover:opacity-100!"
119
+ }
120
+ }
121
+ },
122
+ input: {
123
+ base: "flex mt-4 relative",
124
+ upload: "px-5 py-2 size-10 text-content-text-neutral-2 hover:text-content-text-neutral-base",
125
+ input: "w-full border rounded-3xl px-3 py-2 pr-16 after:hidden after:mx-10! [&>textarea]:w-full [&>textarea]:flex-none [&>textarea]:outline-none [&>textarea]:resize-none",
126
+ actions: {
127
+ base: "absolute flex gap-2 items-center right-2 inset-y-1/2 -translate-y-1/2 z-10",
128
+ send: "px-3 py-3 hover:bg-primary-hover rounded-full size-8",
129
+ stop: "px-2 py-2 bg-content-assets-semantic-error-base text-white rounded-full hover:bg-content-assets-semantic-error-1 size-8"
130
+ }
131
+ }
132
+ };
133
+ const AppBar = ({ content, theme = chatTheme }) => {
134
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: reablocks.cn(theme.appbar), children: content });
135
+ };
36
136
  const ChatContext = React.createContext({
37
137
  sessions: [],
38
138
  activeSessionId: null
39
139
  });
40
- const SvgPaperclip = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1, strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-paperclip", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48" }));
140
+ const useDimensions = () => {
141
+ const [ref, setRef] = React.useState(null);
142
+ const [width, setWidth] = React.useState(void 0);
143
+ const observe = React.useCallback((element) => {
144
+ if (element) setRef(element);
145
+ }, []);
146
+ React.useEffect(() => {
147
+ if (!ref) return;
148
+ const resizeObserver = new ResizeObserver((entries) => {
149
+ for (const entry of entries) {
150
+ setWidth(entry.contentRect.width);
151
+ }
152
+ });
153
+ resizeObserver.observe(ref);
154
+ return () => {
155
+ resizeObserver.disconnect();
156
+ };
157
+ }, [ref]);
158
+ return { width, observe };
159
+ };
160
+ const Chat = ({
161
+ children,
162
+ viewType = "console",
163
+ sessions,
164
+ onSelectSession,
165
+ onDeleteSession,
166
+ onSendMessage,
167
+ onStopMessage,
168
+ onFileUpload,
169
+ isLoading,
170
+ activeSessionId,
171
+ theme = chatTheme,
172
+ onNewSession,
173
+ remarkPlugins = [remarkGfm, remarkYoutube, remarkMath],
174
+ disabled,
175
+ style,
176
+ className
177
+ }) => {
178
+ const [internalActiveSessionID, setInternalActiveSessionID] = React.useState(activeSessionId);
179
+ const { width, observe } = useDimensions();
180
+ const isCompact = viewType === "companion" || width && width < 767;
181
+ React.useEffect(() => {
182
+ setInternalActiveSessionID(activeSessionId);
183
+ }, [activeSessionId]);
184
+ const handleSelectSession = React.useCallback(
185
+ (sessionId) => {
186
+ setInternalActiveSessionID(sessionId);
187
+ onSelectSession?.(sessionId);
188
+ },
189
+ [onSelectSession]
190
+ );
191
+ const handleDeleteSession = React.useCallback(
192
+ (sessionId) => {
193
+ setInternalActiveSessionID(void 0);
194
+ onDeleteSession?.(sessionId);
195
+ },
196
+ [onDeleteSession]
197
+ );
198
+ const handleCreateNewSession = React.useCallback(() => {
199
+ setInternalActiveSessionID(void 0);
200
+ onNewSession?.();
201
+ }, [onNewSession]);
202
+ reakeys.useHotkeys([
203
+ {
204
+ name: "Create new session",
205
+ category: "Chat",
206
+ keys: "meta+shift+s",
207
+ callback: (event) => {
208
+ event.preventDefault();
209
+ handleCreateNewSession();
210
+ }
211
+ }
212
+ ]);
213
+ const activeSession = React.useMemo(
214
+ () => sessions.find((session) => session.id === internalActiveSessionID),
215
+ [sessions, internalActiveSessionID]
216
+ );
217
+ const contextValue = React.useMemo(
218
+ () => ({
219
+ sessions,
220
+ activeSession,
221
+ remarkPlugins,
222
+ theme,
223
+ disabled,
224
+ isLoading,
225
+ isCompact,
226
+ viewType,
227
+ activeSessionId: internalActiveSessionID,
228
+ selectSession: handleSelectSession,
229
+ deleteSession: handleDeleteSession,
230
+ createSession: handleCreateNewSession,
231
+ sendMessage: onSendMessage,
232
+ stopMessage: onStopMessage,
233
+ fileUpload: onFileUpload
234
+ }),
235
+ [
236
+ isLoading,
237
+ isCompact,
238
+ viewType,
239
+ disabled,
240
+ theme,
241
+ remarkPlugins,
242
+ sessions,
243
+ activeSession,
244
+ internalActiveSessionID,
245
+ handleSelectSession,
246
+ handleDeleteSession,
247
+ handleCreateNewSession,
248
+ onSendMessage,
249
+ onStopMessage,
250
+ onFileUpload
251
+ ]
252
+ );
253
+ return /* @__PURE__ */ jsxRuntime.jsx(ChatContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: /* @__PURE__ */ jsxRuntime.jsx(
254
+ "div",
255
+ {
256
+ ref: observe,
257
+ className: reablocks.cn(className, theme.base, {
258
+ [theme.companion]: isCompact,
259
+ [theme.console]: !isCompact
260
+ }),
261
+ style,
262
+ children
263
+ }
264
+ ) }) });
265
+ };
266
+ const ChatBubble = React.memo(
267
+ ({
268
+ children,
269
+ bubbleContent,
270
+ position = "right-end",
271
+ modifiers = [react$1.offset({ mainAxis: 0, crossAxis: -40 })],
272
+ className
273
+ }) => {
274
+ const [isOpen, setIsOpen] = React.useState(false);
275
+ const ref = React.useRef(null);
276
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
277
+ /* @__PURE__ */ jsxRuntime.jsx(
278
+ reablocks.ConnectedOverlay,
279
+ {
280
+ placement: position,
281
+ modifiers,
282
+ reference: ref.current,
283
+ open: isOpen,
284
+ onOpen: () => setIsOpen(true),
285
+ onClose: () => setIsOpen(false),
286
+ content: () => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children })
287
+ }
288
+ ),
289
+ /* @__PURE__ */ jsxRuntime.jsx(
290
+ "div",
291
+ {
292
+ ref,
293
+ className,
294
+ onClick: () => setIsOpen((prev) => !prev),
295
+ children: bubbleContent
296
+ }
297
+ )
298
+ ] });
299
+ }
300
+ );
301
+ const SvgSend = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M15.3451 0.654003C15.0011 0.310003 14.5001 0.191003 14.0401 0.339003L1.11712 4.493C0.626116 4.651 0.286116 5.067 0.230116 5.58C0.174116 6.092 0.417116 6.572 0.862116 6.831L5.43812 9.5L9.39112 5.546C9.68412 5.253 10.1591 5.253 10.4521 5.546C10.7451 5.839 10.7451 6.314 10.4521 6.607L6.49812 10.561L9.16712 15.137C9.40211 15.539 9.81712 15.776 10.2741 15.776C10.3221 15.776 10.3711 15.773 10.4201 15.768C10.9321 15.712 11.3491 15.372 11.5061 14.882L15.6611 1.96C15.8091 1.497 15.6881 0.997003 15.3451 0.654003Z", fill: "currentColor" }));
302
+ const SvgStop = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 50 50", width: "24px", height: "24px", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M 25 2 C 12.309534 2 2 12.309534 2 25 C 2 37.690466 12.309534 48 25 48 C 37.690466 48 48 37.690466 48 25 C 48 12.309534 37.690466 2 25 2 z M 25 4 C 36.609534 4 46 13.390466 46 25 C 46 36.609534 36.609534 46 25 46 C 13.390466 46 4 36.609534 4 25 C 4 13.390466 13.390466 4 25 4 z M 32.990234 15.986328 A 1.0001 1.0001 0 0 0 32.292969 16.292969 L 25 23.585938 L 17.707031 16.292969 A 1.0001 1.0001 0 0 0 16.990234 15.990234 A 1.0001 1.0001 0 0 0 16.292969 17.707031 L 23.585938 25 L 16.292969 32.292969 A 1.0001 1.0001 0 1 0 17.707031 33.707031 L 25 26.414062 L 32.292969 33.707031 A 1.0001 1.0001 0 1 0 33.707031 32.292969 L 26.414062 25 L 33.707031 17.707031 A 1.0001 1.0001 0 0 0 32.990234 15.986328 z", fill: "currentColor" }));
303
+ const SvgPaperclip = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 64 64", width: "24px", height: "24px", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M25.3,56.007c-3.409,0-6.818-1.297-9.414-3.893c-2.595-2.596-3.893-6.005-3.893-9.415c0-3.409,1.298-6.819,3.893-9.414 l20.4-20.4c1.847-1.847,4.302-2.864,6.914-2.864c2.611,0,5.067,1.017,6.914,2.864c3.812,3.813,3.812,10.016,0,13.829l-20.4,20.4 c-2.438,2.439-6.385,2.441-8.828,0c-2.434-2.435-2.434-6.395,0-8.829l13.7-13.7c0.781-0.781,2.047-0.781,2.828,0 c0.781,0.781,0.781,2.047,0,2.828l-13.7,13.7c-0.874,0.875-0.874,2.297,0.001,3.172c0.847,0.846,2.324,0.846,3.171,0l20.4-20.4 c2.252-2.253,2.252-5.919,0-8.172c-1.092-1.091-2.543-1.692-4.086-1.692c-1.544,0-2.994,0.601-4.086,1.692l-20.4,20.4 c-1.815,1.816-2.723,4.201-2.723,6.586c0,2.385,0.908,4.77,2.723,6.586c1.816,1.815,4.201,2.723,6.586,2.723 c2.385,0,4.771-0.907,6.586-2.723l12.7-12.7c0.781-0.781,2.047-0.781,2.828,0c0.781,0.781,0.781,2.047,0,2.828l-12.7,12.7 C32.119,54.709,28.71,56.007,25.3,56.007z", fill: "currentColor" }));
41
304
  const FileInput = ({
42
305
  allowedFiles,
43
306
  onFileUpload,
@@ -70,10 +333,7 @@
70
333
  variant: "text",
71
334
  disabled: isLoading || disabled,
72
335
  className: reablocks.cn(theme.input.upload),
73
- onClick: () => {
74
- var _a;
75
- return (_a = fileInputRef.current) == null ? void 0 : _a.click();
76
- },
336
+ onClick: () => fileInputRef.current?.click(),
77
337
  children: attachIcon
78
338
  }
79
339
  )
@@ -109,24 +369,24 @@
109
369
  inputRef.current.focus();
110
370
  }
111
371
  }, [activeSessionId, inputRef]);
372
+ const handleSendMessage = () => {
373
+ if (internalMessage.trim()) {
374
+ sendMessage?.(internalMessage);
375
+ setInternalMessage("");
376
+ }
377
+ };
112
378
  React.useImperativeHandle(ref, () => ({
113
379
  focus: () => {
114
- var _a;
115
- (_a = inputRef.current) == null ? void 0 : _a.focus();
380
+ inputRef.current?.focus();
116
381
  },
117
382
  send: () => {
118
- if (internalMessage.trim()) {
119
- sendMessage == null ? void 0 : sendMessage(internalMessage);
120
- setInternalMessage("");
121
- }
383
+ handleSendMessage();
384
+ },
385
+ setValue: (value) => {
386
+ setInternalMessage(value);
387
+ onMessageChange?.(value);
122
388
  }
123
389
  }));
124
- const handleSendMessage = () => {
125
- if (internalMessage.trim()) {
126
- sendMessage == null ? void 0 : sendMessage(internalMessage);
127
- setInternalMessage("");
128
- }
129
- };
130
390
  const handleKeyPress = (e) => {
131
391
  if (e.key === "Enter" && !e.shiftKey) {
132
392
  e.preventDefault();
@@ -134,8 +394,7 @@
134
394
  }
135
395
  };
136
396
  const handleFileUpload = (event) => {
137
- var _a;
138
- const file = (_a = event.target.files) == null ? void 0 : _a[0];
397
+ const file = event.target.files?.[0];
139
398
  if (file && fileUpload) {
140
399
  fileUpload(file);
141
400
  }
@@ -143,7 +402,7 @@
143
402
  const handleMessageChange = React.useCallback(
144
403
  (event) => {
145
404
  setInternalMessage(event.target.value);
146
- onMessageChange == null ? void 0 : onMessageChange(event.target.value);
405
+ onMessageChange?.(event.target.value);
147
406
  },
148
407
  [onMessageChange]
149
408
  );
@@ -164,7 +423,7 @@
164
423
  }
165
424
  ),
166
425
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(theme.input.actions.base), children: [
167
- (allowedFiles == null ? void 0 : allowedFiles.length) > 0 && /* @__PURE__ */ jsxRuntime.jsx(
426
+ allowedFiles?.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
168
427
  FileInput,
169
428
  {
170
429
  allowedFiles,
@@ -198,1071 +457,1004 @@
198
457
  ] });
199
458
  }
200
459
  );
201
- const SessionEmpty = ({
202
- children
203
- }) => {
204
- const { theme } = React.useContext(ChatContext);
205
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: reablocks.cn(theme.empty), children });
206
- };
207
- const SessionMessagesHeader = ({ children }) => {
208
- const { activeSession, theme } = React.useContext(ChatContext);
209
- const Comp = children ? reactSlot.Slot : "header";
210
- if (!activeSession) {
211
- return null;
212
- }
213
- return /* @__PURE__ */ jsxRuntime.jsx(Comp, { className: reablocks.cn(theme.messages.header), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
214
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: reablocks.cn(theme.messages.title), children: /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { limit: 125, value: activeSession.title }) }),
215
- /* @__PURE__ */ jsxRuntime.jsx(
216
- reablocks.DateFormat,
217
- {
218
- className: reablocks.cn(theme.messages.date),
219
- date: activeSession.createdAt
220
- }
221
- )
222
- ] }) });
223
- };
224
- const SvgBack = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1, strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-chevron-left", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "m15 18-6-6 6-6" }));
225
- const SessionMessagePanel = ({
226
- children,
227
- allowBack = true
228
- }) => {
229
- const { activeSessionId, theme, isCompact, selectSession, viewType } = React.useContext(ChatContext);
230
- const isVisible = isCompact && activeSessionId || viewType === "chat" || !isCompact;
231
- return isVisible && /* @__PURE__ */ jsxRuntime.jsx(
232
- react.motion.div,
233
- {
234
- initial: { translateX: "200%" },
235
- animate: {
236
- translateX: "0%",
237
- transition: {
238
- type: "tween",
239
- ease: "linear",
240
- duration: 0.2,
241
- when: "beforeChildren"
242
- }
243
- },
244
- exit: { translateX: "200%" },
245
- className: reablocks.cn(theme.messages.base, {
246
- [theme.messages.companion]: isCompact,
247
- [theme.messages.console]: !isCompact
248
- }),
249
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(theme.messages.inner), children: [
250
- allowBack && isCompact && viewType !== "chat" && /* @__PURE__ */ jsxRuntime.jsxs(
251
- reablocks.Button,
252
- {
253
- variant: "text",
254
- size: "small",
255
- onClick: () => selectSession(null),
256
- className: reablocks.cn(theme.messages.back),
257
- children: [
258
- /* @__PURE__ */ jsxRuntime.jsx(SvgBack, {}),
259
- "Back"
260
- ]
261
- }
262
- ),
263
- children
264
- ] })
265
- }
266
- );
267
- };
268
- const SvgCopy = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1, strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-copy", ...props }, /* @__PURE__ */ React__namespace.createElement("rect", { width: 14, height: 14, x: 8, y: 8, rx: 2, ry: 2 }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" }));
460
+ const SvgCopy = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 18, height: 18, viewBox: "0 0 18 18", fill: "none", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M1.75 6C2.164 6 2.5 6.336 2.5 6.75V13.25C2.5 13.939 3.061 14.5 3.75 14.5H12.25C12.664 14.5 13 14.836 13 15.25C13 15.664 12.664 16 12.25 16H3.75C2.233 16 1 14.767 1 13.25V6.75C1 6.336 1.336 6 1.75 6ZM14.25 2C15.7688 2 17 3.23122 17 4.75V10.25C17 11.7688 15.7688 13 14.25 13H6.75C5.23122 13 4 11.7688 4 10.25V4.75C4 3.23122 5.23122 2 6.75 2H14.25Z", fill: "currentColor" }));
269
461
  const dark = {
270
462
  'code[class*="language-"]': {
271
- "background": "#11111f",
272
- "color": "#e2e8f0",
273
- "textShadow": "0 1px rgba(0, 0, 0, 0.3)",
274
- "fontFamily": '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
275
- "direction": "ltr",
276
- "textAlign": "left",
277
- "whiteSpace": "pre",
278
- "wordSpacing": "normal",
279
- "wordBreak": "normal",
280
- "lineHeight": "1.5",
281
- "MozTabSize": "2",
282
- "OTabSize": "2",
283
- "tabSize": "2",
284
- "WebkitHyphens": "none",
285
- "MozHyphens": "none",
286
- "msHyphens": "none",
287
- "hyphens": "none"
463
+ background: "#11111f",
464
+ color: "#e2e8f0",
465
+ textShadow: "0 1px rgba(0, 0, 0, 0.3)",
466
+ fontFamily: '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
467
+ direction: "ltr",
468
+ textAlign: "left",
469
+ whiteSpace: "pre",
470
+ wordSpacing: "normal",
471
+ wordBreak: "normal",
472
+ lineHeight: "1.5",
473
+ MozTabSize: "2",
474
+ OTabSize: "2",
475
+ tabSize: "2",
476
+ WebkitHyphens: "none",
477
+ MozHyphens: "none",
478
+ msHyphens: "none",
479
+ hyphens: "none"
288
480
  },
289
481
  'pre[class*="language-"]': {
290
- "background": "#11111f",
291
- "color": "#e2e8f0",
292
- "textShadow": "0 1px rgba(0, 0, 0, 0.3)",
293
- "fontFamily": '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
294
- "direction": "ltr",
295
- "textAlign": "left",
296
- "whiteSpace": "pre",
297
- "wordSpacing": "normal",
298
- "wordBreak": "normal",
299
- "lineHeight": "1.5",
300
- "MozTabSize": "2",
301
- "OTabSize": "2",
302
- "tabSize": "2",
303
- "WebkitHyphens": "none",
304
- "MozHyphens": "none",
305
- "msHyphens": "none",
306
- "hyphens": "none",
307
- "padding": "1em",
308
- "margin": "0",
309
- "overflow": "auto"
482
+ background: "#11111f",
483
+ color: "#e2e8f0",
484
+ textShadow: "0 1px rgba(0, 0, 0, 0.3)",
485
+ fontFamily: '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
486
+ direction: "ltr",
487
+ textAlign: "left",
488
+ whiteSpace: "pre",
489
+ wordSpacing: "normal",
490
+ wordBreak: "normal",
491
+ lineHeight: "1.5",
492
+ MozTabSize: "2",
493
+ OTabSize: "2",
494
+ tabSize: "2",
495
+ WebkitHyphens: "none",
496
+ MozHyphens: "none",
497
+ msHyphens: "none",
498
+ hyphens: "none",
499
+ padding: "1em",
500
+ margin: "0",
501
+ overflow: "auto"
310
502
  },
311
503
  'code[class*="language-"]::-moz-selection': {
312
- "background": "#1e293b",
313
- "color": "inherit",
314
- "textShadow": "none"
504
+ background: "#1e293b",
505
+ color: "inherit",
506
+ textShadow: "none"
315
507
  },
316
508
  'code[class*="language-"] *::-moz-selection': {
317
- "background": "#1e293b",
318
- "color": "inherit",
319
- "textShadow": "none"
509
+ background: "#1e293b",
510
+ color: "inherit",
511
+ textShadow: "none"
320
512
  },
321
513
  'pre[class*="language-"] *::-moz-selection': {
322
- "background": "#1e293b",
323
- "color": "inherit",
324
- "textShadow": "none"
514
+ background: "#1e293b",
515
+ color: "inherit",
516
+ textShadow: "none"
325
517
  },
326
518
  'code[class*="language-"]::selection': {
327
- "background": "#1e293b",
328
- "color": "inherit",
329
- "textShadow": "none"
519
+ background: "#1e293b",
520
+ color: "inherit",
521
+ textShadow: "none"
330
522
  },
331
523
  'code[class*="language-"] *::selection': {
332
- "background": "#1e293b",
333
- "color": "inherit",
334
- "textShadow": "none"
524
+ background: "#1e293b",
525
+ color: "inherit",
526
+ textShadow: "none"
335
527
  },
336
528
  'pre[class*="language-"] *::selection': {
337
- "background": "#1e293b",
338
- "color": "inherit",
339
- "textShadow": "none"
529
+ background: "#1e293b",
530
+ color: "inherit",
531
+ textShadow: "none"
340
532
  },
341
533
  ':not(pre) > code[class*="language-"]': {
342
- "padding": "0.2em 0.3em",
343
- "borderRadius": "0.3em",
344
- "whiteSpace": "normal"
534
+ padding: "0.2em 0.3em",
535
+ borderRadius: "0.3em",
536
+ whiteSpace: "normal"
345
537
  },
346
- "comment": {
347
- "color": "#64748b",
348
- "fontStyle": "italic"
538
+ comment: {
539
+ color: "#64748b",
540
+ fontStyle: "italic"
349
541
  },
350
- "prolog": {
351
- "color": "#64748b"
542
+ prolog: {
543
+ color: "#64748b"
352
544
  },
353
- "cdata": {
354
- "color": "#64748b"
545
+ cdata: {
546
+ color: "#64748b"
355
547
  },
356
- "doctype": {
357
- "color": "#e2e8f0"
548
+ doctype: {
549
+ color: "#e2e8f0"
358
550
  },
359
- "punctuation": {
360
- "color": "#e2e8f0"
551
+ punctuation: {
552
+ color: "#e2e8f0"
361
553
  },
362
- "entity": {
363
- "color": "#3b82f6",
364
- "cursor": "help"
554
+ entity: {
555
+ color: "#3b82f6",
556
+ cursor: "help"
365
557
  },
366
558
  "attr-name": {
367
- "color": "#f59e0b"
559
+ color: "#f59e0b"
368
560
  },
369
561
  "class-name": {
370
- "color": "#f59e0b"
562
+ color: "#f59e0b"
371
563
  },
372
- "boolean": {
373
- "color": "#3b82f6"
564
+ boolean: {
565
+ color: "#3b82f6"
374
566
  },
375
- "constant": {
376
- "color": "#3b82f6"
567
+ constant: {
568
+ color: "#3b82f6"
377
569
  },
378
- "number": {
379
- "color": "#3b82f6"
570
+ number: {
571
+ color: "#3b82f6"
380
572
  },
381
- "atrule": {
382
- "color": "#f59e0b"
573
+ atrule: {
574
+ color: "#f59e0b"
383
575
  },
384
- "keyword": {
385
- "color": "#f472b6"
576
+ keyword: {
577
+ color: "#f472b6"
386
578
  },
387
- "property": {
388
- "color": "#3b82f6"
579
+ property: {
580
+ color: "#3b82f6"
389
581
  },
390
- "tag": {
391
- "color": "#3b82f6"
582
+ tag: {
583
+ color: "#3b82f6"
392
584
  },
393
- "symbol": {
394
- "color": "#3b82f6"
585
+ symbol: {
586
+ color: "#3b82f6"
395
587
  },
396
- "deleted": {
397
- "color": "#ef4444"
588
+ deleted: {
589
+ color: "#ef4444"
398
590
  },
399
- "important": {
400
- "color": "#f472b6"
591
+ important: {
592
+ color: "#f472b6"
401
593
  },
402
- "selector": {
403
- "color": "#10b981"
594
+ selector: {
595
+ color: "#10b981"
404
596
  },
405
- "string": {
406
- "color": "#10b981"
597
+ string: {
598
+ color: "#10b981"
407
599
  },
408
- "char": {
409
- "color": "#10b981"
600
+ char: {
601
+ color: "#10b981"
410
602
  },
411
- "builtin": {
412
- "color": "#10b981"
603
+ builtin: {
604
+ color: "#10b981"
413
605
  },
414
- "inserted": {
415
- "color": "#10b981"
606
+ inserted: {
607
+ color: "#10b981"
416
608
  },
417
- "regex": {
418
- "color": "#10b981"
609
+ regex: {
610
+ color: "#10b981"
419
611
  },
420
612
  "attr-value": {
421
- "color": "#10b981"
613
+ color: "#10b981"
422
614
  },
423
615
  "attr-value > .token.punctuation": {
424
- "color": "#10b981"
616
+ color: "#10b981"
425
617
  },
426
- "variable": {
427
- "color": "#60a5fa"
618
+ variable: {
619
+ color: "#60a5fa"
428
620
  },
429
- "operator": {
430
- "color": "#60a5fa"
621
+ operator: {
622
+ color: "#60a5fa"
431
623
  },
432
- "function": {
433
- "color": "#60a5fa"
624
+ function: {
625
+ color: "#60a5fa"
434
626
  },
435
- "url": {
436
- "color": "#60a5fa"
627
+ url: {
628
+ color: "#60a5fa"
437
629
  },
438
630
  "attr-value > .token.punctuation.attr-equals": {
439
- "color": "#e2e8f0"
631
+ color: "#e2e8f0"
440
632
  },
441
633
  "special-attr > .token.attr-value > .token.value.css": {
442
- "color": "#e2e8f0"
634
+ color: "#e2e8f0"
443
635
  },
444
636
  ".language-css .token.selector": {
445
- "color": "#3b82f6"
637
+ color: "#3b82f6"
446
638
  },
447
639
  ".language-css .token.property": {
448
- "color": "#e2e8f0"
640
+ color: "#e2e8f0"
449
641
  },
450
642
  ".language-css .token.function": {
451
- "color": "#60a5fa"
643
+ color: "#60a5fa"
452
644
  },
453
645
  ".language-css .token.url > .token.function": {
454
- "color": "#60a5fa"
646
+ color: "#60a5fa"
455
647
  },
456
648
  ".language-css .token.url > .token.string.url": {
457
- "color": "#10b981"
649
+ color: "#10b981"
458
650
  },
459
651
  ".language-css .token.important": {
460
- "color": "#f472b6"
652
+ color: "#f472b6"
461
653
  },
462
654
  ".language-css .token.atrule .token.rule": {
463
- "color": "#f472b6"
655
+ color: "#f472b6"
464
656
  },
465
657
  ".language-javascript .token.operator": {
466
- "color": "#f472b6"
658
+ color: "#f472b6"
467
659
  },
468
660
  ".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation": {
469
- "color": "#ef4444"
661
+ color: "#ef4444"
470
662
  },
471
663
  ".language-json .token.operator": {
472
- "color": "#e2e8f0"
664
+ color: "#e2e8f0"
473
665
  },
474
666
  ".language-json .token.null.keyword": {
475
- "color": "#3b82f6"
667
+ color: "#3b82f6"
476
668
  },
477
669
  ".language-markdown .token.url": {
478
- "color": "#e2e8f0"
670
+ color: "#e2e8f0"
479
671
  },
480
672
  ".language-markdown .token.url > .token.operator": {
481
- "color": "#e2e8f0"
673
+ color: "#e2e8f0"
482
674
  },
483
675
  ".language-markdown .token.url-reference.url > .token.string": {
484
- "color": "#e2e8f0"
676
+ color: "#e2e8f0"
485
677
  },
486
678
  ".language-markdown .token.url > .token.content": {
487
- "color": "#60a5fa"
679
+ color: "#60a5fa"
488
680
  },
489
681
  ".language-markdown .token.url > .token.url": {
490
- "color": "#60a5fa"
682
+ color: "#60a5fa"
491
683
  },
492
684
  ".language-markdown .token.url-reference.url": {
493
- "color": "#60a5fa"
685
+ color: "#60a5fa"
494
686
  },
495
687
  ".language-markdown .token.blockquote.punctuation": {
496
- "color": "#64748b",
497
- "fontStyle": "italic"
688
+ color: "#64748b",
689
+ fontStyle: "italic"
498
690
  },
499
691
  ".language-markdown .token.hr.punctuation": {
500
- "color": "#64748b",
501
- "fontStyle": "italic"
692
+ color: "#64748b",
693
+ fontStyle: "italic"
502
694
  },
503
695
  ".language-markdown .token.code-snippet": {
504
- "color": "#10b981"
696
+ color: "#10b981"
505
697
  },
506
698
  ".language-markdown .token.bold .token.content": {
507
- "color": "#f59e0b"
699
+ color: "#f59e0b"
508
700
  },
509
701
  ".language-markdown .token.italic .token.content": {
510
- "color": "#f472b6"
702
+ color: "#f472b6"
511
703
  },
512
704
  ".language-markdown .token.strike .token.content": {
513
- "color": "#3b82f6"
705
+ color: "#3b82f6"
514
706
  },
515
707
  ".language-markdown .token.strike .token.punctuation": {
516
- "color": "#3b82f6"
708
+ color: "#3b82f6"
517
709
  },
518
710
  ".language-markdown .token.list.punctuation": {
519
- "color": "#3b82f6"
711
+ color: "#3b82f6"
520
712
  },
521
713
  ".language-markdown .token.title.important > .token.punctuation": {
522
- "color": "#3b82f6"
714
+ color: "#3b82f6"
523
715
  },
524
- "bold": {
525
- "fontWeight": "bold"
716
+ bold: {
717
+ fontWeight: "bold"
526
718
  },
527
- "italic": {
528
- "fontStyle": "italic"
719
+ italic: {
720
+ fontStyle: "italic"
529
721
  },
530
- "namespace": {
531
- "Opacity": "0.8"
722
+ namespace: {
723
+ Opacity: "0.8"
532
724
  },
533
725
  "token.tab:not(:empty):before": {
534
- "color": "#64748b",
535
- "textShadow": "none"
726
+ color: "#64748b",
727
+ textShadow: "none"
536
728
  },
537
729
  "token.cr:before": {
538
- "color": "#64748b",
539
- "textShadow": "none"
730
+ color: "#64748b",
731
+ textShadow: "none"
540
732
  },
541
733
  "token.lf:before": {
542
- "color": "#64748b",
543
- "textShadow": "none"
734
+ color: "#64748b",
735
+ textShadow: "none"
544
736
  },
545
737
  "token.space:before": {
546
- "color": "#64748b",
547
- "textShadow": "none"
738
+ color: "#64748b",
739
+ textShadow: "none"
548
740
  },
549
741
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item": {
550
- "marginRight": "0.4em"
742
+ marginRight: "0.4em"
551
743
  },
552
744
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button": {
553
- "background": "#1e293b",
554
- "color": "#94a3b8",
555
- "padding": "0.1em 0.4em",
556
- "borderRadius": "0.3em"
745
+ background: "#1e293b",
746
+ color: "#94a3b8",
747
+ padding: "0.1em 0.4em",
748
+ borderRadius: "0.3em"
557
749
  },
558
750
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a": {
559
- "background": "#1e293b",
560
- "color": "#94a3b8",
561
- "padding": "0.1em 0.4em",
562
- "borderRadius": "0.3em"
751
+ background: "#1e293b",
752
+ color: "#94a3b8",
753
+ padding: "0.1em 0.4em",
754
+ borderRadius: "0.3em"
563
755
  },
564
756
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span": {
565
- "background": "#1e293b",
566
- "color": "#94a3b8",
567
- "padding": "0.1em 0.4em",
568
- "borderRadius": "0.3em"
757
+ background: "#1e293b",
758
+ color: "#94a3b8",
759
+ padding: "0.1em 0.4em",
760
+ borderRadius: "0.3em"
569
761
  },
570
762
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover": {
571
- "background": "#3b82f6",
572
- "color": "#ffffff"
763
+ background: "#3b82f6",
764
+ color: "#ffffff"
573
765
  },
574
766
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus": {
575
- "background": "#3b82f6",
576
- "color": "#ffffff"
767
+ background: "#3b82f6",
768
+ color: "#ffffff"
577
769
  },
578
770
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover": {
579
- "background": "#3b82f6",
580
- "color": "#ffffff"
771
+ background: "#3b82f6",
772
+ color: "#ffffff"
581
773
  },
582
774
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus": {
583
- "background": "#3b82f6",
584
- "color": "#ffffff"
775
+ background: "#3b82f6",
776
+ color: "#ffffff"
585
777
  },
586
778
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover": {
587
- "background": "#3b82f6",
588
- "color": "#ffffff"
779
+ background: "#3b82f6",
780
+ color: "#ffffff"
589
781
  },
590
782
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus": {
591
- "background": "#3b82f6",
592
- "color": "#ffffff"
783
+ background: "#3b82f6",
784
+ color: "#ffffff"
593
785
  },
594
786
  ".line-highlight.line-highlight": {
595
- "background": "rgba(59, 130, 246, 0.08)"
787
+ background: "rgba(59, 130, 246, 0.08)"
596
788
  },
597
789
  ".line-highlight.line-highlight:before": {
598
- "background": "#1e293b",
599
- "color": "#e2e8f0",
600
- "padding": "0.1em 0.6em",
601
- "borderRadius": "0.3em",
602
- "boxShadow": "0 2px 0 0 rgba(0, 0, 0, 0.2)"
790
+ background: "#1e293b",
791
+ color: "#e2e8f0",
792
+ padding: "0.1em 0.6em",
793
+ borderRadius: "0.3em",
794
+ boxShadow: "0 2px 0 0 rgba(0, 0, 0, 0.2)"
603
795
  },
604
796
  ".line-highlight.line-highlight[data-end]:after": {
605
- "background": "#1e293b",
606
- "color": "#e2e8f0",
607
- "padding": "0.1em 0.6em",
608
- "borderRadius": "0.3em",
609
- "boxShadow": "0 2px 0 0 rgba(0, 0, 0, 0.2)"
797
+ background: "#1e293b",
798
+ color: "#e2e8f0",
799
+ padding: "0.1em 0.6em",
800
+ borderRadius: "0.3em",
801
+ boxShadow: "0 2px 0 0 rgba(0, 0, 0, 0.2)"
610
802
  },
611
803
  "pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before": {
612
- "backgroundColor": "rgba(59, 130, 246, 0.08)"
804
+ backgroundColor: "rgba(59, 130, 246, 0.08)"
613
805
  },
614
806
  ".line-numbers.line-numbers .line-numbers-rows": {
615
- "borderRightColor": "#1e293b"
807
+ borderRightColor: "#1e293b"
616
808
  },
617
809
  ".command-line .command-line-prompt": {
618
- "borderRightColor": "#1e293b"
810
+ borderRightColor: "#1e293b"
619
811
  },
620
812
  ".line-numbers .line-numbers-rows > span:before": {
621
- "color": "#64748b"
813
+ color: "#64748b"
622
814
  },
623
815
  ".command-line .command-line-prompt > span:before": {
624
- "color": "#64748b"
816
+ color: "#64748b"
625
817
  },
626
818
  ".rainbow-braces .token.token.punctuation.brace-level-1": {
627
- "color": "#3b82f6"
819
+ color: "#3b82f6"
628
820
  },
629
821
  ".rainbow-braces .token.token.punctuation.brace-level-5": {
630
- "color": "#3b82f6"
822
+ color: "#3b82f6"
631
823
  },
632
824
  ".rainbow-braces .token.token.punctuation.brace-level-9": {
633
- "color": "#3b82f6"
825
+ color: "#3b82f6"
634
826
  },
635
827
  ".rainbow-braces .token.token.punctuation.brace-level-2": {
636
- "color": "#10b981"
828
+ color: "#10b981"
637
829
  },
638
830
  ".rainbow-braces .token.token.punctuation.brace-level-6": {
639
- "color": "#10b981"
831
+ color: "#10b981"
640
832
  },
641
833
  ".rainbow-braces .token.token.punctuation.brace-level-10": {
642
- "color": "#10b981"
834
+ color: "#10b981"
643
835
  },
644
836
  ".rainbow-braces .token.token.punctuation.brace-level-3": {
645
- "color": "#60a5fa"
837
+ color: "#60a5fa"
646
838
  },
647
839
  ".rainbow-braces .token.token.punctuation.brace-level-7": {
648
- "color": "#60a5fa"
840
+ color: "#60a5fa"
649
841
  },
650
842
  ".rainbow-braces .token.token.punctuation.brace-level-11": {
651
- "color": "#60a5fa"
843
+ color: "#60a5fa"
652
844
  },
653
845
  ".rainbow-braces .token.token.punctuation.brace-level-4": {
654
- "color": "#f472b6"
846
+ color: "#f472b6"
655
847
  },
656
848
  ".rainbow-braces .token.token.punctuation.brace-level-8": {
657
- "color": "#f472b6"
849
+ color: "#f472b6"
658
850
  },
659
851
  ".rainbow-braces .token.token.punctuation.brace-level-12": {
660
- "color": "#f472b6"
852
+ color: "#f472b6"
661
853
  },
662
854
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)": {
663
- "backgroundColor": "rgba(239, 68, 68, 0.15)"
855
+ backgroundColor: "rgba(239, 68, 68, 0.15)"
664
856
  },
665
857
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)": {
666
- "backgroundColor": "rgba(239, 68, 68, 0.15)"
858
+ backgroundColor: "rgba(239, 68, 68, 0.15)"
667
859
  },
668
860
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection": {
669
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
861
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
670
862
  },
671
863
  "pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection": {
672
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
864
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
673
865
  },
674
866
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection": {
675
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
867
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
676
868
  },
677
869
  "pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection": {
678
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
870
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
679
871
  },
680
872
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection": {
681
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
873
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
682
874
  },
683
875
  "pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection": {
684
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
876
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
685
877
  },
686
878
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection": {
687
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
879
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
688
880
  },
689
881
  "pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection": {
690
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
882
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
691
883
  },
692
884
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)": {
693
- "backgroundColor": "rgba(16, 185, 129, 0.15)"
885
+ backgroundColor: "rgba(16, 185, 129, 0.15)"
694
886
  },
695
887
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)": {
696
- "backgroundColor": "rgba(16, 185, 129, 0.15)"
888
+ backgroundColor: "rgba(16, 185, 129, 0.15)"
697
889
  },
698
890
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection": {
699
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
891
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
700
892
  },
701
893
  "pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection": {
702
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
894
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
703
895
  },
704
896
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection": {
705
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
897
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
706
898
  },
707
899
  "pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection": {
708
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
900
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
709
901
  },
710
902
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection": {
711
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
903
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
712
904
  },
713
905
  "pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection": {
714
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
906
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
715
907
  },
716
908
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection": {
717
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
909
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
718
910
  },
719
911
  "pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection": {
720
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
912
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
721
913
  },
722
914
  ".prism-previewer.prism-previewer:before": {
723
- "borderColor": "#11111f"
915
+ borderColor: "#11111f"
724
916
  },
725
917
  ".prism-previewer-gradient.prism-previewer-gradient div": {
726
- "borderColor": "#11111f",
727
- "borderRadius": "0.3em"
918
+ borderColor: "#11111f",
919
+ borderRadius: "0.3em"
728
920
  },
729
921
  ".prism-previewer-color.prism-previewer-color:before": {
730
- "borderRadius": "0.3em"
922
+ borderRadius: "0.3em"
731
923
  },
732
924
  ".prism-previewer-easing.prism-previewer-easing:before": {
733
- "borderRadius": "0.3em"
925
+ borderRadius: "0.3em"
734
926
  },
735
927
  ".prism-previewer.prism-previewer:after": {
736
- "borderTopColor": "#11111f"
928
+ borderTopColor: "#11111f"
737
929
  },
738
930
  ".prism-previewer-flipped.prism-previewer-flipped.after": {
739
- "borderBottomColor": "#11111f"
931
+ borderBottomColor: "#11111f"
740
932
  },
741
933
  ".prism-previewer-angle.prism-previewer-angle:before": {
742
- "background": "#1e293b"
934
+ background: "#1e293b"
743
935
  },
744
936
  ".prism-previewer-time.prism-previewer-time:before": {
745
- "background": "#1e293b"
937
+ background: "#1e293b"
746
938
  },
747
939
  ".prism-previewer-easing.prism-previewer-easing": {
748
- "background": "#1e293b"
940
+ background: "#1e293b"
749
941
  },
750
942
  ".prism-previewer-angle.prism-previewer-angle circle": {
751
- "stroke": "#e2e8f0",
752
- "strokeOpacity": "1"
943
+ stroke: "#e2e8f0",
944
+ strokeOpacity: "1"
753
945
  },
754
946
  ".prism-previewer-time.prism-previewer-time circle": {
755
- "stroke": "#e2e8f0",
756
- "strokeOpacity": "1"
947
+ stroke: "#e2e8f0",
948
+ strokeOpacity: "1"
757
949
  },
758
950
  ".prism-previewer-easing.prism-previewer-easing circle": {
759
- "stroke": "#e2e8f0",
760
- "fill": "transparent"
951
+ stroke: "#e2e8f0",
952
+ fill: "transparent"
761
953
  },
762
954
  ".prism-previewer-easing.prism-previewer-easing path": {
763
- "stroke": "#e2e8f0"
955
+ stroke: "#e2e8f0"
764
956
  },
765
957
  ".prism-previewer-easing.prism-previewer-easing line": {
766
- "stroke": "#e2e8f0"
958
+ stroke: "#e2e8f0"
767
959
  }
768
960
  };
769
961
  const light = {
770
962
  'code[class*="language-"]': {
771
- "background": "#fff",
772
- "color": "#1e293b",
773
- "textShadow": "none",
774
- "fontFamily": '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
775
- "direction": "ltr",
776
- "textAlign": "left",
777
- "whiteSpace": "pre",
778
- "wordSpacing": "normal",
779
- "wordBreak": "normal",
780
- "lineHeight": "1.5",
781
- "MozTabSize": "2",
782
- "OTabSize": "2",
783
- "tabSize": "2",
784
- "WebkitHyphens": "none",
785
- "MozHyphens": "none",
786
- "msHyphens": "none",
787
- "hyphens": "none"
963
+ background: "#fff",
964
+ color: "#1e293b",
965
+ textShadow: "none",
966
+ fontFamily: '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
967
+ direction: "ltr",
968
+ textAlign: "left",
969
+ whiteSpace: "pre",
970
+ wordSpacing: "normal",
971
+ wordBreak: "normal",
972
+ lineHeight: "1.5",
973
+ MozTabSize: "2",
974
+ OTabSize: "2",
975
+ tabSize: "2",
976
+ WebkitHyphens: "none",
977
+ MozHyphens: "none",
978
+ msHyphens: "none",
979
+ hyphens: "none"
788
980
  },
789
981
  'pre[class*="language-"]': {
790
- "background": "#fff",
791
- "color": "#1e293b",
792
- "textShadow": "none",
793
- "fontFamily": '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
794
- "direction": "ltr",
795
- "textAlign": "left",
796
- "whiteSpace": "pre",
797
- "wordSpacing": "normal",
798
- "wordBreak": "normal",
799
- "lineHeight": "1.5",
800
- "MozTabSize": "2",
801
- "OTabSize": "2",
802
- "tabSize": "2",
803
- "WebkitHyphens": "none",
804
- "MozHyphens": "none",
805
- "msHyphens": "none",
806
- "hyphens": "none",
807
- "padding": "1em",
808
- "margin": "0.5em 0",
809
- "overflow": "auto",
810
- "borderRadius": "0.3em",
811
- "border": "1px solid #e2e8f0"
982
+ background: "#fff",
983
+ color: "#1e293b",
984
+ textShadow: "none",
985
+ fontFamily: '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
986
+ direction: "ltr",
987
+ textAlign: "left",
988
+ whiteSpace: "pre",
989
+ wordSpacing: "normal",
990
+ wordBreak: "normal",
991
+ lineHeight: "1.5",
992
+ MozTabSize: "2",
993
+ OTabSize: "2",
994
+ tabSize: "2",
995
+ WebkitHyphens: "none",
996
+ MozHyphens: "none",
997
+ msHyphens: "none",
998
+ hyphens: "none",
999
+ padding: "1em",
1000
+ margin: "0.5em 0",
1001
+ overflow: "auto",
1002
+ borderRadius: "0.3em",
1003
+ border: "1px solid #e2e8f0"
812
1004
  },
813
1005
  'code[class*="language-"]::-moz-selection': {
814
- "background": "#e2e8f0",
815
- "color": "inherit",
816
- "textShadow": "none"
1006
+ background: "#e2e8f0",
1007
+ color: "inherit",
1008
+ textShadow: "none"
817
1009
  },
818
1010
  'code[class*="language-"] *::-moz-selection': {
819
- "background": "#e2e8f0",
820
- "color": "inherit",
821
- "textShadow": "none"
1011
+ background: "#e2e8f0",
1012
+ color: "inherit",
1013
+ textShadow: "none"
822
1014
  },
823
1015
  'pre[class*="language-"] *::-moz-selection': {
824
- "background": "#e2e8f0",
825
- "color": "inherit",
826
- "textShadow": "none"
1016
+ background: "#e2e8f0",
1017
+ color: "inherit",
1018
+ textShadow: "none"
827
1019
  },
828
1020
  'code[class*="language-"]::selection': {
829
- "background": "#e2e8f0",
830
- "color": "inherit",
831
- "textShadow": "none"
1021
+ background: "#e2e8f0",
1022
+ color: "inherit",
1023
+ textShadow: "none"
832
1024
  },
833
1025
  'code[class*="language-"] *::selection': {
834
- "background": "#e2e8f0",
835
- "color": "inherit",
836
- "textShadow": "none"
1026
+ background: "#e2e8f0",
1027
+ color: "inherit",
1028
+ textShadow: "none"
837
1029
  },
838
1030
  'pre[class*="language-"] *::selection': {
839
- "background": "#e2e8f0",
840
- "color": "inherit",
841
- "textShadow": "none"
1031
+ background: "#e2e8f0",
1032
+ color: "inherit",
1033
+ textShadow: "none"
842
1034
  },
843
1035
  ':not(pre) > code[class*="language-"]': {
844
- "padding": "0.2em 0.3em",
845
- "borderRadius": "0.3em",
846
- "whiteSpace": "normal",
847
- "background": "#f1f5f9"
1036
+ padding: "0.2em 0.3em",
1037
+ borderRadius: "0.3em",
1038
+ whiteSpace: "normal",
1039
+ background: "#f1f5f9"
848
1040
  },
849
- "comment": {
850
- "color": "#64748b",
851
- "fontStyle": "italic"
1041
+ comment: {
1042
+ color: "#64748b",
1043
+ fontStyle: "italic"
852
1044
  },
853
- "prolog": {
854
- "color": "#64748b"
1045
+ prolog: {
1046
+ color: "#64748b"
855
1047
  },
856
- "cdata": {
857
- "color": "#64748b"
1048
+ cdata: {
1049
+ color: "#64748b"
858
1050
  },
859
- "doctype": {
860
- "color": "#1e293b"
1051
+ doctype: {
1052
+ color: "#1e293b"
861
1053
  },
862
- "punctuation": {
863
- "color": "#64748b"
1054
+ punctuation: {
1055
+ color: "#64748b"
864
1056
  },
865
- "entity": {
866
- "color": "#3b82f6",
867
- "cursor": "help"
1057
+ entity: {
1058
+ color: "#3b82f6",
1059
+ cursor: "help"
868
1060
  },
869
1061
  "attr-name": {
870
- "color": "#ea580c"
1062
+ color: "#ea580c"
871
1063
  },
872
1064
  "class-name": {
873
- "color": "#ea580c"
1065
+ color: "#ea580c"
874
1066
  },
875
- "boolean": {
876
- "color": "#3b82f6"
1067
+ boolean: {
1068
+ color: "#3b82f6"
877
1069
  },
878
- "constant": {
879
- "color": "#3b82f6"
1070
+ constant: {
1071
+ color: "#3b82f6"
880
1072
  },
881
- "number": {
882
- "color": "#3b82f6"
1073
+ number: {
1074
+ color: "#3b82f6"
883
1075
  },
884
- "atrule": {
885
- "color": "#ea580c"
1076
+ atrule: {
1077
+ color: "#ea580c"
886
1078
  },
887
- "keyword": {
888
- "color": "#9333ea"
1079
+ keyword: {
1080
+ color: "#9333ea"
889
1081
  },
890
- "property": {
891
- "color": "#3b82f6"
1082
+ property: {
1083
+ color: "#3b82f6"
892
1084
  },
893
- "tag": {
894
- "color": "#3b82f6"
1085
+ tag: {
1086
+ color: "#3b82f6"
895
1087
  },
896
- "symbol": {
897
- "color": "#3b82f6"
1088
+ symbol: {
1089
+ color: "#3b82f6"
898
1090
  },
899
- "deleted": {
900
- "color": "#dc2626"
1091
+ deleted: {
1092
+ color: "#dc2626"
901
1093
  },
902
- "important": {
903
- "color": "#9333ea"
1094
+ important: {
1095
+ color: "#9333ea"
904
1096
  },
905
- "selector": {
906
- "color": "#16a34a"
1097
+ selector: {
1098
+ color: "#16a34a"
907
1099
  },
908
- "string": {
909
- "color": "#16a34a"
1100
+ string: {
1101
+ color: "#16a34a"
910
1102
  },
911
- "char": {
912
- "color": "#16a34a"
1103
+ char: {
1104
+ color: "#16a34a"
913
1105
  },
914
- "builtin": {
915
- "color": "#16a34a"
1106
+ builtin: {
1107
+ color: "#16a34a"
916
1108
  },
917
- "inserted": {
918
- "color": "#16a34a"
1109
+ inserted: {
1110
+ color: "#16a34a"
919
1111
  },
920
- "regex": {
921
- "color": "#16a34a"
1112
+ regex: {
1113
+ color: "#16a34a"
922
1114
  },
923
1115
  "attr-value": {
924
- "color": "#16a34a"
1116
+ color: "#16a34a"
925
1117
  },
926
1118
  "attr-value > .token.punctuation": {
927
- "color": "#16a34a"
1119
+ color: "#16a34a"
928
1120
  },
929
- "variable": {
930
- "color": "#3b82f6"
1121
+ variable: {
1122
+ color: "#3b82f6"
931
1123
  },
932
- "operator": {
933
- "color": "#3b82f6"
1124
+ operator: {
1125
+ color: "#3b82f6"
934
1126
  },
935
- "function": {
936
- "color": "#3b82f6"
1127
+ function: {
1128
+ color: "#3b82f6"
937
1129
  },
938
- "url": {
939
- "color": "#3b82f6"
1130
+ url: {
1131
+ color: "#3b82f6"
940
1132
  },
941
1133
  "attr-value > .token.punctuation.attr-equals": {
942
- "color": "#64748b"
1134
+ color: "#64748b"
943
1135
  },
944
1136
  "special-attr > .token.attr-value > .token.value.css": {
945
- "color": "#1e293b"
1137
+ color: "#1e293b"
946
1138
  },
947
1139
  ".language-css .token.selector": {
948
- "color": "#3b82f6"
1140
+ color: "#3b82f6"
949
1141
  },
950
1142
  ".language-css .token.property": {
951
- "color": "#1e293b"
1143
+ color: "#1e293b"
952
1144
  },
953
1145
  ".language-css .token.function": {
954
- "color": "#3b82f6"
1146
+ color: "#3b82f6"
955
1147
  },
956
1148
  ".language-css .token.url > .token.function": {
957
- "color": "#3b82f6"
1149
+ color: "#3b82f6"
958
1150
  },
959
1151
  ".language-css .token.url > .token.string.url": {
960
- "color": "#16a34a"
1152
+ color: "#16a34a"
961
1153
  },
962
1154
  ".language-css .token.important": {
963
- "color": "#9333ea"
1155
+ color: "#9333ea"
964
1156
  },
965
1157
  ".language-css .token.atrule .token.rule": {
966
- "color": "#9333ea"
1158
+ color: "#9333ea"
967
1159
  },
968
1160
  ".language-javascript .token.operator": {
969
- "color": "#9333ea"
1161
+ color: "#9333ea"
970
1162
  },
971
1163
  ".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation": {
972
- "color": "#dc2626"
1164
+ color: "#dc2626"
973
1165
  },
974
1166
  ".language-json .token.operator": {
975
- "color": "#1e293b"
1167
+ color: "#1e293b"
976
1168
  },
977
1169
  ".language-json .token.null.keyword": {
978
- "color": "#3b82f6"
1170
+ color: "#3b82f6"
979
1171
  },
980
1172
  ".language-markdown .token.url": {
981
- "color": "#1e293b"
1173
+ color: "#1e293b"
982
1174
  },
983
1175
  ".language-markdown .token.url > .token.operator": {
984
- "color": "#1e293b"
1176
+ color: "#1e293b"
985
1177
  },
986
1178
  ".language-markdown .token.url-reference.url > .token.string": {
987
- "color": "#1e293b"
1179
+ color: "#1e293b"
988
1180
  },
989
1181
  ".language-markdown .token.url > .token.content": {
990
- "color": "#3b82f6"
1182
+ color: "#3b82f6"
991
1183
  },
992
1184
  ".language-markdown .token.url > .token.url": {
993
- "color": "#3b82f6"
1185
+ color: "#3b82f6"
994
1186
  },
995
1187
  ".language-markdown .token.url-reference.url": {
996
- "color": "#3b82f6"
1188
+ color: "#3b82f6"
997
1189
  },
998
1190
  ".language-markdown .token.blockquote.punctuation": {
999
- "color": "#64748b",
1000
- "fontStyle": "italic"
1191
+ color: "#64748b",
1192
+ fontStyle: "italic"
1001
1193
  },
1002
1194
  ".language-markdown .token.hr.punctuation": {
1003
- "color": "#64748b",
1004
- "fontStyle": "italic"
1195
+ color: "#64748b",
1196
+ fontStyle: "italic"
1005
1197
  },
1006
1198
  ".language-markdown .token.code-snippet": {
1007
- "color": "#16a34a"
1199
+ color: "#16a34a"
1008
1200
  },
1009
1201
  ".language-markdown .token.bold .token.content": {
1010
- "color": "#ea580c"
1202
+ color: "#ea580c"
1011
1203
  },
1012
1204
  ".language-markdown .token.italic .token.content": {
1013
- "color": "#9333ea"
1205
+ color: "#9333ea"
1014
1206
  },
1015
1207
  ".language-markdown .token.strike .token.content": {
1016
- "color": "#3b82f6"
1208
+ color: "#3b82f6"
1017
1209
  },
1018
1210
  ".language-markdown .token.strike .token.punctuation": {
1019
- "color": "#3b82f6"
1211
+ color: "#3b82f6"
1020
1212
  },
1021
1213
  ".language-markdown .token.list.punctuation": {
1022
- "color": "#3b82f6"
1214
+ color: "#3b82f6"
1023
1215
  },
1024
1216
  ".language-markdown .token.title.important > .token.punctuation": {
1025
- "color": "#3b82f6"
1217
+ color: "#3b82f6"
1026
1218
  },
1027
- "bold": {
1028
- "fontWeight": "bold"
1219
+ bold: {
1220
+ fontWeight: "bold"
1029
1221
  },
1030
- "italic": {
1031
- "fontStyle": "italic"
1222
+ italic: {
1223
+ fontStyle: "italic"
1032
1224
  },
1033
- "namespace": {
1034
- "Opacity": "0.8"
1225
+ namespace: {
1226
+ Opacity: "0.8"
1035
1227
  },
1036
1228
  "token.tab:not(:empty):before": {
1037
- "color": "#94a3b8"
1229
+ color: "#94a3b8"
1038
1230
  },
1039
1231
  "token.cr:before": {
1040
- "color": "#94a3b8"
1232
+ color: "#94a3b8"
1041
1233
  },
1042
1234
  "token.lf:before": {
1043
- "color": "#94a3b8"
1235
+ color: "#94a3b8"
1044
1236
  },
1045
1237
  "token.space:before": {
1046
- "color": "#94a3b8"
1238
+ color: "#94a3b8"
1047
1239
  },
1048
1240
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item": {
1049
- "marginRight": "0.4em"
1241
+ marginRight: "0.4em"
1050
1242
  },
1051
1243
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button": {
1052
- "background": "#f1f5f9",
1053
- "color": "#475569",
1054
- "padding": "0.1em 0.4em",
1055
- "borderRadius": "0.3em"
1244
+ background: "#f1f5f9",
1245
+ color: "#475569",
1246
+ padding: "0.1em 0.4em",
1247
+ borderRadius: "0.3em"
1056
1248
  },
1057
1249
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a": {
1058
- "background": "#f1f5f9",
1059
- "color": "#475569",
1060
- "padding": "0.1em 0.4em",
1061
- "borderRadius": "0.3em"
1250
+ background: "#f1f5f9",
1251
+ color: "#475569",
1252
+ padding: "0.1em 0.4em",
1253
+ borderRadius: "0.3em"
1062
1254
  },
1063
1255
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span": {
1064
- "background": "#f1f5f9",
1065
- "color": "#475569",
1066
- "padding": "0.1em 0.4em",
1067
- "borderRadius": "0.3em"
1256
+ background: "#f1f5f9",
1257
+ color: "#475569",
1258
+ padding: "0.1em 0.4em",
1259
+ borderRadius: "0.3em"
1068
1260
  },
1069
1261
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover": {
1070
- "background": "#3b82f6",
1071
- "color": "#ffffff"
1262
+ background: "#3b82f6",
1263
+ color: "#ffffff"
1072
1264
  },
1073
1265
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus": {
1074
- "background": "#3b82f6",
1075
- "color": "#ffffff"
1266
+ background: "#3b82f6",
1267
+ color: "#ffffff"
1076
1268
  },
1077
1269
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover": {
1078
- "background": "#3b82f6",
1079
- "color": "#ffffff"
1270
+ background: "#3b82f6",
1271
+ color: "#ffffff"
1080
1272
  },
1081
1273
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus": {
1082
- "background": "#3b82f6",
1083
- "color": "#ffffff"
1274
+ background: "#3b82f6",
1275
+ color: "#ffffff"
1084
1276
  },
1085
1277
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover": {
1086
- "background": "#3b82f6",
1087
- "color": "#ffffff"
1278
+ background: "#3b82f6",
1279
+ color: "#ffffff"
1088
1280
  },
1089
1281
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus": {
1090
- "background": "#3b82f6",
1091
- "color": "#ffffff"
1282
+ background: "#3b82f6",
1283
+ color: "#ffffff"
1092
1284
  },
1093
1285
  ".line-highlight.line-highlight": {
1094
- "background": "rgba(59, 130, 246, 0.08)"
1286
+ background: "rgba(59, 130, 246, 0.08)"
1095
1287
  },
1096
1288
  ".line-highlight.line-highlight:before": {
1097
- "background": "#f1f5f9",
1098
- "color": "#1e293b",
1099
- "padding": "0.1em 0.6em",
1100
- "borderRadius": "0.3em",
1101
- "boxShadow": "0 2px 0 0 rgba(0, 0, 0, 0.1)"
1289
+ background: "#f1f5f9",
1290
+ color: "#1e293b",
1291
+ padding: "0.1em 0.6em",
1292
+ borderRadius: "0.3em",
1293
+ boxShadow: "0 2px 0 0 rgba(0, 0, 0, 0.1)"
1102
1294
  },
1103
1295
  ".line-highlight.line-highlight[data-end]:after": {
1104
- "background": "#f1f5f9",
1105
- "color": "#1e293b",
1106
- "padding": "0.1em 0.6em",
1107
- "borderRadius": "0.3em",
1108
- "boxShadow": "0 2px 0 0 rgba(0, 0, 0, 0.1)"
1296
+ background: "#f1f5f9",
1297
+ color: "#1e293b",
1298
+ padding: "0.1em 0.6em",
1299
+ borderRadius: "0.3em",
1300
+ boxShadow: "0 2px 0 0 rgba(0, 0, 0, 0.1)"
1109
1301
  },
1110
1302
  "pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before": {
1111
- "backgroundColor": "rgba(59, 130, 246, 0.08)"
1303
+ backgroundColor: "rgba(59, 130, 246, 0.08)"
1112
1304
  },
1113
1305
  ".line-numbers.line-numbers .line-numbers-rows": {
1114
- "borderRightColor": "#e2e8f0"
1306
+ borderRightColor: "#e2e8f0"
1115
1307
  },
1116
1308
  ".command-line .command-line-prompt": {
1117
- "borderRightColor": "#e2e8f0"
1309
+ borderRightColor: "#e2e8f0"
1118
1310
  },
1119
1311
  ".line-numbers .line-numbers-rows > span:before": {
1120
- "color": "#94a3b8"
1312
+ color: "#94a3b8"
1121
1313
  },
1122
1314
  ".command-line .command-line-prompt > span:before": {
1123
- "color": "#94a3b8"
1315
+ color: "#94a3b8"
1124
1316
  },
1125
1317
  ".rainbow-braces .token.token.punctuation.brace-level-1": {
1126
- "color": "#3b82f6"
1318
+ color: "#3b82f6"
1127
1319
  },
1128
1320
  ".rainbow-braces .token.token.punctuation.brace-level-5": {
1129
- "color": "#3b82f6"
1321
+ color: "#3b82f6"
1130
1322
  },
1131
1323
  ".rainbow-braces .token.token.punctuation.brace-level-9": {
1132
- "color": "#3b82f6"
1324
+ color: "#3b82f6"
1133
1325
  },
1134
1326
  ".rainbow-braces .token.token.punctuation.brace-level-2": {
1135
- "color": "#16a34a"
1327
+ color: "#16a34a"
1136
1328
  },
1137
1329
  ".rainbow-braces .token.token.punctuation.brace-level-6": {
1138
- "color": "#16a34a"
1330
+ color: "#16a34a"
1139
1331
  },
1140
1332
  ".rainbow-braces .token.token.punctuation.brace-level-10": {
1141
- "color": "#16a34a"
1333
+ color: "#16a34a"
1142
1334
  },
1143
1335
  ".rainbow-braces .token.token.punctuation.brace-level-3": {
1144
- "color": "#ea580c"
1336
+ color: "#ea580c"
1145
1337
  },
1146
1338
  ".rainbow-braces .token.token.punctuation.brace-level-7": {
1147
- "color": "#ea580c"
1339
+ color: "#ea580c"
1148
1340
  },
1149
1341
  ".rainbow-braces .token.token.punctuation.brace-level-11": {
1150
- "color": "#ea580c"
1342
+ color: "#ea580c"
1151
1343
  },
1152
1344
  ".rainbow-braces .token.token.punctuation.brace-level-4": {
1153
- "color": "#9333ea"
1345
+ color: "#9333ea"
1154
1346
  },
1155
1347
  ".rainbow-braces .token.token.punctuation.brace-level-8": {
1156
- "color": "#9333ea"
1348
+ color: "#9333ea"
1157
1349
  },
1158
1350
  ".rainbow-braces .token.token.punctuation.brace-level-12": {
1159
- "color": "#9333ea"
1351
+ color: "#9333ea"
1160
1352
  },
1161
1353
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)": {
1162
- "backgroundColor": "rgba(220, 38, 38, 0.15)"
1354
+ backgroundColor: "rgba(220, 38, 38, 0.15)"
1163
1355
  },
1164
1356
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)": {
1165
- "backgroundColor": "rgba(220, 38, 38, 0.15)"
1357
+ backgroundColor: "rgba(220, 38, 38, 0.15)"
1166
1358
  },
1167
1359
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection": {
1168
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1360
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1169
1361
  },
1170
1362
  "pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection": {
1171
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1363
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1172
1364
  },
1173
1365
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection": {
1174
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1366
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1175
1367
  },
1176
1368
  "pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection": {
1177
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1369
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1178
1370
  },
1179
1371
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection": {
1180
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1372
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1181
1373
  },
1182
1374
  "pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection": {
1183
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1375
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1184
1376
  },
1185
1377
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection": {
1186
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1378
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1187
1379
  },
1188
1380
  "pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection": {
1189
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1381
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1190
1382
  },
1191
1383
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)": {
1192
- "backgroundColor": "rgba(22, 163, 74, 0.15)"
1384
+ backgroundColor: "rgba(22, 163, 74, 0.15)"
1193
1385
  },
1194
1386
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)": {
1195
- "backgroundColor": "rgba(22, 163, 74, 0.15)"
1387
+ backgroundColor: "rgba(22, 163, 74, 0.15)"
1196
1388
  },
1197
1389
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection": {
1198
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1390
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1199
1391
  },
1200
1392
  "pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection": {
1201
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1393
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1202
1394
  },
1203
1395
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection": {
1204
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1396
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1205
1397
  },
1206
1398
  "pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection": {
1207
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1399
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1208
1400
  },
1209
1401
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection": {
1210
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1402
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1211
1403
  },
1212
1404
  "pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection": {
1213
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1405
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1214
1406
  },
1215
1407
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection": {
1216
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1408
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1217
1409
  },
1218
1410
  "pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection": {
1219
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1411
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1220
1412
  },
1221
1413
  ".prism-previewer.prism-previewer:before": {
1222
- "borderColor": "#fff"
1414
+ borderColor: "#fff"
1223
1415
  },
1224
1416
  ".prism-previewer-gradient.prism-previewer-gradient div": {
1225
- "borderColor": "#fff",
1226
- "borderRadius": "0.3em"
1417
+ borderColor: "#fff",
1418
+ borderRadius: "0.3em"
1227
1419
  },
1228
1420
  ".prism-previewer-color.prism-previewer-color:before": {
1229
- "borderRadius": "0.3em"
1421
+ borderRadius: "0.3em"
1230
1422
  },
1231
1423
  ".prism-previewer-easing.prism-previewer-easing:before": {
1232
- "borderRadius": "0.3em"
1424
+ borderRadius: "0.3em"
1233
1425
  },
1234
1426
  ".prism-previewer.prism-previewer:after": {
1235
- "borderTopColor": "#fff"
1427
+ borderTopColor: "#fff"
1236
1428
  },
1237
1429
  ".prism-previewer-flipped.prism-previewer-flipped.after": {
1238
- "borderBottomColor": "#fff"
1430
+ borderBottomColor: "#fff"
1239
1431
  },
1240
1432
  ".prism-previewer-angle.prism-previewer-angle:before": {
1241
- "background": "#f1f5f9"
1433
+ background: "#f1f5f9"
1242
1434
  },
1243
1435
  ".prism-previewer-time.prism-previewer-time:before": {
1244
- "background": "#f1f5f9"
1436
+ background: "#f1f5f9"
1245
1437
  },
1246
1438
  ".prism-previewer-easing.prism-previewer-easing": {
1247
- "background": "#f1f5f9"
1439
+ background: "#f1f5f9"
1248
1440
  },
1249
1441
  ".prism-previewer-angle.prism-previewer-angle circle": {
1250
- "stroke": "#1e293b",
1251
- "strokeOpacity": "1"
1442
+ stroke: "#1e293b",
1443
+ strokeOpacity: "1"
1252
1444
  },
1253
1445
  ".prism-previewer-time.prism-previewer-time circle": {
1254
- "stroke": "#1e293b",
1255
- "strokeOpacity": "1"
1446
+ stroke: "#1e293b",
1447
+ strokeOpacity: "1"
1256
1448
  },
1257
1449
  ".prism-previewer-easing.prism-previewer-easing circle": {
1258
- "stroke": "#1e293b",
1259
- "fill": "transparent"
1450
+ stroke: "#1e293b",
1451
+ fill: "transparent"
1260
1452
  },
1261
1453
  ".prism-previewer-easing.prism-previewer-easing path": {
1262
- "stroke": "#1e293b"
1454
+ stroke: "#1e293b"
1263
1455
  },
1264
1456
  ".prism-previewer-easing.prism-previewer-easing line": {
1265
- "stroke": "#1e293b"
1457
+ stroke: "#1e293b"
1266
1458
  }
1267
1459
  };
1268
1460
  const CodeHighlighter = ({
@@ -1274,7 +1466,7 @@
1274
1466
  toolbarClassName,
1275
1467
  theme = dark
1276
1468
  }) => {
1277
- const match = language == null ? void 0 : language.match(/language-(\w+)/);
1469
+ const match = language?.match(/language-(\w+)/);
1278
1470
  const lang = match ? match[1] : "text";
1279
1471
  const handleCopy = (text) => {
1280
1472
  navigator.clipboard.writeText(text).then(() => {
@@ -1291,21 +1483,14 @@
1291
1483
  {
1292
1484
  className: reablocks.cn(copyClassName),
1293
1485
  size: "small",
1294
- variant: "text",
1486
+ variant: "ghost",
1295
1487
  title: "Copy code",
1296
1488
  onClick: () => handleCopy(children),
1297
1489
  children: copyIcon
1298
1490
  }
1299
1491
  )
1300
1492
  ] }),
1301
- /* @__PURE__ */ jsxRuntime.jsx(
1302
- reactSyntaxHighlighter.Prism,
1303
- {
1304
- language: lang,
1305
- style: theme,
1306
- children
1307
- }
1308
- )
1493
+ /* @__PURE__ */ jsxRuntime.jsx(reactSyntaxHighlighter.Prism, { language: lang, style: theme, children })
1309
1494
  ] });
1310
1495
  };
1311
1496
  const TableComponent = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("table", { ...props, children });
@@ -1366,26 +1551,103 @@
1366
1551
  };
1367
1552
  const CVE_REGEX = /(CVE-(19|20)\d{2}-\d{4,7})/gi;
1368
1553
  function remarkCve() {
1369
- return (tree, _file) => {
1370
- mdastUtilFindAndReplace.findAndReplace(tree, [[
1371
- CVE_REGEX,
1372
- replaceCve
1373
- ]]);
1554
+ return (tree) => {
1555
+ mdastUtilFindAndReplace.findAndReplace(tree, [[CVE_REGEX, replaceCve]]);
1374
1556
  };
1375
1557
  function replaceCve(value, id) {
1376
1558
  return [
1377
1559
  {
1378
1560
  type: "link",
1379
1561
  url: `https://cve.mitre.org/cgi-bin/cvename.cgi?name=${id}`,
1380
- children: [
1381
- { children: [{ type: "text", value: value.trim() }] }
1382
- ]
1562
+ children: [{ children: [{ type: "text", value: value.trim() }] }]
1383
1563
  }
1384
1564
  ];
1385
1565
  }
1386
1566
  }
1567
+ const SessionEmpty = ({ children }) => {
1568
+ const { theme } = React.useContext(ChatContext);
1569
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: reablocks.cn(theme.empty), children });
1570
+ };
1571
+ const SvgRefresh = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: 18, height: 18, viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M1.75 8.25098C2.16399 8.25098 2.49998 8.58699 2.5 9.00098C2.5 12.585 5.416 15.501 9 15.501C11.149 15.501 13.1291 14.4262 14.3301 12.6992L12.8701 12.9014C12.4591 12.9484 12.0814 12.6698 12.0244 12.2598C11.9685 11.8498 12.2541 11.4711 12.665 11.4141L15.6094 11.0068L15.6104 11.0078C16.0172 10.951 16.3981 11.2386 16.4551 11.6484L16.8633 14.5928C16.9203 15.0038 16.6327 15.3825 16.2227 15.4395C16.1878 15.4444 16.153 15.4463 16.1191 15.4463C15.7501 15.4463 15.429 15.1738 15.377 14.7988L15.2598 13.9551C13.7628 15.842 11.4739 17.001 9 17.001C4.589 17.001 1 13.412 1 9.00098C1.00002 8.58699 1.33601 8.25098 1.75 8.25098ZM9.00098 1C13.412 1 17.001 4.589 17.001 9C17.001 9.414 16.665 9.75 16.251 9.75C15.837 9.75 15.501 9.414 15.501 9C15.501 5.416 12.585 2.5 9.00098 2.5C6.84502 2.5 4.87188 3.57384 3.67188 5.30078L5.12988 5.09863C5.53788 5.04563 5.91859 5.32923 5.97559 5.74023C6.03148 6.15017 5.7459 6.52895 5.33496 6.58594L2.39062 6.99316C2.35579 6.99812 2.32095 6.99999 2.28711 7C1.91811 7 1.59692 6.72754 1.54492 6.35254L1.13672 3.4082C1.07972 2.9972 1.36734 2.61852 1.77734 2.56152C2.18818 2.50179 2.56607 2.79129 2.62305 3.20215L2.73926 4.04199C4.23526 2.15508 6.52006 1 9 1H9.00098Z", fill: "currentColor" }));
1572
+ const SvgThumbsDown = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 18, height: 18, viewBox: "0 0 18 18", fill: "none", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M11.25 1.25H4.5C3.8775 1.25 3.345 1.625 3.12 2.165L0.855 7.4525C0.7875 7.625 0.75 7.805 0.75 8V9.5C0.75 10.325 1.425 11 2.25 11H6.9825L6.27 14.4275L6.2475 14.6675C6.2475 14.975 6.375 15.26 6.5775 15.4625L7.3725 16.25L12.315 11.3075C12.585 11.0375 12.75 10.6625 12.75 10.25V2.75C12.75 1.925 12.075 1.25 11.25 1.25ZM11.25 10.25L7.995 13.505L9 9.5H2.25V8L4.5 2.75H11.25V10.25ZM14.25 1.25H17.25V10.25H14.25V1.25Z", fill: "currentColor" }));
1573
+ const SvgThumbsUp = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 18, height: 18, viewBox: "0 0 18 18", fill: "none", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M6.75 15.75H13.5C14.1225 15.75 14.655 15.375 14.88 14.835L17.145 9.5475C17.2125 9.375 17.25 9.195 17.25 9V7.5C17.25 6.675 16.575 6 15.75 6H11.0175L11.73 2.5725L11.7525 2.3325C11.7525 2.025 11.625 1.74 11.4225 1.5375L10.6275 0.75L5.685 5.6925C5.415 5.9625 5.25 6.3375 5.25 6.75V14.25C5.25 15.075 5.925 15.75 6.75 15.75ZM6.75 6.75L10.005 3.495L9 7.5H15.75V9L13.5 14.25H6.75V6.75ZM0.75 6.75H3.75V15.75H0.75V6.75Z", fill: "currentColor" }));
1574
+ const MessageActions = ({
1575
+ children,
1576
+ ...props
1577
+ }) => {
1578
+ const { theme } = React.useContext(ChatContext);
1579
+ const {
1580
+ question,
1581
+ response,
1582
+ copyIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgCopy, {}),
1583
+ thumbsUpIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgThumbsUp, {}),
1584
+ thumbsDownIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgThumbsDown, {}),
1585
+ refreshIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgRefresh, {}),
1586
+ onCopy,
1587
+ onUpvote,
1588
+ onDownvote,
1589
+ onRefresh
1590
+ } = props;
1591
+ const Comp = children ? reactSlot.Slot : "div";
1592
+ const handleCopy = (text) => {
1593
+ navigator.clipboard.writeText(text).then(() => {
1594
+ console.log("Text copied to clipboard");
1595
+ }).catch((err) => {
1596
+ console.error("Could not copy text: ", err);
1597
+ });
1598
+ };
1599
+ return (copyIcon || thumbsDownIcon || thumbsUpIcon || refreshIcon) && /* @__PURE__ */ jsxRuntime.jsx(Comp, { className: reablocks.cn(theme.messages.message.footer.base), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1600
+ copyIcon && /* @__PURE__ */ jsxRuntime.jsx(
1601
+ reablocks.IconButton,
1602
+ {
1603
+ variant: "ghost",
1604
+ disablePadding: true,
1605
+ title: "Copy question and response",
1606
+ className: reablocks.cn(theme.messages.message.footer.copy),
1607
+ onClick: onCopy ? onCopy : () => handleCopy(`${question}
1608
+ ${response}`),
1609
+ children: copyIcon
1610
+ }
1611
+ ),
1612
+ thumbsUpIcon && /* @__PURE__ */ jsxRuntime.jsx(
1613
+ reablocks.IconButton,
1614
+ {
1615
+ variant: "ghost",
1616
+ disablePadding: true,
1617
+ title: "Upvote",
1618
+ className: reablocks.cn(theme.messages.message.footer.upvote),
1619
+ onClick: onUpvote,
1620
+ children: thumbsUpIcon
1621
+ }
1622
+ ),
1623
+ thumbsDownIcon && /* @__PURE__ */ jsxRuntime.jsx(
1624
+ reablocks.IconButton,
1625
+ {
1626
+ variant: "ghost",
1627
+ disablePadding: true,
1628
+ title: "Downvote",
1629
+ className: reablocks.cn(theme.messages.message.footer.downvote),
1630
+ onClick: onDownvote,
1631
+ children: thumbsDownIcon
1632
+ }
1633
+ ),
1634
+ refreshIcon && /* @__PURE__ */ jsxRuntime.jsx(
1635
+ reablocks.IconButton,
1636
+ {
1637
+ variant: "ghost",
1638
+ disablePadding: true,
1639
+ title: "Refresh",
1640
+ className: reablocks.cn(theme.messages.message.footer.refresh),
1641
+ onClick: onRefresh,
1642
+ children: refreshIcon
1643
+ }
1644
+ )
1645
+ ] }) });
1646
+ };
1387
1647
  const SvgFile = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, viewBox: "0 0 16 16", fill: "currentColor", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M2.7036 1.37034C3.04741 1.02653 3.51373 0.833374 3.99996 0.833374H9.33329H9.33331C9.47275 0.833374 9.59885 0.890449 9.68954 0.98251L13.6843 4.97722C13.7763 5.0679 13.8333 5.19398 13.8333 5.33337L13.8333 5.3379V13.3334C13.8333 13.8196 13.6401 14.2859 13.2963 14.6297C12.9525 14.9736 12.4862 15.1667 12 15.1667H3.99996C3.51373 15.1667 3.04741 14.9736 2.7036 14.6297C2.35978 14.2859 2.16663 13.8196 2.16663 13.3334V2.66671C2.16663 2.18048 2.35978 1.71416 2.7036 1.37034ZM3.99996 1.83337H8.83331V5.33337C8.83331 5.60952 9.05717 5.83337 9.33331 5.83337H12.8333V13.3334C12.8333 13.5544 12.7455 13.7663 12.5892 13.9226C12.4329 14.0789 12.221 14.1667 12 14.1667H3.99996C3.77895 14.1667 3.56698 14.0789 3.4107 13.9226C3.25442 13.7663 3.16663 13.5544 3.16663 13.3334V2.66671C3.16663 2.44569 3.25442 2.23373 3.4107 2.07745C3.56698 1.92117 3.77895 1.83337 3.99996 1.83337ZM9.83331 2.5405L12.1262 4.83337H9.83331V2.5405ZM5.33331 8.16663C5.05717 8.16663 4.83331 8.39048 4.83331 8.66663C4.83331 8.94277 5.05717 9.16663 5.33331 9.16663H10.6666C10.9428 9.16663 11.1666 8.94277 11.1666 8.66663C11.1666 8.39048 10.9428 8.16663 10.6666 8.16663H5.33331ZM4.83331 11.3334C4.83331 11.0572 5.05717 10.8334 5.33331 10.8334H10.6666C10.9428 10.8334 11.1666 11.0572 11.1666 11.3334C11.1666 11.6095 10.9428 11.8334 10.6666 11.8334H5.33331C5.05717 11.8334 4.83331 11.6095 4.83331 11.3334ZM5.33331 5.5C5.05717 5.5 4.83331 5.72386 4.83331 6C4.83331 6.27614 5.05717 6.5 5.33331 6.5H6.66665C6.94279 6.5 7.16665 6.27614 7.16665 6C7.16665 5.72386 6.94279 5.5 6.66665 5.5H5.33331Z" }));
1388
- const DefaultFileRenderer$2 = React.lazy(() => Promise.resolve().then(() => DefaultFileRenderer$1));
1648
+ const DefaultFileRenderer$2 = React.lazy(
1649
+ () => Promise.resolve().then(() => DefaultFileRenderer$1)
1650
+ );
1389
1651
  const CSVFileRenderer$2 = React.lazy(() => Promise.resolve().then(() => CSVFileRenderer$1));
1390
1652
  const ImageFileRenderer$2 = React.lazy(() => Promise.resolve().then(() => ImageFileRenderer$1));
1391
1653
  const PDFFileRenderer$2 = React.lazy(() => Promise.resolve().then(() => PDFFileRenderer$1));
@@ -1403,29 +1665,12 @@
1403
1665
  }) => {
1404
1666
  const { theme } = React.useContext(ChatContext);
1405
1667
  const FileRenderer = React.useMemo(() => {
1406
- const Renderer = Object.keys(FILE_TYPE_RENDERER_MAP).find((key) => type == null ? void 0 : type.startsWith(key)) ?? "default";
1668
+ const Renderer = Object.keys(FILE_TYPE_RENDERER_MAP).find((key) => type?.startsWith(key)) ?? "default";
1407
1669
  return FILE_TYPE_RENDERER_MAP[Renderer] || DefaultFileRenderer$2;
1408
1670
  }, [type]);
1409
- return /* @__PURE__ */ jsxRuntime.jsx(
1410
- "div",
1411
- {
1412
- className: reablocks.cn(theme.messages.message.files.file.base),
1413
- children: /* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsxRuntime.jsx(FileRenderer, { name, url, fileIcon, limit }) })
1414
- }
1415
- );
1671
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: reablocks.cn(theme.messages.message.files.file.base), children: /* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsxRuntime.jsx(FileRenderer, { name, url, fileIcon, limit }) }) });
1416
1672
  };
1417
- const DefaultFileRenderer = ({
1418
- name,
1419
- limit = 100,
1420
- fileIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgFile, {})
1421
- }) => /* @__PURE__ */ jsxRuntime.jsxs("figure", { className: "flex items-center gap-2", children: [
1422
- fileIcon,
1423
- name && /* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: reablocks.cn("file-name-class"), children: /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { value: name, limit }) })
1424
- ] });
1425
- const DefaultFileRenderer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1426
- __proto__: null,
1427
- default: DefaultFileRenderer
1428
- }, Symbol.toStringTag, { value: "Module" }));
1673
+ const SvgDownload = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "24px", height: "24px", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M 11 2 C 10.448 2 10 2.448 10 3 L 10 11 L 6.5 11 A 0.5 0.5 0 0 0 6 11.5 A 0.5 0.5 0 0 0 6.1464844 11.853516 A 0.5 0.5 0 0 0 6.1777344 11.882812 L 11.283203 16.697266 L 11.316406 16.728516 A 1 1 0 0 0 12 17 A 1 1 0 0 0 12.683594 16.728516 L 12.697266 16.716797 A 1 1 0 0 0 12.707031 16.705078 L 17.810547 11.892578 A 0.5 0.5 0 0 0 17.839844 11.865234 L 17.847656 11.859375 A 0.5 0.5 0 0 0 17.853516 11.853516 A 0.5 0.5 0 0 0 18 11.5 A 0.5 0.5 0 0 0 17.5 11 L 14 11 L 14 3 C 14 2.448 13.552 2 13 2 L 12 2 L 11 2 z M 3 20 A 1.0001 1.0001 0 1 0 3 22 L 21 22 A 1.0001 1.0001 0 1 0 21 20 L 3 20 z", fill: "currentColor" }));
1429
1674
  const sanitizeSVGCell = (cell) => {
1430
1675
  const trimmed = cell.trim();
1431
1676
  const escaped = trimmed.replace(/"/g, '""');
@@ -1442,8 +1687,8 @@
1442
1687
  throw new Error("Failed to parse CSV file.");
1443
1688
  }
1444
1689
  };
1445
- const SvgDownload = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1, strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-cloud-download", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M12 12v9" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "m8 17 4 4 4-4" }));
1446
1690
  const CSVFileRenderer = ({ name, url, fileIcon }) => {
1691
+ const { theme } = React.useContext(ChatContext);
1447
1692
  const [isLoading, setIsLoading] = React.useState(true);
1448
1693
  const [csvData, setCsvData] = React.useState([]);
1449
1694
  const [error, setError] = React.useState(null);
@@ -1519,24 +1764,24 @@
1519
1764
  ]
1520
1765
  }
1521
1766
  );
1522
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
1523
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center gap-4", children: [
1524
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "csv-icon flex items-center", children: [
1767
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: theme.messages.message.csvPreview.base, children: [
1768
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: theme.messages.message.csvPreview.header.base, children: [
1769
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: theme.messages.message.csvPreview.header.icon, children: [
1525
1770
  fileIcon,
1526
1771
  name && /* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: "ml-1", children: name })
1527
1772
  ] }),
1528
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "csv-icon flex items-center gap-6", children: [
1529
- /* @__PURE__ */ jsxRuntime.jsx(reablocks.IconButton, { size: "small", variant: "text", onClick: downloadCSV, children: /* @__PURE__ */ jsxRuntime.jsx(SvgDownload, {}) }),
1530
- /* @__PURE__ */ jsxRuntime.jsx(reablocks.IconButton, { size: "small", variant: "text", onClick: toggleModal, children: /* @__PURE__ */ jsxRuntime.jsx(SvgCopy, {}) })
1773
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: theme.messages.message.csvPreview.header.actions, children: [
1774
+ /* @__PURE__ */ jsxRuntime.jsx(reablocks.IconButton, { size: "medium", variant: "text", onClick: downloadCSV, children: /* @__PURE__ */ jsxRuntime.jsx(SvgDownload, {}) }),
1775
+ /* @__PURE__ */ jsxRuntime.jsx(reablocks.IconButton, { size: "medium", variant: "text", onClick: toggleModal, children: /* @__PURE__ */ jsxRuntime.jsx(SvgCopy, {}) })
1531
1776
  ] })
1532
1777
  ] }),
1533
1778
  error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "error-message", children: error }),
1534
1779
  isLoading && !csvData && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-text-secondary", children: "Loading..." }),
1535
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-between", children: !error && csvData.length > 0 && renderTable(csvData, 6) }),
1780
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: theme.messages.message.csvPreview.tableContainer, children: !error && csvData.length > 0 && renderTable(csvData, 6) }),
1536
1781
  /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: isModalOpen && /* @__PURE__ */ jsxRuntime.jsx(
1537
1782
  react.motion.div,
1538
1783
  {
1539
- className: "fixed inset-0 bg-black/70 flex justify-center items-center z-50",
1784
+ className: theme.messages.message.csvPreview.dialog.base,
1540
1785
  initial: { opacity: 0 },
1541
1786
  animate: { opacity: 1 },
1542
1787
  exit: { opacity: 0 },
@@ -1545,7 +1790,7 @@
1545
1790
  react.motion.div,
1546
1791
  {
1547
1792
  ref: modalRef,
1548
- className: "bg-white dark:bg-gray-900 rounded-md w-11/12 h-5/6 overflow-auto",
1793
+ className: theme.messages.message.csvPreview.dialog.container,
1549
1794
  initial: { scale: 0.8 },
1550
1795
  animate: { scale: 1 },
1551
1796
  exit: { scale: 0.8 },
@@ -1561,15 +1806,34 @@
1561
1806
  __proto__: null,
1562
1807
  default: CSVFileRenderer
1563
1808
  }, Symbol.toStringTag, { value: "Module" }));
1809
+ const DefaultFileRenderer = ({
1810
+ name,
1811
+ limit = 100,
1812
+ fileIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgFile, {})
1813
+ }) => /* @__PURE__ */ jsxRuntime.jsxs("figure", { className: "flex items-center gap-2", children: [
1814
+ fileIcon,
1815
+ name && /* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: reablocks.cn("file-name-class"), children: /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { value: name, limit }) })
1816
+ ] });
1817
+ const DefaultFileRenderer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1818
+ __proto__: null,
1819
+ default: DefaultFileRenderer
1820
+ }, Symbol.toStringTag, { value: "Module" }));
1564
1821
  const ImageFileRenderer = ({ url }) => /* @__PURE__ */ jsxRuntime.jsx("img", { src: url, alt: "Image", className: "size-10" });
1565
1822
  const ImageFileRenderer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1566
1823
  __proto__: null,
1567
1824
  default: ImageFileRenderer
1568
1825
  }, Symbol.toStringTag, { value: "Module" }));
1569
- const PDFFileRenderer = ({ name, url, fileIcon }) => /* @__PURE__ */ jsxRuntime.jsxs("figure", { className: "csv-icon flex items-center gap-2", onClick: () => window.open(url, "_blank"), children: [
1570
- fileIcon,
1571
- name && /* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: "file-name", children: name })
1572
- ] });
1826
+ const PDFFileRenderer = ({ name, url, fileIcon }) => /* @__PURE__ */ jsxRuntime.jsxs(
1827
+ "figure",
1828
+ {
1829
+ className: "csv-icon flex items-center gap-2",
1830
+ onClick: () => window.open(url, "_blank"),
1831
+ children: [
1832
+ fileIcon,
1833
+ name && /* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: "file-name", children: name })
1834
+ ]
1835
+ }
1836
+ );
1573
1837
  const PDFFileRenderer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1574
1838
  __proto__: null,
1575
1839
  default: PDFFileRenderer
@@ -1704,7 +1968,12 @@
1704
1968
  }
1705
1969
  );
1706
1970
  };
1707
- const MessageSource = ({ title, url, image, limit = 50 }) => {
1971
+ const MessageSource = ({
1972
+ title,
1973
+ url,
1974
+ image,
1975
+ limit = 50
1976
+ }) => {
1708
1977
  const { theme, isCompact } = React.useContext(ChatContext);
1709
1978
  return /* @__PURE__ */ jsxRuntime.jsxs(
1710
1979
  "figure",
@@ -1718,10 +1987,26 @@
1718
1987
  }
1719
1988
  },
1720
1989
  children: [
1721
- image && /* @__PURE__ */ jsxRuntime.jsx("img", { src: image, alt: title, className: reablocks.cn(theme.messages.message.sources.source.image) }),
1990
+ image && /* @__PURE__ */ jsxRuntime.jsx(
1991
+ "img",
1992
+ {
1993
+ src: image,
1994
+ alt: title,
1995
+ className: reablocks.cn(theme.messages.message.sources.source.image)
1996
+ }
1997
+ ),
1722
1998
  (title || url) && /* @__PURE__ */ jsxRuntime.jsxs("figcaption", { children: [
1723
1999
  title && /* @__PURE__ */ jsxRuntime.jsx("span", { className: reablocks.cn(theme.messages.message.sources.source.title), children: /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { value: title, limit }) }),
1724
- url && /* @__PURE__ */ jsxRuntime.jsx("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: reablocks.cn(theme.messages.message.sources.source.url), children: url })
2000
+ url && /* @__PURE__ */ jsxRuntime.jsx(
2001
+ "a",
2002
+ {
2003
+ href: url,
2004
+ target: "_blank",
2005
+ rel: "noopener noreferrer",
2006
+ className: reablocks.cn(theme.messages.message.sources.source.url),
2007
+ children: url
2008
+ }
2009
+ )
1725
2010
  ] })
1726
2011
  ]
1727
2012
  }
@@ -1738,82 +2023,6 @@
1738
2023
  }
1739
2024
  return sources && sources.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: reablocks.cn(theme.messages.message.sources.base), children: sources.map((source, index) => /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...source, children }, index)) });
1740
2025
  };
1741
- const SvgThumbsDown = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1, strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-thumbs-down", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M17 14V2" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z" }));
1742
- const SvgThumbsUp = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1, strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-thumbs-up", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M7 10v12" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z" }));
1743
- const SvgRefresh = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1, strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-refresh-ccw", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M3 3v5h5" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M16 16h5v5" }));
1744
- const MessageActions = ({
1745
- children,
1746
- ...props
1747
- }) => {
1748
- const { theme } = React.useContext(ChatContext);
1749
- const {
1750
- question,
1751
- response,
1752
- copyIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgCopy, {}),
1753
- thumbsUpIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgThumbsUp, {}),
1754
- thumbsDownIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgThumbsDown, {}),
1755
- refreshIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgRefresh, {}),
1756
- onCopy,
1757
- onUpvote,
1758
- onDownvote,
1759
- onRefresh
1760
- } = props;
1761
- const Comp = children ? reactSlot.Slot : "div";
1762
- const handleCopy = (text) => {
1763
- navigator.clipboard.writeText(text).then(() => {
1764
- console.log("Text copied to clipboard");
1765
- }).catch((err) => {
1766
- console.error("Could not copy text: ", err);
1767
- });
1768
- };
1769
- return (copyIcon || thumbsDownIcon || thumbsUpIcon || refreshIcon) && /* @__PURE__ */ jsxRuntime.jsx(Comp, { className: reablocks.cn(theme.messages.message.footer.base), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1770
- copyIcon && /* @__PURE__ */ jsxRuntime.jsx(
1771
- reablocks.IconButton,
1772
- {
1773
- variant: "text",
1774
- disablePadding: true,
1775
- title: "Copy question and response",
1776
- className: reablocks.cn(theme.messages.message.footer.copy),
1777
- onClick: onCopy ? onCopy : () => handleCopy(`${question}
1778
- ${response}`),
1779
- children: copyIcon
1780
- }
1781
- ),
1782
- thumbsUpIcon && /* @__PURE__ */ jsxRuntime.jsx(
1783
- reablocks.IconButton,
1784
- {
1785
- variant: "text",
1786
- disablePadding: true,
1787
- title: "Upvote",
1788
- className: reablocks.cn(theme.messages.message.footer.upvote),
1789
- onClick: onUpvote,
1790
- children: thumbsUpIcon
1791
- }
1792
- ),
1793
- thumbsDownIcon && /* @__PURE__ */ jsxRuntime.jsx(
1794
- reablocks.IconButton,
1795
- {
1796
- variant: "text",
1797
- disablePadding: true,
1798
- title: "Downvote",
1799
- className: reablocks.cn(theme.messages.message.footer.downvote),
1800
- onClick: onDownvote,
1801
- children: thumbsDownIcon
1802
- }
1803
- ),
1804
- refreshIcon && /* @__PURE__ */ jsxRuntime.jsx(
1805
- reablocks.IconButton,
1806
- {
1807
- variant: "text",
1808
- disablePadding: true,
1809
- title: "Refresh",
1810
- className: reablocks.cn(theme.messages.message.footer.refresh),
1811
- onClick: onRefresh,
1812
- children: refreshIcon
1813
- }
1814
- )
1815
- ] }) });
1816
- };
1817
2026
  const messageVariants = {
1818
2027
  hidden: {
1819
2028
  opacity: 0,
@@ -1835,7 +2044,13 @@ ${response}`),
1835
2044
  const { theme, isLoading } = React.useContext(ChatContext);
1836
2045
  return /* @__PURE__ */ jsxRuntime.jsxs(react.motion.div, { variants: messageVariants, children: [
1837
2046
  /* @__PURE__ */ jsxRuntime.jsx(reablocks.Card, { className: reablocks.cn(theme.messages.message.base), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1838
- /* @__PURE__ */ jsxRuntime.jsx(MessageQuestion, { question: conversation.question, files: conversation.files }),
2047
+ /* @__PURE__ */ jsxRuntime.jsx(
2048
+ MessageQuestion,
2049
+ {
2050
+ question: conversation.question,
2051
+ files: conversation.files
2052
+ }
2053
+ ),
1839
2054
  /* @__PURE__ */ jsxRuntime.jsx(
1840
2055
  MessageResponse,
1841
2056
  {
@@ -1855,18 +2070,62 @@ ${response}`),
1855
2070
  !isLast && /* @__PURE__ */ jsxRuntime.jsx(reablocks.Divider, {})
1856
2071
  ] }, conversation.id);
1857
2072
  };
1858
- const containerVariants = {
1859
- hidden: {},
1860
- visible: {
1861
- transition: {
1862
- staggerChildren: 0.07,
1863
- when: "beforeChildren"
1864
- }
1865
- }
1866
- };
1867
- const SessionMessages = ({
2073
+ const SvgBack = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 50 50", width: "24px", height: "24px", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M 34.980469 3.992188 C 34.71875 3.996094 34.472656 4.105469 34.292969 4.292969 L 14.292969 24.292969 C 13.902344 24.683594 13.902344 25.316406 14.292969 25.707031 L 34.292969 45.707031 C 34.542969 45.96875 34.917969 46.074219 35.265625 45.980469 C 35.617188 45.890625 35.890625 45.617188 35.980469 45.265625 C 36.074219 44.917969 35.96875 44.542969 35.707031 44.292969 L 16.414063 25 L 35.707031 5.707031 C 36.003906 5.417969 36.089844 4.980469 35.929688 4.601563 C 35.769531 4.21875 35.394531 3.976563 34.980469 3.992188 Z", fill: "currentColor" }));
2074
+ const SessionMessagePanel = ({
1868
2075
  children,
1869
- newSessionContent,
2076
+ allowBack = true
2077
+ }) => {
2078
+ const { activeSessionId, theme, isCompact, selectSession, viewType } = React.useContext(ChatContext);
2079
+ const isVisible = isCompact && activeSessionId || viewType === "chat" || !isCompact;
2080
+ return isVisible && /* @__PURE__ */ jsxRuntime.jsx(
2081
+ react.motion.div,
2082
+ {
2083
+ initial: { translateX: "200%" },
2084
+ animate: {
2085
+ translateX: "0%",
2086
+ transition: {
2087
+ type: "tween",
2088
+ ease: "linear",
2089
+ duration: 0.2,
2090
+ when: "beforeChildren"
2091
+ }
2092
+ },
2093
+ exit: { translateX: "200%" },
2094
+ className: reablocks.cn(theme.messages.base, {
2095
+ [theme.messages.companion]: isCompact,
2096
+ [theme.messages.console]: !isCompact
2097
+ }),
2098
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(theme.messages.inner), children: [
2099
+ allowBack && isCompact && viewType !== "chat" && /* @__PURE__ */ jsxRuntime.jsxs(
2100
+ reablocks.Button,
2101
+ {
2102
+ variant: "text",
2103
+ size: "small",
2104
+ onClick: () => selectSession(null),
2105
+ className: reablocks.cn(theme.messages.back),
2106
+ children: [
2107
+ /* @__PURE__ */ jsxRuntime.jsx(SvgBack, {}),
2108
+ "Back"
2109
+ ]
2110
+ }
2111
+ ),
2112
+ children
2113
+ ] })
2114
+ }
2115
+ );
2116
+ };
2117
+ const containerVariants = {
2118
+ hidden: {},
2119
+ visible: {
2120
+ transition: {
2121
+ staggerChildren: 0.07,
2122
+ when: "beforeChildren"
2123
+ }
2124
+ }
2125
+ };
2126
+ const SessionMessages = ({
2127
+ children,
2128
+ newSessionContent,
1870
2129
  limit = 10,
1871
2130
  showMoreText = "Show more",
1872
2131
  autoScroll = true
@@ -1886,7 +2145,7 @@ ${response}`),
1886
2145
  requestAnimationFrame(() => contentRef.current.scrollTop = 0);
1887
2146
  }
1888
2147
  const reversedConvos = React.useMemo(
1889
- () => [...(activeSession == null ? void 0 : activeSession.conversations) ?? []].reverse(),
2148
+ () => [...activeSession?.conversations ?? []].reverse(),
1890
2149
  [activeSession]
1891
2150
  );
1892
2151
  const { data, hasMore, showNext } = reablocks.useInfinityList({
@@ -1894,7 +2153,7 @@ ${response}`),
1894
2153
  size: limit
1895
2154
  });
1896
2155
  const reReversedConvo = React.useMemo(() => [...data].reverse(), [data]);
1897
- const convosToRender = limit ? reReversedConvo : activeSession == null ? void 0 : activeSession.conversations;
2156
+ const convosToRender = limit ? reReversedConvo : activeSession?.conversations;
1898
2157
  if (!activeSession) {
1899
2158
  return /* @__PURE__ */ jsxRuntime.jsx(SessionEmpty, { children: newSessionContent });
1900
2159
  }
@@ -1927,336 +2186,26 @@ ${response}`),
1927
2186
  conversation.id
1928
2187
  ))
1929
2188
  },
1930
- activeSession == null ? void 0 : activeSession.id
2189
+ activeSession?.id
1931
2190
  ) })
1932
2191
  ] });
1933
2192
  };
1934
- const chatTheme = {
1935
- base: "dark:text-white text-gray-500",
1936
- console: "flex w-full gap-4 h-full",
1937
- companion: "w-full h-full overflow-hidden",
1938
- empty: "text-center flex-1",
1939
- appbar: "flex p-5",
1940
- sessions: {
1941
- base: "overflow-auto",
1942
- console: "min-w-[150px] w-[30%] max-w-[300px] dark:bg-[#11111F] bg-[#F2F3F7] p-5 rounded-3xl",
1943
- companion: "w-full h-full",
1944
- group: "text-xs dart:text-gray-400 text-gray-700 mt-4 hover:bg-transparent mb-1",
1945
- create: "relative mb-4 rounded-[10px] text-white",
1946
- session: {
1947
- base: [
1948
- "group my-1 rounded-[10px] p-2 text-gray-500 border border-transparent hover:bg-gray-300 hover:border-gray-400 [&_svg]:text-gray-500",
1949
- "dark:text-typography dark:text-gray-400 dark:hover:bg-gray-800/50 dark:hover:border-gray-700/50 dark:[&_svg]:text-gray-200"
1950
- ].join(" "),
1951
- active: [
1952
- "border border-gray-300 hover:border-gray-400 text-gray-700 bg-gray-200 hover:bg-gray-300 ",
1953
- "dark:text-gray-500 dark:bg-gray-800/70 dark:border-gray-700/50 dark:text-white dark:border-gray-700/70 dark:hover:bg-gray-800/50",
1954
- "[&_button]:opacity-100!"
1955
- ].join(" "),
1956
- delete: "[&>svg]:w-4 [&>svg]:h-4 opacity-0 group-hover:opacity-50!"
1957
- }
1958
- },
1959
- messages: {
1960
- base: "",
1961
- console: "flex flex-col mx-5 flex-1 overflow-hidden",
1962
- companion: "flex w-full h-full",
1963
- back: "self-start p-0 my-2",
1964
- inner: "flex-1 h-full flex flex-col",
1965
- title: ["text-base font-bold text-gray-500", "dark:text-gray-200"].join(
1966
- " "
1967
- ),
1968
- date: "text-xs whitespace-nowrap text-gray-400",
1969
- content: [
1970
- "mt-2 flex-1 overflow-auto [&_hr]:bg-gray-200",
1971
- "dark:[&_hr]:bg-gray-800/60"
1972
- ].join(" "),
1973
- header: "flex justify-between items-center gap-2",
1974
- showMore: "mb-4",
1975
- message: {
1976
- base: "mt-4 mb-4 flex flex-col p-0 rounded-sm border-none bg-transparent",
1977
- question: [
1978
- "relative font-semibold mb-4 px-4 py-4 pb-2 rounded-3xl rounded-br-none text-typography border bg-gray-200 border-gray-300 text-gray-900",
1979
- "dark:bg-gray-900/60 dark:border-gray-700/50 dark:text-gray-100"
1980
- ].join(" "),
1981
- response: [
1982
- "relative data-[compact=false]:px-4 text-gray-900",
1983
- "dark:text-gray-100"
1984
- ].join(" "),
1985
- overlay: "overflow-y-hidden max-h-[350px] after:content-[''] after:absolute after:inset-x-0 after:bottom-0 after:h-16 after:bg-linear-to-b after:from-transparent dark:after:to-gray-900 after:to-gray-200",
1986
- cursor: "inline-block w-1 h-4 bg-current",
1987
- expand: "absolute bottom-1 right-1 z-10",
1988
- files: {
1989
- base: "mb-2 flex flex-wrap gap-3 ",
1990
- file: {
1991
- base: [
1992
- "flex items-center gap-2 border border-gray-300 px-3 py-2 rounded-lg cursor-pointer",
1993
- "dark:border-gray-700"
1994
- ].join(" "),
1995
- name: ["text-sm text-gray-500", "dark:text-gray-200"].join(" ")
1996
- }
1997
- },
1998
- sources: {
1999
- base: "my-4 flex flex-wrap gap-3",
2000
- source: {
2001
- base: [
2002
- "flex gap-2 border border-gray-200 px-4 py-2 rounded-lg cursor-pointer",
2003
- "dark:border-gray-700"
2004
- ].join(" "),
2005
- companion: "flex-1 px-3 py-1.5",
2006
- image: "max-w-10 max-h-10 rounded-md w-full h-fit self-center",
2007
- title: "text-md block",
2008
- url: "text-sm text-blue-400 underline"
2009
- }
2010
- },
2011
- markdown: {
2012
- copy: "sticky py-1 [&>svg]:w-4 [&>svg]:h-4 opacity-50",
2013
- p: "mb-2",
2014
- a: "text-blue-400 underline",
2015
- table: "table-auto w-full m-2",
2016
- th: "px-4 py-2 text-left font-bold border-b border-gray-500",
2017
- td: "px-4 py-2",
2018
- code: "m-2 rounded-b relative",
2019
- toolbar: "text-xs dark:bg-gray-700/50 flex items-center justify-between px-2 py-1 rounded-t sticky top-0 backdrop-blur-md bg-gray-200 ",
2020
- li: "mb-2 ml-6",
2021
- ul: "mb-4 list-disc",
2022
- ol: "mb-4 list-decimal"
2023
- },
2024
- footer: {
2025
- base: "mt-3 flex gap-1.5",
2026
- copy: [
2027
- "p-3 rounded-[10px] [&>svg]:w-4 [&>svg]:h-4 opacity-50 hover:opacity-100! hover:bg-gray-200 hover:text-gray-500",
2028
- "dark:hover:bg-gray-800 dark:hover:text-white text-gray-400"
2029
- ].join(" "),
2030
- upvote: "p-3 rounded-[10px] [&>svg]:w-4 [&>svg]:h-4 opacity-50 hover:opacity-100! hover:bg-gray-700/40 hover:text-white text-gray-400",
2031
- downvote: "p-3 rounded-[10px] [&>svg]:w-4 [&>svg]:h-4 opacity-50 hover:opacity-100! hover:bg-gray-700/40 hover:text-white text-gray-400",
2032
- refresh: "p-3 rounded-[10px] [&>svg]:w-4 [&>svg]:h-4 opacity-50 hover:opacity-100! hover:bg-gray-700/40 hover:text-white text-gray-400"
2033
- }
2034
- }
2035
- },
2036
- input: {
2037
- base: "flex mt-4 relative",
2038
- upload: ["px-5 py-2 text-gray-400 size-10", "dark:gray-500"].join(" "),
2039
- input: [
2040
- "w-full border rounded-3xl px-3 py-2 pr-16 text-gray-500 border-gray-200 hover:bg-blue-100 hover:border-blue-500 after:hidden after:mx-10! bg-white [&>textarea]:w-full [&>textarea]:flex-none",
2041
- "dark:border-gray-700/50 dark:text-gray-200 dark:bg-gray-950 dark:hover:bg-blue-950/40"
2042
- ].join(" "),
2043
- actions: {
2044
- base: "absolute flex gap-2 items-center right-5 inset-y-1/2 -translate-y-1/2 z-10",
2045
- send: [
2046
- "px-3 py-3 hover:bg-primary-hover rounded-full bg-gray-200 hover:bg-gray-300 text-gray-500",
2047
- "dark:text-white light:text-gray-500 dark:bg-gray-800 dark:hover:bg-gray-700"
2048
- ].join(" "),
2049
- stop: "px-2 py-2 bg-red-500 text-white rounded-full hover:bg-red-700 "
2050
- }
2193
+ const SessionMessagesHeader = ({ children }) => {
2194
+ const { activeSession, theme } = React.useContext(ChatContext);
2195
+ const Comp = children ? reactSlot.Slot : "header";
2196
+ if (!activeSession) {
2197
+ return null;
2051
2198
  }
2052
- };
2053
- const useDimensions = () => {
2054
- const [ref, setRef] = React.useState(null);
2055
- const [width, setWidth] = React.useState(void 0);
2056
- const observe = React.useCallback((element) => {
2057
- if (element) setRef(element);
2058
- }, []);
2059
- React.useEffect(() => {
2060
- if (!ref) return;
2061
- const resizeObserver = new ResizeObserver((entries) => {
2062
- for (let entry of entries) {
2063
- setWidth(entry.contentRect.width);
2064
- }
2065
- });
2066
- resizeObserver.observe(ref);
2067
- return () => {
2068
- resizeObserver.disconnect();
2069
- };
2070
- }, [ref]);
2071
- return { width, observe };
2072
- };
2073
- const Chat = ({
2074
- children,
2075
- viewType = "console",
2076
- sessions,
2077
- onSelectSession,
2078
- onDeleteSession,
2079
- onSendMessage,
2080
- onStopMessage,
2081
- onFileUpload,
2082
- isLoading,
2083
- activeSessionId,
2084
- theme = chatTheme,
2085
- onNewSession,
2086
- remarkPlugins = [remarkGfm, remarkYoutube, remarkMath],
2087
- disabled,
2088
- style,
2089
- className
2090
- }) => {
2091
- const [internalActiveSessionID, setInternalActiveSessionID] = React.useState(activeSessionId);
2092
- const { width, observe } = useDimensions();
2093
- const isCompact = viewType === "companion" || width && width < 767;
2094
- React.useEffect(() => {
2095
- setInternalActiveSessionID(activeSessionId);
2096
- }, [activeSessionId]);
2097
- const handleSelectSession = React.useCallback(
2098
- (sessionId) => {
2099
- setInternalActiveSessionID(sessionId);
2100
- onSelectSession == null ? void 0 : onSelectSession(sessionId);
2101
- },
2102
- [onSelectSession]
2103
- );
2104
- const handleDeleteSession = React.useCallback(
2105
- (sessionId) => {
2106
- setInternalActiveSessionID(void 0);
2107
- onDeleteSession == null ? void 0 : onDeleteSession(sessionId);
2108
- },
2109
- [onDeleteSession]
2110
- );
2111
- const handleCreateNewSession = React.useCallback(() => {
2112
- setInternalActiveSessionID(void 0);
2113
- onNewSession == null ? void 0 : onNewSession();
2114
- }, [onNewSession]);
2115
- reakeys.useHotkeys([
2116
- {
2117
- name: "Create new session",
2118
- category: "Chat",
2119
- keys: "meta+shift+s",
2120
- callback: (event) => {
2121
- event.preventDefault();
2122
- handleCreateNewSession();
2199
+ return /* @__PURE__ */ jsxRuntime.jsx(Comp, { className: reablocks.cn(theme.messages.header), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2200
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: reablocks.cn(theme.messages.title), children: /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { limit: 125, value: activeSession.title }) }),
2201
+ /* @__PURE__ */ jsxRuntime.jsx(
2202
+ reablocks.DateFormat,
2203
+ {
2204
+ className: reablocks.cn(theme.messages.date),
2205
+ date: activeSession.createdAt
2123
2206
  }
2124
- }
2125
- ]);
2126
- const activeSession = React.useMemo(
2127
- () => sessions.find((session) => session.id === internalActiveSessionID),
2128
- [sessions, internalActiveSessionID]
2129
- );
2130
- const contextValue = React.useMemo(
2131
- () => ({
2132
- sessions,
2133
- activeSession,
2134
- remarkPlugins,
2135
- theme,
2136
- disabled,
2137
- isLoading,
2138
- isCompact,
2139
- viewType,
2140
- activeSessionId: internalActiveSessionID,
2141
- selectSession: handleSelectSession,
2142
- deleteSession: handleDeleteSession,
2143
- createSession: handleCreateNewSession,
2144
- sendMessage: onSendMessage,
2145
- stopMessage: onStopMessage,
2146
- fileUpload: onFileUpload
2147
- }),
2148
- [
2149
- isLoading,
2150
- isCompact,
2151
- viewType,
2152
- disabled,
2153
- theme,
2154
- remarkPlugins,
2155
- sessions,
2156
- activeSession,
2157
- internalActiveSessionID,
2158
- handleSelectSession,
2159
- handleDeleteSession,
2160
- handleCreateNewSession,
2161
- onSendMessage,
2162
- onStopMessage,
2163
- onFileUpload
2164
- ]
2165
- );
2166
- return /* @__PURE__ */ jsxRuntime.jsx(ChatContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: /* @__PURE__ */ jsxRuntime.jsx(
2167
- "div",
2168
- {
2169
- ref: observe,
2170
- className: reablocks.cn(className, theme.base, {
2171
- [theme.companion]: isCompact,
2172
- [theme.console]: !isCompact
2173
- }),
2174
- style,
2175
- children
2176
- }
2177
- ) }) });
2178
- };
2179
- const SvgTrash = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: 14, height: 14, viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("g", { id: "Delete" }, /* @__PURE__ */ React__namespace.createElement("path", { id: "Vector", d: "M5.97905 1.16666C5.90859 1.16576 5.83895 1.18189 5.77605 1.21368C5.71316 1.24547 5.65888 1.29199 5.61783 1.34926C5.57677 1.40654 5.55016 1.47288 5.54025 1.54265C5.53034 1.61242 5.53743 1.68355 5.56092 1.75H4.27007C3.7342 1.75 3.2324 2.01817 2.93535 2.46435L2.24492 3.5H2.18738C2.12941 3.49918 2.07185 3.50989 2.01805 3.5315C1.96425 3.55312 1.91529 3.58522 1.874 3.62593C1.83271 3.66663 1.79993 3.71514 1.77755 3.76863C1.75518 3.82211 1.74365 3.87952 1.74365 3.9375C1.74365 3.99548 1.75518 4.05288 1.77755 4.10636C1.79993 4.15985 1.83271 4.20836 1.874 4.24907C1.91529 4.28977 1.96425 4.32187 2.01805 4.34349C2.07185 4.3651 2.12941 4.37582 2.18738 4.375H2.41012C2.44765 4.38067 2.48576 4.38143 2.52348 4.37727L3.24468 11.1084C3.33169 11.9199 4.02367 12.5417 4.83973 12.5417H9.15947C9.97553 12.5417 10.6675 11.9199 10.7545 11.1084L11.4763 4.37727C11.5133 4.38124 11.5506 4.38047 11.5874 4.375H11.8124C11.8704 4.37582 11.9279 4.3651 11.9817 4.34349C12.0355 4.32187 12.0845 4.28977 12.1258 4.24907C12.1671 4.20836 12.1998 4.15985 12.2222 4.10636C12.2446 4.05288 12.2561 3.99548 12.2561 3.9375C12.2561 3.87952 12.2446 3.82211 12.2222 3.76863C12.1998 3.71514 12.1671 3.66663 12.1258 3.62593C12.0845 3.58522 12.0355 3.55312 11.9817 3.5315C11.9279 3.50989 11.8704 3.49918 11.8124 3.5H11.7548L11.0644 2.46435C10.7671 2.01841 10.2654 1.75 9.7297 1.75H8.43885C8.46234 1.68355 8.46943 1.61242 8.45952 1.54265C8.44961 1.47288 8.423 1.40654 8.38194 1.34926C8.34089 1.29199 8.2866 1.24547 8.22371 1.21368C8.16082 1.18189 8.09118 1.16576 8.02072 1.16666H5.97905ZM4.27007 2.625H9.7297C9.97394 2.625 10.2009 2.74639 10.3364 2.9497L10.7033 3.5H3.29651L3.66338 2.9497L3.66395 2.94913C3.79913 2.74608 4.02543 2.625 4.27007 2.625ZM3.40361 4.375H10.5962L9.88465 11.015C9.8445 11.3894 9.53575 11.6667 9.15947 11.6667H4.83973C4.46345 11.6667 4.15527 11.3894 4.11512 11.015L3.40361 4.375Z", fill: "currentColor" })));
2180
- const SvgChat = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: 16, height: 17, viewBox: "0 0 16 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M8 3C4.55375 3 1.75 5.23753 1.75 7.98828C1.75 9.70653 2.83659 11.2762 4.62109 12.188C4.11184 13.0465 3.62587 13.7378 3.62012 13.7461C3.50687 13.9071 3.49862 14.1196 3.59912 14.2891C3.69012 14.4418 3.8543 14.5342 4.0293 14.5342C4.0483 14.5342 4.06743 14.533 4.08643 14.5308C4.15168 14.5233 5.66214 14.3364 7.50439 12.9604C7.67239 12.9712 7.8385 12.9766 8 12.9766C11.4462 12.9766 14.25 10.739 14.25 7.98828C14.25 5.23753 11.4462 3 8 3ZM8 4C10.8948 4 13.25 5.78903 13.25 7.98828C13.25 10.1875 10.8948 11.9766 8 11.9766C7.8055 11.9766 7.60225 11.968 7.396 11.9497C7.271 11.9382 7.1454 11.9752 7.0459 12.0527C6.3589 12.5855 5.72033 12.9308 5.20508 13.1528C5.38383 12.8648 5.57691 12.5418 5.76416 12.2061C5.83416 12.0813 5.84705 11.9324 5.7998 11.7974C5.75255 11.6624 5.64983 11.5542 5.51758 11.5C3.81033 10.7993 2.75 9.45328 2.75 7.98828C2.75 5.78903 5.10525 4 8 4ZM5.5 7.25C5.08575 7.25 4.75 7.58575 4.75 8C4.75 8.41425 5.08575 8.75 5.5 8.75C5.91425 8.75 6.25 8.41425 6.25 8C6.25 7.58575 5.91425 7.25 5.5 7.25ZM8 7.25C7.58575 7.25 7.25 7.58575 7.25 8C7.25 8.41425 7.58575 8.75 8 8.75C8.41425 8.75 8.75 8.41425 8.75 8C8.75 7.58575 8.41425 7.25 8 7.25ZM10.5 7.25C10.0857 7.25 9.75 7.58575 9.75 8C9.75 8.41425 10.0857 8.75 10.5 8.75C10.9143 8.75 11.25 8.41425 11.25 8C11.25 7.58575 10.9143 7.25 10.5 7.25Z", fill: "currentColor" }));
2181
- const SessionListItem = ({
2182
- children,
2183
- session,
2184
- deletable = true,
2185
- limit = 100,
2186
- deleteIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgTrash, {}),
2187
- chatIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgChat, { className: "mr-2" })
2188
- }) => {
2189
- const { activeSessionId, selectSession, deleteSession, theme } = React.useContext(ChatContext);
2190
- const Comp = children ? reactSlot.Slot : reablocks.ListItem;
2191
- return /* @__PURE__ */ jsxRuntime.jsx(
2192
- Comp,
2193
- {
2194
- dense: true,
2195
- disableGutters: true,
2196
- active: session.id === activeSessionId,
2197
- className: reablocks.cn(theme.sessions.session.base, {
2198
- [theme.sessions.session.active]: session.id === activeSessionId
2199
- }),
2200
- onClick: () => selectSession == null ? void 0 : selectSession(session.id),
2201
- start: chatIcon,
2202
- end: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: deletable && /* @__PURE__ */ jsxRuntime.jsx(
2203
- reablocks.IconButton,
2204
- {
2205
- size: "small",
2206
- variant: "text",
2207
- onClick: (e) => {
2208
- e.stopPropagation();
2209
- deleteSession(session.id);
2210
- },
2211
- className: reablocks.cn(theme.sessions.session.delete),
2212
- children: deleteIcon
2213
- }
2214
- ) }),
2215
- children: children || /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { value: session.title, limit })
2216
- }
2217
- );
2218
- };
2219
- const SessionsList = ({
2220
- children,
2221
- templates
2222
- }) => {
2223
- const { theme, isCompact, activeSessionId, createSession } = React.useContext(ChatContext);
2224
- const isVisible = isCompact && !activeSessionId;
2225
- return (!isCompact || isVisible) && /* @__PURE__ */ jsxRuntime.jsxs(
2226
- react.motion.div,
2227
- {
2228
- initial: { translateX: "-100%" },
2229
- animate: {
2230
- translateX: "0%",
2231
- transition: {
2232
- type: "tween",
2233
- ease: "linear",
2234
- duration: 0.2,
2235
- when: "beforeChildren"
2236
- }
2237
- },
2238
- exit: { translateX: "-100%" },
2239
- className: reablocks.cn(theme.sessions.base, {
2240
- [theme.sessions.companion]: isCompact,
2241
- [theme.sessions.console]: !isCompact
2242
- }),
2243
- children: [
2244
- /* @__PURE__ */ jsxRuntime.jsx(reablocks.List, { children }),
2245
- templates && !activeSessionId && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: templates.map((template) => /* @__PURE__ */ jsxRuntime.jsx("div", { onClick: () => createSession == null ? void 0 : createSession(), children: /* @__PURE__ */ jsxRuntime.jsx(
2246
- SessionListItem,
2247
- {
2248
- session: {
2249
- id: template.id,
2250
- title: template.title,
2251
- conversations: []
2252
- },
2253
- chatIcon: template.icon,
2254
- deletable: false
2255
- }
2256
- ) }, template.id)) })
2257
- ]
2258
- }
2259
- );
2207
+ )
2208
+ ] }) });
2260
2209
  };
2261
2210
  const SvgPlus = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: 17, height: 17, viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("g", { id: "add" }, /* @__PURE__ */ React__namespace.createElement("path", { id: "Vector", d: "M13.1667 9.16658H9.16671V13.1666H7.83337V9.16658H3.83337V7.83325H7.83337V3.83325H9.16671V7.83325H13.1667V9.16658Z", fill: "currentColor" })));
2262
2211
  const NewSessionButton = ({
@@ -2342,6 +2291,46 @@ ${response}`),
2342
2291
  )
2343
2292
  }));
2344
2293
  }
2294
+ const SvgChat = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: 16, height: 17, viewBox: "0 0 16 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M8 3C4.55375 3 1.75 5.23753 1.75 7.98828C1.75 9.70653 2.83659 11.2762 4.62109 12.188C4.11184 13.0465 3.62587 13.7378 3.62012 13.7461C3.50687 13.9071 3.49862 14.1196 3.59912 14.2891C3.69012 14.4418 3.8543 14.5342 4.0293 14.5342C4.0483 14.5342 4.06743 14.533 4.08643 14.5308C4.15168 14.5233 5.66214 14.3364 7.50439 12.9604C7.67239 12.9712 7.8385 12.9766 8 12.9766C11.4462 12.9766 14.25 10.739 14.25 7.98828C14.25 5.23753 11.4462 3 8 3ZM8 4C10.8948 4 13.25 5.78903 13.25 7.98828C13.25 10.1875 10.8948 11.9766 8 11.9766C7.8055 11.9766 7.60225 11.968 7.396 11.9497C7.271 11.9382 7.1454 11.9752 7.0459 12.0527C6.3589 12.5855 5.72033 12.9308 5.20508 13.1528C5.38383 12.8648 5.57691 12.5418 5.76416 12.2061C5.83416 12.0813 5.84705 11.9324 5.7998 11.7974C5.75255 11.6624 5.64983 11.5542 5.51758 11.5C3.81033 10.7993 2.75 9.45328 2.75 7.98828C2.75 5.78903 5.10525 4 8 4ZM5.5 7.25C5.08575 7.25 4.75 7.58575 4.75 8C4.75 8.41425 5.08575 8.75 5.5 8.75C5.91425 8.75 6.25 8.41425 6.25 8C6.25 7.58575 5.91425 7.25 5.5 7.25ZM8 7.25C7.58575 7.25 7.25 7.58575 7.25 8C7.25 8.41425 7.58575 8.75 8 8.75C8.41425 8.75 8.75 8.41425 8.75 8C8.75 7.58575 8.41425 7.25 8 7.25ZM10.5 7.25C10.0857 7.25 9.75 7.58575 9.75 8C9.75 8.41425 10.0857 8.75 10.5 8.75C10.9143 8.75 11.25 8.41425 11.25 8C11.25 7.58575 10.9143 7.25 10.5 7.25Z", fill: "currentColor" }));
2295
+ const SvgTrash = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: 14, height: 14, viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("g", { id: "Delete" }, /* @__PURE__ */ React__namespace.createElement("path", { id: "Vector", d: "M5.97905 1.16666C5.90859 1.16576 5.83895 1.18189 5.77605 1.21368C5.71316 1.24547 5.65888 1.29199 5.61783 1.34926C5.57677 1.40654 5.55016 1.47288 5.54025 1.54265C5.53034 1.61242 5.53743 1.68355 5.56092 1.75H4.27007C3.7342 1.75 3.2324 2.01817 2.93535 2.46435L2.24492 3.5H2.18738C2.12941 3.49918 2.07185 3.50989 2.01805 3.5315C1.96425 3.55312 1.91529 3.58522 1.874 3.62593C1.83271 3.66663 1.79993 3.71514 1.77755 3.76863C1.75518 3.82211 1.74365 3.87952 1.74365 3.9375C1.74365 3.99548 1.75518 4.05288 1.77755 4.10636C1.79993 4.15985 1.83271 4.20836 1.874 4.24907C1.91529 4.28977 1.96425 4.32187 2.01805 4.34349C2.07185 4.3651 2.12941 4.37582 2.18738 4.375H2.41012C2.44765 4.38067 2.48576 4.38143 2.52348 4.37727L3.24468 11.1084C3.33169 11.9199 4.02367 12.5417 4.83973 12.5417H9.15947C9.97553 12.5417 10.6675 11.9199 10.7545 11.1084L11.4763 4.37727C11.5133 4.38124 11.5506 4.38047 11.5874 4.375H11.8124C11.8704 4.37582 11.9279 4.3651 11.9817 4.34349C12.0355 4.32187 12.0845 4.28977 12.1258 4.24907C12.1671 4.20836 12.1998 4.15985 12.2222 4.10636C12.2446 4.05288 12.2561 3.99548 12.2561 3.9375C12.2561 3.87952 12.2446 3.82211 12.2222 3.76863C12.1998 3.71514 12.1671 3.66663 12.1258 3.62593C12.0845 3.58522 12.0355 3.55312 11.9817 3.5315C11.9279 3.50989 11.8704 3.49918 11.8124 3.5H11.7548L11.0644 2.46435C10.7671 2.01841 10.2654 1.75 9.7297 1.75H8.43885C8.46234 1.68355 8.46943 1.61242 8.45952 1.54265C8.44961 1.47288 8.423 1.40654 8.38194 1.34926C8.34089 1.29199 8.2866 1.24547 8.22371 1.21368C8.16082 1.18189 8.09118 1.16576 8.02072 1.16666H5.97905ZM4.27007 2.625H9.7297C9.97394 2.625 10.2009 2.74639 10.3364 2.9497L10.7033 3.5H3.29651L3.66338 2.9497L3.66395 2.94913C3.79913 2.74608 4.02543 2.625 4.27007 2.625ZM3.40361 4.375H10.5962L9.88465 11.015C9.8445 11.3894 9.53575 11.6667 9.15947 11.6667H4.83973C4.46345 11.6667 4.15527 11.3894 4.11512 11.015L3.40361 4.375Z", fill: "currentColor" })));
2296
+ const SessionListItem = ({
2297
+ children,
2298
+ session,
2299
+ deletable = true,
2300
+ limit = 100,
2301
+ deleteIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgTrash, {}),
2302
+ chatIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgChat, { className: "mr-2" })
2303
+ }) => {
2304
+ const { activeSessionId, selectSession, deleteSession, theme } = React.useContext(ChatContext);
2305
+ const Comp = children ? reactSlot.Slot : reablocks.ListItem;
2306
+ return /* @__PURE__ */ jsxRuntime.jsx(
2307
+ Comp,
2308
+ {
2309
+ dense: true,
2310
+ disableGutters: true,
2311
+ active: session.id === activeSessionId,
2312
+ className: reablocks.cn(theme.sessions.session.base, {
2313
+ [theme.sessions.session.active]: session.id === activeSessionId
2314
+ }),
2315
+ onClick: () => selectSession?.(session.id),
2316
+ start: chatIcon,
2317
+ end: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: deletable && /* @__PURE__ */ jsxRuntime.jsx(
2318
+ reablocks.IconButton,
2319
+ {
2320
+ size: "small",
2321
+ variant: "ghost",
2322
+ onClick: (e) => {
2323
+ e.stopPropagation();
2324
+ deleteSession(session.id);
2325
+ },
2326
+ className: reablocks.cn(theme.sessions.session.delete),
2327
+ children: deleteIcon
2328
+ }
2329
+ ) }),
2330
+ children: children || /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { value: session.title, limit })
2331
+ }
2332
+ );
2333
+ };
2345
2334
  const SessionsGroup = ({
2346
2335
  heading,
2347
2336
  children
@@ -2363,46 +2352,50 @@ ${response}`),
2363
2352
  const SessionGroups = ({ children }) => {
2364
2353
  const { sessions } = React.useContext(ChatContext);
2365
2354
  const groups = React.useMemo(() => groupSessionsByDate(sessions), [sessions]);
2366
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: children ? children(groups) : groups.map(({ heading, sessions: sessions2 }) => /* @__PURE__ */ jsxRuntime.jsx(SessionsGroup, { heading, children: sessions2.map((session) => /* @__PURE__ */ jsxRuntime.jsx(SessionListItem, { session }, session.id)) })) });
2367
- };
2368
- const AppBar = ({ content, theme = chatTheme }) => {
2369
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: reablocks.cn(theme.appbar), children: content });
2355
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: children ? children(groups) : groups.map(({ heading, sessions: sessions2 }) => /* @__PURE__ */ jsxRuntime.jsx(SessionsGroup, { heading, children: sessions2.map((session) => /* @__PURE__ */ jsxRuntime.jsx(SessionListItem, { session }, session.id)) }, heading)) });
2370
2356
  };
2371
- const ChatBubble = React.memo(
2372
- ({
2373
- children,
2374
- bubbleContent,
2375
- position = "right-end",
2376
- modifiers = [react$1.offset({ mainAxis: 0, crossAxis: -40 })],
2377
- className
2378
- }) => {
2379
- const [isOpen, setIsOpen] = React.useState(false);
2380
- const ref = React.useRef(null);
2381
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2382
- /* @__PURE__ */ jsxRuntime.jsx(
2383
- reablocks.ConnectedOverlay,
2384
- {
2385
- placement: position,
2386
- modifiers,
2387
- reference: ref.current,
2388
- open: isOpen,
2389
- onOpen: () => setIsOpen(true),
2390
- onClose: () => setIsOpen(false),
2391
- content: () => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children })
2392
- }
2393
- ),
2394
- /* @__PURE__ */ jsxRuntime.jsx(
2395
- "div",
2396
- {
2397
- ref,
2398
- className,
2399
- onClick: () => setIsOpen((prev) => !prev),
2400
- children: bubbleContent
2357
+ const SessionsList = ({
2358
+ children,
2359
+ templates
2360
+ }) => {
2361
+ const { theme, isCompact, activeSessionId, createSession } = React.useContext(ChatContext);
2362
+ const isVisible = isCompact && !activeSessionId;
2363
+ return (!isCompact || isVisible) && /* @__PURE__ */ jsxRuntime.jsxs(
2364
+ react.motion.div,
2365
+ {
2366
+ initial: { translateX: "-100%" },
2367
+ animate: {
2368
+ translateX: "0%",
2369
+ transition: {
2370
+ type: "tween",
2371
+ ease: "linear",
2372
+ duration: 0.2,
2373
+ when: "beforeChildren"
2401
2374
  }
2402
- )
2403
- ] });
2404
- }
2405
- );
2375
+ },
2376
+ exit: { translateX: "-100%" },
2377
+ className: reablocks.cn(theme.sessions.base, {
2378
+ [theme.sessions.companion]: isCompact,
2379
+ [theme.sessions.console]: !isCompact
2380
+ }),
2381
+ children: [
2382
+ /* @__PURE__ */ jsxRuntime.jsx(reablocks.List, { children }),
2383
+ templates && !activeSessionId && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: templates.map((template) => /* @__PURE__ */ jsxRuntime.jsx("div", { onClick: () => createSession?.(), children: /* @__PURE__ */ jsxRuntime.jsx(
2384
+ SessionListItem,
2385
+ {
2386
+ session: {
2387
+ id: template.id,
2388
+ title: template.title,
2389
+ conversations: []
2390
+ },
2391
+ chatIcon: template.icon,
2392
+ deletable: false
2393
+ }
2394
+ ) }, template.id)) })
2395
+ ]
2396
+ }
2397
+ );
2398
+ };
2406
2399
  exports2.AppBar = AppBar;
2407
2400
  exports2.Chat = Chat;
2408
2401
  exports2.ChatBubble = ChatBubble;
@@ -2436,5 +2429,5 @@ ${response}`),
2436
2429
  exports2.light = light;
2437
2430
  exports2.remarkCve = remarkCve;
2438
2431
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
2439
- });
2432
+ }));
2440
2433
  //# sourceMappingURL=index.umd.cjs.map