reachat 2.1.0-alpha.2 → 2.1.0-alpha.21

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 (56) hide show
  1. package/dist/AppBar/AppBar.d.ts +1 -1
  2. package/dist/{CSVFileRenderer-CpB8ngRc.js → CSVFileRenderer-GYEEFRXD.js} +15 -14
  3. package/dist/CSVFileRenderer-GYEEFRXD.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 +16 -0
  8. package/dist/ChatInput/FileInput.d.ts +5 -1
  9. package/dist/{DefaultFileRenderer-DEgyNAd4.js → DefaultFileRenderer-CUcl0kc2.js} +2 -2
  10. package/dist/DefaultFileRenderer-CUcl0kc2.js.map +1 -0
  11. package/dist/ImageFileRenderer-C8tVW3I8.js.map +1 -1
  12. package/dist/Markdown/CodeHighlighter.d.ts +4 -0
  13. package/dist/Markdown/Markdown.d.ts +5 -0
  14. package/dist/Markdown/Table.d.ts +1 -1
  15. package/dist/Markdown/index.d.ts +2 -2
  16. package/dist/Markdown/plugins/remarkCve.d.ts +2 -1
  17. package/dist/PDFFileRenderer-BBn2EVrV.js +16 -0
  18. package/dist/PDFFileRenderer-BBn2EVrV.js.map +1 -0
  19. package/dist/SessionMessages/SessionEmpty.d.ts +1 -4
  20. package/dist/SessionMessages/SessionMessage/MessageFile/renderers/index.d.ts +1 -1
  21. package/dist/SessionMessages/SessionMessage/MessageFiles.d.ts +1 -1
  22. package/dist/SessionMessages/SessionMessage/MessageQuestion.d.ts +4 -0
  23. package/dist/SessionMessages/SessionMessage/MessageSources.d.ts +1 -1
  24. package/dist/SessionMessages/SessionMessage/SessionMessage.d.ts +4 -0
  25. package/dist/SessionMessages/SessionMessage/index.d.ts +2 -2
  26. package/dist/SessionMessages/SessionMessages.d.ts +14 -1
  27. package/dist/SessionMessages/index.d.ts +2 -2
  28. package/dist/SessionsList/index.d.ts +2 -2
  29. package/dist/docs.json +216 -20
  30. package/dist/{index-DVFyp_Cz.js → index-CwH75cwk.js} +1336 -1269
  31. package/dist/index-CwH75cwk.js.map +1 -0
  32. package/dist/index.css +6358 -727
  33. package/dist/index.d.ts +7 -6
  34. package/dist/index.js +32 -31
  35. package/dist/index.umd.cjs +1321 -1246
  36. package/dist/index.umd.cjs.map +1 -1
  37. package/dist/stories/Changelog.mdx +1 -1
  38. package/dist/stories/Chat.stories.tsx +28 -23
  39. package/dist/stories/ChatBubble.stories.tsx +3 -3
  40. package/dist/stories/Companion.stories.tsx +6 -6
  41. package/dist/stories/Console.stories.tsx +23 -23
  42. package/dist/stories/Integration.stories.tsx +2 -2
  43. package/dist/stories/Intro.mdx +1 -1
  44. package/dist/stories/Markdown.stories.tsx +318 -0
  45. package/dist/stories/assets/logo.svg +38 -19
  46. package/dist/stories/assets/paperclip.svg +4 -1
  47. package/dist/stories/assets/search.svg +5 -1
  48. package/dist/stories/examples.ts +20 -13
  49. package/dist/theme.d.ts +21 -0
  50. package/dist/utils/index.d.ts +1 -0
  51. package/package.json +63 -47
  52. package/dist/CSVFileRenderer-CpB8ngRc.js.map +0 -1
  53. package/dist/DefaultFileRenderer-DEgyNAd4.js.map +0 -1
  54. package/dist/PDFFileRenderer-DQdFS2l6.js +0 -9
  55. package/dist/PDFFileRenderer-DQdFS2l6.js.map +0 -1
  56. package/dist/index-DVFyp_Cz.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,15 +31,287 @@
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
+ hr: "my-4 border-t border-stroke-neutral-4",
89
+ copy: "sticky py-1 [&>svg]:w-4 [&>svg]:h-4 opacity-50",
90
+ p: "mb-2",
91
+ a: "text-buttons-colors-link-primary-text-resting underline",
92
+ table: "table-auto w-full m-2",
93
+ th: "px-4 py-2 text-left font-bold border-b border-stroke-neutral-4",
94
+ td: "px-4 py-2",
95
+ code: "m-2 rounded-b relative",
96
+ inlineCode: "bg-gradient-neutral-200 p-1 rounded",
97
+ 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",
98
+ li: "mb-2 ml-6",
99
+ ul: "mb-4 list-disc",
100
+ ol: "mb-4 list-decimal",
101
+ h1: "text-4xl font-bold mb-4 mt-6",
102
+ h2: "text-3xl font-bold mb-3 mt-5",
103
+ h3: "text-2xl font-bold mb-3 mt-4",
104
+ h4: "text-xl font-bold mb-2 mt-3",
105
+ h5: "text-lg font-bold mb-2 mt-2",
106
+ h6: "text-base font-bold mb-2 mt-2"
107
+ },
108
+ csvPreview: {
109
+ base: "flex flex-col gap-2",
110
+ header: {
111
+ base: "flex justify-between items-center gap-4",
112
+ icon: "csv-icon flex items-center",
113
+ actions: "csv-actions flex items-center gap-6"
114
+ },
115
+ tableContainer: "flex justify-between",
116
+ dialog: {
117
+ base: "fixed inset-0 bg-background-neutral-canvas-base/70 flex justify-center items-center z-50",
118
+ container: "bg-background-neutral-canvas-base rounded-md w-11/12 h-5/6 overflow-auto"
119
+ }
120
+ },
121
+ footer: {
122
+ base: "mt-3 flex gap-1.5",
123
+ copy: "p-3 rounded-[10px] [&>svg]:size-4 opacity-50 hover:opacity-100!",
124
+ upvote: "p-3 rounded-[10px] [&>svg]:size-4 opacity-50 hover:opacity-100!",
125
+ downvote: "p-3 rounded-[10px] [&>svg]:size-4 opacity-50 hover:opacity-100!",
126
+ refresh: "p-3 rounded-[10px] [&>svg]:size-4 opacity-50 hover:opacity-100!"
127
+ }
128
+ }
129
+ },
130
+ input: {
131
+ base: "flex mt-4 relative",
132
+ upload: "px-5 py-2 size-10 text-content-text-neutral-2 hover:text-content-text-neutral-base",
133
+ 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",
134
+ actions: {
135
+ base: "absolute flex gap-2 items-center right-2 inset-y-1/2 -translate-y-1/2 z-10",
136
+ send: "px-3 py-3 hover:bg-primary-hover rounded-full size-8",
137
+ stop: "px-2 py-2 bg-content-assets-semantic-error-base text-white rounded-full hover:bg-content-assets-semantic-error-1 size-8"
138
+ }
139
+ }
140
+ };
141
+ const AppBar = ({ content, theme = chatTheme }) => {
142
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: reablocks.cn(theme.appbar), children: content });
143
+ };
36
144
  const ChatContext = React.createContext({
37
145
  sessions: [],
38
146
  activeSessionId: null
39
147
  });
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" }));
148
+ const useDimensions = () => {
149
+ const [ref, setRef] = React.useState(null);
150
+ const [width, setWidth] = React.useState(void 0);
151
+ const observe = React.useCallback((element) => {
152
+ if (element) setRef(element);
153
+ }, []);
154
+ React.useEffect(() => {
155
+ if (!ref) return;
156
+ const resizeObserver = new ResizeObserver((entries) => {
157
+ for (const entry of entries) {
158
+ setWidth(entry.contentRect.width);
159
+ }
160
+ });
161
+ resizeObserver.observe(ref);
162
+ return () => {
163
+ resizeObserver.disconnect();
164
+ };
165
+ }, [ref]);
166
+ return { width, observe };
167
+ };
168
+ const Chat = ({
169
+ children,
170
+ viewType = "console",
171
+ sessions,
172
+ onSelectSession,
173
+ onDeleteSession,
174
+ onSendMessage,
175
+ onStopMessage,
176
+ onFileUpload,
177
+ isLoading,
178
+ activeSessionId,
179
+ theme = chatTheme,
180
+ onNewSession,
181
+ remarkPlugins = [remarkGfm, remarkYoutube, remarkMath],
182
+ disabled,
183
+ style,
184
+ className
185
+ }) => {
186
+ const [internalActiveSessionID, setInternalActiveSessionID] = React.useState(activeSessionId);
187
+ const { width, observe } = useDimensions();
188
+ const isCompact = viewType === "companion" || width && width < 767;
189
+ React.useEffect(() => {
190
+ setInternalActiveSessionID(activeSessionId);
191
+ }, [activeSessionId]);
192
+ const handleSelectSession = React.useCallback(
193
+ (sessionId) => {
194
+ setInternalActiveSessionID(sessionId);
195
+ onSelectSession?.(sessionId);
196
+ },
197
+ [onSelectSession]
198
+ );
199
+ const handleDeleteSession = React.useCallback(
200
+ (sessionId) => {
201
+ setInternalActiveSessionID(void 0);
202
+ onDeleteSession?.(sessionId);
203
+ },
204
+ [onDeleteSession]
205
+ );
206
+ const handleCreateNewSession = React.useCallback(() => {
207
+ setInternalActiveSessionID(void 0);
208
+ onNewSession?.();
209
+ }, [onNewSession]);
210
+ reakeys.useHotkeys([
211
+ {
212
+ name: "Create new session",
213
+ category: "Chat",
214
+ keys: "meta+shift+s",
215
+ callback: (event) => {
216
+ event.preventDefault();
217
+ handleCreateNewSession();
218
+ }
219
+ }
220
+ ]);
221
+ const activeSession = React.useMemo(
222
+ () => sessions.find((session) => session.id === internalActiveSessionID),
223
+ [sessions, internalActiveSessionID]
224
+ );
225
+ const contextValue = React.useMemo(
226
+ () => ({
227
+ sessions,
228
+ activeSession,
229
+ remarkPlugins,
230
+ theme,
231
+ disabled,
232
+ isLoading,
233
+ isCompact,
234
+ viewType,
235
+ activeSessionId: internalActiveSessionID,
236
+ selectSession: handleSelectSession,
237
+ deleteSession: handleDeleteSession,
238
+ createSession: handleCreateNewSession,
239
+ sendMessage: onSendMessage,
240
+ stopMessage: onStopMessage,
241
+ fileUpload: onFileUpload
242
+ }),
243
+ [
244
+ isLoading,
245
+ isCompact,
246
+ viewType,
247
+ disabled,
248
+ theme,
249
+ remarkPlugins,
250
+ sessions,
251
+ activeSession,
252
+ internalActiveSessionID,
253
+ handleSelectSession,
254
+ handleDeleteSession,
255
+ handleCreateNewSession,
256
+ onSendMessage,
257
+ onStopMessage,
258
+ onFileUpload
259
+ ]
260
+ );
261
+ return /* @__PURE__ */ jsxRuntime.jsx(ChatContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: /* @__PURE__ */ jsxRuntime.jsx(
262
+ "div",
263
+ {
264
+ ref: observe,
265
+ className: reablocks.cn(className, theme.base, {
266
+ [theme.companion]: isCompact,
267
+ [theme.console]: !isCompact
268
+ }),
269
+ style,
270
+ children
271
+ }
272
+ ) }) });
273
+ };
274
+ const ChatBubble = React.memo(
275
+ ({
276
+ children,
277
+ bubbleContent,
278
+ position = "right-end",
279
+ modifiers = [react$1.offset({ mainAxis: 0, crossAxis: -40 })],
280
+ className
281
+ }) => {
282
+ const [isOpen, setIsOpen] = React.useState(false);
283
+ const ref = React.useRef(null);
284
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
285
+ /* @__PURE__ */ jsxRuntime.jsx(
286
+ reablocks.ConnectedOverlay,
287
+ {
288
+ placement: position,
289
+ modifiers,
290
+ reference: ref.current,
291
+ open: isOpen,
292
+ onOpen: () => setIsOpen(true),
293
+ onClose: () => setIsOpen(false),
294
+ content: () => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children })
295
+ }
296
+ ),
297
+ /* @__PURE__ */ jsxRuntime.jsx(
298
+ "div",
299
+ {
300
+ ref,
301
+ className,
302
+ onClick: () => setIsOpen((prev) => !prev),
303
+ children: bubbleContent
304
+ }
305
+ )
306
+ ] });
307
+ }
308
+ );
309
+ 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" }));
310
+ 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" }));
311
+ 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
312
  const FileInput = ({
42
313
  allowedFiles,
314
+ multiple,
43
315
  onFileUpload,
44
316
  isLoading,
45
317
  disabled,
@@ -55,6 +327,7 @@
55
327
  ref: fileInputRef,
56
328
  className: "hidden",
57
329
  accept: allowedFiles.join(","),
330
+ multiple,
58
331
  onChange: (e) => {
59
332
  onFileUpload(e);
60
333
  if (fileInputRef.current) {
@@ -70,10 +343,7 @@
70
343
  variant: "text",
71
344
  disabled: isLoading || disabled,
72
345
  className: reablocks.cn(theme.input.upload),
73
- onClick: () => {
74
- var _a;
75
- return (_a = fileInputRef.current) == null ? void 0 : _a.click();
76
- },
346
+ onClick: () => fileInputRef.current?.click(),
77
347
  children: attachIcon
78
348
  }
79
349
  )
@@ -82,8 +352,10 @@
82
352
  const ChatInput = React.forwardRef(
83
353
  ({
84
354
  allowedFiles,
355
+ allowMultipleFiles = false,
85
356
  placeholder,
86
357
  defaultValue,
358
+ className,
87
359
  message,
88
360
  sendIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgSend, {}),
89
361
  stopIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgStop, {}),
@@ -109,24 +381,27 @@
109
381
  inputRef.current.focus();
110
382
  }
111
383
  }, [activeSessionId, inputRef]);
384
+ const handleSendMessage = () => {
385
+ if (internalMessage.trim()) {
386
+ sendMessage?.(internalMessage);
387
+ setInternalMessage("");
388
+ }
389
+ };
112
390
  React.useImperativeHandle(ref, () => ({
113
391
  focus: () => {
114
- var _a;
115
- (_a = inputRef.current) == null ? void 0 : _a.focus();
392
+ inputRef.current?.focus();
116
393
  },
117
394
  send: () => {
118
- if (internalMessage.trim()) {
119
- sendMessage == null ? void 0 : sendMessage(internalMessage);
120
- setInternalMessage("");
121
- }
395
+ handleSendMessage();
396
+ },
397
+ setValue: (value) => {
398
+ setInternalMessage(value);
399
+ onMessageChange?.(value);
400
+ },
401
+ getValue: () => {
402
+ return internalMessage;
122
403
  }
123
404
  }));
124
- const handleSendMessage = () => {
125
- if (internalMessage.trim()) {
126
- sendMessage == null ? void 0 : sendMessage(internalMessage);
127
- setInternalMessage("");
128
- }
129
- };
130
405
  const handleKeyPress = (e) => {
131
406
  if (e.key === "Enter" && !e.shiftKey) {
132
407
  e.preventDefault();
@@ -134,20 +409,26 @@
134
409
  }
135
410
  };
136
411
  const handleFileUpload = (event) => {
137
- var _a;
138
- const file = (_a = event.target.files) == null ? void 0 : _a[0];
139
- if (file && fileUpload) {
140
- fileUpload(file);
412
+ const files = event.target.files;
413
+ if (files && fileUpload) {
414
+ if (allowMultipleFiles) {
415
+ Array.from(files).forEach((file) => fileUpload(file));
416
+ } else {
417
+ const file = files[0];
418
+ if (file) {
419
+ fileUpload(file);
420
+ }
421
+ }
141
422
  }
142
423
  };
143
424
  const handleMessageChange = React.useCallback(
144
425
  (event) => {
145
426
  setInternalMessage(event.target.value);
146
- onMessageChange == null ? void 0 : onMessageChange(event.target.value);
427
+ onMessageChange?.(event.target.value);
147
428
  },
148
429
  [onMessageChange]
149
430
  );
150
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(theme.input.base), children: [
431
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(theme.input.base, className), children: [
151
432
  /* @__PURE__ */ jsxRuntime.jsx(
152
433
  reablocks.Textarea,
153
434
  {
@@ -164,10 +445,11 @@
164
445
  }
165
446
  ),
166
447
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(theme.input.actions.base), children: [
167
- (allowedFiles == null ? void 0 : allowedFiles.length) > 0 && /* @__PURE__ */ jsxRuntime.jsx(
448
+ allowedFiles?.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
168
449
  FileInput,
169
450
  {
170
451
  allowedFiles,
452
+ multiple: allowMultipleFiles,
171
453
  onFileUpload: handleFileUpload,
172
454
  isLoading,
173
455
  disabled,
@@ -198,1084 +480,1020 @@
198
480
  ] });
199
481
  }
200
482
  );
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" }));
483
+ 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
484
  const dark = {
270
485
  '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"
486
+ background: "#11111f",
487
+ color: "#e2e8f0",
488
+ textShadow: "0 1px rgba(0, 0, 0, 0.3)",
489
+ fontFamily: '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
490
+ direction: "ltr",
491
+ textAlign: "left",
492
+ whiteSpace: "pre",
493
+ wordSpacing: "normal",
494
+ wordBreak: "normal",
495
+ lineHeight: "1.5",
496
+ MozTabSize: "2",
497
+ OTabSize: "2",
498
+ tabSize: "2",
499
+ WebkitHyphens: "none",
500
+ MozHyphens: "none",
501
+ msHyphens: "none",
502
+ hyphens: "none"
288
503
  },
289
504
  '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"
505
+ background: "#11111f",
506
+ color: "#e2e8f0",
507
+ textShadow: "0 1px rgba(0, 0, 0, 0.3)",
508
+ fontFamily: '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
509
+ direction: "ltr",
510
+ textAlign: "left",
511
+ whiteSpace: "pre",
512
+ wordSpacing: "normal",
513
+ wordBreak: "normal",
514
+ lineHeight: "1.5",
515
+ MozTabSize: "2",
516
+ OTabSize: "2",
517
+ tabSize: "2",
518
+ WebkitHyphens: "none",
519
+ MozHyphens: "none",
520
+ msHyphens: "none",
521
+ hyphens: "none",
522
+ padding: "1em",
523
+ margin: "0",
524
+ overflow: "auto"
310
525
  },
311
526
  'code[class*="language-"]::-moz-selection': {
312
- "background": "#1e293b",
313
- "color": "inherit",
314
- "textShadow": "none"
527
+ background: "#1e293b",
528
+ color: "inherit",
529
+ textShadow: "none"
315
530
  },
316
531
  'code[class*="language-"] *::-moz-selection': {
317
- "background": "#1e293b",
318
- "color": "inherit",
319
- "textShadow": "none"
532
+ background: "#1e293b",
533
+ color: "inherit",
534
+ textShadow: "none"
320
535
  },
321
536
  'pre[class*="language-"] *::-moz-selection': {
322
- "background": "#1e293b",
323
- "color": "inherit",
324
- "textShadow": "none"
537
+ background: "#1e293b",
538
+ color: "inherit",
539
+ textShadow: "none"
325
540
  },
326
541
  'code[class*="language-"]::selection': {
327
- "background": "#1e293b",
328
- "color": "inherit",
329
- "textShadow": "none"
542
+ background: "#1e293b",
543
+ color: "inherit",
544
+ textShadow: "none"
330
545
  },
331
546
  'code[class*="language-"] *::selection': {
332
- "background": "#1e293b",
333
- "color": "inherit",
334
- "textShadow": "none"
547
+ background: "#1e293b",
548
+ color: "inherit",
549
+ textShadow: "none"
335
550
  },
336
551
  'pre[class*="language-"] *::selection': {
337
- "background": "#1e293b",
338
- "color": "inherit",
339
- "textShadow": "none"
552
+ background: "#1e293b",
553
+ color: "inherit",
554
+ textShadow: "none"
340
555
  },
341
556
  ':not(pre) > code[class*="language-"]': {
342
- "padding": "0.2em 0.3em",
343
- "borderRadius": "0.3em",
344
- "whiteSpace": "normal"
557
+ padding: "0.2em 0.3em",
558
+ borderRadius: "0.3em",
559
+ whiteSpace: "normal"
345
560
  },
346
- "comment": {
347
- "color": "#64748b",
348
- "fontStyle": "italic"
561
+ comment: {
562
+ color: "#64748b",
563
+ fontStyle: "italic"
349
564
  },
350
- "prolog": {
351
- "color": "#64748b"
565
+ prolog: {
566
+ color: "#64748b"
352
567
  },
353
- "cdata": {
354
- "color": "#64748b"
568
+ cdata: {
569
+ color: "#64748b"
355
570
  },
356
- "doctype": {
357
- "color": "#e2e8f0"
571
+ doctype: {
572
+ color: "#e2e8f0"
358
573
  },
359
- "punctuation": {
360
- "color": "#e2e8f0"
574
+ punctuation: {
575
+ color: "#e2e8f0"
361
576
  },
362
- "entity": {
363
- "color": "#3b82f6",
364
- "cursor": "help"
577
+ entity: {
578
+ color: "#3b82f6",
579
+ cursor: "help"
365
580
  },
366
581
  "attr-name": {
367
- "color": "#f59e0b"
582
+ color: "#f59e0b"
368
583
  },
369
584
  "class-name": {
370
- "color": "#f59e0b"
585
+ color: "#f59e0b"
371
586
  },
372
- "boolean": {
373
- "color": "#3b82f6"
587
+ boolean: {
588
+ color: "#3b82f6"
374
589
  },
375
- "constant": {
376
- "color": "#3b82f6"
590
+ constant: {
591
+ color: "#3b82f6"
377
592
  },
378
- "number": {
379
- "color": "#3b82f6"
593
+ number: {
594
+ color: "#3b82f6"
380
595
  },
381
- "atrule": {
382
- "color": "#f59e0b"
596
+ atrule: {
597
+ color: "#f59e0b"
383
598
  },
384
- "keyword": {
385
- "color": "#f472b6"
599
+ keyword: {
600
+ color: "#f472b6"
386
601
  },
387
- "property": {
388
- "color": "#3b82f6"
602
+ property: {
603
+ color: "#3b82f6"
389
604
  },
390
- "tag": {
391
- "color": "#3b82f6"
605
+ tag: {
606
+ color: "#3b82f6"
392
607
  },
393
- "symbol": {
394
- "color": "#3b82f6"
608
+ symbol: {
609
+ color: "#3b82f6"
395
610
  },
396
- "deleted": {
397
- "color": "#ef4444"
611
+ deleted: {
612
+ color: "#ef4444"
398
613
  },
399
- "important": {
400
- "color": "#f472b6"
614
+ important: {
615
+ color: "#f472b6"
401
616
  },
402
- "selector": {
403
- "color": "#10b981"
617
+ selector: {
618
+ color: "#10b981"
404
619
  },
405
- "string": {
406
- "color": "#10b981"
620
+ string: {
621
+ color: "#10b981"
407
622
  },
408
- "char": {
409
- "color": "#10b981"
623
+ char: {
624
+ color: "#10b981"
410
625
  },
411
- "builtin": {
412
- "color": "#10b981"
626
+ builtin: {
627
+ color: "#10b981"
413
628
  },
414
- "inserted": {
415
- "color": "#10b981"
629
+ inserted: {
630
+ color: "#10b981"
416
631
  },
417
- "regex": {
418
- "color": "#10b981"
632
+ regex: {
633
+ color: "#10b981"
419
634
  },
420
635
  "attr-value": {
421
- "color": "#10b981"
636
+ color: "#10b981"
422
637
  },
423
638
  "attr-value > .token.punctuation": {
424
- "color": "#10b981"
639
+ color: "#10b981"
425
640
  },
426
- "variable": {
427
- "color": "#60a5fa"
641
+ variable: {
642
+ color: "#60a5fa"
428
643
  },
429
- "operator": {
430
- "color": "#60a5fa"
644
+ operator: {
645
+ color: "#60a5fa"
431
646
  },
432
- "function": {
433
- "color": "#60a5fa"
647
+ function: {
648
+ color: "#60a5fa"
434
649
  },
435
- "url": {
436
- "color": "#60a5fa"
650
+ url: {
651
+ color: "#60a5fa"
437
652
  },
438
653
  "attr-value > .token.punctuation.attr-equals": {
439
- "color": "#e2e8f0"
654
+ color: "#e2e8f0"
440
655
  },
441
656
  "special-attr > .token.attr-value > .token.value.css": {
442
- "color": "#e2e8f0"
657
+ color: "#e2e8f0"
443
658
  },
444
659
  ".language-css .token.selector": {
445
- "color": "#3b82f6"
660
+ color: "#3b82f6"
446
661
  },
447
662
  ".language-css .token.property": {
448
- "color": "#e2e8f0"
663
+ color: "#e2e8f0"
449
664
  },
450
665
  ".language-css .token.function": {
451
- "color": "#60a5fa"
666
+ color: "#60a5fa"
452
667
  },
453
668
  ".language-css .token.url > .token.function": {
454
- "color": "#60a5fa"
669
+ color: "#60a5fa"
455
670
  },
456
671
  ".language-css .token.url > .token.string.url": {
457
- "color": "#10b981"
672
+ color: "#10b981"
458
673
  },
459
674
  ".language-css .token.important": {
460
- "color": "#f472b6"
675
+ color: "#f472b6"
461
676
  },
462
677
  ".language-css .token.atrule .token.rule": {
463
- "color": "#f472b6"
678
+ color: "#f472b6"
464
679
  },
465
680
  ".language-javascript .token.operator": {
466
- "color": "#f472b6"
681
+ color: "#f472b6"
467
682
  },
468
683
  ".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation": {
469
- "color": "#ef4444"
684
+ color: "#ef4444"
470
685
  },
471
686
  ".language-json .token.operator": {
472
- "color": "#e2e8f0"
687
+ color: "#e2e8f0"
473
688
  },
474
689
  ".language-json .token.null.keyword": {
475
- "color": "#3b82f6"
690
+ color: "#3b82f6"
476
691
  },
477
692
  ".language-markdown .token.url": {
478
- "color": "#e2e8f0"
693
+ color: "#e2e8f0"
479
694
  },
480
695
  ".language-markdown .token.url > .token.operator": {
481
- "color": "#e2e8f0"
696
+ color: "#e2e8f0"
482
697
  },
483
698
  ".language-markdown .token.url-reference.url > .token.string": {
484
- "color": "#e2e8f0"
699
+ color: "#e2e8f0"
485
700
  },
486
701
  ".language-markdown .token.url > .token.content": {
487
- "color": "#60a5fa"
702
+ color: "#60a5fa"
488
703
  },
489
704
  ".language-markdown .token.url > .token.url": {
490
- "color": "#60a5fa"
705
+ color: "#60a5fa"
491
706
  },
492
707
  ".language-markdown .token.url-reference.url": {
493
- "color": "#60a5fa"
708
+ color: "#60a5fa"
494
709
  },
495
710
  ".language-markdown .token.blockquote.punctuation": {
496
- "color": "#64748b",
497
- "fontStyle": "italic"
711
+ color: "#64748b",
712
+ fontStyle: "italic"
498
713
  },
499
714
  ".language-markdown .token.hr.punctuation": {
500
- "color": "#64748b",
501
- "fontStyle": "italic"
715
+ color: "#64748b",
716
+ fontStyle: "italic"
502
717
  },
503
718
  ".language-markdown .token.code-snippet": {
504
- "color": "#10b981"
719
+ color: "#10b981"
505
720
  },
506
721
  ".language-markdown .token.bold .token.content": {
507
- "color": "#f59e0b"
722
+ color: "#f59e0b"
508
723
  },
509
724
  ".language-markdown .token.italic .token.content": {
510
- "color": "#f472b6"
725
+ color: "#f472b6"
511
726
  },
512
727
  ".language-markdown .token.strike .token.content": {
513
- "color": "#3b82f6"
728
+ color: "#3b82f6"
514
729
  },
515
730
  ".language-markdown .token.strike .token.punctuation": {
516
- "color": "#3b82f6"
731
+ color: "#3b82f6"
517
732
  },
518
733
  ".language-markdown .token.list.punctuation": {
519
- "color": "#3b82f6"
734
+ color: "#3b82f6"
520
735
  },
521
736
  ".language-markdown .token.title.important > .token.punctuation": {
522
- "color": "#3b82f6"
737
+ color: "#3b82f6"
523
738
  },
524
- "bold": {
525
- "fontWeight": "bold"
739
+ bold: {
740
+ fontWeight: "bold"
526
741
  },
527
- "italic": {
528
- "fontStyle": "italic"
742
+ italic: {
743
+ fontStyle: "italic"
529
744
  },
530
- "namespace": {
531
- "Opacity": "0.8"
745
+ namespace: {
746
+ Opacity: "0.8"
532
747
  },
533
748
  "token.tab:not(:empty):before": {
534
- "color": "#64748b",
535
- "textShadow": "none"
749
+ color: "#64748b",
750
+ textShadow: "none"
536
751
  },
537
752
  "token.cr:before": {
538
- "color": "#64748b",
539
- "textShadow": "none"
753
+ color: "#64748b",
754
+ textShadow: "none"
540
755
  },
541
756
  "token.lf:before": {
542
- "color": "#64748b",
543
- "textShadow": "none"
757
+ color: "#64748b",
758
+ textShadow: "none"
544
759
  },
545
760
  "token.space:before": {
546
- "color": "#64748b",
547
- "textShadow": "none"
761
+ color: "#64748b",
762
+ textShadow: "none"
548
763
  },
549
764
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item": {
550
- "marginRight": "0.4em"
765
+ marginRight: "0.4em"
551
766
  },
552
767
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button": {
553
- "background": "#1e293b",
554
- "color": "#94a3b8",
555
- "padding": "0.1em 0.4em",
556
- "borderRadius": "0.3em"
768
+ background: "#1e293b",
769
+ color: "#94a3b8",
770
+ padding: "0.1em 0.4em",
771
+ borderRadius: "0.3em"
557
772
  },
558
773
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a": {
559
- "background": "#1e293b",
560
- "color": "#94a3b8",
561
- "padding": "0.1em 0.4em",
562
- "borderRadius": "0.3em"
774
+ background: "#1e293b",
775
+ color: "#94a3b8",
776
+ padding: "0.1em 0.4em",
777
+ borderRadius: "0.3em"
563
778
  },
564
779
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span": {
565
- "background": "#1e293b",
566
- "color": "#94a3b8",
567
- "padding": "0.1em 0.4em",
568
- "borderRadius": "0.3em"
780
+ background: "#1e293b",
781
+ color: "#94a3b8",
782
+ padding: "0.1em 0.4em",
783
+ borderRadius: "0.3em"
569
784
  },
570
785
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover": {
571
- "background": "#3b82f6",
572
- "color": "#ffffff"
786
+ background: "#3b82f6",
787
+ color: "#ffffff"
573
788
  },
574
789
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus": {
575
- "background": "#3b82f6",
576
- "color": "#ffffff"
790
+ background: "#3b82f6",
791
+ color: "#ffffff"
577
792
  },
578
793
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover": {
579
- "background": "#3b82f6",
580
- "color": "#ffffff"
794
+ background: "#3b82f6",
795
+ color: "#ffffff"
581
796
  },
582
797
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus": {
583
- "background": "#3b82f6",
584
- "color": "#ffffff"
798
+ background: "#3b82f6",
799
+ color: "#ffffff"
585
800
  },
586
801
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover": {
587
- "background": "#3b82f6",
588
- "color": "#ffffff"
802
+ background: "#3b82f6",
803
+ color: "#ffffff"
589
804
  },
590
805
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus": {
591
- "background": "#3b82f6",
592
- "color": "#ffffff"
806
+ background: "#3b82f6",
807
+ color: "#ffffff"
593
808
  },
594
809
  ".line-highlight.line-highlight": {
595
- "background": "rgba(59, 130, 246, 0.08)"
810
+ background: "rgba(59, 130, 246, 0.08)"
596
811
  },
597
812
  ".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)"
813
+ background: "#1e293b",
814
+ color: "#e2e8f0",
815
+ padding: "0.1em 0.6em",
816
+ borderRadius: "0.3em",
817
+ boxShadow: "0 2px 0 0 rgba(0, 0, 0, 0.2)"
603
818
  },
604
819
  ".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)"
820
+ background: "#1e293b",
821
+ color: "#e2e8f0",
822
+ padding: "0.1em 0.6em",
823
+ borderRadius: "0.3em",
824
+ boxShadow: "0 2px 0 0 rgba(0, 0, 0, 0.2)"
610
825
  },
611
826
  "pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before": {
612
- "backgroundColor": "rgba(59, 130, 246, 0.08)"
827
+ backgroundColor: "rgba(59, 130, 246, 0.08)"
613
828
  },
614
829
  ".line-numbers.line-numbers .line-numbers-rows": {
615
- "borderRightColor": "#1e293b"
830
+ borderRightColor: "#1e293b"
616
831
  },
617
832
  ".command-line .command-line-prompt": {
618
- "borderRightColor": "#1e293b"
833
+ borderRightColor: "#1e293b"
619
834
  },
620
835
  ".line-numbers .line-numbers-rows > span:before": {
621
- "color": "#64748b"
836
+ color: "#64748b"
622
837
  },
623
838
  ".command-line .command-line-prompt > span:before": {
624
- "color": "#64748b"
839
+ color: "#64748b"
625
840
  },
626
841
  ".rainbow-braces .token.token.punctuation.brace-level-1": {
627
- "color": "#3b82f6"
842
+ color: "#3b82f6"
628
843
  },
629
844
  ".rainbow-braces .token.token.punctuation.brace-level-5": {
630
- "color": "#3b82f6"
845
+ color: "#3b82f6"
631
846
  },
632
847
  ".rainbow-braces .token.token.punctuation.brace-level-9": {
633
- "color": "#3b82f6"
848
+ color: "#3b82f6"
634
849
  },
635
850
  ".rainbow-braces .token.token.punctuation.brace-level-2": {
636
- "color": "#10b981"
851
+ color: "#10b981"
637
852
  },
638
853
  ".rainbow-braces .token.token.punctuation.brace-level-6": {
639
- "color": "#10b981"
854
+ color: "#10b981"
640
855
  },
641
856
  ".rainbow-braces .token.token.punctuation.brace-level-10": {
642
- "color": "#10b981"
857
+ color: "#10b981"
643
858
  },
644
859
  ".rainbow-braces .token.token.punctuation.brace-level-3": {
645
- "color": "#60a5fa"
860
+ color: "#60a5fa"
646
861
  },
647
862
  ".rainbow-braces .token.token.punctuation.brace-level-7": {
648
- "color": "#60a5fa"
863
+ color: "#60a5fa"
649
864
  },
650
865
  ".rainbow-braces .token.token.punctuation.brace-level-11": {
651
- "color": "#60a5fa"
866
+ color: "#60a5fa"
652
867
  },
653
868
  ".rainbow-braces .token.token.punctuation.brace-level-4": {
654
- "color": "#f472b6"
869
+ color: "#f472b6"
655
870
  },
656
871
  ".rainbow-braces .token.token.punctuation.brace-level-8": {
657
- "color": "#f472b6"
872
+ color: "#f472b6"
658
873
  },
659
874
  ".rainbow-braces .token.token.punctuation.brace-level-12": {
660
- "color": "#f472b6"
875
+ color: "#f472b6"
661
876
  },
662
877
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)": {
663
- "backgroundColor": "rgba(239, 68, 68, 0.15)"
878
+ backgroundColor: "rgba(239, 68, 68, 0.15)"
664
879
  },
665
880
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)": {
666
- "backgroundColor": "rgba(239, 68, 68, 0.15)"
881
+ backgroundColor: "rgba(239, 68, 68, 0.15)"
667
882
  },
668
883
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection": {
669
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
884
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
670
885
  },
671
886
  "pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection": {
672
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
887
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
673
888
  },
674
889
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection": {
675
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
890
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
676
891
  },
677
892
  "pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection": {
678
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
893
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
679
894
  },
680
895
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection": {
681
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
896
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
682
897
  },
683
898
  "pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection": {
684
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
899
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
685
900
  },
686
901
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection": {
687
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
902
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
688
903
  },
689
904
  "pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection": {
690
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
905
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
691
906
  },
692
907
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)": {
693
- "backgroundColor": "rgba(16, 185, 129, 0.15)"
908
+ backgroundColor: "rgba(16, 185, 129, 0.15)"
694
909
  },
695
910
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)": {
696
- "backgroundColor": "rgba(16, 185, 129, 0.15)"
911
+ backgroundColor: "rgba(16, 185, 129, 0.15)"
697
912
  },
698
913
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection": {
699
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
914
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
700
915
  },
701
916
  "pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection": {
702
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
917
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
703
918
  },
704
919
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection": {
705
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
920
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
706
921
  },
707
922
  "pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection": {
708
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
923
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
709
924
  },
710
925
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection": {
711
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
926
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
712
927
  },
713
928
  "pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection": {
714
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
929
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
715
930
  },
716
931
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection": {
717
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
932
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
718
933
  },
719
934
  "pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection": {
720
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
935
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
721
936
  },
722
937
  ".prism-previewer.prism-previewer:before": {
723
- "borderColor": "#11111f"
938
+ borderColor: "#11111f"
724
939
  },
725
940
  ".prism-previewer-gradient.prism-previewer-gradient div": {
726
- "borderColor": "#11111f",
727
- "borderRadius": "0.3em"
941
+ borderColor: "#11111f",
942
+ borderRadius: "0.3em"
728
943
  },
729
944
  ".prism-previewer-color.prism-previewer-color:before": {
730
- "borderRadius": "0.3em"
945
+ borderRadius: "0.3em"
731
946
  },
732
947
  ".prism-previewer-easing.prism-previewer-easing:before": {
733
- "borderRadius": "0.3em"
948
+ borderRadius: "0.3em"
734
949
  },
735
950
  ".prism-previewer.prism-previewer:after": {
736
- "borderTopColor": "#11111f"
951
+ borderTopColor: "#11111f"
737
952
  },
738
953
  ".prism-previewer-flipped.prism-previewer-flipped.after": {
739
- "borderBottomColor": "#11111f"
954
+ borderBottomColor: "#11111f"
740
955
  },
741
956
  ".prism-previewer-angle.prism-previewer-angle:before": {
742
- "background": "#1e293b"
957
+ background: "#1e293b"
743
958
  },
744
959
  ".prism-previewer-time.prism-previewer-time:before": {
745
- "background": "#1e293b"
960
+ background: "#1e293b"
746
961
  },
747
962
  ".prism-previewer-easing.prism-previewer-easing": {
748
- "background": "#1e293b"
963
+ background: "#1e293b"
749
964
  },
750
965
  ".prism-previewer-angle.prism-previewer-angle circle": {
751
- "stroke": "#e2e8f0",
752
- "strokeOpacity": "1"
966
+ stroke: "#e2e8f0",
967
+ strokeOpacity: "1"
753
968
  },
754
969
  ".prism-previewer-time.prism-previewer-time circle": {
755
- "stroke": "#e2e8f0",
756
- "strokeOpacity": "1"
970
+ stroke: "#e2e8f0",
971
+ strokeOpacity: "1"
757
972
  },
758
973
  ".prism-previewer-easing.prism-previewer-easing circle": {
759
- "stroke": "#e2e8f0",
760
- "fill": "transparent"
974
+ stroke: "#e2e8f0",
975
+ fill: "transparent"
761
976
  },
762
977
  ".prism-previewer-easing.prism-previewer-easing path": {
763
- "stroke": "#e2e8f0"
978
+ stroke: "#e2e8f0"
764
979
  },
765
980
  ".prism-previewer-easing.prism-previewer-easing line": {
766
- "stroke": "#e2e8f0"
981
+ stroke: "#e2e8f0"
767
982
  }
768
983
  };
769
984
  const light = {
770
985
  '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"
986
+ background: "#fff",
987
+ color: "#1e293b",
988
+ textShadow: "none",
989
+ fontFamily: '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
990
+ direction: "ltr",
991
+ textAlign: "left",
992
+ whiteSpace: "pre",
993
+ wordSpacing: "normal",
994
+ wordBreak: "normal",
995
+ lineHeight: "1.5",
996
+ MozTabSize: "2",
997
+ OTabSize: "2",
998
+ tabSize: "2",
999
+ WebkitHyphens: "none",
1000
+ MozHyphens: "none",
1001
+ msHyphens: "none",
1002
+ hyphens: "none"
788
1003
  },
789
1004
  '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"
1005
+ background: "#fff",
1006
+ color: "#1e293b",
1007
+ textShadow: "none",
1008
+ fontFamily: '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
1009
+ direction: "ltr",
1010
+ textAlign: "left",
1011
+ whiteSpace: "pre",
1012
+ wordSpacing: "normal",
1013
+ wordBreak: "normal",
1014
+ lineHeight: "1.5",
1015
+ MozTabSize: "2",
1016
+ OTabSize: "2",
1017
+ tabSize: "2",
1018
+ WebkitHyphens: "none",
1019
+ MozHyphens: "none",
1020
+ msHyphens: "none",
1021
+ hyphens: "none",
1022
+ padding: "1em",
1023
+ margin: "0.5em 0",
1024
+ overflow: "auto",
1025
+ borderRadius: "0.3em",
1026
+ border: "1px solid #e2e8f0"
812
1027
  },
813
1028
  'code[class*="language-"]::-moz-selection': {
814
- "background": "#e2e8f0",
815
- "color": "inherit",
816
- "textShadow": "none"
1029
+ background: "#e2e8f0",
1030
+ color: "inherit",
1031
+ textShadow: "none"
817
1032
  },
818
1033
  'code[class*="language-"] *::-moz-selection': {
819
- "background": "#e2e8f0",
820
- "color": "inherit",
821
- "textShadow": "none"
1034
+ background: "#e2e8f0",
1035
+ color: "inherit",
1036
+ textShadow: "none"
822
1037
  },
823
1038
  'pre[class*="language-"] *::-moz-selection': {
824
- "background": "#e2e8f0",
825
- "color": "inherit",
826
- "textShadow": "none"
1039
+ background: "#e2e8f0",
1040
+ color: "inherit",
1041
+ textShadow: "none"
827
1042
  },
828
1043
  'code[class*="language-"]::selection': {
829
- "background": "#e2e8f0",
830
- "color": "inherit",
831
- "textShadow": "none"
1044
+ background: "#e2e8f0",
1045
+ color: "inherit",
1046
+ textShadow: "none"
832
1047
  },
833
1048
  'code[class*="language-"] *::selection': {
834
- "background": "#e2e8f0",
835
- "color": "inherit",
836
- "textShadow": "none"
1049
+ background: "#e2e8f0",
1050
+ color: "inherit",
1051
+ textShadow: "none"
837
1052
  },
838
1053
  'pre[class*="language-"] *::selection': {
839
- "background": "#e2e8f0",
840
- "color": "inherit",
841
- "textShadow": "none"
1054
+ background: "#e2e8f0",
1055
+ color: "inherit",
1056
+ textShadow: "none"
842
1057
  },
843
1058
  ':not(pre) > code[class*="language-"]': {
844
- "padding": "0.2em 0.3em",
845
- "borderRadius": "0.3em",
846
- "whiteSpace": "normal",
847
- "background": "#f1f5f9"
1059
+ padding: "0.2em 0.3em",
1060
+ borderRadius: "0.3em",
1061
+ whiteSpace: "normal",
1062
+ background: "#f1f5f9"
848
1063
  },
849
- "comment": {
850
- "color": "#64748b",
851
- "fontStyle": "italic"
1064
+ comment: {
1065
+ color: "#64748b",
1066
+ fontStyle: "italic"
852
1067
  },
853
- "prolog": {
854
- "color": "#64748b"
1068
+ prolog: {
1069
+ color: "#64748b"
855
1070
  },
856
- "cdata": {
857
- "color": "#64748b"
1071
+ cdata: {
1072
+ color: "#64748b"
858
1073
  },
859
- "doctype": {
860
- "color": "#1e293b"
1074
+ doctype: {
1075
+ color: "#1e293b"
861
1076
  },
862
- "punctuation": {
863
- "color": "#64748b"
1077
+ punctuation: {
1078
+ color: "#64748b"
864
1079
  },
865
- "entity": {
866
- "color": "#3b82f6",
867
- "cursor": "help"
1080
+ entity: {
1081
+ color: "#3b82f6",
1082
+ cursor: "help"
868
1083
  },
869
1084
  "attr-name": {
870
- "color": "#ea580c"
1085
+ color: "#ea580c"
871
1086
  },
872
1087
  "class-name": {
873
- "color": "#ea580c"
1088
+ color: "#ea580c"
874
1089
  },
875
- "boolean": {
876
- "color": "#3b82f6"
1090
+ boolean: {
1091
+ color: "#3b82f6"
877
1092
  },
878
- "constant": {
879
- "color": "#3b82f6"
1093
+ constant: {
1094
+ color: "#3b82f6"
880
1095
  },
881
- "number": {
882
- "color": "#3b82f6"
1096
+ number: {
1097
+ color: "#3b82f6"
883
1098
  },
884
- "atrule": {
885
- "color": "#ea580c"
1099
+ atrule: {
1100
+ color: "#ea580c"
886
1101
  },
887
- "keyword": {
888
- "color": "#9333ea"
1102
+ keyword: {
1103
+ color: "#9333ea"
889
1104
  },
890
- "property": {
891
- "color": "#3b82f6"
1105
+ property: {
1106
+ color: "#3b82f6"
892
1107
  },
893
- "tag": {
894
- "color": "#3b82f6"
1108
+ tag: {
1109
+ color: "#3b82f6"
895
1110
  },
896
- "symbol": {
897
- "color": "#3b82f6"
1111
+ symbol: {
1112
+ color: "#3b82f6"
898
1113
  },
899
- "deleted": {
900
- "color": "#dc2626"
1114
+ deleted: {
1115
+ color: "#dc2626"
901
1116
  },
902
- "important": {
903
- "color": "#9333ea"
1117
+ important: {
1118
+ color: "#9333ea"
904
1119
  },
905
- "selector": {
906
- "color": "#16a34a"
1120
+ selector: {
1121
+ color: "#16a34a"
907
1122
  },
908
- "string": {
909
- "color": "#16a34a"
1123
+ string: {
1124
+ color: "#16a34a"
910
1125
  },
911
- "char": {
912
- "color": "#16a34a"
1126
+ char: {
1127
+ color: "#16a34a"
913
1128
  },
914
- "builtin": {
915
- "color": "#16a34a"
1129
+ builtin: {
1130
+ color: "#16a34a"
916
1131
  },
917
- "inserted": {
918
- "color": "#16a34a"
1132
+ inserted: {
1133
+ color: "#16a34a"
919
1134
  },
920
- "regex": {
921
- "color": "#16a34a"
1135
+ regex: {
1136
+ color: "#16a34a"
922
1137
  },
923
1138
  "attr-value": {
924
- "color": "#16a34a"
1139
+ color: "#16a34a"
925
1140
  },
926
1141
  "attr-value > .token.punctuation": {
927
- "color": "#16a34a"
1142
+ color: "#16a34a"
928
1143
  },
929
- "variable": {
930
- "color": "#3b82f6"
1144
+ variable: {
1145
+ color: "#3b82f6"
931
1146
  },
932
- "operator": {
933
- "color": "#3b82f6"
1147
+ operator: {
1148
+ color: "#3b82f6"
934
1149
  },
935
- "function": {
936
- "color": "#3b82f6"
1150
+ function: {
1151
+ color: "#3b82f6"
937
1152
  },
938
- "url": {
939
- "color": "#3b82f6"
1153
+ url: {
1154
+ color: "#3b82f6"
940
1155
  },
941
1156
  "attr-value > .token.punctuation.attr-equals": {
942
- "color": "#64748b"
1157
+ color: "#64748b"
943
1158
  },
944
1159
  "special-attr > .token.attr-value > .token.value.css": {
945
- "color": "#1e293b"
1160
+ color: "#1e293b"
946
1161
  },
947
1162
  ".language-css .token.selector": {
948
- "color": "#3b82f6"
1163
+ color: "#3b82f6"
949
1164
  },
950
1165
  ".language-css .token.property": {
951
- "color": "#1e293b"
1166
+ color: "#1e293b"
952
1167
  },
953
1168
  ".language-css .token.function": {
954
- "color": "#3b82f6"
1169
+ color: "#3b82f6"
955
1170
  },
956
1171
  ".language-css .token.url > .token.function": {
957
- "color": "#3b82f6"
1172
+ color: "#3b82f6"
958
1173
  },
959
1174
  ".language-css .token.url > .token.string.url": {
960
- "color": "#16a34a"
1175
+ color: "#16a34a"
961
1176
  },
962
1177
  ".language-css .token.important": {
963
- "color": "#9333ea"
1178
+ color: "#9333ea"
964
1179
  },
965
1180
  ".language-css .token.atrule .token.rule": {
966
- "color": "#9333ea"
1181
+ color: "#9333ea"
967
1182
  },
968
1183
  ".language-javascript .token.operator": {
969
- "color": "#9333ea"
1184
+ color: "#9333ea"
970
1185
  },
971
1186
  ".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation": {
972
- "color": "#dc2626"
1187
+ color: "#dc2626"
973
1188
  },
974
1189
  ".language-json .token.operator": {
975
- "color": "#1e293b"
1190
+ color: "#1e293b"
976
1191
  },
977
1192
  ".language-json .token.null.keyword": {
978
- "color": "#3b82f6"
1193
+ color: "#3b82f6"
979
1194
  },
980
1195
  ".language-markdown .token.url": {
981
- "color": "#1e293b"
1196
+ color: "#1e293b"
982
1197
  },
983
1198
  ".language-markdown .token.url > .token.operator": {
984
- "color": "#1e293b"
1199
+ color: "#1e293b"
985
1200
  },
986
1201
  ".language-markdown .token.url-reference.url > .token.string": {
987
- "color": "#1e293b"
1202
+ color: "#1e293b"
988
1203
  },
989
1204
  ".language-markdown .token.url > .token.content": {
990
- "color": "#3b82f6"
1205
+ color: "#3b82f6"
991
1206
  },
992
1207
  ".language-markdown .token.url > .token.url": {
993
- "color": "#3b82f6"
1208
+ color: "#3b82f6"
994
1209
  },
995
1210
  ".language-markdown .token.url-reference.url": {
996
- "color": "#3b82f6"
1211
+ color: "#3b82f6"
997
1212
  },
998
1213
  ".language-markdown .token.blockquote.punctuation": {
999
- "color": "#64748b",
1000
- "fontStyle": "italic"
1214
+ color: "#64748b",
1215
+ fontStyle: "italic"
1001
1216
  },
1002
1217
  ".language-markdown .token.hr.punctuation": {
1003
- "color": "#64748b",
1004
- "fontStyle": "italic"
1218
+ color: "#64748b",
1219
+ fontStyle: "italic"
1005
1220
  },
1006
1221
  ".language-markdown .token.code-snippet": {
1007
- "color": "#16a34a"
1222
+ color: "#16a34a"
1008
1223
  },
1009
1224
  ".language-markdown .token.bold .token.content": {
1010
- "color": "#ea580c"
1225
+ color: "#ea580c"
1011
1226
  },
1012
1227
  ".language-markdown .token.italic .token.content": {
1013
- "color": "#9333ea"
1228
+ color: "#9333ea"
1014
1229
  },
1015
1230
  ".language-markdown .token.strike .token.content": {
1016
- "color": "#3b82f6"
1231
+ color: "#3b82f6"
1017
1232
  },
1018
1233
  ".language-markdown .token.strike .token.punctuation": {
1019
- "color": "#3b82f6"
1234
+ color: "#3b82f6"
1020
1235
  },
1021
1236
  ".language-markdown .token.list.punctuation": {
1022
- "color": "#3b82f6"
1237
+ color: "#3b82f6"
1023
1238
  },
1024
1239
  ".language-markdown .token.title.important > .token.punctuation": {
1025
- "color": "#3b82f6"
1240
+ color: "#3b82f6"
1026
1241
  },
1027
- "bold": {
1028
- "fontWeight": "bold"
1242
+ bold: {
1243
+ fontWeight: "bold"
1029
1244
  },
1030
- "italic": {
1031
- "fontStyle": "italic"
1245
+ italic: {
1246
+ fontStyle: "italic"
1032
1247
  },
1033
- "namespace": {
1034
- "Opacity": "0.8"
1248
+ namespace: {
1249
+ Opacity: "0.8"
1035
1250
  },
1036
1251
  "token.tab:not(:empty):before": {
1037
- "color": "#94a3b8"
1252
+ color: "#94a3b8"
1038
1253
  },
1039
1254
  "token.cr:before": {
1040
- "color": "#94a3b8"
1255
+ color: "#94a3b8"
1041
1256
  },
1042
1257
  "token.lf:before": {
1043
- "color": "#94a3b8"
1258
+ color: "#94a3b8"
1044
1259
  },
1045
1260
  "token.space:before": {
1046
- "color": "#94a3b8"
1261
+ color: "#94a3b8"
1047
1262
  },
1048
1263
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item": {
1049
- "marginRight": "0.4em"
1264
+ marginRight: "0.4em"
1050
1265
  },
1051
1266
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button": {
1052
- "background": "#f1f5f9",
1053
- "color": "#475569",
1054
- "padding": "0.1em 0.4em",
1055
- "borderRadius": "0.3em"
1267
+ background: "#f1f5f9",
1268
+ color: "#475569",
1269
+ padding: "0.1em 0.4em",
1270
+ borderRadius: "0.3em"
1056
1271
  },
1057
1272
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a": {
1058
- "background": "#f1f5f9",
1059
- "color": "#475569",
1060
- "padding": "0.1em 0.4em",
1061
- "borderRadius": "0.3em"
1273
+ background: "#f1f5f9",
1274
+ color: "#475569",
1275
+ padding: "0.1em 0.4em",
1276
+ borderRadius: "0.3em"
1062
1277
  },
1063
1278
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span": {
1064
- "background": "#f1f5f9",
1065
- "color": "#475569",
1066
- "padding": "0.1em 0.4em",
1067
- "borderRadius": "0.3em"
1279
+ background: "#f1f5f9",
1280
+ color: "#475569",
1281
+ padding: "0.1em 0.4em",
1282
+ borderRadius: "0.3em"
1068
1283
  },
1069
1284
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover": {
1070
- "background": "#3b82f6",
1071
- "color": "#ffffff"
1285
+ background: "#3b82f6",
1286
+ color: "#ffffff"
1072
1287
  },
1073
1288
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus": {
1074
- "background": "#3b82f6",
1075
- "color": "#ffffff"
1289
+ background: "#3b82f6",
1290
+ color: "#ffffff"
1076
1291
  },
1077
1292
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover": {
1078
- "background": "#3b82f6",
1079
- "color": "#ffffff"
1293
+ background: "#3b82f6",
1294
+ color: "#ffffff"
1080
1295
  },
1081
1296
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus": {
1082
- "background": "#3b82f6",
1083
- "color": "#ffffff"
1297
+ background: "#3b82f6",
1298
+ color: "#ffffff"
1084
1299
  },
1085
1300
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover": {
1086
- "background": "#3b82f6",
1087
- "color": "#ffffff"
1301
+ background: "#3b82f6",
1302
+ color: "#ffffff"
1088
1303
  },
1089
1304
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus": {
1090
- "background": "#3b82f6",
1091
- "color": "#ffffff"
1305
+ background: "#3b82f6",
1306
+ color: "#ffffff"
1092
1307
  },
1093
1308
  ".line-highlight.line-highlight": {
1094
- "background": "rgba(59, 130, 246, 0.08)"
1309
+ background: "rgba(59, 130, 246, 0.08)"
1095
1310
  },
1096
1311
  ".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)"
1312
+ background: "#f1f5f9",
1313
+ color: "#1e293b",
1314
+ padding: "0.1em 0.6em",
1315
+ borderRadius: "0.3em",
1316
+ boxShadow: "0 2px 0 0 rgba(0, 0, 0, 0.1)"
1102
1317
  },
1103
1318
  ".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)"
1319
+ background: "#f1f5f9",
1320
+ color: "#1e293b",
1321
+ padding: "0.1em 0.6em",
1322
+ borderRadius: "0.3em",
1323
+ boxShadow: "0 2px 0 0 rgba(0, 0, 0, 0.1)"
1109
1324
  },
1110
1325
  "pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before": {
1111
- "backgroundColor": "rgba(59, 130, 246, 0.08)"
1326
+ backgroundColor: "rgba(59, 130, 246, 0.08)"
1112
1327
  },
1113
1328
  ".line-numbers.line-numbers .line-numbers-rows": {
1114
- "borderRightColor": "#e2e8f0"
1329
+ borderRightColor: "#e2e8f0"
1115
1330
  },
1116
1331
  ".command-line .command-line-prompt": {
1117
- "borderRightColor": "#e2e8f0"
1332
+ borderRightColor: "#e2e8f0"
1118
1333
  },
1119
1334
  ".line-numbers .line-numbers-rows > span:before": {
1120
- "color": "#94a3b8"
1335
+ color: "#94a3b8"
1121
1336
  },
1122
1337
  ".command-line .command-line-prompt > span:before": {
1123
- "color": "#94a3b8"
1338
+ color: "#94a3b8"
1124
1339
  },
1125
1340
  ".rainbow-braces .token.token.punctuation.brace-level-1": {
1126
- "color": "#3b82f6"
1341
+ color: "#3b82f6"
1127
1342
  },
1128
1343
  ".rainbow-braces .token.token.punctuation.brace-level-5": {
1129
- "color": "#3b82f6"
1344
+ color: "#3b82f6"
1130
1345
  },
1131
1346
  ".rainbow-braces .token.token.punctuation.brace-level-9": {
1132
- "color": "#3b82f6"
1347
+ color: "#3b82f6"
1133
1348
  },
1134
1349
  ".rainbow-braces .token.token.punctuation.brace-level-2": {
1135
- "color": "#16a34a"
1350
+ color: "#16a34a"
1136
1351
  },
1137
1352
  ".rainbow-braces .token.token.punctuation.brace-level-6": {
1138
- "color": "#16a34a"
1353
+ color: "#16a34a"
1139
1354
  },
1140
1355
  ".rainbow-braces .token.token.punctuation.brace-level-10": {
1141
- "color": "#16a34a"
1356
+ color: "#16a34a"
1142
1357
  },
1143
1358
  ".rainbow-braces .token.token.punctuation.brace-level-3": {
1144
- "color": "#ea580c"
1359
+ color: "#ea580c"
1145
1360
  },
1146
1361
  ".rainbow-braces .token.token.punctuation.brace-level-7": {
1147
- "color": "#ea580c"
1362
+ color: "#ea580c"
1148
1363
  },
1149
1364
  ".rainbow-braces .token.token.punctuation.brace-level-11": {
1150
- "color": "#ea580c"
1365
+ color: "#ea580c"
1151
1366
  },
1152
1367
  ".rainbow-braces .token.token.punctuation.brace-level-4": {
1153
- "color": "#9333ea"
1368
+ color: "#9333ea"
1154
1369
  },
1155
1370
  ".rainbow-braces .token.token.punctuation.brace-level-8": {
1156
- "color": "#9333ea"
1371
+ color: "#9333ea"
1157
1372
  },
1158
1373
  ".rainbow-braces .token.token.punctuation.brace-level-12": {
1159
- "color": "#9333ea"
1374
+ color: "#9333ea"
1160
1375
  },
1161
1376
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)": {
1162
- "backgroundColor": "rgba(220, 38, 38, 0.15)"
1377
+ backgroundColor: "rgba(220, 38, 38, 0.15)"
1163
1378
  },
1164
1379
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)": {
1165
- "backgroundColor": "rgba(220, 38, 38, 0.15)"
1380
+ backgroundColor: "rgba(220, 38, 38, 0.15)"
1166
1381
  },
1167
1382
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection": {
1168
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1383
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1169
1384
  },
1170
1385
  "pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection": {
1171
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1386
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1172
1387
  },
1173
1388
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection": {
1174
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1389
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1175
1390
  },
1176
1391
  "pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection": {
1177
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1392
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1178
1393
  },
1179
1394
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection": {
1180
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1395
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1181
1396
  },
1182
1397
  "pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection": {
1183
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1398
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1184
1399
  },
1185
1400
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection": {
1186
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1401
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1187
1402
  },
1188
1403
  "pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection": {
1189
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1404
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1190
1405
  },
1191
1406
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)": {
1192
- "backgroundColor": "rgba(22, 163, 74, 0.15)"
1407
+ backgroundColor: "rgba(22, 163, 74, 0.15)"
1193
1408
  },
1194
1409
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)": {
1195
- "backgroundColor": "rgba(22, 163, 74, 0.15)"
1410
+ backgroundColor: "rgba(22, 163, 74, 0.15)"
1196
1411
  },
1197
1412
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection": {
1198
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1413
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1199
1414
  },
1200
1415
  "pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection": {
1201
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1416
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1202
1417
  },
1203
1418
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection": {
1204
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1419
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1205
1420
  },
1206
1421
  "pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection": {
1207
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1422
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1208
1423
  },
1209
1424
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection": {
1210
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1425
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1211
1426
  },
1212
1427
  "pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection": {
1213
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1428
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1214
1429
  },
1215
1430
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection": {
1216
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1431
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1217
1432
  },
1218
1433
  "pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection": {
1219
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1434
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1220
1435
  },
1221
1436
  ".prism-previewer.prism-previewer:before": {
1222
- "borderColor": "#fff"
1437
+ borderColor: "#fff"
1223
1438
  },
1224
1439
  ".prism-previewer-gradient.prism-previewer-gradient div": {
1225
- "borderColor": "#fff",
1226
- "borderRadius": "0.3em"
1440
+ borderColor: "#fff",
1441
+ borderRadius: "0.3em"
1227
1442
  },
1228
1443
  ".prism-previewer-color.prism-previewer-color:before": {
1229
- "borderRadius": "0.3em"
1444
+ borderRadius: "0.3em"
1230
1445
  },
1231
1446
  ".prism-previewer-easing.prism-previewer-easing:before": {
1232
- "borderRadius": "0.3em"
1447
+ borderRadius: "0.3em"
1233
1448
  },
1234
1449
  ".prism-previewer.prism-previewer:after": {
1235
- "borderTopColor": "#fff"
1450
+ borderTopColor: "#fff"
1236
1451
  },
1237
1452
  ".prism-previewer-flipped.prism-previewer-flipped.after": {
1238
- "borderBottomColor": "#fff"
1453
+ borderBottomColor: "#fff"
1239
1454
  },
1240
1455
  ".prism-previewer-angle.prism-previewer-angle:before": {
1241
- "background": "#f1f5f9"
1456
+ background: "#f1f5f9"
1242
1457
  },
1243
1458
  ".prism-previewer-time.prism-previewer-time:before": {
1244
- "background": "#f1f5f9"
1459
+ background: "#f1f5f9"
1245
1460
  },
1246
1461
  ".prism-previewer-easing.prism-previewer-easing": {
1247
- "background": "#f1f5f9"
1462
+ background: "#f1f5f9"
1248
1463
  },
1249
1464
  ".prism-previewer-angle.prism-previewer-angle circle": {
1250
- "stroke": "#1e293b",
1251
- "strokeOpacity": "1"
1465
+ stroke: "#1e293b",
1466
+ strokeOpacity: "1"
1252
1467
  },
1253
1468
  ".prism-previewer-time.prism-previewer-time circle": {
1254
- "stroke": "#1e293b",
1255
- "strokeOpacity": "1"
1469
+ stroke: "#1e293b",
1470
+ strokeOpacity: "1"
1256
1471
  },
1257
1472
  ".prism-previewer-easing.prism-previewer-easing circle": {
1258
- "stroke": "#1e293b",
1259
- "fill": "transparent"
1473
+ stroke: "#1e293b",
1474
+ fill: "transparent"
1260
1475
  },
1261
1476
  ".prism-previewer-easing.prism-previewer-easing path": {
1262
- "stroke": "#1e293b"
1477
+ stroke: "#1e293b"
1263
1478
  },
1264
1479
  ".prism-previewer-easing.prism-previewer-easing line": {
1265
- "stroke": "#1e293b"
1480
+ stroke: "#1e293b"
1266
1481
  }
1267
1482
  };
1268
1483
  const CodeHighlighter = ({
1269
1484
  className,
1270
1485
  children,
1486
+ inlineClassName,
1271
1487
  copyClassName,
1272
1488
  copyIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgCopy, {}),
1273
1489
  language,
1274
1490
  toolbarClassName,
1275
- theme = dark
1491
+ theme = dark,
1492
+ ...props
1276
1493
  }) => {
1277
- const match = language == null ? void 0 : language.match(/language-(\w+)/);
1494
+ const match = language?.match(/language-(\w+)/);
1278
1495
  const lang = match ? match[1] : "text";
1496
+ const isInline = !match;
1279
1497
  const handleCopy = (text) => {
1280
1498
  navigator.clipboard.writeText(text).then(() => {
1281
1499
  console.log("Text copied to clipboard");
@@ -1283,6 +1501,9 @@
1283
1501
  console.error("Could not copy text: ", err);
1284
1502
  });
1285
1503
  };
1504
+ if (isInline) {
1505
+ return /* @__PURE__ */ jsxRuntime.jsx("code", { className: reablocks.cn(inlineClassName), ...props, children });
1506
+ }
1286
1507
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn("relative", className), children: [
1287
1508
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(toolbarClassName), children: [
1288
1509
  /* @__PURE__ */ jsxRuntime.jsx("div", { children: lang }),
@@ -1291,21 +1512,14 @@
1291
1512
  {
1292
1513
  className: reablocks.cn(copyClassName),
1293
1514
  size: "small",
1294
- variant: "text",
1515
+ variant: "ghost",
1295
1516
  title: "Copy code",
1296
1517
  onClick: () => handleCopy(children),
1297
1518
  children: copyIcon
1298
1519
  }
1299
1520
  )
1300
1521
  ] }),
1301
- /* @__PURE__ */ jsxRuntime.jsx(
1302
- reactSyntaxHighlighter.Prism,
1303
- {
1304
- language: lang,
1305
- style: theme,
1306
- children
1307
- }
1308
- )
1522
+ /* @__PURE__ */ jsxRuntime.jsx(reactSyntaxHighlighter.Prism, { language: lang, style: theme, children })
1309
1523
  ] });
1310
1524
  };
1311
1525
  const TableComponent = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("table", { ...props, children });
@@ -1314,78 +1528,161 @@
1314
1528
  const Markdown = ({
1315
1529
  children,
1316
1530
  remarkPlugins,
1317
- rehypePlugins = [rehypeKatex]
1318
- }) => {
1531
+ rehypePlugins = [rehypeKatex],
1532
+ theme
1533
+ }) => /* @__PURE__ */ jsxRuntime.jsx(
1534
+ ReactMarkdown,
1535
+ {
1536
+ remarkPlugins,
1537
+ rehypePlugins,
1538
+ components: {
1539
+ code: ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1540
+ CodeHighlighter,
1541
+ {
1542
+ ...props,
1543
+ language: reablocks.cn(className),
1544
+ inlineClassName: reablocks.cn(theme.messages.message.markdown.inlineCode),
1545
+ className: reablocks.cn(theme.messages.message.markdown.code, className),
1546
+ copyClassName: reablocks.cn(theme.messages.message.markdown.copy),
1547
+ toolbarClassName: reablocks.cn(theme.messages.message.markdown.toolbar)
1548
+ }
1549
+ ),
1550
+ table: (props) => /* @__PURE__ */ jsxRuntime.jsx(
1551
+ TableComponent,
1552
+ {
1553
+ ...props,
1554
+ className: reablocks.cn(theme.messages.message.markdown.table)
1555
+ }
1556
+ ),
1557
+ th: (props) => /* @__PURE__ */ jsxRuntime.jsx(
1558
+ TableHeaderCell,
1559
+ {
1560
+ ...props,
1561
+ className: reablocks.cn(theme.messages.message.markdown.th)
1562
+ }
1563
+ ),
1564
+ td: (props) => /* @__PURE__ */ jsxRuntime.jsx(
1565
+ TableDataCell,
1566
+ {
1567
+ ...props,
1568
+ className: reablocks.cn(theme.messages.message.markdown.td)
1569
+ }
1570
+ ),
1571
+ a: (props) => /* @__PURE__ */ jsxRuntime.jsx("a", { ...props, className: reablocks.cn(theme.messages.message.markdown.a) }),
1572
+ hr: (props) => /* @__PURE__ */ jsxRuntime.jsx("hr", { ...props, className: reablocks.cn(theme.messages.message.markdown.hr) }),
1573
+ p: (props) => /* @__PURE__ */ jsxRuntime.jsx("p", { ...props, className: reablocks.cn(theme.messages.message.markdown.p) }),
1574
+ li: (props) => /* @__PURE__ */ jsxRuntime.jsx("li", { ...props, className: reablocks.cn(theme.messages.message.markdown.li) }),
1575
+ ul: (props) => /* @__PURE__ */ jsxRuntime.jsx("ul", { ...props, className: reablocks.cn(theme.messages.message.markdown.ul) }),
1576
+ ol: (props) => /* @__PURE__ */ jsxRuntime.jsx("ol", { ...props, className: reablocks.cn(theme.messages.message.markdown.ol) }),
1577
+ h1: (props) => /* @__PURE__ */ jsxRuntime.jsx("h1", { ...props, className: reablocks.cn(theme.messages.message.markdown.h1) }),
1578
+ h2: (props) => /* @__PURE__ */ jsxRuntime.jsx("h2", { ...props, className: reablocks.cn(theme.messages.message.markdown.h2) }),
1579
+ h3: (props) => /* @__PURE__ */ jsxRuntime.jsx("h3", { ...props, className: reablocks.cn(theme.messages.message.markdown.h3) }),
1580
+ h4: (props) => /* @__PURE__ */ jsxRuntime.jsx("h4", { ...props, className: reablocks.cn(theme.messages.message.markdown.h4) }),
1581
+ h5: (props) => /* @__PURE__ */ jsxRuntime.jsx("h5", { ...props, className: reablocks.cn(theme.messages.message.markdown.h5) }),
1582
+ h6: (props) => /* @__PURE__ */ jsxRuntime.jsx("h6", { ...props, className: reablocks.cn(theme.messages.message.markdown.h6) })
1583
+ },
1584
+ children
1585
+ }
1586
+ );
1587
+ const CVE_REGEX = /(CVE-(19|20)\d{2}-\d{4,7})/gi;
1588
+ const remarkCve = () => {
1589
+ return (tree) => {
1590
+ mdastUtilFindAndReplace.findAndReplace(tree, [[CVE_REGEX, replaceCve]], {
1591
+ ignore: ["link", "linkReference"]
1592
+ });
1593
+ };
1594
+ };
1595
+ function replaceCve(value) {
1596
+ return {
1597
+ type: "link",
1598
+ url: `https://cve.mitre.org/cgi-bin/cvename.cgi?name=${value}`,
1599
+ children: [{ type: "text", value: value.trim() }]
1600
+ };
1601
+ }
1602
+ const SessionEmpty = ({ children }) => {
1319
1603
  const { theme } = React.useContext(ChatContext);
1320
- return /* @__PURE__ */ jsxRuntime.jsx(
1321
- ReactMarkdown,
1322
- {
1323
- remarkPlugins,
1324
- rehypePlugins,
1325
- components: {
1326
- code: ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1327
- CodeHighlighter,
1328
- {
1329
- ...props,
1330
- language: className,
1331
- className: reablocks.cn(theme.messages.message.markdown.code, className),
1332
- copyClassName: reablocks.cn(theme.messages.message.markdown.copy),
1333
- toolbarClassName: reablocks.cn(theme.messages.message.markdown.toolbar)
1334
- }
1335
- ),
1336
- table: (props) => /* @__PURE__ */ jsxRuntime.jsx(
1337
- TableComponent,
1338
- {
1339
- ...props,
1340
- className: reablocks.cn(theme.messages.message.markdown.table)
1341
- }
1342
- ),
1343
- th: (props) => /* @__PURE__ */ jsxRuntime.jsx(
1344
- TableHeaderCell,
1345
- {
1346
- ...props,
1347
- className: reablocks.cn(theme.messages.message.markdown.th)
1348
- }
1349
- ),
1350
- td: (props) => /* @__PURE__ */ jsxRuntime.jsx(
1351
- TableDataCell,
1352
- {
1353
- ...props,
1354
- className: reablocks.cn(theme.messages.message.markdown.td)
1355
- }
1356
- ),
1357
- a: (props) => /* @__PURE__ */ jsxRuntime.jsx("a", { ...props, className: reablocks.cn(theme.messages.message.markdown.a) }),
1358
- p: (props) => /* @__PURE__ */ jsxRuntime.jsx("p", { ...props, className: reablocks.cn(theme.messages.message.markdown.p) }),
1359
- li: (props) => /* @__PURE__ */ jsxRuntime.jsx("li", { ...props, className: reablocks.cn(theme.messages.message.markdown.li) }),
1360
- ul: (props) => /* @__PURE__ */ jsxRuntime.jsx("ul", { ...props, className: reablocks.cn(theme.messages.message.markdown.ul) }),
1361
- ol: (props) => /* @__PURE__ */ jsxRuntime.jsx("ol", { ...props, className: reablocks.cn(theme.messages.message.markdown.ol) })
1362
- },
1363
- children
1364
- }
1365
- );
1604
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: reablocks.cn(theme.empty), children });
1366
1605
  };
1367
- const CVE_REGEX = /(CVE-(19|20)\d{2}-\d{4,7})/gi;
1368
- function remarkCve() {
1369
- return (tree, _file) => {
1370
- mdastUtilFindAndReplace.findAndReplace(tree, [[
1371
- CVE_REGEX,
1372
- replaceCve
1373
- ]]);
1606
+ 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" }));
1607
+ 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" }));
1608
+ 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" }));
1609
+ const MessageActions = ({
1610
+ children,
1611
+ ...props
1612
+ }) => {
1613
+ const { theme } = React.useContext(ChatContext);
1614
+ const {
1615
+ question,
1616
+ response,
1617
+ copyIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgCopy, {}),
1618
+ thumbsUpIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgThumbsUp, {}),
1619
+ thumbsDownIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgThumbsDown, {}),
1620
+ refreshIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgRefresh, {}),
1621
+ onCopy,
1622
+ onUpvote,
1623
+ onDownvote,
1624
+ onRefresh
1625
+ } = props;
1626
+ const Comp = children ? reactSlot.Slot : "div";
1627
+ const handleCopy = (text) => {
1628
+ navigator.clipboard.writeText(text).then(() => {
1629
+ console.log("Text copied to clipboard");
1630
+ }).catch((err) => {
1631
+ console.error("Could not copy text: ", err);
1632
+ });
1374
1633
  };
1375
- function replaceCve(value, id) {
1376
- return [
1634
+ 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: [
1635
+ copyIcon && /* @__PURE__ */ jsxRuntime.jsx(
1636
+ reablocks.IconButton,
1377
1637
  {
1378
- type: "link",
1379
- url: `https://cve.mitre.org/cgi-bin/cvename.cgi?name=${id}`,
1380
- children: [
1381
- { children: [{ type: "text", value: value.trim() }] }
1382
- ]
1638
+ variant: "ghost",
1639
+ disablePadding: true,
1640
+ title: "Copy question and response",
1641
+ className: reablocks.cn(theme.messages.message.footer.copy),
1642
+ onClick: onCopy ? onCopy : () => handleCopy(`${question}
1643
+ ${response}`),
1644
+ children: copyIcon
1383
1645
  }
1384
- ];
1385
- }
1386
- }
1646
+ ),
1647
+ thumbsUpIcon && /* @__PURE__ */ jsxRuntime.jsx(
1648
+ reablocks.IconButton,
1649
+ {
1650
+ variant: "ghost",
1651
+ disablePadding: true,
1652
+ title: "Upvote",
1653
+ className: reablocks.cn(theme.messages.message.footer.upvote),
1654
+ onClick: onUpvote,
1655
+ children: thumbsUpIcon
1656
+ }
1657
+ ),
1658
+ thumbsDownIcon && /* @__PURE__ */ jsxRuntime.jsx(
1659
+ reablocks.IconButton,
1660
+ {
1661
+ variant: "ghost",
1662
+ disablePadding: true,
1663
+ title: "Downvote",
1664
+ className: reablocks.cn(theme.messages.message.footer.downvote),
1665
+ onClick: onDownvote,
1666
+ children: thumbsDownIcon
1667
+ }
1668
+ ),
1669
+ refreshIcon && /* @__PURE__ */ jsxRuntime.jsx(
1670
+ reablocks.IconButton,
1671
+ {
1672
+ variant: "ghost",
1673
+ disablePadding: true,
1674
+ title: "Refresh",
1675
+ className: reablocks.cn(theme.messages.message.footer.refresh),
1676
+ onClick: onRefresh,
1677
+ children: refreshIcon
1678
+ }
1679
+ )
1680
+ ] }) });
1681
+ };
1387
1682
  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));
1683
+ const DefaultFileRenderer$2 = React.lazy(
1684
+ () => Promise.resolve().then(() => DefaultFileRenderer$1)
1685
+ );
1389
1686
  const CSVFileRenderer$2 = React.lazy(() => Promise.resolve().then(() => CSVFileRenderer$1));
1390
1687
  const ImageFileRenderer$2 = React.lazy(() => Promise.resolve().then(() => ImageFileRenderer$1));
1391
1688
  const PDFFileRenderer$2 = React.lazy(() => Promise.resolve().then(() => PDFFileRenderer$1));
@@ -1403,29 +1700,12 @@
1403
1700
  }) => {
1404
1701
  const { theme } = React.useContext(ChatContext);
1405
1702
  const FileRenderer = React.useMemo(() => {
1406
- const Renderer = Object.keys(FILE_TYPE_RENDERER_MAP).find((key) => type == null ? void 0 : type.startsWith(key)) ?? "default";
1703
+ const Renderer = Object.keys(FILE_TYPE_RENDERER_MAP).find((key) => type?.startsWith(key)) ?? "default";
1407
1704
  return FILE_TYPE_RENDERER_MAP[Renderer] || DefaultFileRenderer$2;
1408
1705
  }, [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
- );
1706
+ 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
1707
  };
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" }));
1708
+ 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
1709
  const sanitizeSVGCell = (cell) => {
1430
1710
  const trimmed = cell.trim();
1431
1711
  const escaped = trimmed.replace(/"/g, '""');
@@ -1442,8 +1722,8 @@
1442
1722
  throw new Error("Failed to parse CSV file.");
1443
1723
  }
1444
1724
  };
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
1725
  const CSVFileRenderer = ({ name, url, fileIcon }) => {
1726
+ const { theme } = React.useContext(ChatContext);
1447
1727
  const [isLoading, setIsLoading] = React.useState(true);
1448
1728
  const [csvData, setCsvData] = React.useState([]);
1449
1729
  const [error, setError] = React.useState(null);
@@ -1519,24 +1799,24 @@
1519
1799
  ]
1520
1800
  }
1521
1801
  );
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: [
1802
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: theme.messages.message.csvPreview.base, children: [
1803
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: theme.messages.message.csvPreview.header.base, children: [
1804
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: theme.messages.message.csvPreview.header.icon, children: [
1525
1805
  fileIcon,
1526
1806
  name && /* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: "ml-1", children: name })
1527
1807
  ] }),
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, {}) })
1808
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: theme.messages.message.csvPreview.header.actions, children: [
1809
+ /* @__PURE__ */ jsxRuntime.jsx(reablocks.IconButton, { size: "medium", variant: "text", onClick: downloadCSV, children: /* @__PURE__ */ jsxRuntime.jsx(SvgDownload, {}) }),
1810
+ /* @__PURE__ */ jsxRuntime.jsx(reablocks.IconButton, { size: "medium", variant: "text", onClick: toggleModal, children: /* @__PURE__ */ jsxRuntime.jsx(SvgCopy, {}) })
1531
1811
  ] })
1532
1812
  ] }),
1533
1813
  error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "error-message", children: error }),
1534
1814
  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) }),
1815
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: theme.messages.message.csvPreview.tableContainer, children: !error && csvData.length > 0 && renderTable(csvData, 6) }),
1536
1816
  /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: isModalOpen && /* @__PURE__ */ jsxRuntime.jsx(
1537
1817
  react.motion.div,
1538
1818
  {
1539
- className: "fixed inset-0 bg-black/70 flex justify-center items-center z-50",
1819
+ className: theme.messages.message.csvPreview.dialog.base,
1540
1820
  initial: { opacity: 0 },
1541
1821
  animate: { opacity: 1 },
1542
1822
  exit: { opacity: 0 },
@@ -1545,7 +1825,7 @@
1545
1825
  react.motion.div,
1546
1826
  {
1547
1827
  ref: modalRef,
1548
- className: "bg-white dark:bg-gray-900 rounded-md w-11/12 h-5/6 overflow-auto",
1828
+ className: theme.messages.message.csvPreview.dialog.container,
1549
1829
  initial: { scale: 0.8 },
1550
1830
  animate: { scale: 1 },
1551
1831
  exit: { scale: 0.8 },
@@ -1561,15 +1841,34 @@
1561
1841
  __proto__: null,
1562
1842
  default: CSVFileRenderer
1563
1843
  }, Symbol.toStringTag, { value: "Module" }));
1844
+ const DefaultFileRenderer = ({
1845
+ name,
1846
+ limit = 100,
1847
+ fileIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgFile, {})
1848
+ }) => /* @__PURE__ */ jsxRuntime.jsxs("figure", { className: "flex items-center gap-2", children: [
1849
+ fileIcon,
1850
+ name && /* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: reablocks.cn("file-name-class"), children: /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { value: name, limit }) })
1851
+ ] });
1852
+ const DefaultFileRenderer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1853
+ __proto__: null,
1854
+ default: DefaultFileRenderer
1855
+ }, Symbol.toStringTag, { value: "Module" }));
1564
1856
  const ImageFileRenderer = ({ url }) => /* @__PURE__ */ jsxRuntime.jsx("img", { src: url, alt: "Image", className: "size-10" });
1565
1857
  const ImageFileRenderer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1566
1858
  __proto__: null,
1567
1859
  default: ImageFileRenderer
1568
1860
  }, 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
- ] });
1861
+ const PDFFileRenderer = ({ name, url, fileIcon }) => /* @__PURE__ */ jsxRuntime.jsxs(
1862
+ "figure",
1863
+ {
1864
+ className: "csv-icon flex items-center gap-2",
1865
+ onClick: () => window.open(url, "_blank"),
1866
+ children: [
1867
+ fileIcon,
1868
+ name && /* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: "file-name", children: name })
1869
+ ]
1870
+ }
1871
+ );
1573
1872
  const PDFFileRenderer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1574
1873
  __proto__: null,
1575
1874
  default: PDFFileRenderer
@@ -1583,7 +1882,7 @@
1583
1882
  }
1584
1883
  const { imageFiles, otherFiles } = files.reduce(
1585
1884
  (acc, file) => {
1586
- if (file.type.startsWith("image/")) {
1885
+ if (file.type?.startsWith("image/")) {
1587
1886
  acc.imageFiles.push(file);
1588
1887
  } else {
1589
1888
  acc.otherFiles.push(file);
@@ -1643,30 +1942,64 @@
1643
1942
  };
1644
1943
  const MessageQuestion = ({
1645
1944
  children,
1945
+ previewLineClamp = 3,
1646
1946
  ...props
1647
1947
  }) => {
1648
1948
  const { theme, remarkPlugins } = React.useContext(ChatContext);
1649
1949
  const { question, files } = props;
1650
1950
  const Comp = children ? reactSlot.Slot : "div";
1651
- const [expanded, setExpanded] = React.useState(false);
1652
- const isLong = question.length > 500;
1951
+ const [truncated, setTruncated] = React.useState(false);
1952
+ const [showAll, setShowAll] = React.useState(false);
1953
+ const ref = React.useRef(null);
1954
+ const calculateTruncation = React.useCallback(() => {
1955
+ const el = ref.current;
1956
+ if (el) {
1957
+ setTruncated(el.scrollHeight > el.clientHeight);
1958
+ }
1959
+ }, []);
1960
+ React.useEffect(() => {
1961
+ const el = ref.current;
1962
+ if (!el || previewLineClamp === false) {
1963
+ return;
1964
+ }
1965
+ calculateTruncation();
1966
+ const resizeObserver = new ResizeObserver(() => {
1967
+ calculateTruncation();
1968
+ });
1969
+ resizeObserver.observe(el);
1970
+ window.addEventListener("resize", calculateTruncation);
1971
+ return () => {
1972
+ resizeObserver.disconnect();
1973
+ window.removeEventListener("resize", calculateTruncation);
1974
+ };
1975
+ }, [calculateTruncation, previewLineClamp]);
1653
1976
  return /* @__PURE__ */ jsxRuntime.jsx(
1654
1977
  Comp,
1655
1978
  {
1656
1979
  className: reablocks.cn(theme.messages.message.question, {
1657
- [theme.messages.message.overlay]: isLong && !expanded
1980
+ [theme.messages.message.overlay]: truncated
1658
1981
  }),
1659
1982
  ...props,
1660
1983
  children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1661
1984
  /* @__PURE__ */ jsxRuntime.jsx(MessageFiles, { files }),
1662
- /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, children: question }),
1663
- isLong && !expanded && /* @__PURE__ */ jsxRuntime.jsx(
1985
+ /* @__PURE__ */ jsxRuntime.jsx(
1986
+ "div",
1987
+ {
1988
+ ref,
1989
+ className: reablocks.cn({
1990
+ [`line-clamp-${previewLineClamp}`]: !showAll && typeof previewLineClamp === "number",
1991
+ "line-clamp-none": showAll || previewLineClamp === false
1992
+ }),
1993
+ children: /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, theme, children: question })
1994
+ }
1995
+ ),
1996
+ truncated && !showAll && /* @__PURE__ */ jsxRuntime.jsx(
1664
1997
  reablocks.Button,
1665
1998
  {
1666
1999
  variant: "link",
1667
2000
  size: "small",
1668
2001
  className: theme.messages.message.expand,
1669
- onClick: () => setExpanded(true),
2002
+ onClick: () => setShowAll(true),
1670
2003
  children: "Show more"
1671
2004
  }
1672
2005
  )
@@ -1687,7 +2020,7 @@
1687
2020
  "data-compact": isCompact,
1688
2021
  className: reablocks.cn(theme.messages.message.response),
1689
2022
  children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1690
- /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, children: response }),
2023
+ /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, theme, children: response }),
1691
2024
  isLoading && /* @__PURE__ */ jsxRuntime.jsx(
1692
2025
  react.motion.div,
1693
2026
  {
@@ -1704,7 +2037,12 @@
1704
2037
  }
1705
2038
  );
1706
2039
  };
1707
- const MessageSource = ({ title, url, image, limit = 50 }) => {
2040
+ const MessageSource = ({
2041
+ title,
2042
+ url,
2043
+ image,
2044
+ limit = 50
2045
+ }) => {
1708
2046
  const { theme, isCompact } = React.useContext(ChatContext);
1709
2047
  return /* @__PURE__ */ jsxRuntime.jsxs(
1710
2048
  "figure",
@@ -1718,10 +2056,26 @@
1718
2056
  }
1719
2057
  },
1720
2058
  children: [
1721
- image && /* @__PURE__ */ jsxRuntime.jsx("img", { src: image, alt: title, className: reablocks.cn(theme.messages.message.sources.source.image) }),
2059
+ image && /* @__PURE__ */ jsxRuntime.jsx(
2060
+ "img",
2061
+ {
2062
+ src: image,
2063
+ alt: title,
2064
+ className: reablocks.cn(theme.messages.message.sources.source.image)
2065
+ }
2066
+ ),
1722
2067
  (title || url) && /* @__PURE__ */ jsxRuntime.jsxs("figcaption", { children: [
1723
2068
  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 })
2069
+ url && /* @__PURE__ */ jsxRuntime.jsx(
2070
+ "a",
2071
+ {
2072
+ href: url,
2073
+ target: "_blank",
2074
+ rel: "noopener noreferrer",
2075
+ className: reablocks.cn(theme.messages.message.sources.source.url),
2076
+ children: url
2077
+ }
2078
+ )
1725
2079
  ] })
1726
2080
  ]
1727
2081
  }
@@ -1738,493 +2092,65 @@
1738
2092
  }
1739
2093
  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
2094
  };
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
- const messageVariants = {
1818
- hidden: {
1819
- opacity: 0,
1820
- y: 20
1821
- },
1822
- visible: {
1823
- opacity: 1,
1824
- y: 0,
1825
- transition: {
1826
- duration: 0.3
1827
- }
1828
- }
1829
- };
1830
- const SessionMessage = ({
1831
- conversation,
1832
- isLast,
1833
- children
2095
+ const messageVariants = {
2096
+ hidden: {
2097
+ opacity: 0,
2098
+ y: 20
2099
+ },
2100
+ visible: {
2101
+ opacity: 1,
2102
+ y: 0,
2103
+ transition: {
2104
+ duration: 0.3
2105
+ }
2106
+ }
2107
+ };
2108
+ const SessionMessage = ({
2109
+ className,
2110
+ conversation,
2111
+ isLast,
2112
+ children
1834
2113
  }) => {
1835
2114
  const { theme, isLoading } = React.useContext(ChatContext);
1836
2115
  return /* @__PURE__ */ jsxRuntime.jsxs(react.motion.div, { variants: messageVariants, children: [
1837
- /* @__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 }),
2116
+ /* @__PURE__ */ jsxRuntime.jsx(reablocks.Card, { className: reablocks.cn(theme.messages.message.base, className), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1839
2117
  /* @__PURE__ */ jsxRuntime.jsx(
1840
- MessageResponse,
1841
- {
1842
- response: conversation.response,
1843
- isLoading: isLast && isLoading
1844
- }
1845
- ),
1846
- /* @__PURE__ */ jsxRuntime.jsx(MessageSources, { sources: conversation.sources }),
1847
- /* @__PURE__ */ jsxRuntime.jsx(
1848
- MessageActions,
2118
+ MessageQuestion,
1849
2119
  {
1850
2120
  question: conversation.question,
1851
- response: conversation.response
1852
- }
1853
- )
1854
- ] }) }),
1855
- !isLast && /* @__PURE__ */ jsxRuntime.jsx(reablocks.Divider, {})
1856
- ] }, conversation.id);
1857
- };
1858
- const containerVariants = {
1859
- hidden: {},
1860
- visible: {
1861
- transition: {
1862
- staggerChildren: 0.07,
1863
- when: "beforeChildren"
1864
- }
1865
- }
1866
- };
1867
- const SessionMessages = ({
1868
- children,
1869
- newSessionContent,
1870
- limit = 10,
1871
- showMoreText = "Show more"
1872
- }) => {
1873
- const { activeSession, theme } = React.useContext(ChatContext);
1874
- const contentRef = React.useRef(null);
1875
- const [isAnimating, setIsAnimating] = React.useState(true);
1876
- React.useEffect(() => {
1877
- if (contentRef.current) {
1878
- requestAnimationFrame(
1879
- () => contentRef.current.scrollTop = contentRef.current.scrollHeight
1880
- );
1881
- }
1882
- }, [activeSession, isAnimating]);
1883
- function handleShowMore() {
1884
- showNext(limit);
1885
- requestAnimationFrame(() => contentRef.current.scrollTop = 0);
1886
- }
1887
- const reversedConvos = React.useMemo(
1888
- () => [...(activeSession == null ? void 0 : activeSession.conversations) ?? []].reverse(),
1889
- [activeSession]
1890
- );
1891
- const { data, hasMore, showNext } = reablocks.useInfinityList({
1892
- items: reversedConvos,
1893
- size: limit
1894
- });
1895
- const reReversedConvo = React.useMemo(() => [...data].reverse(), [data]);
1896
- const convosToRender = limit ? reReversedConvo : activeSession == null ? void 0 : activeSession.conversations;
1897
- if (!activeSession) {
1898
- return /* @__PURE__ */ jsxRuntime.jsx(SessionEmpty, { children: newSessionContent });
1899
- }
1900
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(theme.messages.content), ref: contentRef, children: [
1901
- hasMore && /* @__PURE__ */ jsxRuntime.jsx(
1902
- reablocks.Button,
1903
- {
1904
- variant: "outline",
1905
- className: reablocks.cn(theme.messages.showMore),
1906
- fullWidth: true,
1907
- onClick: handleShowMore,
1908
- children: showMoreText
1909
- }
1910
- ),
1911
- /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: /* @__PURE__ */ jsxRuntime.jsx(
1912
- react.motion.div,
1913
- {
1914
- variants: containerVariants,
1915
- initial: "hidden",
1916
- animate: "visible",
1917
- onAnimationComplete: () => {
1918
- requestAnimationFrame(() => setIsAnimating(false));
1919
- },
1920
- children: children ? children(convosToRender) : convosToRender.map((conversation, index) => /* @__PURE__ */ jsxRuntime.jsx(
1921
- SessionMessage,
1922
- {
1923
- conversation,
1924
- isLast: index === conversation.length - 1
1925
- },
1926
- conversation.id
1927
- ))
1928
- },
1929
- activeSession == null ? void 0 : activeSession.id
1930
- ) })
1931
- ] });
1932
- };
1933
- const chatTheme = {
1934
- base: "dark:text-white text-gray-500",
1935
- console: "flex w-full gap-4 h-full",
1936
- companion: "w-full h-full overflow-hidden",
1937
- empty: "text-center flex-1",
1938
- appbar: "flex p-5",
1939
- sessions: {
1940
- base: "overflow-auto",
1941
- console: "min-w-[150px] w-[30%] max-w-[300px] dark:bg-[#11111F] bg-[#F2F3F7] p-5 rounded-3xl",
1942
- companion: "w-full h-full",
1943
- group: "text-xs dart:text-gray-400 text-gray-700 mt-4 hover:bg-transparent mb-1",
1944
- create: "relative mb-4 rounded-[10px] text-white",
1945
- session: {
1946
- base: [
1947
- "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",
1948
- "dark:text-typography dark:text-gray-400 dark:hover:bg-gray-800/50 dark:hover:border-gray-700/50 dark:[&_svg]:text-gray-200"
1949
- ].join(" "),
1950
- active: [
1951
- "border border-gray-300 hover:border-gray-400 text-gray-700 bg-gray-200 hover:bg-gray-300 ",
1952
- "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",
1953
- "[&_button]:opacity-100!"
1954
- ].join(" "),
1955
- delete: "[&>svg]:w-4 [&>svg]:h-4 opacity-0 group-hover:opacity-50!"
1956
- }
1957
- },
1958
- messages: {
1959
- base: "",
1960
- console: "flex flex-col mx-5 flex-1 overflow-hidden",
1961
- companion: "flex w-full h-full",
1962
- back: "self-start p-0 my-2",
1963
- inner: "flex-1 h-full flex flex-col",
1964
- title: ["text-base font-bold text-gray-500", "dark:text-gray-200"].join(
1965
- " "
1966
- ),
1967
- date: "text-xs whitespace-nowrap text-gray-400",
1968
- content: [
1969
- "mt-2 flex-1 overflow-auto [&_hr]:bg-gray-200",
1970
- "dark:[&_hr]:bg-gray-800/60"
1971
- ].join(" "),
1972
- header: "flex justify-between items-center gap-2",
1973
- showMore: "mb-4",
1974
- message: {
1975
- base: "mt-4 mb-4 flex flex-col p-0 rounded-sm border-none bg-transparent",
1976
- question: [
1977
- "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",
1978
- "dark:bg-gray-900/60 dark:border-gray-700/50 dark:text-gray-100"
1979
- ].join(" "),
1980
- response: [
1981
- "relative data-[compact=false]:px-4 text-gray-900",
1982
- "dark:text-gray-100"
1983
- ].join(" "),
1984
- 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",
1985
- cursor: "inline-block w-1 h-4 bg-current",
1986
- expand: "absolute bottom-1 right-1 z-10",
1987
- files: {
1988
- base: "mb-2 flex flex-wrap gap-3 ",
1989
- file: {
1990
- base: [
1991
- "flex items-center gap-2 border border-gray-300 px-3 py-2 rounded-lg cursor-pointer",
1992
- "dark:border-gray-700"
1993
- ].join(" "),
1994
- name: ["text-sm text-gray-500", "dark:text-gray-200"].join(" ")
2121
+ files: conversation.files
1995
2122
  }
1996
- },
1997
- sources: {
1998
- base: "my-4 flex flex-wrap gap-3",
1999
- source: {
2000
- base: [
2001
- "flex gap-2 border border-gray-200 px-4 py-2 rounded-lg cursor-pointer",
2002
- "dark:border-gray-700"
2003
- ].join(" "),
2004
- companion: "flex-1 px-3 py-1.5",
2005
- image: "max-w-10 max-h-10 rounded-md w-full h-fit self-center",
2006
- title: "text-md block",
2007
- url: "text-sm text-blue-400 underline"
2008
- }
2009
- },
2010
- markdown: {
2011
- copy: "sticky py-1 [&>svg]:w-4 [&>svg]:h-4 opacity-50",
2012
- p: "mb-2",
2013
- a: "text-blue-400 underline",
2014
- table: "table-auto w-full m-2",
2015
- th: "px-4 py-2 text-left font-bold border-b border-gray-500",
2016
- td: "px-4 py-2",
2017
- code: "m-2 rounded-b relative",
2018
- 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 ",
2019
- li: "mb-2 ml-6",
2020
- ul: "mb-4 list-disc",
2021
- ol: "mb-4 list-decimal"
2022
- },
2023
- footer: {
2024
- base: "mt-3 flex gap-1.5",
2025
- copy: [
2026
- "p-3 rounded-[10px] [&>svg]:w-4 [&>svg]:h-4 opacity-50 hover:opacity-100! hover:bg-gray-200 hover:text-gray-500",
2027
- "dark:hover:bg-gray-800 dark:hover:text-white text-gray-400"
2028
- ].join(" "),
2029
- 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",
2030
- 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",
2031
- 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"
2032
- }
2033
- }
2034
- },
2035
- input: {
2036
- base: "flex mt-4 relative",
2037
- upload: ["px-5 py-2 text-gray-400 size-10", "dark:gray-500"].join(" "),
2038
- input: [
2039
- "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",
2040
- "dark:border-gray-700/50 dark:text-gray-200 dark:bg-gray-950 dark:hover:bg-blue-950/40"
2041
- ].join(" "),
2042
- actions: {
2043
- base: "absolute flex gap-2 items-center right-5 inset-y-1/2 -translate-y-1/2 z-10",
2044
- send: [
2045
- "px-3 py-3 hover:bg-primary-hover rounded-full bg-gray-200 hover:bg-gray-300 text-gray-500",
2046
- "dark:text-white light:text-gray-500 dark:bg-gray-800 dark:hover:bg-gray-700"
2047
- ].join(" "),
2048
- stop: "px-2 py-2 bg-red-500 text-white rounded-full hover:bg-red-700 "
2049
- }
2050
- }
2051
- };
2052
- const useDimensions = () => {
2053
- const [ref, setRef] = React.useState(null);
2054
- const [width, setWidth] = React.useState(void 0);
2055
- const observe = React.useCallback((element) => {
2056
- if (element) setRef(element);
2057
- }, []);
2058
- React.useEffect(() => {
2059
- if (!ref) return;
2060
- const resizeObserver = new ResizeObserver((entries) => {
2061
- for (let entry of entries) {
2062
- setWidth(entry.contentRect.width);
2063
- }
2064
- });
2065
- resizeObserver.observe(ref);
2066
- return () => {
2067
- resizeObserver.disconnect();
2068
- };
2069
- }, [ref]);
2070
- return { width, observe };
2071
- };
2072
- const Chat = ({
2073
- children,
2074
- viewType = "console",
2075
- sessions,
2076
- onSelectSession,
2077
- onDeleteSession,
2078
- onSendMessage,
2079
- onStopMessage,
2080
- onFileUpload,
2081
- isLoading,
2082
- activeSessionId,
2083
- theme = chatTheme,
2084
- onNewSession,
2085
- remarkPlugins = [remarkGfm, remarkYoutube, remarkMath],
2086
- disabled,
2087
- style,
2088
- className
2089
- }) => {
2090
- const [internalActiveSessionID, setInternalActiveSessionID] = React.useState(activeSessionId);
2091
- const { width, observe } = useDimensions();
2092
- const isCompact = viewType === "companion" || width && width < 767;
2093
- React.useEffect(() => {
2094
- setInternalActiveSessionID(activeSessionId);
2095
- }, [activeSessionId]);
2096
- const handleSelectSession = React.useCallback(
2097
- (sessionId) => {
2098
- setInternalActiveSessionID(sessionId);
2099
- onSelectSession == null ? void 0 : onSelectSession(sessionId);
2100
- },
2101
- [onSelectSession]
2102
- );
2103
- const handleDeleteSession = React.useCallback(
2104
- (sessionId) => {
2105
- setInternalActiveSessionID(void 0);
2106
- onDeleteSession == null ? void 0 : onDeleteSession(sessionId);
2107
- },
2108
- [onDeleteSession]
2109
- );
2110
- const handleCreateNewSession = React.useCallback(() => {
2111
- setInternalActiveSessionID(void 0);
2112
- onNewSession == null ? void 0 : onNewSession();
2113
- }, [onNewSession]);
2114
- reakeys.useHotkeys([
2115
- {
2116
- name: "Create new session",
2117
- category: "Chat",
2118
- keys: "meta+shift+s",
2119
- callback: (event) => {
2120
- event.preventDefault();
2121
- handleCreateNewSession();
2122
- }
2123
- }
2124
- ]);
2125
- const activeSession = React.useMemo(
2126
- () => sessions.find((session) => session.id === internalActiveSessionID),
2127
- [sessions, internalActiveSessionID]
2128
- );
2129
- const contextValue = React.useMemo(
2130
- () => ({
2131
- sessions,
2132
- activeSession,
2133
- remarkPlugins,
2134
- theme,
2135
- disabled,
2136
- isLoading,
2137
- isCompact,
2138
- viewType,
2139
- activeSessionId: internalActiveSessionID,
2140
- selectSession: handleSelectSession,
2141
- deleteSession: handleDeleteSession,
2142
- createSession: handleCreateNewSession,
2143
- sendMessage: onSendMessage,
2144
- stopMessage: onStopMessage,
2145
- fileUpload: onFileUpload
2146
- }),
2147
- [
2148
- isLoading,
2149
- isCompact,
2150
- viewType,
2151
- disabled,
2152
- theme,
2153
- remarkPlugins,
2154
- sessions,
2155
- activeSession,
2156
- internalActiveSessionID,
2157
- handleSelectSession,
2158
- handleDeleteSession,
2159
- handleCreateNewSession,
2160
- onSendMessage,
2161
- onStopMessage,
2162
- onFileUpload
2163
- ]
2164
- );
2165
- return /* @__PURE__ */ jsxRuntime.jsx(ChatContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: /* @__PURE__ */ jsxRuntime.jsx(
2166
- "div",
2167
- {
2168
- ref: observe,
2169
- className: reablocks.cn(className, theme.base, {
2170
- [theme.companion]: isCompact,
2171
- [theme.console]: !isCompact
2172
- }),
2173
- style,
2174
- children
2175
- }
2176
- ) }) });
2177
- };
2178
- 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" })));
2179
- 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" }));
2180
- const SessionListItem = ({
2181
- children,
2182
- session,
2183
- deletable = true,
2184
- limit = 100,
2185
- deleteIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgTrash, {}),
2186
- chatIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgChat, { className: "mr-2" })
2187
- }) => {
2188
- const { activeSessionId, selectSession, deleteSession, theme } = React.useContext(ChatContext);
2189
- const Comp = children ? reactSlot.Slot : reablocks.ListItem;
2190
- return /* @__PURE__ */ jsxRuntime.jsx(
2191
- Comp,
2192
- {
2193
- dense: true,
2194
- disableGutters: true,
2195
- active: session.id === activeSessionId,
2196
- className: reablocks.cn(theme.sessions.session.base, {
2197
- [theme.sessions.session.active]: session.id === activeSessionId
2198
- }),
2199
- onClick: () => selectSession == null ? void 0 : selectSession(session.id),
2200
- start: chatIcon,
2201
- end: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: deletable && /* @__PURE__ */ jsxRuntime.jsx(
2202
- reablocks.IconButton,
2123
+ ),
2124
+ /* @__PURE__ */ jsxRuntime.jsx(
2125
+ MessageResponse,
2203
2126
  {
2204
- size: "small",
2205
- variant: "text",
2206
- onClick: (e) => {
2207
- e.stopPropagation();
2208
- deleteSession(session.id);
2209
- },
2210
- className: reablocks.cn(theme.sessions.session.delete),
2211
- children: deleteIcon
2127
+ response: conversation.response,
2128
+ isLoading: isLast && isLoading
2212
2129
  }
2213
- ) }),
2214
- children: children || /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { value: session.title, limit })
2215
- }
2216
- );
2130
+ ),
2131
+ /* @__PURE__ */ jsxRuntime.jsx(MessageSources, { sources: conversation.sources }),
2132
+ /* @__PURE__ */ jsxRuntime.jsx(
2133
+ MessageActions,
2134
+ {
2135
+ question: conversation.question,
2136
+ response: conversation.response
2137
+ }
2138
+ )
2139
+ ] }) }),
2140
+ !isLast && /* @__PURE__ */ jsxRuntime.jsx(reablocks.Divider, {})
2141
+ ] }, conversation.id);
2217
2142
  };
2218
- const SessionsList = ({
2143
+ 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" }));
2144
+ const SessionMessagePanel = ({
2219
2145
  children,
2220
- templates
2146
+ allowBack = true
2221
2147
  }) => {
2222
- const { theme, isCompact, activeSessionId, createSession } = React.useContext(ChatContext);
2223
- const isVisible = isCompact && !activeSessionId;
2224
- return (!isCompact || isVisible) && /* @__PURE__ */ jsxRuntime.jsxs(
2148
+ const { activeSessionId, theme, isCompact, selectSession, viewType } = React.useContext(ChatContext);
2149
+ const isVisible = isCompact && activeSessionId || viewType === "chat" || !isCompact;
2150
+ return isVisible && /* @__PURE__ */ jsxRuntime.jsx(
2225
2151
  react.motion.div,
2226
2152
  {
2227
- initial: { translateX: "-100%" },
2153
+ initial: { translateX: "200%" },
2228
2154
  animate: {
2229
2155
  translateX: "0%",
2230
2156
  transition: {
@@ -2234,29 +2160,133 @@ ${response}`),
2234
2160
  when: "beforeChildren"
2235
2161
  }
2236
2162
  },
2237
- exit: { translateX: "-100%" },
2238
- className: reablocks.cn(theme.sessions.base, {
2239
- [theme.sessions.companion]: isCompact,
2240
- [theme.sessions.console]: !isCompact
2163
+ exit: { translateX: "200%" },
2164
+ className: reablocks.cn(theme.messages.base, {
2165
+ [theme.messages.companion]: isCompact,
2166
+ [theme.messages.console]: !isCompact
2241
2167
  }),
2168
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(theme.messages.inner), children: [
2169
+ allowBack && isCompact && viewType !== "chat" && /* @__PURE__ */ jsxRuntime.jsxs(
2170
+ reablocks.Button,
2171
+ {
2172
+ variant: "text",
2173
+ size: "small",
2174
+ onClick: () => selectSession(null),
2175
+ className: reablocks.cn(theme.messages.back),
2176
+ children: [
2177
+ /* @__PURE__ */ jsxRuntime.jsx(SvgBack, {}),
2178
+ "Back"
2179
+ ]
2180
+ }
2181
+ ),
2182
+ children
2183
+ ] })
2184
+ }
2185
+ );
2186
+ };
2187
+ const containerVariants = {
2188
+ hidden: {},
2189
+ visible: {
2190
+ transition: {
2191
+ staggerChildren: 0.07,
2192
+ when: "beforeChildren"
2193
+ }
2194
+ }
2195
+ };
2196
+ const SessionMessages = ({
2197
+ children,
2198
+ newSessionContent,
2199
+ limit = 10,
2200
+ className,
2201
+ showMoreText = "Show more",
2202
+ autoScroll = true,
2203
+ onScroll
2204
+ }) => {
2205
+ const { activeSession, theme } = React.useContext(ChatContext);
2206
+ const contentRef = React.useRef(null);
2207
+ const [isAnimating, setIsAnimating] = React.useState(true);
2208
+ React.useEffect(() => {
2209
+ if (contentRef.current && autoScroll) {
2210
+ requestAnimationFrame(
2211
+ () => contentRef.current.scrollTop = contentRef.current.scrollHeight
2212
+ );
2213
+ }
2214
+ }, [activeSession, autoScroll, isAnimating]);
2215
+ function handleShowMore() {
2216
+ showNext(limit);
2217
+ requestAnimationFrame(() => contentRef.current.scrollTop = 0);
2218
+ }
2219
+ const reversedConvos = React.useMemo(
2220
+ () => [...activeSession?.conversations ?? []].reverse(),
2221
+ [activeSession]
2222
+ );
2223
+ const { data, hasMore, showNext } = reablocks.useInfinityList({
2224
+ items: reversedConvos,
2225
+ size: limit
2226
+ });
2227
+ const reReversedConvo = React.useMemo(() => [...data].reverse(), [data]);
2228
+ const convosToRender = limit ? reReversedConvo : activeSession?.conversations;
2229
+ if (!activeSession) {
2230
+ return /* @__PURE__ */ jsxRuntime.jsx(SessionEmpty, { children: newSessionContent });
2231
+ }
2232
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2233
+ "div",
2234
+ {
2235
+ className: reablocks.cn(theme.messages.content, className),
2236
+ ref: contentRef,
2237
+ onScrollCapture: onScroll,
2242
2238
  children: [
2243
- /* @__PURE__ */ jsxRuntime.jsx(reablocks.List, { children }),
2244
- 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(
2245
- SessionListItem,
2239
+ hasMore && /* @__PURE__ */ jsxRuntime.jsx(
2240
+ reablocks.Button,
2246
2241
  {
2247
- session: {
2248
- id: template.id,
2249
- title: template.title,
2250
- conversations: []
2251
- },
2252
- chatIcon: template.icon,
2253
- deletable: false
2242
+ variant: "outline",
2243
+ className: reablocks.cn(theme.messages.showMore),
2244
+ fullWidth: true,
2245
+ onClick: handleShowMore,
2246
+ children: showMoreText
2254
2247
  }
2255
- ) }, template.id)) })
2248
+ ),
2249
+ /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: /* @__PURE__ */ jsxRuntime.jsx(
2250
+ react.motion.div,
2251
+ {
2252
+ variants: containerVariants,
2253
+ initial: "hidden",
2254
+ animate: "visible",
2255
+ onAnimationComplete: () => {
2256
+ requestAnimationFrame(() => setIsAnimating(false));
2257
+ },
2258
+ children: children ? children(convosToRender) : convosToRender.map((conversation, index) => /* @__PURE__ */ jsxRuntime.jsx(
2259
+ SessionMessage,
2260
+ {
2261
+ conversation,
2262
+ isLast: index === conversation.length - 1
2263
+ },
2264
+ conversation.id
2265
+ ))
2266
+ },
2267
+ activeSession?.id
2268
+ ) })
2256
2269
  ]
2257
2270
  }
2258
2271
  );
2259
2272
  };
2273
+ const SessionMessagesHeader = ({ children }) => {
2274
+ const { activeSession, theme } = React.useContext(ChatContext);
2275
+ const Comp = children ? reactSlot.Slot : "header";
2276
+ if (!activeSession) {
2277
+ return null;
2278
+ }
2279
+ return /* @__PURE__ */ jsxRuntime.jsx(Comp, { className: reablocks.cn(theme.messages.header), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2280
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: reablocks.cn(theme.messages.title), children: /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { limit: 125, value: activeSession.title }) }),
2281
+ /* @__PURE__ */ jsxRuntime.jsx(
2282
+ reablocks.DateFormat,
2283
+ {
2284
+ className: reablocks.cn(theme.messages.date),
2285
+ date: activeSession.createdAt
2286
+ }
2287
+ )
2288
+ ] }) });
2289
+ };
2260
2290
  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" })));
2261
2291
  const NewSessionButton = ({
2262
2292
  children,
@@ -2341,6 +2371,46 @@ ${response}`),
2341
2371
  )
2342
2372
  }));
2343
2373
  }
2374
+ 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" }));
2375
+ 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" })));
2376
+ const SessionListItem = ({
2377
+ children,
2378
+ session,
2379
+ deletable = true,
2380
+ limit = 100,
2381
+ deleteIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgTrash, {}),
2382
+ chatIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgChat, { className: "mr-2" })
2383
+ }) => {
2384
+ const { activeSessionId, selectSession, deleteSession, theme } = React.useContext(ChatContext);
2385
+ const Comp = children ? reactSlot.Slot : reablocks.ListItem;
2386
+ return /* @__PURE__ */ jsxRuntime.jsx(
2387
+ Comp,
2388
+ {
2389
+ dense: true,
2390
+ disableGutters: true,
2391
+ active: session.id === activeSessionId,
2392
+ className: reablocks.cn(theme.sessions.session.base, {
2393
+ [theme.sessions.session.active]: session.id === activeSessionId
2394
+ }),
2395
+ onClick: () => selectSession?.(session.id),
2396
+ start: chatIcon,
2397
+ end: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: deletable && /* @__PURE__ */ jsxRuntime.jsx(
2398
+ reablocks.IconButton,
2399
+ {
2400
+ size: "small",
2401
+ variant: "ghost",
2402
+ onClick: (e) => {
2403
+ e.stopPropagation();
2404
+ deleteSession(session.id);
2405
+ },
2406
+ className: reablocks.cn(theme.sessions.session.delete),
2407
+ children: deleteIcon
2408
+ }
2409
+ ) }),
2410
+ children: children || /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { value: session.title, limit })
2411
+ }
2412
+ );
2413
+ };
2344
2414
  const SessionsGroup = ({
2345
2415
  heading,
2346
2416
  children
@@ -2362,46 +2432,50 @@ ${response}`),
2362
2432
  const SessionGroups = ({ children }) => {
2363
2433
  const { sessions } = React.useContext(ChatContext);
2364
2434
  const groups = React.useMemo(() => groupSessionsByDate(sessions), [sessions]);
2365
- 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)) })) });
2366
- };
2367
- const AppBar = ({ content, theme = chatTheme }) => {
2368
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: reablocks.cn(theme.appbar), children: content });
2435
+ 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)) });
2369
2436
  };
2370
- const ChatBubble = React.memo(
2371
- ({
2372
- children,
2373
- bubbleContent,
2374
- position = "right-end",
2375
- modifiers = [react$1.offset({ mainAxis: 0, crossAxis: -40 })],
2376
- className
2377
- }) => {
2378
- const [isOpen, setIsOpen] = React.useState(false);
2379
- const ref = React.useRef(null);
2380
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2381
- /* @__PURE__ */ jsxRuntime.jsx(
2382
- reablocks.ConnectedOverlay,
2383
- {
2384
- placement: position,
2385
- modifiers,
2386
- reference: ref.current,
2387
- open: isOpen,
2388
- onOpen: () => setIsOpen(true),
2389
- onClose: () => setIsOpen(false),
2390
- content: () => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children })
2391
- }
2392
- ),
2393
- /* @__PURE__ */ jsxRuntime.jsx(
2394
- "div",
2395
- {
2396
- ref,
2397
- className,
2398
- onClick: () => setIsOpen((prev) => !prev),
2399
- children: bubbleContent
2437
+ const SessionsList = ({
2438
+ children,
2439
+ templates
2440
+ }) => {
2441
+ const { theme, isCompact, activeSessionId, createSession } = React.useContext(ChatContext);
2442
+ const isVisible = isCompact && !activeSessionId;
2443
+ return (!isCompact || isVisible) && /* @__PURE__ */ jsxRuntime.jsxs(
2444
+ react.motion.div,
2445
+ {
2446
+ initial: { translateX: "-100%" },
2447
+ animate: {
2448
+ translateX: "0%",
2449
+ transition: {
2450
+ type: "tween",
2451
+ ease: "linear",
2452
+ duration: 0.2,
2453
+ when: "beforeChildren"
2400
2454
  }
2401
- )
2402
- ] });
2403
- }
2404
- );
2455
+ },
2456
+ exit: { translateX: "-100%" },
2457
+ className: reablocks.cn(theme.sessions.base, {
2458
+ [theme.sessions.companion]: isCompact,
2459
+ [theme.sessions.console]: !isCompact
2460
+ }),
2461
+ children: [
2462
+ /* @__PURE__ */ jsxRuntime.jsx(reablocks.List, { children }),
2463
+ templates && !activeSessionId && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: templates.map((template) => /* @__PURE__ */ jsxRuntime.jsx("div", { onClick: () => createSession?.(), children: /* @__PURE__ */ jsxRuntime.jsx(
2464
+ SessionListItem,
2465
+ {
2466
+ session: {
2467
+ id: template.id,
2468
+ title: template.title,
2469
+ conversations: []
2470
+ },
2471
+ chatIcon: template.icon,
2472
+ deletable: false
2473
+ }
2474
+ ) }, template.id)) })
2475
+ ]
2476
+ }
2477
+ );
2478
+ };
2405
2479
  exports2.AppBar = AppBar;
2406
2480
  exports2.Chat = Chat;
2407
2481
  exports2.ChatBubble = ChatBubble;
@@ -2432,8 +2506,9 @@ ${response}`),
2432
2506
  exports2.TableHeaderCell = TableHeaderCell;
2433
2507
  exports2.chatTheme = chatTheme;
2434
2508
  exports2.dark = dark;
2509
+ exports2.groupSessionsByDate = groupSessionsByDate;
2435
2510
  exports2.light = light;
2436
2511
  exports2.remarkCve = remarkCve;
2437
2512
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
2438
- });
2513
+ }));
2439
2514
  //# sourceMappingURL=index.umd.cjs.map