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