reachat 2.1.0-alpha.2 → 2.1.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AppBar/AppBar.d.ts +1 -1
- package/dist/{CSVFileRenderer-CpB8ngRc.js → CSVFileRenderer-B7eSDub6.js} +15 -14
- package/dist/CSVFileRenderer-B7eSDub6.js.map +1 -0
- package/dist/Chat.d.ts +3 -3
- package/dist/ChatBubble/ChatBubble.d.ts +1 -1
- package/dist/ChatContext.d.ts +2 -2
- package/dist/ChatInput/ChatInput.d.ts +16 -0
- package/dist/ChatInput/FileInput.d.ts +5 -1
- package/dist/{DefaultFileRenderer-DEgyNAd4.js → DefaultFileRenderer-CszY8p_0.js} +2 -2
- package/dist/DefaultFileRenderer-CszY8p_0.js.map +1 -0
- package/dist/ImageFileRenderer-C8tVW3I8.js.map +1 -1
- package/dist/Markdown/CodeHighlighter.d.ts +4 -0
- package/dist/Markdown/Markdown.d.ts +5 -0
- package/dist/Markdown/Table.d.ts +1 -1
- package/dist/Markdown/index.d.ts +2 -2
- package/dist/Markdown/plugins/remarkCve.d.ts +2 -1
- package/dist/PDFFileRenderer-BBn2EVrV.js +16 -0
- package/dist/PDFFileRenderer-BBn2EVrV.js.map +1 -0
- package/dist/SessionMessages/SessionEmpty.d.ts +1 -4
- package/dist/SessionMessages/SessionMessage/MessageFile/renderers/index.d.ts +1 -1
- package/dist/SessionMessages/SessionMessage/MessageFiles.d.ts +1 -1
- package/dist/SessionMessages/SessionMessage/MessageQuestion.d.ts +4 -0
- package/dist/SessionMessages/SessionMessage/MessageSources.d.ts +1 -1
- package/dist/SessionMessages/SessionMessage/SessionMessage.d.ts +4 -0
- package/dist/SessionMessages/SessionMessage/index.d.ts +2 -2
- package/dist/SessionMessages/SessionMessages.d.ts +14 -1
- package/dist/SessionMessages/index.d.ts +2 -2
- package/dist/SessionsList/index.d.ts +2 -2
- package/dist/docs.json +216 -20
- package/dist/{index-DVFyp_Cz.js → index-DNefh8rs.js} +1332 -1269
- package/dist/index-DNefh8rs.js.map +1 -0
- package/dist/index.css +6358 -727
- package/dist/index.d.ts +7 -6
- package/dist/index.js +32 -31
- package/dist/index.umd.cjs +1317 -1246
- package/dist/index.umd.cjs.map +1 -1
- package/dist/stories/Changelog.mdx +1 -1
- package/dist/stories/Chat.stories.tsx +28 -23
- package/dist/stories/ChatBubble.stories.tsx +3 -3
- package/dist/stories/Companion.stories.tsx +6 -6
- package/dist/stories/Console.stories.tsx +23 -23
- package/dist/stories/Integration.stories.tsx +2 -2
- package/dist/stories/Intro.mdx +1 -1
- package/dist/stories/Markdown.stories.tsx +318 -0
- package/dist/stories/assets/logo.svg +38 -19
- package/dist/stories/assets/paperclip.svg +4 -1
- package/dist/stories/assets/search.svg +5 -1
- package/dist/stories/examples.ts +20 -13
- package/dist/theme.d.ts +21 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +63 -47
- package/dist/CSVFileRenderer-CpB8ngRc.js.map +0 -1
- package/dist/DefaultFileRenderer-DEgyNAd4.js.map +0 -1
- package/dist/PDFFileRenderer-DQdFS2l6.js +0 -9
- package/dist/PDFFileRenderer-DQdFS2l6.js.map +0 -1
- package/dist/index-DVFyp_Cz.js.map +0 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -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("
|
|
15
|
-
})(this, function(exports2, jsxRuntime, reablocks, React,
|
|
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
|
|
35
|
-
|
|
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
|
|
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
|
-
|
|
115
|
-
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
392
|
+
inputRef.current?.focus();
|
|
116
393
|
},
|
|
117
394
|
send: () => {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
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
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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
|
-
|
|
313
|
-
|
|
314
|
-
|
|
527
|
+
background: "#1e293b",
|
|
528
|
+
color: "inherit",
|
|
529
|
+
textShadow: "none"
|
|
315
530
|
},
|
|
316
531
|
'code[class*="language-"] *::-moz-selection': {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
532
|
+
background: "#1e293b",
|
|
533
|
+
color: "inherit",
|
|
534
|
+
textShadow: "none"
|
|
320
535
|
},
|
|
321
536
|
'pre[class*="language-"] *::-moz-selection': {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
537
|
+
background: "#1e293b",
|
|
538
|
+
color: "inherit",
|
|
539
|
+
textShadow: "none"
|
|
325
540
|
},
|
|
326
541
|
'code[class*="language-"]::selection': {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
542
|
+
background: "#1e293b",
|
|
543
|
+
color: "inherit",
|
|
544
|
+
textShadow: "none"
|
|
330
545
|
},
|
|
331
546
|
'code[class*="language-"] *::selection': {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
547
|
+
background: "#1e293b",
|
|
548
|
+
color: "inherit",
|
|
549
|
+
textShadow: "none"
|
|
335
550
|
},
|
|
336
551
|
'pre[class*="language-"] *::selection': {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
552
|
+
background: "#1e293b",
|
|
553
|
+
color: "inherit",
|
|
554
|
+
textShadow: "none"
|
|
340
555
|
},
|
|
341
556
|
':not(pre) > code[class*="language-"]': {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
557
|
+
padding: "0.2em 0.3em",
|
|
558
|
+
borderRadius: "0.3em",
|
|
559
|
+
whiteSpace: "normal"
|
|
345
560
|
},
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
561
|
+
comment: {
|
|
562
|
+
color: "#64748b",
|
|
563
|
+
fontStyle: "italic"
|
|
349
564
|
},
|
|
350
|
-
|
|
351
|
-
|
|
565
|
+
prolog: {
|
|
566
|
+
color: "#64748b"
|
|
352
567
|
},
|
|
353
|
-
|
|
354
|
-
|
|
568
|
+
cdata: {
|
|
569
|
+
color: "#64748b"
|
|
355
570
|
},
|
|
356
|
-
|
|
357
|
-
|
|
571
|
+
doctype: {
|
|
572
|
+
color: "#e2e8f0"
|
|
358
573
|
},
|
|
359
|
-
|
|
360
|
-
|
|
574
|
+
punctuation: {
|
|
575
|
+
color: "#e2e8f0"
|
|
361
576
|
},
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
577
|
+
entity: {
|
|
578
|
+
color: "#3b82f6",
|
|
579
|
+
cursor: "help"
|
|
365
580
|
},
|
|
366
581
|
"attr-name": {
|
|
367
|
-
|
|
582
|
+
color: "#f59e0b"
|
|
368
583
|
},
|
|
369
584
|
"class-name": {
|
|
370
|
-
|
|
585
|
+
color: "#f59e0b"
|
|
371
586
|
},
|
|
372
|
-
|
|
373
|
-
|
|
587
|
+
boolean: {
|
|
588
|
+
color: "#3b82f6"
|
|
374
589
|
},
|
|
375
|
-
|
|
376
|
-
|
|
590
|
+
constant: {
|
|
591
|
+
color: "#3b82f6"
|
|
377
592
|
},
|
|
378
|
-
|
|
379
|
-
|
|
593
|
+
number: {
|
|
594
|
+
color: "#3b82f6"
|
|
380
595
|
},
|
|
381
|
-
|
|
382
|
-
|
|
596
|
+
atrule: {
|
|
597
|
+
color: "#f59e0b"
|
|
383
598
|
},
|
|
384
|
-
|
|
385
|
-
|
|
599
|
+
keyword: {
|
|
600
|
+
color: "#f472b6"
|
|
386
601
|
},
|
|
387
|
-
|
|
388
|
-
|
|
602
|
+
property: {
|
|
603
|
+
color: "#3b82f6"
|
|
389
604
|
},
|
|
390
|
-
|
|
391
|
-
|
|
605
|
+
tag: {
|
|
606
|
+
color: "#3b82f6"
|
|
392
607
|
},
|
|
393
|
-
|
|
394
|
-
|
|
608
|
+
symbol: {
|
|
609
|
+
color: "#3b82f6"
|
|
395
610
|
},
|
|
396
|
-
|
|
397
|
-
|
|
611
|
+
deleted: {
|
|
612
|
+
color: "#ef4444"
|
|
398
613
|
},
|
|
399
|
-
|
|
400
|
-
|
|
614
|
+
important: {
|
|
615
|
+
color: "#f472b6"
|
|
401
616
|
},
|
|
402
|
-
|
|
403
|
-
|
|
617
|
+
selector: {
|
|
618
|
+
color: "#10b981"
|
|
404
619
|
},
|
|
405
|
-
|
|
406
|
-
|
|
620
|
+
string: {
|
|
621
|
+
color: "#10b981"
|
|
407
622
|
},
|
|
408
|
-
|
|
409
|
-
|
|
623
|
+
char: {
|
|
624
|
+
color: "#10b981"
|
|
410
625
|
},
|
|
411
|
-
|
|
412
|
-
|
|
626
|
+
builtin: {
|
|
627
|
+
color: "#10b981"
|
|
413
628
|
},
|
|
414
|
-
|
|
415
|
-
|
|
629
|
+
inserted: {
|
|
630
|
+
color: "#10b981"
|
|
416
631
|
},
|
|
417
|
-
|
|
418
|
-
|
|
632
|
+
regex: {
|
|
633
|
+
color: "#10b981"
|
|
419
634
|
},
|
|
420
635
|
"attr-value": {
|
|
421
|
-
|
|
636
|
+
color: "#10b981"
|
|
422
637
|
},
|
|
423
638
|
"attr-value > .token.punctuation": {
|
|
424
|
-
|
|
639
|
+
color: "#10b981"
|
|
425
640
|
},
|
|
426
|
-
|
|
427
|
-
|
|
641
|
+
variable: {
|
|
642
|
+
color: "#60a5fa"
|
|
428
643
|
},
|
|
429
|
-
|
|
430
|
-
|
|
644
|
+
operator: {
|
|
645
|
+
color: "#60a5fa"
|
|
431
646
|
},
|
|
432
|
-
|
|
433
|
-
|
|
647
|
+
function: {
|
|
648
|
+
color: "#60a5fa"
|
|
434
649
|
},
|
|
435
|
-
|
|
436
|
-
|
|
650
|
+
url: {
|
|
651
|
+
color: "#60a5fa"
|
|
437
652
|
},
|
|
438
653
|
"attr-value > .token.punctuation.attr-equals": {
|
|
439
|
-
|
|
654
|
+
color: "#e2e8f0"
|
|
440
655
|
},
|
|
441
656
|
"special-attr > .token.attr-value > .token.value.css": {
|
|
442
|
-
|
|
657
|
+
color: "#e2e8f0"
|
|
443
658
|
},
|
|
444
659
|
".language-css .token.selector": {
|
|
445
|
-
|
|
660
|
+
color: "#3b82f6"
|
|
446
661
|
},
|
|
447
662
|
".language-css .token.property": {
|
|
448
|
-
|
|
663
|
+
color: "#e2e8f0"
|
|
449
664
|
},
|
|
450
665
|
".language-css .token.function": {
|
|
451
|
-
|
|
666
|
+
color: "#60a5fa"
|
|
452
667
|
},
|
|
453
668
|
".language-css .token.url > .token.function": {
|
|
454
|
-
|
|
669
|
+
color: "#60a5fa"
|
|
455
670
|
},
|
|
456
671
|
".language-css .token.url > .token.string.url": {
|
|
457
|
-
|
|
672
|
+
color: "#10b981"
|
|
458
673
|
},
|
|
459
674
|
".language-css .token.important": {
|
|
460
|
-
|
|
675
|
+
color: "#f472b6"
|
|
461
676
|
},
|
|
462
677
|
".language-css .token.atrule .token.rule": {
|
|
463
|
-
|
|
678
|
+
color: "#f472b6"
|
|
464
679
|
},
|
|
465
680
|
".language-javascript .token.operator": {
|
|
466
|
-
|
|
681
|
+
color: "#f472b6"
|
|
467
682
|
},
|
|
468
683
|
".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation": {
|
|
469
|
-
|
|
684
|
+
color: "#ef4444"
|
|
470
685
|
},
|
|
471
686
|
".language-json .token.operator": {
|
|
472
|
-
|
|
687
|
+
color: "#e2e8f0"
|
|
473
688
|
},
|
|
474
689
|
".language-json .token.null.keyword": {
|
|
475
|
-
|
|
690
|
+
color: "#3b82f6"
|
|
476
691
|
},
|
|
477
692
|
".language-markdown .token.url": {
|
|
478
|
-
|
|
693
|
+
color: "#e2e8f0"
|
|
479
694
|
},
|
|
480
695
|
".language-markdown .token.url > .token.operator": {
|
|
481
|
-
|
|
696
|
+
color: "#e2e8f0"
|
|
482
697
|
},
|
|
483
698
|
".language-markdown .token.url-reference.url > .token.string": {
|
|
484
|
-
|
|
699
|
+
color: "#e2e8f0"
|
|
485
700
|
},
|
|
486
701
|
".language-markdown .token.url > .token.content": {
|
|
487
|
-
|
|
702
|
+
color: "#60a5fa"
|
|
488
703
|
},
|
|
489
704
|
".language-markdown .token.url > .token.url": {
|
|
490
|
-
|
|
705
|
+
color: "#60a5fa"
|
|
491
706
|
},
|
|
492
707
|
".language-markdown .token.url-reference.url": {
|
|
493
|
-
|
|
708
|
+
color: "#60a5fa"
|
|
494
709
|
},
|
|
495
710
|
".language-markdown .token.blockquote.punctuation": {
|
|
496
|
-
|
|
497
|
-
|
|
711
|
+
color: "#64748b",
|
|
712
|
+
fontStyle: "italic"
|
|
498
713
|
},
|
|
499
714
|
".language-markdown .token.hr.punctuation": {
|
|
500
|
-
|
|
501
|
-
|
|
715
|
+
color: "#64748b",
|
|
716
|
+
fontStyle: "italic"
|
|
502
717
|
},
|
|
503
718
|
".language-markdown .token.code-snippet": {
|
|
504
|
-
|
|
719
|
+
color: "#10b981"
|
|
505
720
|
},
|
|
506
721
|
".language-markdown .token.bold .token.content": {
|
|
507
|
-
|
|
722
|
+
color: "#f59e0b"
|
|
508
723
|
},
|
|
509
724
|
".language-markdown .token.italic .token.content": {
|
|
510
|
-
|
|
725
|
+
color: "#f472b6"
|
|
511
726
|
},
|
|
512
727
|
".language-markdown .token.strike .token.content": {
|
|
513
|
-
|
|
728
|
+
color: "#3b82f6"
|
|
514
729
|
},
|
|
515
730
|
".language-markdown .token.strike .token.punctuation": {
|
|
516
|
-
|
|
731
|
+
color: "#3b82f6"
|
|
517
732
|
},
|
|
518
733
|
".language-markdown .token.list.punctuation": {
|
|
519
|
-
|
|
734
|
+
color: "#3b82f6"
|
|
520
735
|
},
|
|
521
736
|
".language-markdown .token.title.important > .token.punctuation": {
|
|
522
|
-
|
|
737
|
+
color: "#3b82f6"
|
|
523
738
|
},
|
|
524
|
-
|
|
525
|
-
|
|
739
|
+
bold: {
|
|
740
|
+
fontWeight: "bold"
|
|
526
741
|
},
|
|
527
|
-
|
|
528
|
-
|
|
742
|
+
italic: {
|
|
743
|
+
fontStyle: "italic"
|
|
529
744
|
},
|
|
530
|
-
|
|
531
|
-
|
|
745
|
+
namespace: {
|
|
746
|
+
Opacity: "0.8"
|
|
532
747
|
},
|
|
533
748
|
"token.tab:not(:empty):before": {
|
|
534
|
-
|
|
535
|
-
|
|
749
|
+
color: "#64748b",
|
|
750
|
+
textShadow: "none"
|
|
536
751
|
},
|
|
537
752
|
"token.cr:before": {
|
|
538
|
-
|
|
539
|
-
|
|
753
|
+
color: "#64748b",
|
|
754
|
+
textShadow: "none"
|
|
540
755
|
},
|
|
541
756
|
"token.lf:before": {
|
|
542
|
-
|
|
543
|
-
|
|
757
|
+
color: "#64748b",
|
|
758
|
+
textShadow: "none"
|
|
544
759
|
},
|
|
545
760
|
"token.space:before": {
|
|
546
|
-
|
|
547
|
-
|
|
761
|
+
color: "#64748b",
|
|
762
|
+
textShadow: "none"
|
|
548
763
|
},
|
|
549
764
|
"div.code-toolbar > .toolbar.toolbar > .toolbar-item": {
|
|
550
|
-
|
|
765
|
+
marginRight: "0.4em"
|
|
551
766
|
},
|
|
552
767
|
"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button": {
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
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
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
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
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
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
|
-
|
|
572
|
-
|
|
786
|
+
background: "#3b82f6",
|
|
787
|
+
color: "#ffffff"
|
|
573
788
|
},
|
|
574
789
|
"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus": {
|
|
575
|
-
|
|
576
|
-
|
|
790
|
+
background: "#3b82f6",
|
|
791
|
+
color: "#ffffff"
|
|
577
792
|
},
|
|
578
793
|
"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover": {
|
|
579
|
-
|
|
580
|
-
|
|
794
|
+
background: "#3b82f6",
|
|
795
|
+
color: "#ffffff"
|
|
581
796
|
},
|
|
582
797
|
"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus": {
|
|
583
|
-
|
|
584
|
-
|
|
798
|
+
background: "#3b82f6",
|
|
799
|
+
color: "#ffffff"
|
|
585
800
|
},
|
|
586
801
|
"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover": {
|
|
587
|
-
|
|
588
|
-
|
|
802
|
+
background: "#3b82f6",
|
|
803
|
+
color: "#ffffff"
|
|
589
804
|
},
|
|
590
805
|
"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus": {
|
|
591
|
-
|
|
592
|
-
|
|
806
|
+
background: "#3b82f6",
|
|
807
|
+
color: "#ffffff"
|
|
593
808
|
},
|
|
594
809
|
".line-highlight.line-highlight": {
|
|
595
|
-
|
|
810
|
+
background: "rgba(59, 130, 246, 0.08)"
|
|
596
811
|
},
|
|
597
812
|
".line-highlight.line-highlight:before": {
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
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
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
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
|
-
|
|
827
|
+
backgroundColor: "rgba(59, 130, 246, 0.08)"
|
|
613
828
|
},
|
|
614
829
|
".line-numbers.line-numbers .line-numbers-rows": {
|
|
615
|
-
|
|
830
|
+
borderRightColor: "#1e293b"
|
|
616
831
|
},
|
|
617
832
|
".command-line .command-line-prompt": {
|
|
618
|
-
|
|
833
|
+
borderRightColor: "#1e293b"
|
|
619
834
|
},
|
|
620
835
|
".line-numbers .line-numbers-rows > span:before": {
|
|
621
|
-
|
|
836
|
+
color: "#64748b"
|
|
622
837
|
},
|
|
623
838
|
".command-line .command-line-prompt > span:before": {
|
|
624
|
-
|
|
839
|
+
color: "#64748b"
|
|
625
840
|
},
|
|
626
841
|
".rainbow-braces .token.token.punctuation.brace-level-1": {
|
|
627
|
-
|
|
842
|
+
color: "#3b82f6"
|
|
628
843
|
},
|
|
629
844
|
".rainbow-braces .token.token.punctuation.brace-level-5": {
|
|
630
|
-
|
|
845
|
+
color: "#3b82f6"
|
|
631
846
|
},
|
|
632
847
|
".rainbow-braces .token.token.punctuation.brace-level-9": {
|
|
633
|
-
|
|
848
|
+
color: "#3b82f6"
|
|
634
849
|
},
|
|
635
850
|
".rainbow-braces .token.token.punctuation.brace-level-2": {
|
|
636
|
-
|
|
851
|
+
color: "#10b981"
|
|
637
852
|
},
|
|
638
853
|
".rainbow-braces .token.token.punctuation.brace-level-6": {
|
|
639
|
-
|
|
854
|
+
color: "#10b981"
|
|
640
855
|
},
|
|
641
856
|
".rainbow-braces .token.token.punctuation.brace-level-10": {
|
|
642
|
-
|
|
857
|
+
color: "#10b981"
|
|
643
858
|
},
|
|
644
859
|
".rainbow-braces .token.token.punctuation.brace-level-3": {
|
|
645
|
-
|
|
860
|
+
color: "#60a5fa"
|
|
646
861
|
},
|
|
647
862
|
".rainbow-braces .token.token.punctuation.brace-level-7": {
|
|
648
|
-
|
|
863
|
+
color: "#60a5fa"
|
|
649
864
|
},
|
|
650
865
|
".rainbow-braces .token.token.punctuation.brace-level-11": {
|
|
651
|
-
|
|
866
|
+
color: "#60a5fa"
|
|
652
867
|
},
|
|
653
868
|
".rainbow-braces .token.token.punctuation.brace-level-4": {
|
|
654
|
-
|
|
869
|
+
color: "#f472b6"
|
|
655
870
|
},
|
|
656
871
|
".rainbow-braces .token.token.punctuation.brace-level-8": {
|
|
657
|
-
|
|
872
|
+
color: "#f472b6"
|
|
658
873
|
},
|
|
659
874
|
".rainbow-braces .token.token.punctuation.brace-level-12": {
|
|
660
|
-
|
|
875
|
+
color: "#f472b6"
|
|
661
876
|
},
|
|
662
877
|
"pre.diff-highlight > code .token.token.deleted:not(.prefix)": {
|
|
663
|
-
|
|
878
|
+
backgroundColor: "rgba(239, 68, 68, 0.15)"
|
|
664
879
|
},
|
|
665
880
|
"pre > code.diff-highlight .token.token.deleted:not(.prefix)": {
|
|
666
|
-
|
|
881
|
+
backgroundColor: "rgba(239, 68, 68, 0.15)"
|
|
667
882
|
},
|
|
668
883
|
"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection": {
|
|
669
|
-
|
|
884
|
+
backgroundColor: "rgba(239, 68, 68, 0.25)"
|
|
670
885
|
},
|
|
671
886
|
"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection": {
|
|
672
|
-
|
|
887
|
+
backgroundColor: "rgba(239, 68, 68, 0.25)"
|
|
673
888
|
},
|
|
674
889
|
"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection": {
|
|
675
|
-
|
|
890
|
+
backgroundColor: "rgba(239, 68, 68, 0.25)"
|
|
676
891
|
},
|
|
677
892
|
"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection": {
|
|
678
|
-
|
|
893
|
+
backgroundColor: "rgba(239, 68, 68, 0.25)"
|
|
679
894
|
},
|
|
680
895
|
"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection": {
|
|
681
|
-
|
|
896
|
+
backgroundColor: "rgba(239, 68, 68, 0.25)"
|
|
682
897
|
},
|
|
683
898
|
"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection": {
|
|
684
|
-
|
|
899
|
+
backgroundColor: "rgba(239, 68, 68, 0.25)"
|
|
685
900
|
},
|
|
686
901
|
"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection": {
|
|
687
|
-
|
|
902
|
+
backgroundColor: "rgba(239, 68, 68, 0.25)"
|
|
688
903
|
},
|
|
689
904
|
"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection": {
|
|
690
|
-
|
|
905
|
+
backgroundColor: "rgba(239, 68, 68, 0.25)"
|
|
691
906
|
},
|
|
692
907
|
"pre.diff-highlight > code .token.token.inserted:not(.prefix)": {
|
|
693
|
-
|
|
908
|
+
backgroundColor: "rgba(16, 185, 129, 0.15)"
|
|
694
909
|
},
|
|
695
910
|
"pre > code.diff-highlight .token.token.inserted:not(.prefix)": {
|
|
696
|
-
|
|
911
|
+
backgroundColor: "rgba(16, 185, 129, 0.15)"
|
|
697
912
|
},
|
|
698
913
|
"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection": {
|
|
699
|
-
|
|
914
|
+
backgroundColor: "rgba(16, 185, 129, 0.25)"
|
|
700
915
|
},
|
|
701
916
|
"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection": {
|
|
702
|
-
|
|
917
|
+
backgroundColor: "rgba(16, 185, 129, 0.25)"
|
|
703
918
|
},
|
|
704
919
|
"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection": {
|
|
705
|
-
|
|
920
|
+
backgroundColor: "rgba(16, 185, 129, 0.25)"
|
|
706
921
|
},
|
|
707
922
|
"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection": {
|
|
708
|
-
|
|
923
|
+
backgroundColor: "rgba(16, 185, 129, 0.25)"
|
|
709
924
|
},
|
|
710
925
|
"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection": {
|
|
711
|
-
|
|
926
|
+
backgroundColor: "rgba(16, 185, 129, 0.25)"
|
|
712
927
|
},
|
|
713
928
|
"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection": {
|
|
714
|
-
|
|
929
|
+
backgroundColor: "rgba(16, 185, 129, 0.25)"
|
|
715
930
|
},
|
|
716
931
|
"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection": {
|
|
717
|
-
|
|
932
|
+
backgroundColor: "rgba(16, 185, 129, 0.25)"
|
|
718
933
|
},
|
|
719
934
|
"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection": {
|
|
720
|
-
|
|
935
|
+
backgroundColor: "rgba(16, 185, 129, 0.25)"
|
|
721
936
|
},
|
|
722
937
|
".prism-previewer.prism-previewer:before": {
|
|
723
|
-
|
|
938
|
+
borderColor: "#11111f"
|
|
724
939
|
},
|
|
725
940
|
".prism-previewer-gradient.prism-previewer-gradient div": {
|
|
726
|
-
|
|
727
|
-
|
|
941
|
+
borderColor: "#11111f",
|
|
942
|
+
borderRadius: "0.3em"
|
|
728
943
|
},
|
|
729
944
|
".prism-previewer-color.prism-previewer-color:before": {
|
|
730
|
-
|
|
945
|
+
borderRadius: "0.3em"
|
|
731
946
|
},
|
|
732
947
|
".prism-previewer-easing.prism-previewer-easing:before": {
|
|
733
|
-
|
|
948
|
+
borderRadius: "0.3em"
|
|
734
949
|
},
|
|
735
950
|
".prism-previewer.prism-previewer:after": {
|
|
736
|
-
|
|
951
|
+
borderTopColor: "#11111f"
|
|
737
952
|
},
|
|
738
953
|
".prism-previewer-flipped.prism-previewer-flipped.after": {
|
|
739
|
-
|
|
954
|
+
borderBottomColor: "#11111f"
|
|
740
955
|
},
|
|
741
956
|
".prism-previewer-angle.prism-previewer-angle:before": {
|
|
742
|
-
|
|
957
|
+
background: "#1e293b"
|
|
743
958
|
},
|
|
744
959
|
".prism-previewer-time.prism-previewer-time:before": {
|
|
745
|
-
|
|
960
|
+
background: "#1e293b"
|
|
746
961
|
},
|
|
747
962
|
".prism-previewer-easing.prism-previewer-easing": {
|
|
748
|
-
|
|
963
|
+
background: "#1e293b"
|
|
749
964
|
},
|
|
750
965
|
".prism-previewer-angle.prism-previewer-angle circle": {
|
|
751
|
-
|
|
752
|
-
|
|
966
|
+
stroke: "#e2e8f0",
|
|
967
|
+
strokeOpacity: "1"
|
|
753
968
|
},
|
|
754
969
|
".prism-previewer-time.prism-previewer-time circle": {
|
|
755
|
-
|
|
756
|
-
|
|
970
|
+
stroke: "#e2e8f0",
|
|
971
|
+
strokeOpacity: "1"
|
|
757
972
|
},
|
|
758
973
|
".prism-previewer-easing.prism-previewer-easing circle": {
|
|
759
|
-
|
|
760
|
-
|
|
974
|
+
stroke: "#e2e8f0",
|
|
975
|
+
fill: "transparent"
|
|
761
976
|
},
|
|
762
977
|
".prism-previewer-easing.prism-previewer-easing path": {
|
|
763
|
-
|
|
978
|
+
stroke: "#e2e8f0"
|
|
764
979
|
},
|
|
765
980
|
".prism-previewer-easing.prism-previewer-easing line": {
|
|
766
|
-
|
|
981
|
+
stroke: "#e2e8f0"
|
|
767
982
|
}
|
|
768
983
|
};
|
|
769
984
|
const light = {
|
|
770
985
|
'code[class*="language-"]': {
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
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
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
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
|
-
|
|
815
|
-
|
|
816
|
-
|
|
1029
|
+
background: "#e2e8f0",
|
|
1030
|
+
color: "inherit",
|
|
1031
|
+
textShadow: "none"
|
|
817
1032
|
},
|
|
818
1033
|
'code[class*="language-"] *::-moz-selection': {
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
1034
|
+
background: "#e2e8f0",
|
|
1035
|
+
color: "inherit",
|
|
1036
|
+
textShadow: "none"
|
|
822
1037
|
},
|
|
823
1038
|
'pre[class*="language-"] *::-moz-selection': {
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
1039
|
+
background: "#e2e8f0",
|
|
1040
|
+
color: "inherit",
|
|
1041
|
+
textShadow: "none"
|
|
827
1042
|
},
|
|
828
1043
|
'code[class*="language-"]::selection': {
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
1044
|
+
background: "#e2e8f0",
|
|
1045
|
+
color: "inherit",
|
|
1046
|
+
textShadow: "none"
|
|
832
1047
|
},
|
|
833
1048
|
'code[class*="language-"] *::selection': {
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
1049
|
+
background: "#e2e8f0",
|
|
1050
|
+
color: "inherit",
|
|
1051
|
+
textShadow: "none"
|
|
837
1052
|
},
|
|
838
1053
|
'pre[class*="language-"] *::selection': {
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
1054
|
+
background: "#e2e8f0",
|
|
1055
|
+
color: "inherit",
|
|
1056
|
+
textShadow: "none"
|
|
842
1057
|
},
|
|
843
1058
|
':not(pre) > code[class*="language-"]': {
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
1059
|
+
padding: "0.2em 0.3em",
|
|
1060
|
+
borderRadius: "0.3em",
|
|
1061
|
+
whiteSpace: "normal",
|
|
1062
|
+
background: "#f1f5f9"
|
|
848
1063
|
},
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
1064
|
+
comment: {
|
|
1065
|
+
color: "#64748b",
|
|
1066
|
+
fontStyle: "italic"
|
|
852
1067
|
},
|
|
853
|
-
|
|
854
|
-
|
|
1068
|
+
prolog: {
|
|
1069
|
+
color: "#64748b"
|
|
855
1070
|
},
|
|
856
|
-
|
|
857
|
-
|
|
1071
|
+
cdata: {
|
|
1072
|
+
color: "#64748b"
|
|
858
1073
|
},
|
|
859
|
-
|
|
860
|
-
|
|
1074
|
+
doctype: {
|
|
1075
|
+
color: "#1e293b"
|
|
861
1076
|
},
|
|
862
|
-
|
|
863
|
-
|
|
1077
|
+
punctuation: {
|
|
1078
|
+
color: "#64748b"
|
|
864
1079
|
},
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
1080
|
+
entity: {
|
|
1081
|
+
color: "#3b82f6",
|
|
1082
|
+
cursor: "help"
|
|
868
1083
|
},
|
|
869
1084
|
"attr-name": {
|
|
870
|
-
|
|
1085
|
+
color: "#ea580c"
|
|
871
1086
|
},
|
|
872
1087
|
"class-name": {
|
|
873
|
-
|
|
1088
|
+
color: "#ea580c"
|
|
874
1089
|
},
|
|
875
|
-
|
|
876
|
-
|
|
1090
|
+
boolean: {
|
|
1091
|
+
color: "#3b82f6"
|
|
877
1092
|
},
|
|
878
|
-
|
|
879
|
-
|
|
1093
|
+
constant: {
|
|
1094
|
+
color: "#3b82f6"
|
|
880
1095
|
},
|
|
881
|
-
|
|
882
|
-
|
|
1096
|
+
number: {
|
|
1097
|
+
color: "#3b82f6"
|
|
883
1098
|
},
|
|
884
|
-
|
|
885
|
-
|
|
1099
|
+
atrule: {
|
|
1100
|
+
color: "#ea580c"
|
|
886
1101
|
},
|
|
887
|
-
|
|
888
|
-
|
|
1102
|
+
keyword: {
|
|
1103
|
+
color: "#9333ea"
|
|
889
1104
|
},
|
|
890
|
-
|
|
891
|
-
|
|
1105
|
+
property: {
|
|
1106
|
+
color: "#3b82f6"
|
|
892
1107
|
},
|
|
893
|
-
|
|
894
|
-
|
|
1108
|
+
tag: {
|
|
1109
|
+
color: "#3b82f6"
|
|
895
1110
|
},
|
|
896
|
-
|
|
897
|
-
|
|
1111
|
+
symbol: {
|
|
1112
|
+
color: "#3b82f6"
|
|
898
1113
|
},
|
|
899
|
-
|
|
900
|
-
|
|
1114
|
+
deleted: {
|
|
1115
|
+
color: "#dc2626"
|
|
901
1116
|
},
|
|
902
|
-
|
|
903
|
-
|
|
1117
|
+
important: {
|
|
1118
|
+
color: "#9333ea"
|
|
904
1119
|
},
|
|
905
|
-
|
|
906
|
-
|
|
1120
|
+
selector: {
|
|
1121
|
+
color: "#16a34a"
|
|
907
1122
|
},
|
|
908
|
-
|
|
909
|
-
|
|
1123
|
+
string: {
|
|
1124
|
+
color: "#16a34a"
|
|
910
1125
|
},
|
|
911
|
-
|
|
912
|
-
|
|
1126
|
+
char: {
|
|
1127
|
+
color: "#16a34a"
|
|
913
1128
|
},
|
|
914
|
-
|
|
915
|
-
|
|
1129
|
+
builtin: {
|
|
1130
|
+
color: "#16a34a"
|
|
916
1131
|
},
|
|
917
|
-
|
|
918
|
-
|
|
1132
|
+
inserted: {
|
|
1133
|
+
color: "#16a34a"
|
|
919
1134
|
},
|
|
920
|
-
|
|
921
|
-
|
|
1135
|
+
regex: {
|
|
1136
|
+
color: "#16a34a"
|
|
922
1137
|
},
|
|
923
1138
|
"attr-value": {
|
|
924
|
-
|
|
1139
|
+
color: "#16a34a"
|
|
925
1140
|
},
|
|
926
1141
|
"attr-value > .token.punctuation": {
|
|
927
|
-
|
|
1142
|
+
color: "#16a34a"
|
|
928
1143
|
},
|
|
929
|
-
|
|
930
|
-
|
|
1144
|
+
variable: {
|
|
1145
|
+
color: "#3b82f6"
|
|
931
1146
|
},
|
|
932
|
-
|
|
933
|
-
|
|
1147
|
+
operator: {
|
|
1148
|
+
color: "#3b82f6"
|
|
934
1149
|
},
|
|
935
|
-
|
|
936
|
-
|
|
1150
|
+
function: {
|
|
1151
|
+
color: "#3b82f6"
|
|
937
1152
|
},
|
|
938
|
-
|
|
939
|
-
|
|
1153
|
+
url: {
|
|
1154
|
+
color: "#3b82f6"
|
|
940
1155
|
},
|
|
941
1156
|
"attr-value > .token.punctuation.attr-equals": {
|
|
942
|
-
|
|
1157
|
+
color: "#64748b"
|
|
943
1158
|
},
|
|
944
1159
|
"special-attr > .token.attr-value > .token.value.css": {
|
|
945
|
-
|
|
1160
|
+
color: "#1e293b"
|
|
946
1161
|
},
|
|
947
1162
|
".language-css .token.selector": {
|
|
948
|
-
|
|
1163
|
+
color: "#3b82f6"
|
|
949
1164
|
},
|
|
950
1165
|
".language-css .token.property": {
|
|
951
|
-
|
|
1166
|
+
color: "#1e293b"
|
|
952
1167
|
},
|
|
953
1168
|
".language-css .token.function": {
|
|
954
|
-
|
|
1169
|
+
color: "#3b82f6"
|
|
955
1170
|
},
|
|
956
1171
|
".language-css .token.url > .token.function": {
|
|
957
|
-
|
|
1172
|
+
color: "#3b82f6"
|
|
958
1173
|
},
|
|
959
1174
|
".language-css .token.url > .token.string.url": {
|
|
960
|
-
|
|
1175
|
+
color: "#16a34a"
|
|
961
1176
|
},
|
|
962
1177
|
".language-css .token.important": {
|
|
963
|
-
|
|
1178
|
+
color: "#9333ea"
|
|
964
1179
|
},
|
|
965
1180
|
".language-css .token.atrule .token.rule": {
|
|
966
|
-
|
|
1181
|
+
color: "#9333ea"
|
|
967
1182
|
},
|
|
968
1183
|
".language-javascript .token.operator": {
|
|
969
|
-
|
|
1184
|
+
color: "#9333ea"
|
|
970
1185
|
},
|
|
971
1186
|
".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation": {
|
|
972
|
-
|
|
1187
|
+
color: "#dc2626"
|
|
973
1188
|
},
|
|
974
1189
|
".language-json .token.operator": {
|
|
975
|
-
|
|
1190
|
+
color: "#1e293b"
|
|
976
1191
|
},
|
|
977
1192
|
".language-json .token.null.keyword": {
|
|
978
|
-
|
|
1193
|
+
color: "#3b82f6"
|
|
979
1194
|
},
|
|
980
1195
|
".language-markdown .token.url": {
|
|
981
|
-
|
|
1196
|
+
color: "#1e293b"
|
|
982
1197
|
},
|
|
983
1198
|
".language-markdown .token.url > .token.operator": {
|
|
984
|
-
|
|
1199
|
+
color: "#1e293b"
|
|
985
1200
|
},
|
|
986
1201
|
".language-markdown .token.url-reference.url > .token.string": {
|
|
987
|
-
|
|
1202
|
+
color: "#1e293b"
|
|
988
1203
|
},
|
|
989
1204
|
".language-markdown .token.url > .token.content": {
|
|
990
|
-
|
|
1205
|
+
color: "#3b82f6"
|
|
991
1206
|
},
|
|
992
1207
|
".language-markdown .token.url > .token.url": {
|
|
993
|
-
|
|
1208
|
+
color: "#3b82f6"
|
|
994
1209
|
},
|
|
995
1210
|
".language-markdown .token.url-reference.url": {
|
|
996
|
-
|
|
1211
|
+
color: "#3b82f6"
|
|
997
1212
|
},
|
|
998
1213
|
".language-markdown .token.blockquote.punctuation": {
|
|
999
|
-
|
|
1000
|
-
|
|
1214
|
+
color: "#64748b",
|
|
1215
|
+
fontStyle: "italic"
|
|
1001
1216
|
},
|
|
1002
1217
|
".language-markdown .token.hr.punctuation": {
|
|
1003
|
-
|
|
1004
|
-
|
|
1218
|
+
color: "#64748b",
|
|
1219
|
+
fontStyle: "italic"
|
|
1005
1220
|
},
|
|
1006
1221
|
".language-markdown .token.code-snippet": {
|
|
1007
|
-
|
|
1222
|
+
color: "#16a34a"
|
|
1008
1223
|
},
|
|
1009
1224
|
".language-markdown .token.bold .token.content": {
|
|
1010
|
-
|
|
1225
|
+
color: "#ea580c"
|
|
1011
1226
|
},
|
|
1012
1227
|
".language-markdown .token.italic .token.content": {
|
|
1013
|
-
|
|
1228
|
+
color: "#9333ea"
|
|
1014
1229
|
},
|
|
1015
1230
|
".language-markdown .token.strike .token.content": {
|
|
1016
|
-
|
|
1231
|
+
color: "#3b82f6"
|
|
1017
1232
|
},
|
|
1018
1233
|
".language-markdown .token.strike .token.punctuation": {
|
|
1019
|
-
|
|
1234
|
+
color: "#3b82f6"
|
|
1020
1235
|
},
|
|
1021
1236
|
".language-markdown .token.list.punctuation": {
|
|
1022
|
-
|
|
1237
|
+
color: "#3b82f6"
|
|
1023
1238
|
},
|
|
1024
1239
|
".language-markdown .token.title.important > .token.punctuation": {
|
|
1025
|
-
|
|
1240
|
+
color: "#3b82f6"
|
|
1026
1241
|
},
|
|
1027
|
-
|
|
1028
|
-
|
|
1242
|
+
bold: {
|
|
1243
|
+
fontWeight: "bold"
|
|
1029
1244
|
},
|
|
1030
|
-
|
|
1031
|
-
|
|
1245
|
+
italic: {
|
|
1246
|
+
fontStyle: "italic"
|
|
1032
1247
|
},
|
|
1033
|
-
|
|
1034
|
-
|
|
1248
|
+
namespace: {
|
|
1249
|
+
Opacity: "0.8"
|
|
1035
1250
|
},
|
|
1036
1251
|
"token.tab:not(:empty):before": {
|
|
1037
|
-
|
|
1252
|
+
color: "#94a3b8"
|
|
1038
1253
|
},
|
|
1039
1254
|
"token.cr:before": {
|
|
1040
|
-
|
|
1255
|
+
color: "#94a3b8"
|
|
1041
1256
|
},
|
|
1042
1257
|
"token.lf:before": {
|
|
1043
|
-
|
|
1258
|
+
color: "#94a3b8"
|
|
1044
1259
|
},
|
|
1045
1260
|
"token.space:before": {
|
|
1046
|
-
|
|
1261
|
+
color: "#94a3b8"
|
|
1047
1262
|
},
|
|
1048
1263
|
"div.code-toolbar > .toolbar.toolbar > .toolbar-item": {
|
|
1049
|
-
|
|
1264
|
+
marginRight: "0.4em"
|
|
1050
1265
|
},
|
|
1051
1266
|
"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button": {
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
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
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
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
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
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
|
-
|
|
1071
|
-
|
|
1285
|
+
background: "#3b82f6",
|
|
1286
|
+
color: "#ffffff"
|
|
1072
1287
|
},
|
|
1073
1288
|
"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus": {
|
|
1074
|
-
|
|
1075
|
-
|
|
1289
|
+
background: "#3b82f6",
|
|
1290
|
+
color: "#ffffff"
|
|
1076
1291
|
},
|
|
1077
1292
|
"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover": {
|
|
1078
|
-
|
|
1079
|
-
|
|
1293
|
+
background: "#3b82f6",
|
|
1294
|
+
color: "#ffffff"
|
|
1080
1295
|
},
|
|
1081
1296
|
"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus": {
|
|
1082
|
-
|
|
1083
|
-
|
|
1297
|
+
background: "#3b82f6",
|
|
1298
|
+
color: "#ffffff"
|
|
1084
1299
|
},
|
|
1085
1300
|
"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover": {
|
|
1086
|
-
|
|
1087
|
-
|
|
1301
|
+
background: "#3b82f6",
|
|
1302
|
+
color: "#ffffff"
|
|
1088
1303
|
},
|
|
1089
1304
|
"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus": {
|
|
1090
|
-
|
|
1091
|
-
|
|
1305
|
+
background: "#3b82f6",
|
|
1306
|
+
color: "#ffffff"
|
|
1092
1307
|
},
|
|
1093
1308
|
".line-highlight.line-highlight": {
|
|
1094
|
-
|
|
1309
|
+
background: "rgba(59, 130, 246, 0.08)"
|
|
1095
1310
|
},
|
|
1096
1311
|
".line-highlight.line-highlight:before": {
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
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
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
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
|
-
|
|
1326
|
+
backgroundColor: "rgba(59, 130, 246, 0.08)"
|
|
1112
1327
|
},
|
|
1113
1328
|
".line-numbers.line-numbers .line-numbers-rows": {
|
|
1114
|
-
|
|
1329
|
+
borderRightColor: "#e2e8f0"
|
|
1115
1330
|
},
|
|
1116
1331
|
".command-line .command-line-prompt": {
|
|
1117
|
-
|
|
1332
|
+
borderRightColor: "#e2e8f0"
|
|
1118
1333
|
},
|
|
1119
1334
|
".line-numbers .line-numbers-rows > span:before": {
|
|
1120
|
-
|
|
1335
|
+
color: "#94a3b8"
|
|
1121
1336
|
},
|
|
1122
1337
|
".command-line .command-line-prompt > span:before": {
|
|
1123
|
-
|
|
1338
|
+
color: "#94a3b8"
|
|
1124
1339
|
},
|
|
1125
1340
|
".rainbow-braces .token.token.punctuation.brace-level-1": {
|
|
1126
|
-
|
|
1341
|
+
color: "#3b82f6"
|
|
1127
1342
|
},
|
|
1128
1343
|
".rainbow-braces .token.token.punctuation.brace-level-5": {
|
|
1129
|
-
|
|
1344
|
+
color: "#3b82f6"
|
|
1130
1345
|
},
|
|
1131
1346
|
".rainbow-braces .token.token.punctuation.brace-level-9": {
|
|
1132
|
-
|
|
1347
|
+
color: "#3b82f6"
|
|
1133
1348
|
},
|
|
1134
1349
|
".rainbow-braces .token.token.punctuation.brace-level-2": {
|
|
1135
|
-
|
|
1350
|
+
color: "#16a34a"
|
|
1136
1351
|
},
|
|
1137
1352
|
".rainbow-braces .token.token.punctuation.brace-level-6": {
|
|
1138
|
-
|
|
1353
|
+
color: "#16a34a"
|
|
1139
1354
|
},
|
|
1140
1355
|
".rainbow-braces .token.token.punctuation.brace-level-10": {
|
|
1141
|
-
|
|
1356
|
+
color: "#16a34a"
|
|
1142
1357
|
},
|
|
1143
1358
|
".rainbow-braces .token.token.punctuation.brace-level-3": {
|
|
1144
|
-
|
|
1359
|
+
color: "#ea580c"
|
|
1145
1360
|
},
|
|
1146
1361
|
".rainbow-braces .token.token.punctuation.brace-level-7": {
|
|
1147
|
-
|
|
1362
|
+
color: "#ea580c"
|
|
1148
1363
|
},
|
|
1149
1364
|
".rainbow-braces .token.token.punctuation.brace-level-11": {
|
|
1150
|
-
|
|
1365
|
+
color: "#ea580c"
|
|
1151
1366
|
},
|
|
1152
1367
|
".rainbow-braces .token.token.punctuation.brace-level-4": {
|
|
1153
|
-
|
|
1368
|
+
color: "#9333ea"
|
|
1154
1369
|
},
|
|
1155
1370
|
".rainbow-braces .token.token.punctuation.brace-level-8": {
|
|
1156
|
-
|
|
1371
|
+
color: "#9333ea"
|
|
1157
1372
|
},
|
|
1158
1373
|
".rainbow-braces .token.token.punctuation.brace-level-12": {
|
|
1159
|
-
|
|
1374
|
+
color: "#9333ea"
|
|
1160
1375
|
},
|
|
1161
1376
|
"pre.diff-highlight > code .token.token.deleted:not(.prefix)": {
|
|
1162
|
-
|
|
1377
|
+
backgroundColor: "rgba(220, 38, 38, 0.15)"
|
|
1163
1378
|
},
|
|
1164
1379
|
"pre > code.diff-highlight .token.token.deleted:not(.prefix)": {
|
|
1165
|
-
|
|
1380
|
+
backgroundColor: "rgba(220, 38, 38, 0.15)"
|
|
1166
1381
|
},
|
|
1167
1382
|
"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection": {
|
|
1168
|
-
|
|
1383
|
+
backgroundColor: "rgba(220, 38, 38, 0.25)"
|
|
1169
1384
|
},
|
|
1170
1385
|
"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection": {
|
|
1171
|
-
|
|
1386
|
+
backgroundColor: "rgba(220, 38, 38, 0.25)"
|
|
1172
1387
|
},
|
|
1173
1388
|
"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection": {
|
|
1174
|
-
|
|
1389
|
+
backgroundColor: "rgba(220, 38, 38, 0.25)"
|
|
1175
1390
|
},
|
|
1176
1391
|
"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection": {
|
|
1177
|
-
|
|
1392
|
+
backgroundColor: "rgba(220, 38, 38, 0.25)"
|
|
1178
1393
|
},
|
|
1179
1394
|
"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection": {
|
|
1180
|
-
|
|
1395
|
+
backgroundColor: "rgba(220, 38, 38, 0.25)"
|
|
1181
1396
|
},
|
|
1182
1397
|
"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection": {
|
|
1183
|
-
|
|
1398
|
+
backgroundColor: "rgba(220, 38, 38, 0.25)"
|
|
1184
1399
|
},
|
|
1185
1400
|
"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection": {
|
|
1186
|
-
|
|
1401
|
+
backgroundColor: "rgba(220, 38, 38, 0.25)"
|
|
1187
1402
|
},
|
|
1188
1403
|
"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection": {
|
|
1189
|
-
|
|
1404
|
+
backgroundColor: "rgba(220, 38, 38, 0.25)"
|
|
1190
1405
|
},
|
|
1191
1406
|
"pre.diff-highlight > code .token.token.inserted:not(.prefix)": {
|
|
1192
|
-
|
|
1407
|
+
backgroundColor: "rgba(22, 163, 74, 0.15)"
|
|
1193
1408
|
},
|
|
1194
1409
|
"pre > code.diff-highlight .token.token.inserted:not(.prefix)": {
|
|
1195
|
-
|
|
1410
|
+
backgroundColor: "rgba(22, 163, 74, 0.15)"
|
|
1196
1411
|
},
|
|
1197
1412
|
"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection": {
|
|
1198
|
-
|
|
1413
|
+
backgroundColor: "rgba(22, 163, 74, 0.25)"
|
|
1199
1414
|
},
|
|
1200
1415
|
"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection": {
|
|
1201
|
-
|
|
1416
|
+
backgroundColor: "rgba(22, 163, 74, 0.25)"
|
|
1202
1417
|
},
|
|
1203
1418
|
"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection": {
|
|
1204
|
-
|
|
1419
|
+
backgroundColor: "rgba(22, 163, 74, 0.25)"
|
|
1205
1420
|
},
|
|
1206
1421
|
"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection": {
|
|
1207
|
-
|
|
1422
|
+
backgroundColor: "rgba(22, 163, 74, 0.25)"
|
|
1208
1423
|
},
|
|
1209
1424
|
"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection": {
|
|
1210
|
-
|
|
1425
|
+
backgroundColor: "rgba(22, 163, 74, 0.25)"
|
|
1211
1426
|
},
|
|
1212
1427
|
"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection": {
|
|
1213
|
-
|
|
1428
|
+
backgroundColor: "rgba(22, 163, 74, 0.25)"
|
|
1214
1429
|
},
|
|
1215
1430
|
"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection": {
|
|
1216
|
-
|
|
1431
|
+
backgroundColor: "rgba(22, 163, 74, 0.25)"
|
|
1217
1432
|
},
|
|
1218
1433
|
"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection": {
|
|
1219
|
-
|
|
1434
|
+
backgroundColor: "rgba(22, 163, 74, 0.25)"
|
|
1220
1435
|
},
|
|
1221
1436
|
".prism-previewer.prism-previewer:before": {
|
|
1222
|
-
|
|
1437
|
+
borderColor: "#fff"
|
|
1223
1438
|
},
|
|
1224
1439
|
".prism-previewer-gradient.prism-previewer-gradient div": {
|
|
1225
|
-
|
|
1226
|
-
|
|
1440
|
+
borderColor: "#fff",
|
|
1441
|
+
borderRadius: "0.3em"
|
|
1227
1442
|
},
|
|
1228
1443
|
".prism-previewer-color.prism-previewer-color:before": {
|
|
1229
|
-
|
|
1444
|
+
borderRadius: "0.3em"
|
|
1230
1445
|
},
|
|
1231
1446
|
".prism-previewer-easing.prism-previewer-easing:before": {
|
|
1232
|
-
|
|
1447
|
+
borderRadius: "0.3em"
|
|
1233
1448
|
},
|
|
1234
1449
|
".prism-previewer.prism-previewer:after": {
|
|
1235
|
-
|
|
1450
|
+
borderTopColor: "#fff"
|
|
1236
1451
|
},
|
|
1237
1452
|
".prism-previewer-flipped.prism-previewer-flipped.after": {
|
|
1238
|
-
|
|
1453
|
+
borderBottomColor: "#fff"
|
|
1239
1454
|
},
|
|
1240
1455
|
".prism-previewer-angle.prism-previewer-angle:before": {
|
|
1241
|
-
|
|
1456
|
+
background: "#f1f5f9"
|
|
1242
1457
|
},
|
|
1243
1458
|
".prism-previewer-time.prism-previewer-time:before": {
|
|
1244
|
-
|
|
1459
|
+
background: "#f1f5f9"
|
|
1245
1460
|
},
|
|
1246
1461
|
".prism-previewer-easing.prism-previewer-easing": {
|
|
1247
|
-
|
|
1462
|
+
background: "#f1f5f9"
|
|
1248
1463
|
},
|
|
1249
1464
|
".prism-previewer-angle.prism-previewer-angle circle": {
|
|
1250
|
-
|
|
1251
|
-
|
|
1465
|
+
stroke: "#1e293b",
|
|
1466
|
+
strokeOpacity: "1"
|
|
1252
1467
|
},
|
|
1253
1468
|
".prism-previewer-time.prism-previewer-time circle": {
|
|
1254
|
-
|
|
1255
|
-
|
|
1469
|
+
stroke: "#1e293b",
|
|
1470
|
+
strokeOpacity: "1"
|
|
1256
1471
|
},
|
|
1257
1472
|
".prism-previewer-easing.prism-previewer-easing circle": {
|
|
1258
|
-
|
|
1259
|
-
|
|
1473
|
+
stroke: "#1e293b",
|
|
1474
|
+
fill: "transparent"
|
|
1260
1475
|
},
|
|
1261
1476
|
".prism-previewer-easing.prism-previewer-easing path": {
|
|
1262
|
-
|
|
1477
|
+
stroke: "#1e293b"
|
|
1263
1478
|
},
|
|
1264
1479
|
".prism-previewer-easing.prism-previewer-easing line": {
|
|
1265
|
-
|
|
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
|
|
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: "
|
|
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
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
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
|
-
|
|
1376
|
-
|
|
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
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
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(
|
|
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
|
|
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
|
|
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:
|
|
1523
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
1524
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
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:
|
|
1529
|
-
/* @__PURE__ */ jsxRuntime.jsx(reablocks.IconButton, { size: "
|
|
1530
|
-
/* @__PURE__ */ jsxRuntime.jsx(reablocks.IconButton, { size: "
|
|
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:
|
|
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:
|
|
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:
|
|
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(
|
|
1570
|
-
|
|
1571
|
-
|
|
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
|
|
1885
|
+
if (file.type?.startsWith("image/")) {
|
|
1587
1886
|
acc.imageFiles.push(file);
|
|
1588
1887
|
} else {
|
|
1589
1888
|
acc.otherFiles.push(file);
|
|
@@ -1643,30 +1942,60 @@
|
|
|
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 [
|
|
1652
|
-
const
|
|
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
|
+
setTruncated(el.scrollHeight > el.clientHeight);
|
|
1957
|
+
}, []);
|
|
1958
|
+
React.useEffect(() => {
|
|
1959
|
+
const el = ref.current;
|
|
1960
|
+
if (!el || previewLineClamp === false) return;
|
|
1961
|
+
calculateTruncation();
|
|
1962
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
1963
|
+
calculateTruncation();
|
|
1964
|
+
});
|
|
1965
|
+
resizeObserver.observe(el);
|
|
1966
|
+
window.addEventListener("resize", calculateTruncation);
|
|
1967
|
+
return () => {
|
|
1968
|
+
resizeObserver.disconnect();
|
|
1969
|
+
window.removeEventListener("resize", calculateTruncation);
|
|
1970
|
+
};
|
|
1971
|
+
}, [calculateTruncation, previewLineClamp]);
|
|
1653
1972
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1654
1973
|
Comp,
|
|
1655
1974
|
{
|
|
1656
1975
|
className: reablocks.cn(theme.messages.message.question, {
|
|
1657
|
-
[theme.messages.message.overlay]:
|
|
1976
|
+
[theme.messages.message.overlay]: truncated
|
|
1658
1977
|
}),
|
|
1659
1978
|
...props,
|
|
1660
1979
|
children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1661
1980
|
/* @__PURE__ */ jsxRuntime.jsx(MessageFiles, { files }),
|
|
1662
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1663
|
-
|
|
1981
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1982
|
+
"div",
|
|
1983
|
+
{
|
|
1984
|
+
ref,
|
|
1985
|
+
className: reablocks.cn({
|
|
1986
|
+
[`line-clamp-${previewLineClamp}`]: !showAll && typeof previewLineClamp === "number",
|
|
1987
|
+
"line-clamp-none": showAll || previewLineClamp === false
|
|
1988
|
+
}),
|
|
1989
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, theme, children: question })
|
|
1990
|
+
}
|
|
1991
|
+
),
|
|
1992
|
+
truncated && !showAll && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1664
1993
|
reablocks.Button,
|
|
1665
1994
|
{
|
|
1666
1995
|
variant: "link",
|
|
1667
1996
|
size: "small",
|
|
1668
1997
|
className: theme.messages.message.expand,
|
|
1669
|
-
onClick: () =>
|
|
1998
|
+
onClick: () => setShowAll(true),
|
|
1670
1999
|
children: "Show more"
|
|
1671
2000
|
}
|
|
1672
2001
|
)
|
|
@@ -1687,7 +2016,7 @@
|
|
|
1687
2016
|
"data-compact": isCompact,
|
|
1688
2017
|
className: reablocks.cn(theme.messages.message.response),
|
|
1689
2018
|
children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1690
|
-
/* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, children: response }),
|
|
2019
|
+
/* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, theme, children: response }),
|
|
1691
2020
|
isLoading && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1692
2021
|
react.motion.div,
|
|
1693
2022
|
{
|
|
@@ -1704,7 +2033,12 @@
|
|
|
1704
2033
|
}
|
|
1705
2034
|
);
|
|
1706
2035
|
};
|
|
1707
|
-
const MessageSource = ({
|
|
2036
|
+
const MessageSource = ({
|
|
2037
|
+
title,
|
|
2038
|
+
url,
|
|
2039
|
+
image,
|
|
2040
|
+
limit = 50
|
|
2041
|
+
}) => {
|
|
1708
2042
|
const { theme, isCompact } = React.useContext(ChatContext);
|
|
1709
2043
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1710
2044
|
"figure",
|
|
@@ -1718,10 +2052,26 @@
|
|
|
1718
2052
|
}
|
|
1719
2053
|
},
|
|
1720
2054
|
children: [
|
|
1721
|
-
image && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2055
|
+
image && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2056
|
+
"img",
|
|
2057
|
+
{
|
|
2058
|
+
src: image,
|
|
2059
|
+
alt: title,
|
|
2060
|
+
className: reablocks.cn(theme.messages.message.sources.source.image)
|
|
2061
|
+
}
|
|
2062
|
+
),
|
|
1722
2063
|
(title || url) && /* @__PURE__ */ jsxRuntime.jsxs("figcaption", { children: [
|
|
1723
2064
|
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(
|
|
2065
|
+
url && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2066
|
+
"a",
|
|
2067
|
+
{
|
|
2068
|
+
href: url,
|
|
2069
|
+
target: "_blank",
|
|
2070
|
+
rel: "noopener noreferrer",
|
|
2071
|
+
className: reablocks.cn(theme.messages.message.sources.source.url),
|
|
2072
|
+
children: url
|
|
2073
|
+
}
|
|
2074
|
+
)
|
|
1725
2075
|
] })
|
|
1726
2076
|
]
|
|
1727
2077
|
}
|
|
@@ -1738,493 +2088,65 @@
|
|
|
1738
2088
|
}
|
|
1739
2089
|
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
2090
|
};
|
|
1741
|
-
const
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
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
|
|
2091
|
+
const messageVariants = {
|
|
2092
|
+
hidden: {
|
|
2093
|
+
opacity: 0,
|
|
2094
|
+
y: 20
|
|
2095
|
+
},
|
|
2096
|
+
visible: {
|
|
2097
|
+
opacity: 1,
|
|
2098
|
+
y: 0,
|
|
2099
|
+
transition: {
|
|
2100
|
+
duration: 0.3
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
};
|
|
2104
|
+
const SessionMessage = ({
|
|
2105
|
+
className,
|
|
2106
|
+
conversation,
|
|
2107
|
+
isLast,
|
|
2108
|
+
children
|
|
1834
2109
|
}) => {
|
|
1835
2110
|
const { theme, isLoading } = React.useContext(ChatContext);
|
|
1836
2111
|
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 }),
|
|
2112
|
+
/* @__PURE__ */ jsxRuntime.jsx(reablocks.Card, { className: reablocks.cn(theme.messages.message.base, className), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1839
2113
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1840
|
-
|
|
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,
|
|
2114
|
+
MessageQuestion,
|
|
1849
2115
|
{
|
|
1850
2116
|
question: conversation.question,
|
|
1851
|
-
|
|
2117
|
+
files: conversation.files
|
|
1852
2118
|
}
|
|
1853
|
-
)
|
|
1854
|
-
|
|
1855
|
-
|
|
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(" ")
|
|
1995
|
-
}
|
|
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,
|
|
2119
|
+
),
|
|
2120
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2121
|
+
MessageResponse,
|
|
2203
2122
|
{
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
onClick: (e) => {
|
|
2207
|
-
e.stopPropagation();
|
|
2208
|
-
deleteSession(session.id);
|
|
2209
|
-
},
|
|
2210
|
-
className: reablocks.cn(theme.sessions.session.delete),
|
|
2211
|
-
children: deleteIcon
|
|
2123
|
+
response: conversation.response,
|
|
2124
|
+
isLoading: isLast && isLoading
|
|
2212
2125
|
}
|
|
2213
|
-
)
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2126
|
+
),
|
|
2127
|
+
/* @__PURE__ */ jsxRuntime.jsx(MessageSources, { sources: conversation.sources }),
|
|
2128
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2129
|
+
MessageActions,
|
|
2130
|
+
{
|
|
2131
|
+
question: conversation.question,
|
|
2132
|
+
response: conversation.response
|
|
2133
|
+
}
|
|
2134
|
+
)
|
|
2135
|
+
] }) }),
|
|
2136
|
+
!isLast && /* @__PURE__ */ jsxRuntime.jsx(reablocks.Divider, {})
|
|
2137
|
+
] }, conversation.id);
|
|
2217
2138
|
};
|
|
2218
|
-
const
|
|
2139
|
+
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" }));
|
|
2140
|
+
const SessionMessagePanel = ({
|
|
2219
2141
|
children,
|
|
2220
|
-
|
|
2142
|
+
allowBack = true
|
|
2221
2143
|
}) => {
|
|
2222
|
-
const { theme, isCompact,
|
|
2223
|
-
const isVisible = isCompact && !
|
|
2224
|
-
return
|
|
2144
|
+
const { activeSessionId, theme, isCompact, selectSession, viewType } = React.useContext(ChatContext);
|
|
2145
|
+
const isVisible = isCompact && activeSessionId || viewType === "chat" || !isCompact;
|
|
2146
|
+
return isVisible && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2225
2147
|
react.motion.div,
|
|
2226
2148
|
{
|
|
2227
|
-
initial: { translateX: "
|
|
2149
|
+
initial: { translateX: "200%" },
|
|
2228
2150
|
animate: {
|
|
2229
2151
|
translateX: "0%",
|
|
2230
2152
|
transition: {
|
|
@@ -2234,29 +2156,133 @@ ${response}`),
|
|
|
2234
2156
|
when: "beforeChildren"
|
|
2235
2157
|
}
|
|
2236
2158
|
},
|
|
2237
|
-
exit: { translateX: "
|
|
2238
|
-
className: reablocks.cn(theme.
|
|
2239
|
-
[theme.
|
|
2240
|
-
[theme.
|
|
2159
|
+
exit: { translateX: "200%" },
|
|
2160
|
+
className: reablocks.cn(theme.messages.base, {
|
|
2161
|
+
[theme.messages.companion]: isCompact,
|
|
2162
|
+
[theme.messages.console]: !isCompact
|
|
2241
2163
|
}),
|
|
2164
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(theme.messages.inner), children: [
|
|
2165
|
+
allowBack && isCompact && viewType !== "chat" && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2166
|
+
reablocks.Button,
|
|
2167
|
+
{
|
|
2168
|
+
variant: "text",
|
|
2169
|
+
size: "small",
|
|
2170
|
+
onClick: () => selectSession(null),
|
|
2171
|
+
className: reablocks.cn(theme.messages.back),
|
|
2172
|
+
children: [
|
|
2173
|
+
/* @__PURE__ */ jsxRuntime.jsx(SvgBack, {}),
|
|
2174
|
+
"Back"
|
|
2175
|
+
]
|
|
2176
|
+
}
|
|
2177
|
+
),
|
|
2178
|
+
children
|
|
2179
|
+
] })
|
|
2180
|
+
}
|
|
2181
|
+
);
|
|
2182
|
+
};
|
|
2183
|
+
const containerVariants = {
|
|
2184
|
+
hidden: {},
|
|
2185
|
+
visible: {
|
|
2186
|
+
transition: {
|
|
2187
|
+
staggerChildren: 0.07,
|
|
2188
|
+
when: "beforeChildren"
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
};
|
|
2192
|
+
const SessionMessages = ({
|
|
2193
|
+
children,
|
|
2194
|
+
newSessionContent,
|
|
2195
|
+
limit = 10,
|
|
2196
|
+
className,
|
|
2197
|
+
showMoreText = "Show more",
|
|
2198
|
+
autoScroll = true,
|
|
2199
|
+
onScroll
|
|
2200
|
+
}) => {
|
|
2201
|
+
const { activeSession, theme } = React.useContext(ChatContext);
|
|
2202
|
+
const contentRef = React.useRef(null);
|
|
2203
|
+
const [isAnimating, setIsAnimating] = React.useState(true);
|
|
2204
|
+
React.useEffect(() => {
|
|
2205
|
+
if (contentRef.current && autoScroll) {
|
|
2206
|
+
requestAnimationFrame(
|
|
2207
|
+
() => contentRef.current.scrollTop = contentRef.current.scrollHeight
|
|
2208
|
+
);
|
|
2209
|
+
}
|
|
2210
|
+
}, [activeSession, autoScroll, isAnimating]);
|
|
2211
|
+
function handleShowMore() {
|
|
2212
|
+
showNext(limit);
|
|
2213
|
+
requestAnimationFrame(() => contentRef.current.scrollTop = 0);
|
|
2214
|
+
}
|
|
2215
|
+
const reversedConvos = React.useMemo(
|
|
2216
|
+
() => [...activeSession?.conversations ?? []].reverse(),
|
|
2217
|
+
[activeSession]
|
|
2218
|
+
);
|
|
2219
|
+
const { data, hasMore, showNext } = reablocks.useInfinityList({
|
|
2220
|
+
items: reversedConvos,
|
|
2221
|
+
size: limit
|
|
2222
|
+
});
|
|
2223
|
+
const reReversedConvo = React.useMemo(() => [...data].reverse(), [data]);
|
|
2224
|
+
const convosToRender = limit ? reReversedConvo : activeSession?.conversations;
|
|
2225
|
+
if (!activeSession) {
|
|
2226
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SessionEmpty, { children: newSessionContent });
|
|
2227
|
+
}
|
|
2228
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2229
|
+
"div",
|
|
2230
|
+
{
|
|
2231
|
+
className: reablocks.cn(theme.messages.content, className),
|
|
2232
|
+
ref: contentRef,
|
|
2233
|
+
onScrollCapture: onScroll,
|
|
2242
2234
|
children: [
|
|
2243
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2244
|
-
|
|
2245
|
-
SessionListItem,
|
|
2235
|
+
hasMore && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2236
|
+
reablocks.Button,
|
|
2246
2237
|
{
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
chatIcon: template.icon,
|
|
2253
|
-
deletable: false
|
|
2238
|
+
variant: "outline",
|
|
2239
|
+
className: reablocks.cn(theme.messages.showMore),
|
|
2240
|
+
fullWidth: true,
|
|
2241
|
+
onClick: handleShowMore,
|
|
2242
|
+
children: showMoreText
|
|
2254
2243
|
}
|
|
2255
|
-
)
|
|
2244
|
+
),
|
|
2245
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2246
|
+
react.motion.div,
|
|
2247
|
+
{
|
|
2248
|
+
variants: containerVariants,
|
|
2249
|
+
initial: "hidden",
|
|
2250
|
+
animate: "visible",
|
|
2251
|
+
onAnimationComplete: () => {
|
|
2252
|
+
requestAnimationFrame(() => setIsAnimating(false));
|
|
2253
|
+
},
|
|
2254
|
+
children: children ? children(convosToRender) : convosToRender.map((conversation, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2255
|
+
SessionMessage,
|
|
2256
|
+
{
|
|
2257
|
+
conversation,
|
|
2258
|
+
isLast: index === conversation.length - 1
|
|
2259
|
+
},
|
|
2260
|
+
conversation.id
|
|
2261
|
+
))
|
|
2262
|
+
},
|
|
2263
|
+
activeSession?.id
|
|
2264
|
+
) })
|
|
2256
2265
|
]
|
|
2257
2266
|
}
|
|
2258
2267
|
);
|
|
2259
2268
|
};
|
|
2269
|
+
const SessionMessagesHeader = ({ children }) => {
|
|
2270
|
+
const { activeSession, theme } = React.useContext(ChatContext);
|
|
2271
|
+
const Comp = children ? reactSlot.Slot : "header";
|
|
2272
|
+
if (!activeSession) {
|
|
2273
|
+
return null;
|
|
2274
|
+
}
|
|
2275
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { className: reablocks.cn(theme.messages.header), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2276
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: reablocks.cn(theme.messages.title), children: /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { limit: 125, value: activeSession.title }) }),
|
|
2277
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2278
|
+
reablocks.DateFormat,
|
|
2279
|
+
{
|
|
2280
|
+
className: reablocks.cn(theme.messages.date),
|
|
2281
|
+
date: activeSession.createdAt
|
|
2282
|
+
}
|
|
2283
|
+
)
|
|
2284
|
+
] }) });
|
|
2285
|
+
};
|
|
2260
2286
|
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
2287
|
const NewSessionButton = ({
|
|
2262
2288
|
children,
|
|
@@ -2341,6 +2367,46 @@ ${response}`),
|
|
|
2341
2367
|
)
|
|
2342
2368
|
}));
|
|
2343
2369
|
}
|
|
2370
|
+
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" }));
|
|
2371
|
+
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" })));
|
|
2372
|
+
const SessionListItem = ({
|
|
2373
|
+
children,
|
|
2374
|
+
session,
|
|
2375
|
+
deletable = true,
|
|
2376
|
+
limit = 100,
|
|
2377
|
+
deleteIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgTrash, {}),
|
|
2378
|
+
chatIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgChat, { className: "mr-2" })
|
|
2379
|
+
}) => {
|
|
2380
|
+
const { activeSessionId, selectSession, deleteSession, theme } = React.useContext(ChatContext);
|
|
2381
|
+
const Comp = children ? reactSlot.Slot : reablocks.ListItem;
|
|
2382
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2383
|
+
Comp,
|
|
2384
|
+
{
|
|
2385
|
+
dense: true,
|
|
2386
|
+
disableGutters: true,
|
|
2387
|
+
active: session.id === activeSessionId,
|
|
2388
|
+
className: reablocks.cn(theme.sessions.session.base, {
|
|
2389
|
+
[theme.sessions.session.active]: session.id === activeSessionId
|
|
2390
|
+
}),
|
|
2391
|
+
onClick: () => selectSession?.(session.id),
|
|
2392
|
+
start: chatIcon,
|
|
2393
|
+
end: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: deletable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2394
|
+
reablocks.IconButton,
|
|
2395
|
+
{
|
|
2396
|
+
size: "small",
|
|
2397
|
+
variant: "ghost",
|
|
2398
|
+
onClick: (e) => {
|
|
2399
|
+
e.stopPropagation();
|
|
2400
|
+
deleteSession(session.id);
|
|
2401
|
+
},
|
|
2402
|
+
className: reablocks.cn(theme.sessions.session.delete),
|
|
2403
|
+
children: deleteIcon
|
|
2404
|
+
}
|
|
2405
|
+
) }),
|
|
2406
|
+
children: children || /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { value: session.title, limit })
|
|
2407
|
+
}
|
|
2408
|
+
);
|
|
2409
|
+
};
|
|
2344
2410
|
const SessionsGroup = ({
|
|
2345
2411
|
heading,
|
|
2346
2412
|
children
|
|
@@ -2362,46 +2428,50 @@ ${response}`),
|
|
|
2362
2428
|
const SessionGroups = ({ children }) => {
|
|
2363
2429
|
const { sessions } = React.useContext(ChatContext);
|
|
2364
2430
|
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 });
|
|
2431
|
+
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
2432
|
};
|
|
2370
|
-
const
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
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
|
|
2433
|
+
const SessionsList = ({
|
|
2434
|
+
children,
|
|
2435
|
+
templates
|
|
2436
|
+
}) => {
|
|
2437
|
+
const { theme, isCompact, activeSessionId, createSession } = React.useContext(ChatContext);
|
|
2438
|
+
const isVisible = isCompact && !activeSessionId;
|
|
2439
|
+
return (!isCompact || isVisible) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2440
|
+
react.motion.div,
|
|
2441
|
+
{
|
|
2442
|
+
initial: { translateX: "-100%" },
|
|
2443
|
+
animate: {
|
|
2444
|
+
translateX: "0%",
|
|
2445
|
+
transition: {
|
|
2446
|
+
type: "tween",
|
|
2447
|
+
ease: "linear",
|
|
2448
|
+
duration: 0.2,
|
|
2449
|
+
when: "beforeChildren"
|
|
2400
2450
|
}
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2451
|
+
},
|
|
2452
|
+
exit: { translateX: "-100%" },
|
|
2453
|
+
className: reablocks.cn(theme.sessions.base, {
|
|
2454
|
+
[theme.sessions.companion]: isCompact,
|
|
2455
|
+
[theme.sessions.console]: !isCompact
|
|
2456
|
+
}),
|
|
2457
|
+
children: [
|
|
2458
|
+
/* @__PURE__ */ jsxRuntime.jsx(reablocks.List, { children }),
|
|
2459
|
+
templates && !activeSessionId && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: templates.map((template) => /* @__PURE__ */ jsxRuntime.jsx("div", { onClick: () => createSession?.(), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2460
|
+
SessionListItem,
|
|
2461
|
+
{
|
|
2462
|
+
session: {
|
|
2463
|
+
id: template.id,
|
|
2464
|
+
title: template.title,
|
|
2465
|
+
conversations: []
|
|
2466
|
+
},
|
|
2467
|
+
chatIcon: template.icon,
|
|
2468
|
+
deletable: false
|
|
2469
|
+
}
|
|
2470
|
+
) }, template.id)) })
|
|
2471
|
+
]
|
|
2472
|
+
}
|
|
2473
|
+
);
|
|
2474
|
+
};
|
|
2405
2475
|
exports2.AppBar = AppBar;
|
|
2406
2476
|
exports2.Chat = Chat;
|
|
2407
2477
|
exports2.ChatBubble = ChatBubble;
|
|
@@ -2432,8 +2502,9 @@ ${response}`),
|
|
|
2432
2502
|
exports2.TableHeaderCell = TableHeaderCell;
|
|
2433
2503
|
exports2.chatTheme = chatTheme;
|
|
2434
2504
|
exports2.dark = dark;
|
|
2505
|
+
exports2.groupSessionsByDate = groupSessionsByDate;
|
|
2435
2506
|
exports2.light = light;
|
|
2436
2507
|
exports2.remarkCve = remarkCve;
|
|
2437
2508
|
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
2438
|
-
});
|
|
2509
|
+
}));
|
|
2439
2510
|
//# sourceMappingURL=index.umd.cjs.map
|