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