@swisper.ai/web-chat-ui 0.2.11 → 0.2.13
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/components/chat-suggestion/chat-suggestion.d.ts +1 -1
- package/dist/components/chat-suggestion/chat-suggestion.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.es.js +885 -885
- package/dist/index.es.js.map +1 -1
- package/package.json +3 -3
- package/src/components/chat-suggestion/chat-suggestion.json +1 -2
- package/src/components/chat-suggestion/chat-suggestion.tsx +9 -7
package/dist/index.es.js
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import { Button as e, Chip as t, Collapsible as n, CollapsibleChevron as r, CollapsibleContent as i, CollapsibleTrigger as a, Divider as o, EmptyState as s, EmptyStateActionRow as c, EmptyStateDescription as l, EmptyStateIcon as u, EmptyStateTitle as d, IconButton as f, List as p, ListItem as m, ListItemAction as h, ListItemTitle as g, ListItemTrigger as _, Menu as v, MenuList as y, MenuProvider as b, MenuTrigger as x,
|
|
2
|
-
import { cn as M, useElementMeasure as
|
|
3
|
-
import
|
|
4
|
-
import { Fragment as
|
|
1
|
+
import { Button as e, Chip as t, Collapsible as n, CollapsibleChevron as r, CollapsibleContent as i, CollapsibleTrigger as a, Divider as o, EmptyState as s, EmptyStateActionRow as c, EmptyStateDescription as l, EmptyStateIcon as u, EmptyStateTitle as d, IconButton as f, List as p, ListItem as m, ListItemAction as h, ListItemTitle as g, ListItemTrigger as _, Menu as v, MenuList as y, MenuProvider as b, MenuTrigger as x, Panel as S, PanelActionButton as C, PanelActionCloseButton as w, PanelBody as ee, PanelContent as T, PanelFooter as E, PanelHeader as te, PanelProvider as ne, PanelTitle as re, Popover as D, PopoverContent as ie, PopoverTrigger as O, ScrollArea as ae, SelectField as k, Skeleton as oe, Tooltip as A, Typography as j, listItemVariants as se, panelBodyPadding as ce, useIsResolution as le } from "@swisper.ai/ui";
|
|
2
|
+
import { cn as M, useElementMeasure as ue } from "@swisper.ai/web-core";
|
|
3
|
+
import de, { Children as fe, cloneElement as pe, createContext as N, forwardRef as P, isValidElement as me, memo as he, useCallback as F, useContext as I, useEffect as L, useImperativeHandle as ge, useLayoutEffect as R, useMemo as z, useRef as B, useState as V } from "react";
|
|
4
|
+
import { Fragment as _e, jsx as H, jsxs as U } from "react/jsx-runtime";
|
|
5
5
|
import { Slot as W } from "@radix-ui/react-slot";
|
|
6
|
-
import { CodeNode as
|
|
7
|
-
import { $isLinkNode as
|
|
8
|
-
import { $createListItemNode as
|
|
9
|
-
import { LexicalComposer as
|
|
10
|
-
import { ContentEditable as
|
|
11
|
-
import { LexicalErrorBoundary as
|
|
12
|
-
import { HistoryPlugin as
|
|
13
|
-
import { RichTextPlugin as
|
|
14
|
-
import { $createHeadingNode as
|
|
15
|
-
import { useLexicalComposerContext as
|
|
16
|
-
import { $convertFromMarkdownString as
|
|
17
|
-
import { $addUpdateTag as
|
|
18
|
-
import { OnChangePlugin as
|
|
19
|
-
import { createPortal as
|
|
20
|
-
import { useVirtualizer as
|
|
21
|
-
import * as
|
|
22
|
-
import { nanoid as
|
|
23
|
-
import { AttachmentsIcon as
|
|
24
|
-
import
|
|
25
|
-
import { Streamdown as
|
|
26
|
-
import
|
|
6
|
+
import { CodeNode as ve } from "@lexical/code";
|
|
7
|
+
import { $isLinkNode as ye, LinkNode as be, TOGGLE_LINK_COMMAND as xe } from "@lexical/link";
|
|
8
|
+
import { $createListItemNode as Se, $createListNode as Ce, ListItemNode as we, ListNode as Te } from "@lexical/list";
|
|
9
|
+
import { LexicalComposer as Ee } from "@lexical/react/LexicalComposer";
|
|
10
|
+
import { ContentEditable as De } from "@lexical/react/LexicalContentEditable";
|
|
11
|
+
import { LexicalErrorBoundary as Oe } from "@lexical/react/LexicalErrorBoundary";
|
|
12
|
+
import { HistoryPlugin as ke } from "@lexical/react/LexicalHistoryPlugin";
|
|
13
|
+
import { RichTextPlugin as Ae } from "@lexical/react/LexicalRichTextPlugin";
|
|
14
|
+
import { $createHeadingNode as je, HeadingNode as Me, QuoteNode as Ne } from "@lexical/rich-text";
|
|
15
|
+
import { useLexicalComposerContext as Pe } from "@lexical/react/LexicalComposerContext";
|
|
16
|
+
import { $convertFromMarkdownString as Fe, $convertToMarkdownString as Ie, TRANSFORMERS as Le, TRANSFORMERS as Re } from "@lexical/markdown";
|
|
17
|
+
import { $addUpdateTag as ze, $createParagraphNode as Be, $createRangeSelection as Ve, $createTextNode as He, $getPreviousSelection as Ue, $getRoot as G, $getSelection as K, $insertNodes as We, $isElementNode as Ge, $isParagraphNode as Ke, $isRangeSelection as q, $isTextNode as J, $selectAll as qe, $setSelection as Je, $setState as Ye, COMMAND_PRIORITY_CRITICAL as Xe, COMMAND_PRIORITY_EDITOR as Ze, COMMAND_PRIORITY_LOW as Qe, DecoratorNode as $e, ElementNode as et, FORMAT_ELEMENT_COMMAND as tt, FORMAT_TEXT_COMMAND as nt, PASTE_COMMAND as rt, SELECTION_CHANGE_COMMAND as it, SKIP_DOM_SELECTION_TAG as at, SKIP_SELECTION_FOCUS_TAG as ot, createCommand as st, createState as ct, isHTMLElement as lt, setNodeIndentFromDOM as ut } from "lexical";
|
|
18
|
+
import { OnChangePlugin as dt } from "@lexical/react/LexicalOnChangePlugin";
|
|
19
|
+
import { createPortal as ft } from "react-dom";
|
|
20
|
+
import { useVirtualizer as pt } from "@tanstack/react-virtual";
|
|
21
|
+
import * as mt from "@radix-ui/react-scroll-area";
|
|
22
|
+
import { nanoid as ht } from "nanoid";
|
|
23
|
+
import { AttachmentsIcon as gt, ChevronDownIcon as _t, ChevronUpIcon as vt, CloseIcon as yt, CodeIcon as bt, DeleteIcon as xt, DocIcon as St, DraftIcon as Ct, FormatAlignCenterIcon as wt, FormatAlignLeftIcon as Tt, FormatAlignRightIcon as Et, FormatBoldIcon as Dt, FormatCleanIcon as Ot, FormatColorIcon as kt, FormatItalicIcon as At, FormatUnderlineIcon as jt, ImageIcon as Mt, LinkOffIcon as Nt, LinkOnIcon as Pt, MoreHorizontalIcon as Ft, OpenInFullIcon as It, PdfIcon as Lt, PptIcon as Rt, SignalReadIcon as zt, SignalUnreadIcon as Bt, SnoozeIcon as Vt, XlsIcon as Ht } from "@swisper.ai/icons";
|
|
24
|
+
import Ut from "mime";
|
|
25
|
+
import { Streamdown as Wt, defaultRehypePlugins as Gt, defaultRemarkPlugins as Kt } from "streamdown";
|
|
26
|
+
import qt, { defaultSchema as Jt } from "rehype-sanitize";
|
|
27
27
|
import "katex/dist/katex.min.css";
|
|
28
|
-
import { MessageScroller as
|
|
29
|
-
import { AnimatePresence as
|
|
30
|
-
import { TablePlugin as
|
|
31
|
-
import { TableCellNode as
|
|
32
|
-
import { $generateHtmlFromNodes as
|
|
33
|
-
import { EditorRefPlugin as
|
|
34
|
-
import { $getNearestBlockElementAncestorOrThrow as
|
|
35
|
-
import { $forEachSelectedTextNode as
|
|
28
|
+
import { MessageScroller as Yt, useMessageScroller as Xt, useMessageScrollerScrollable as Zt } from "@shadcn/react/message-scroller";
|
|
29
|
+
import { AnimatePresence as Qt, motion as $t } from "motion/react";
|
|
30
|
+
import { TablePlugin as en } from "@lexical/react/LexicalTablePlugin";
|
|
31
|
+
import { TableCellNode as tn, TableNode as nn, TableRowNode as rn } from "@lexical/table";
|
|
32
|
+
import { $generateHtmlFromNodes as an, $generateNodesFromDOM as on } from "@lexical/html";
|
|
33
|
+
import { EditorRefPlugin as sn } from "@lexical/react/LexicalEditorRefPlugin";
|
|
34
|
+
import { $getNearestBlockElementAncestorOrThrow as cn, mergeRegister as ln } from "@lexical/utils";
|
|
35
|
+
import { $forEachSelectedTextNode as un, $getSelectionStyleValueForProperty as dn, $isAtNodeEnd as fn, $patchStyleText as pn } from "@lexical/selection";
|
|
36
36
|
import "@lexical/react/LexicalDecoratorBlockNode";
|
|
37
|
-
import
|
|
38
|
-
import { cva as
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import { unified as
|
|
42
|
-
import { visit as
|
|
43
|
-
import { createParser as
|
|
37
|
+
import mn from "inline-style-parser";
|
|
38
|
+
import { cva as hn } from "class-variance-authority";
|
|
39
|
+
import gn from "remark-gfm";
|
|
40
|
+
import _n from "remark-parse";
|
|
41
|
+
import { unified as vn } from "unified";
|
|
42
|
+
import { visit as yn } from "unist-util-visit";
|
|
43
|
+
import { createParser as bn } from "eventsource-parser";
|
|
44
44
|
//#region src/components/chat-card/context.tsx
|
|
45
|
-
var
|
|
45
|
+
var xn = N(null);
|
|
46
46
|
function Y() {
|
|
47
|
-
let e = I(
|
|
47
|
+
let e = I(xn);
|
|
48
48
|
if (!e) throw Error("[web-chat-ui] useChatCardContext() called outside ChatCard. Wrap this component in <ChatCard>, or the provider and the caller resolved two copies of the package.");
|
|
49
49
|
return e;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
return /* @__PURE__ */ H(
|
|
51
|
+
function Sn({ value: e, children: t }) {
|
|
52
|
+
return /* @__PURE__ */ H(xn.Provider, {
|
|
53
53
|
value: e,
|
|
54
54
|
children: t
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
//#endregion
|
|
58
58
|
//#region src/components/chat-card/components/chat-card-header.tsx
|
|
59
|
-
function
|
|
59
|
+
function Cn({ className: e, children: t, hoverAreaClassName: n, ...r }) {
|
|
60
60
|
let { isCollapsible: i, level: o } = Y(), s = /* @__PURE__ */ H("div", {
|
|
61
61
|
"data-slot": "chat-card-header-hover-area",
|
|
62
62
|
className: M("w-full", "flex flex-row items-start", "gap-card-header-gap", o === 1 && "px-card-header-hover-area rounded-card-header", o === 1 && i && "hover:bg-layout-accent-low-background-hover-base", o === 1 && "group-hover/chat-card:bg-layout-accent-low-background-hover-base", !i && "cursor-default", n),
|
|
@@ -75,7 +75,7 @@ function wn({ className: e, children: t, hoverAreaClassName: n, ...r }) {
|
|
|
75
75
|
}) : s
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function wn({ className: e, children: t, ...n }) {
|
|
79
79
|
let { level: r } = Y();
|
|
80
80
|
return /* @__PURE__ */ H("div", {
|
|
81
81
|
"data-slot": "chat-card-icon",
|
|
@@ -86,7 +86,7 @@ function Tn({ className: e, children: t, ...n }) {
|
|
|
86
86
|
children: t
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function Tn({ className: e, children: t, ...n }) {
|
|
90
90
|
let { level: r } = Y();
|
|
91
91
|
return /* @__PURE__ */ H("div", {
|
|
92
92
|
"data-slot": "chat-card-header-content",
|
|
@@ -97,8 +97,8 @@ function En({ className: e, children: t, ...n }) {
|
|
|
97
97
|
children: t
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
|
-
function
|
|
101
|
-
return /* @__PURE__ */ H(
|
|
100
|
+
function En({ className: e, children: t, ...n }) {
|
|
101
|
+
return /* @__PURE__ */ H(j, {
|
|
102
102
|
"data-testid": "chat-card-title",
|
|
103
103
|
variant: "body-medium",
|
|
104
104
|
className: M(e),
|
|
@@ -106,8 +106,8 @@ function Dn({ className: e, children: t, ...n }) {
|
|
|
106
106
|
children: t
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
|
-
function
|
|
110
|
-
return /* @__PURE__ */ H(
|
|
109
|
+
function Dn({ className: e, children: t, ...n }) {
|
|
110
|
+
return /* @__PURE__ */ H(j, {
|
|
111
111
|
"data-testid": "chat-card-sub-title",
|
|
112
112
|
variant: "body-small-high",
|
|
113
113
|
className: M("text-text-secondary", e),
|
|
@@ -115,7 +115,7 @@ function On({ className: e, children: t, ...n }) {
|
|
|
115
115
|
children: t
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function On({ className: e, children: t, ...n }) {
|
|
119
119
|
let { level: r } = Y();
|
|
120
120
|
return /* @__PURE__ */ H("div", {
|
|
121
121
|
role: "group",
|
|
@@ -127,7 +127,7 @@ function kn({ className: e, children: t, ...n }) {
|
|
|
127
127
|
children: t
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function kn({ className: e, children: t, shouldPreventCollapse: n = !0, tooltip: r, onClick: i, ...a }) {
|
|
131
131
|
function o(e) {
|
|
132
132
|
n && e.stopPropagation(), i?.(e);
|
|
133
133
|
}
|
|
@@ -140,14 +140,14 @@ function An({ className: e, children: t, shouldPreventCollapse: n = !0, tooltip:
|
|
|
140
140
|
...a,
|
|
141
141
|
children: t
|
|
142
142
|
});
|
|
143
|
-
return r ? /* @__PURE__ */ H(
|
|
143
|
+
return r ? /* @__PURE__ */ H(A, {
|
|
144
144
|
tooltip: r,
|
|
145
145
|
children: s
|
|
146
146
|
}) : s;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function An({ className: e, ...t }) {
|
|
149
149
|
let { isCollapsible: n } = Y();
|
|
150
|
-
if (n) return /* @__PURE__ */ H(
|
|
150
|
+
if (n) return /* @__PURE__ */ H(kn, {
|
|
151
151
|
"data-slot": "chat-card-collapsible-button",
|
|
152
152
|
shouldPreventCollapse: !1,
|
|
153
153
|
isSemantic: !1,
|
|
@@ -158,7 +158,7 @@ function jn({ className: e, ...t }) {
|
|
|
158
158
|
}
|
|
159
159
|
//#endregion
|
|
160
160
|
//#region src/components/chat-card/components/chat-card-body.tsx
|
|
161
|
-
function
|
|
161
|
+
function jn({ className: e, children: t, ...n }) {
|
|
162
162
|
return /* @__PURE__ */ H("figure", {
|
|
163
163
|
"data-slot": "chat-card-media",
|
|
164
164
|
"data-testid": "chat-card-media",
|
|
@@ -167,7 +167,7 @@ function Mn({ className: e, children: t, ...n }) {
|
|
|
167
167
|
children: t
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
-
function
|
|
170
|
+
function Mn({ className: e, children: t, asChild: n = !1, ...r }) {
|
|
171
171
|
let a = n ? W : "div";
|
|
172
172
|
return /* @__PURE__ */ H(i, {
|
|
173
173
|
"data-slot": "chat-card-body",
|
|
@@ -178,7 +178,7 @@ function Nn({ className: e, children: t, asChild: n = !1, ...r }) {
|
|
|
178
178
|
children: /* @__PURE__ */ H(a, { children: t })
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function Nn({ className: e, children: t, asChild: n = !1, hasPadding: r = !0, hasHeaderPadding: i = !0, ...a }) {
|
|
182
182
|
let { level: o } = Y();
|
|
183
183
|
return /* @__PURE__ */ H(n ? W : "div", {
|
|
184
184
|
"data-slot": "chat-card-content",
|
|
@@ -191,7 +191,7 @@ function Pn({ className: e, children: t, asChild: n = !1, hasPadding: r = !0, ha
|
|
|
191
191
|
children: t
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function Pn({ className: e, children: t, ...n }) {
|
|
195
195
|
let { level: r } = Y();
|
|
196
196
|
return /* @__PURE__ */ H("div", {
|
|
197
197
|
"data-slot": "chat-card-preview",
|
|
@@ -204,7 +204,7 @@ function Fn({ className: e, children: t, ...n }) {
|
|
|
204
204
|
}
|
|
205
205
|
//#endregion
|
|
206
206
|
//#region src/components/chat-card/components/chat-card-footer.tsx
|
|
207
|
-
function
|
|
207
|
+
function Fn({ className: e, children: t, ...n }) {
|
|
208
208
|
let { level: r } = Y();
|
|
209
209
|
return /* @__PURE__ */ H("footer", {
|
|
210
210
|
"data-slot": "chat-card-footer",
|
|
@@ -214,7 +214,7 @@ function In({ className: e, children: t, ...n }) {
|
|
|
214
214
|
children: t
|
|
215
215
|
});
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function In({ className: e, children: t }) {
|
|
218
218
|
return /* @__PURE__ */ H("div", {
|
|
219
219
|
"data-slot": "chat-card-footer-notes",
|
|
220
220
|
"data-testid": "chat-card-footer-notes",
|
|
@@ -222,7 +222,7 @@ function Ln({ className: e, children: t }) {
|
|
|
222
222
|
children: t
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function Ln({ className: e, children: t }) {
|
|
226
226
|
return /* @__PURE__ */ H("div", {
|
|
227
227
|
"data-slot": "chat-card-footer-price",
|
|
228
228
|
"data-testid": "chat-card-footer-price",
|
|
@@ -230,7 +230,7 @@ function Rn({ className: e, children: t }) {
|
|
|
230
230
|
children: t
|
|
231
231
|
});
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function Rn({ className: e, children: t, ...n }) {
|
|
234
234
|
return /* @__PURE__ */ H("div", {
|
|
235
235
|
role: "group",
|
|
236
236
|
"data-slot": "chat-card-footer-actions",
|
|
@@ -242,7 +242,7 @@ function zn({ className: e, children: t, ...n }) {
|
|
|
242
242
|
}
|
|
243
243
|
//#endregion
|
|
244
244
|
//#region src/components/chat-card/components/chat-card-form.tsx
|
|
245
|
-
var
|
|
245
|
+
var zn = P(function({ className: e, children: t, asChild: n, ...r }, i) {
|
|
246
246
|
return /* @__PURE__ */ H(n ? W : "form", {
|
|
247
247
|
ref: i,
|
|
248
248
|
"data-slot": "chat-card-form",
|
|
@@ -252,8 +252,8 @@ var Bn = P(function({ className: e, children: t, asChild: n, ...r }, i) {
|
|
|
252
252
|
children: t
|
|
253
253
|
});
|
|
254
254
|
});
|
|
255
|
-
|
|
256
|
-
function
|
|
255
|
+
zn.displayName = "ChatCardForm";
|
|
256
|
+
function Bn({ className: e, children: t }) {
|
|
257
257
|
return /* @__PURE__ */ H("ul", {
|
|
258
258
|
"data-slot": "chat-card-attributes",
|
|
259
259
|
"data-testid": "chat-card-attributes",
|
|
@@ -261,7 +261,7 @@ function Vn({ className: e, children: t }) {
|
|
|
261
261
|
children: t
|
|
262
262
|
});
|
|
263
263
|
}
|
|
264
|
-
function
|
|
264
|
+
function Vn({ className: e, children: t, ...n }) {
|
|
265
265
|
return /* @__PURE__ */ H("li", {
|
|
266
266
|
"data-slot": "chat-card-attribute",
|
|
267
267
|
"data-testid": "chat-card-attribute-item",
|
|
@@ -270,7 +270,7 @@ function Hn({ className: e, children: t, ...n }) {
|
|
|
270
270
|
children: t
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function Hn({ className: e, children: n, hasPadding: r = !1, ...i }) {
|
|
274
274
|
return /* @__PURE__ */ H(t, {
|
|
275
275
|
variant: "outlined",
|
|
276
276
|
size: "md",
|
|
@@ -283,8 +283,8 @@ function Un({ className: e, children: n, hasPadding: r = !1, ...i }) {
|
|
|
283
283
|
children: n
|
|
284
284
|
});
|
|
285
285
|
}
|
|
286
|
-
function
|
|
287
|
-
return /* @__PURE__ */ H(n ? W :
|
|
286
|
+
function Un({ className: e, children: t, asChild: n = !1, ...r }) {
|
|
287
|
+
return /* @__PURE__ */ H(n ? W : j, {
|
|
288
288
|
"data-testid": "chat-card-attribute-value",
|
|
289
289
|
variant: "body-sm",
|
|
290
290
|
className: M("flex-1 text-text-secondary", e),
|
|
@@ -294,7 +294,7 @@ function Wn({ className: e, children: t, asChild: n = !1, ...r }) {
|
|
|
294
294
|
}
|
|
295
295
|
//#endregion
|
|
296
296
|
//#region src/components/chat-card/chat-card.tsx
|
|
297
|
-
var
|
|
297
|
+
var Wn = P(function({ className: e, variant: t = "default", level: r = 1, children: i, fullWidth: a = !1, defaultOpen: o = !0, open: s, isRounded: c = !0, isCollapsible: l = !0, isSelected: u = !1, onOpenChange: d, onClick: f, ...p }, m) {
|
|
298
298
|
let h = s !== void 0, [g, _] = V(o), v = h ? s : g, y = F((e) => {
|
|
299
299
|
h || _(e), d?.(e);
|
|
300
300
|
}, [h, d]), b = z(() => ({
|
|
@@ -309,7 +309,7 @@ var Gn = P(function({ className: e, variant: t = "default", level: r = 1, childr
|
|
|
309
309
|
function x(e) {
|
|
310
310
|
f?.(e), !e.defaultPrevented && l && !v && y(!0);
|
|
311
311
|
}
|
|
312
|
-
return /* @__PURE__ */ H(
|
|
312
|
+
return /* @__PURE__ */ H(Sn, {
|
|
313
313
|
value: b,
|
|
314
314
|
children: /* @__PURE__ */ H(n, {
|
|
315
315
|
isDisabled: !l,
|
|
@@ -336,10 +336,10 @@ var Gn = P(function({ className: e, variant: t = "default", level: r = 1, childr
|
|
|
336
336
|
})
|
|
337
337
|
});
|
|
338
338
|
});
|
|
339
|
-
|
|
339
|
+
Wn.displayName = "ChatCard";
|
|
340
340
|
//#endregion
|
|
341
341
|
//#region src/components/chat-card/hooks.ts
|
|
342
|
-
function
|
|
342
|
+
function Gn({ isEditable: e, defaultEditing: t = !1 }) {
|
|
343
343
|
let [n, r] = V(t);
|
|
344
344
|
function i() {
|
|
345
345
|
return e ? !0 : (console.warn("Chat card is not editable"), !1);
|
|
@@ -363,25 +363,25 @@ function Kn({ isEditable: e, defaultEditing: t = !1 }) {
|
|
|
363
363
|
}
|
|
364
364
|
//#endregion
|
|
365
365
|
//#region src/components/chat-card/contexts.tsx
|
|
366
|
-
var
|
|
367
|
-
function
|
|
368
|
-
let e = I(
|
|
366
|
+
var Kn = N(null);
|
|
367
|
+
function qn() {
|
|
368
|
+
let e = I(Kn);
|
|
369
369
|
if (!e) throw Error("\"useEditableChatCardContext\" must be used within a EditableChatCardContextProvider");
|
|
370
370
|
return e;
|
|
371
371
|
}
|
|
372
|
-
function
|
|
373
|
-
let r =
|
|
372
|
+
function Jn({ children: e, defaultEditing: t = !1, isEditable: n = !1 }) {
|
|
373
|
+
let r = Gn({
|
|
374
374
|
isEditable: n,
|
|
375
375
|
defaultEditing: t
|
|
376
376
|
});
|
|
377
|
-
return /* @__PURE__ */ H(
|
|
377
|
+
return /* @__PURE__ */ H(Kn.Provider, {
|
|
378
378
|
value: r,
|
|
379
379
|
children: e
|
|
380
380
|
});
|
|
381
381
|
}
|
|
382
382
|
//#endregion
|
|
383
383
|
//#region src/components/chat-card-container/chat-card-container.tsx
|
|
384
|
-
function
|
|
384
|
+
function Yn({ children: e, variant: t = "fixed", inline: n = !1, className: r, ...i }) {
|
|
385
385
|
return /* @__PURE__ */ H("div", {
|
|
386
386
|
"data-slot": "chat-card-container",
|
|
387
387
|
"data-testid": "chat-card-container",
|
|
@@ -394,21 +394,21 @@ function Xn({ children: e, variant: t = "fixed", inline: n = !1, className: r, .
|
|
|
394
394
|
}
|
|
395
395
|
//#endregion
|
|
396
396
|
//#region src/components/chat-container/chat-container.tsx
|
|
397
|
-
var
|
|
397
|
+
var Xn = "var(--spacing-chat-area)", Zn = {
|
|
398
398
|
prompt: "--type-window-height",
|
|
399
399
|
welcome: "--welcome-screen-box-height"
|
|
400
400
|
};
|
|
401
|
-
function
|
|
401
|
+
function Qn(e) {
|
|
402
402
|
return e === "unset" ? "unset" : `${e}px`;
|
|
403
403
|
}
|
|
404
|
-
var
|
|
405
|
-
function
|
|
406
|
-
let e = I(
|
|
404
|
+
var $n = N(null);
|
|
405
|
+
function er() {
|
|
406
|
+
let e = I($n);
|
|
407
407
|
if (!e) throw Error("[web-chat-ui] ChatContainer slot rendered outside a ChatContainer. ChatContainerPrompt and ChatContainerWelcome report their measured height up to the container, so one must be mounted above them. If it is mounted, check the slot is not rendered through a portal that escapes the provider.");
|
|
408
408
|
return e;
|
|
409
409
|
}
|
|
410
|
-
function
|
|
411
|
-
let o = e ? W : "section", { ref: s, width: c, height: l } =
|
|
410
|
+
function tr({ asChild: e = !1, children: t, className: n, contentWidth: r = Xn, style: i, ...a }) {
|
|
411
|
+
let o = e ? W : "section", { ref: s, width: c, height: l } = ue(), [u, d] = V({
|
|
412
412
|
prompt: "unset",
|
|
413
413
|
welcome: "unset"
|
|
414
414
|
}), f = F((e, t) => {
|
|
@@ -420,8 +420,8 @@ function nr({ asChild: e = !1, children: t, className: n, contentWidth: r = Zn,
|
|
|
420
420
|
"--chat-window-width": c === "unset" ? "100%" : `${c}px`,
|
|
421
421
|
"--chat-window-height": l === "unset" ? "100%" : `${l}px`,
|
|
422
422
|
"--message-list-content-width": `min(${r}, var(--chat-window-width))`,
|
|
423
|
-
[
|
|
424
|
-
[
|
|
423
|
+
[Zn.prompt]: Qn(u.prompt),
|
|
424
|
+
[Zn.welcome]: Qn(u.welcome),
|
|
425
425
|
...i
|
|
426
426
|
}), [
|
|
427
427
|
c,
|
|
@@ -430,7 +430,7 @@ function nr({ asChild: e = !1, children: t, className: n, contentWidth: r = Zn,
|
|
|
430
430
|
u,
|
|
431
431
|
i
|
|
432
432
|
]);
|
|
433
|
-
return /* @__PURE__ */ H(
|
|
433
|
+
return /* @__PURE__ */ H($n.Provider, {
|
|
434
434
|
value: p,
|
|
435
435
|
children: /* @__PURE__ */ H(o, {
|
|
436
436
|
ref: s,
|
|
@@ -443,16 +443,16 @@ function nr({ asChild: e = !1, children: t, className: n, contentWidth: r = Zn,
|
|
|
443
443
|
})
|
|
444
444
|
});
|
|
445
445
|
}
|
|
446
|
-
function
|
|
447
|
-
let { setSlotHeight: t } =
|
|
446
|
+
function nr(e) {
|
|
447
|
+
let { setSlotHeight: t } = er(), { ref: n, height: r } = ue();
|
|
448
448
|
return R(() => (t(e, r), () => t(e, "unset")), [
|
|
449
449
|
e,
|
|
450
450
|
r,
|
|
451
451
|
t
|
|
452
452
|
]), n;
|
|
453
453
|
}
|
|
454
|
-
function
|
|
455
|
-
let i =
|
|
454
|
+
function rr({ asChild: e = !1, children: t, className: n, ...r }) {
|
|
455
|
+
let i = nr("prompt");
|
|
456
456
|
return /* @__PURE__ */ H(e ? W : "div", {
|
|
457
457
|
ref: i,
|
|
458
458
|
"data-slot": "chat-container-prompt",
|
|
@@ -462,8 +462,8 @@ function ir({ asChild: e = !1, children: t, className: n, ...r }) {
|
|
|
462
462
|
children: t
|
|
463
463
|
});
|
|
464
464
|
}
|
|
465
|
-
function
|
|
466
|
-
let i =
|
|
465
|
+
function ir({ asChild: e = !1, children: t, className: n, ...r }) {
|
|
466
|
+
let i = nr("welcome");
|
|
467
467
|
return /* @__PURE__ */ H(e ? W : "div", {
|
|
468
468
|
ref: i,
|
|
469
469
|
"data-slot": "chat-container-welcome",
|
|
@@ -475,8 +475,8 @@ function ar({ asChild: e = !1, children: t, className: n, ...r }) {
|
|
|
475
475
|
}
|
|
476
476
|
//#endregion
|
|
477
477
|
//#region src/components/chat-input/plugins/auto-focus-plugin.tsx
|
|
478
|
-
function
|
|
479
|
-
let [r] =
|
|
478
|
+
function ar({ defaultSelection: e = "rootEnd", autoFocus: t, isDisabled: n }) {
|
|
479
|
+
let [r] = Pe();
|
|
480
480
|
return L(() => {
|
|
481
481
|
t && !n && r.focus(() => {
|
|
482
482
|
let e = document.activeElement, t = r.getRootElement();
|
|
@@ -491,36 +491,36 @@ function or({ defaultSelection: e = "rootEnd", autoFocus: t, isDisabled: n }) {
|
|
|
491
491
|
}
|
|
492
492
|
//#endregion
|
|
493
493
|
//#region src/components/chat-input/transformers.ts
|
|
494
|
-
var
|
|
494
|
+
var or = Le, sr = Le;
|
|
495
495
|
//#endregion
|
|
496
496
|
//#region src/components/chat-input/plugins/hooks.ts
|
|
497
|
-
function
|
|
498
|
-
let [e] =
|
|
497
|
+
function cr() {
|
|
498
|
+
let [e] = Pe();
|
|
499
499
|
return e;
|
|
500
500
|
}
|
|
501
501
|
//#endregion
|
|
502
502
|
//#region src/components/chat-input/plugins/utils.ts
|
|
503
|
-
function
|
|
503
|
+
function lr() {
|
|
504
504
|
return G().getTextContent();
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function ur() {
|
|
507
507
|
let e = G().getLastDescendant();
|
|
508
508
|
if (e && J(e)) {
|
|
509
|
-
let t =
|
|
510
|
-
t.anchor.set(e.getKey(), n, "text"), t.focus.set(e.getKey(), n, "text"),
|
|
509
|
+
let t = Ve(), n = e.getTextContentSize();
|
|
510
|
+
t.anchor.set(e.getKey(), n, "text"), t.focus.set(e.getKey(), n, "text"), Je(t);
|
|
511
511
|
} else {
|
|
512
|
-
|
|
512
|
+
qe();
|
|
513
513
|
let e = K();
|
|
514
514
|
if (q(e)) {
|
|
515
515
|
let t = e.focus.getNode(), n = J(t) ? t.getTextContentSize() : 0;
|
|
516
|
-
e.anchor.set(e.focus.key, e.focus.offset, e.focus.type), e.focus.set(e.focus.key, n, e.focus.type),
|
|
516
|
+
e.anchor.set(e.focus.key, e.focus.offset, e.focus.type), e.focus.set(e.focus.key, n, e.focus.type), Je(e);
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
519
|
}
|
|
520
520
|
//#endregion
|
|
521
521
|
//#region src/components/chat-input/plugins/controlled-value-plugin.tsx
|
|
522
|
-
function
|
|
523
|
-
let n =
|
|
522
|
+
function dr({ value: e, emittedValuesRef: t }) {
|
|
523
|
+
let n = cr(), r = B();
|
|
524
524
|
return L(() => {
|
|
525
525
|
if (!n || e === r.current) return;
|
|
526
526
|
if (r.current = e, t && e !== void 0) {
|
|
@@ -529,9 +529,9 @@ function fr({ value: e, emittedValuesRef: t }) {
|
|
|
529
529
|
}
|
|
530
530
|
let i = "";
|
|
531
531
|
n.getEditorState().read(() => {
|
|
532
|
-
i =
|
|
532
|
+
i = Ie(or);
|
|
533
533
|
}), e !== void 0 && e !== i && n.update(() => {
|
|
534
|
-
|
|
534
|
+
ze(at), Fe(e ?? "", sr), ur();
|
|
535
535
|
}, { discrete: !0 });
|
|
536
536
|
}, [
|
|
537
537
|
n,
|
|
@@ -541,8 +541,8 @@ function fr({ value: e, emittedValuesRef: t }) {
|
|
|
541
541
|
}
|
|
542
542
|
//#endregion
|
|
543
543
|
//#region src/components/chat-input/plugins/disabled-plugin.tsx
|
|
544
|
-
function
|
|
545
|
-
let n =
|
|
544
|
+
function fr({ isDisabled: e, isReadOnly: t }) {
|
|
545
|
+
let n = cr();
|
|
546
546
|
return L(() => {
|
|
547
547
|
n.setEditable(!e && !t);
|
|
548
548
|
}, [
|
|
@@ -553,8 +553,8 @@ function pr({ isDisabled: e, isReadOnly: t }) {
|
|
|
553
553
|
}
|
|
554
554
|
//#endregion
|
|
555
555
|
//#region src/components/chat-input/plugins/focus-plugin.tsx
|
|
556
|
-
function
|
|
557
|
-
let t =
|
|
556
|
+
function pr({ onFocusChange: e }) {
|
|
557
|
+
let t = cr();
|
|
558
558
|
return L(() => {
|
|
559
559
|
if (!e) return;
|
|
560
560
|
let n = t.getRootElement();
|
|
@@ -572,29 +572,29 @@ function mr({ onFocusChange: e }) {
|
|
|
572
572
|
}
|
|
573
573
|
//#endregion
|
|
574
574
|
//#region src/components/chat-input/plugins/has-value-plugin.tsx
|
|
575
|
-
function
|
|
575
|
+
function mr(e) {
|
|
576
576
|
let t = !1;
|
|
577
577
|
return e.getEditorState().read(() => {
|
|
578
|
-
t =
|
|
578
|
+
t = lr().length > 0;
|
|
579
579
|
}), t;
|
|
580
580
|
}
|
|
581
|
-
function
|
|
582
|
-
let r =
|
|
581
|
+
function hr(e, t, n) {
|
|
582
|
+
let r = mr(e);
|
|
583
583
|
n.current !== r && (n.current = r, t?.(r));
|
|
584
584
|
}
|
|
585
|
-
function
|
|
586
|
-
let t =
|
|
585
|
+
function gr({ onHasValueChange: e }) {
|
|
586
|
+
let t = cr(), n = B();
|
|
587
587
|
return L(() => {
|
|
588
|
-
if (t) return
|
|
589
|
-
|
|
588
|
+
if (t) return hr(t, e, n), t.registerUpdateListener(() => {
|
|
589
|
+
hr(t, e, n);
|
|
590
590
|
});
|
|
591
591
|
}, [t, e]), null;
|
|
592
592
|
}
|
|
593
593
|
//#endregion
|
|
594
594
|
//#region src/components/chat-input/plugins/markdown-plain-paste-plugin.tsx
|
|
595
|
-
function
|
|
596
|
-
let e =
|
|
597
|
-
return L(() => e.registerCommand(
|
|
595
|
+
function _r() {
|
|
596
|
+
let e = cr();
|
|
597
|
+
return L(() => e.registerCommand(rt, (t) => {
|
|
598
598
|
let { clipboardData: n } = t;
|
|
599
599
|
if (!n) return !1;
|
|
600
600
|
let r = n.getData("text/plain");
|
|
@@ -606,46 +606,46 @@ function vr() {
|
|
|
606
606
|
}
|
|
607
607
|
let t = G();
|
|
608
608
|
t.clear(), r.split(/\r?\n/).forEach((e) => {
|
|
609
|
-
let n =
|
|
610
|
-
e.length > 0 && n.append(
|
|
609
|
+
let n = Be();
|
|
610
|
+
e.length > 0 && n.append(He(e)), t.append(n);
|
|
611
611
|
});
|
|
612
612
|
}), !0) : !1;
|
|
613
|
-
},
|
|
613
|
+
}, Xe), [e]), null;
|
|
614
614
|
}
|
|
615
615
|
//#endregion
|
|
616
616
|
//#region src/components/chat-input/plugins/value-plugin.tsx
|
|
617
|
-
var
|
|
618
|
-
function
|
|
617
|
+
var vr = 50;
|
|
618
|
+
function yr({ onChange: e, emittedValuesRef: t }) {
|
|
619
619
|
let n = F((n, r, i) => {
|
|
620
620
|
if (!i.has("focus") && e) try {
|
|
621
621
|
n.read(() => {
|
|
622
|
-
let n =
|
|
623
|
-
t && (t.current.push(n), t.current.splice(0, t.current.length -
|
|
622
|
+
let n = Ie(or);
|
|
623
|
+
t && (t.current.push(n), t.current.splice(0, t.current.length - vr)), e(n);
|
|
624
624
|
});
|
|
625
625
|
} catch (e) {
|
|
626
626
|
console.error("ValuePlugin error:", e);
|
|
627
627
|
}
|
|
628
628
|
}, [e, t]);
|
|
629
|
-
return /* @__PURE__ */ H(
|
|
629
|
+
return /* @__PURE__ */ H(dt, { onChange: n });
|
|
630
630
|
}
|
|
631
631
|
//#endregion
|
|
632
632
|
//#region src/components/chat-input/chat-input.tsx
|
|
633
|
-
var
|
|
634
|
-
function
|
|
635
|
-
let e = I(
|
|
633
|
+
var br = N(null);
|
|
634
|
+
function xr() {
|
|
635
|
+
let e = I(br);
|
|
636
636
|
if (!e) throw Error("\"useChatInputContext\" must be used within a ChatInputContextProvider");
|
|
637
637
|
return e;
|
|
638
638
|
}
|
|
639
|
-
var
|
|
639
|
+
var Sr = {
|
|
640
640
|
namespace: "chat-input",
|
|
641
641
|
editable: !0,
|
|
642
642
|
nodes: [
|
|
643
|
+
Me,
|
|
643
644
|
Ne,
|
|
644
|
-
Pe,
|
|
645
|
-
Ee,
|
|
646
645
|
Te,
|
|
647
|
-
|
|
648
|
-
|
|
646
|
+
we,
|
|
647
|
+
ve,
|
|
648
|
+
be
|
|
649
649
|
],
|
|
650
650
|
theme: {
|
|
651
651
|
paragraph: "m-0 min-h-[26px]",
|
|
@@ -658,7 +658,7 @@ var Cr = {
|
|
|
658
658
|
onError: (e) => {
|
|
659
659
|
console.error("ChatInput Lexical error:", e);
|
|
660
660
|
}
|
|
661
|
-
},
|
|
661
|
+
}, Cr = P(function({ className: e, children: t, initialConfig: n = Sr, ...r }, i) {
|
|
662
662
|
let [a, o] = V(!1), [s, c] = V(!1), [l, u] = V(!1), d = z(() => ({
|
|
663
663
|
hasError: a,
|
|
664
664
|
hasValue: s,
|
|
@@ -671,9 +671,9 @@ var Cr = {
|
|
|
671
671
|
s,
|
|
672
672
|
l
|
|
673
673
|
]);
|
|
674
|
-
return /* @__PURE__ */ H(
|
|
674
|
+
return /* @__PURE__ */ H(br.Provider, {
|
|
675
675
|
value: d,
|
|
676
|
-
children: /* @__PURE__ */ H(
|
|
676
|
+
children: /* @__PURE__ */ H(Ee, {
|
|
677
677
|
initialConfig: n,
|
|
678
678
|
children: /* @__PURE__ */ H("div", {
|
|
679
679
|
ref: i,
|
|
@@ -690,9 +690,9 @@ var Cr = {
|
|
|
690
690
|
})
|
|
691
691
|
});
|
|
692
692
|
});
|
|
693
|
-
|
|
694
|
-
var
|
|
695
|
-
return /* @__PURE__ */ H(
|
|
693
|
+
Cr.displayName = "ChatInput";
|
|
694
|
+
var wr = P(function({ className: e, children: t, ...n }, r) {
|
|
695
|
+
return /* @__PURE__ */ H(j, {
|
|
696
696
|
ref: r,
|
|
697
697
|
variant: "body",
|
|
698
698
|
className: M("pointer-events-none absolute inset-0 z-0", "min-h-[26px]", "text-text-tertiary", e),
|
|
@@ -704,9 +704,9 @@ var Tr = P(function({ className: e, children: t, ...n }, r) {
|
|
|
704
704
|
})
|
|
705
705
|
});
|
|
706
706
|
});
|
|
707
|
-
|
|
708
|
-
var
|
|
709
|
-
let { setHasValue: p, setIsFocused: m } =
|
|
707
|
+
wr.displayName = "ChatInputPlaceholder";
|
|
708
|
+
var Tr = P(function({ className: e, style: t, placeholderClassName: n, placeholder: r = "Input your message...", children: i, value: a, autoFocus: o = !0, isDisabled: s = !1, isReadOnly: c = !1, onChange: l, onKeyDown: u, ...d }, f) {
|
|
709
|
+
let { setHasValue: p, setIsFocused: m } = xr(), h = c && !s, g = B([]);
|
|
710
710
|
return /* @__PURE__ */ U("div", {
|
|
711
711
|
"data-slot": "chat-input-textarea",
|
|
712
712
|
"data-testid": "chat-input-textarea",
|
|
@@ -718,38 +718,38 @@ var Er = P(function({ className: e, style: t, placeholderClassName: n, placehold
|
|
|
718
718
|
style: t,
|
|
719
719
|
...d,
|
|
720
720
|
children: [
|
|
721
|
-
/* @__PURE__ */ H(
|
|
722
|
-
contentEditable: /* @__PURE__ */ H(
|
|
721
|
+
/* @__PURE__ */ H(Ae, {
|
|
722
|
+
contentEditable: /* @__PURE__ */ H(De, {
|
|
723
723
|
ref: f,
|
|
724
724
|
"data-slot": "chat-input-editable",
|
|
725
725
|
className: M("min-h-[26px]!", "overflow-y-auto text-wrap outline-none", e),
|
|
726
726
|
"aria-label": "Chat input",
|
|
727
727
|
"aria-placeholder": r,
|
|
728
|
-
placeholder: /* @__PURE__ */ H(
|
|
728
|
+
placeholder: /* @__PURE__ */ H(wr, {
|
|
729
729
|
className: n,
|
|
730
730
|
children: r
|
|
731
731
|
}),
|
|
732
732
|
onKeyDown: u
|
|
733
733
|
}),
|
|
734
|
-
ErrorBoundary:
|
|
734
|
+
ErrorBoundary: Oe
|
|
735
735
|
}),
|
|
736
|
-
/* @__PURE__ */ H(
|
|
737
|
-
/* @__PURE__ */ H(
|
|
736
|
+
/* @__PURE__ */ H(ke, {}),
|
|
737
|
+
/* @__PURE__ */ H(fr, {
|
|
738
738
|
isDisabled: s,
|
|
739
739
|
isReadOnly: c
|
|
740
740
|
}),
|
|
741
|
-
/* @__PURE__ */ H(
|
|
741
|
+
/* @__PURE__ */ H(dr, {
|
|
742
742
|
value: a,
|
|
743
743
|
emittedValuesRef: g
|
|
744
744
|
}),
|
|
745
|
-
/* @__PURE__ */ H(
|
|
745
|
+
/* @__PURE__ */ H(yr, {
|
|
746
746
|
onChange: l,
|
|
747
747
|
emittedValuesRef: g
|
|
748
748
|
}),
|
|
749
|
-
/* @__PURE__ */ H(
|
|
750
|
-
/* @__PURE__ */ H(
|
|
751
|
-
/* @__PURE__ */ H(
|
|
752
|
-
/* @__PURE__ */ H(
|
|
749
|
+
/* @__PURE__ */ H(_r, {}),
|
|
750
|
+
/* @__PURE__ */ H(gr, { onHasValueChange: p }),
|
|
751
|
+
/* @__PURE__ */ H(pr, { onFocusChange: m }),
|
|
752
|
+
/* @__PURE__ */ H(ar, {
|
|
753
753
|
autoFocus: o,
|
|
754
754
|
isDisabled: s || c
|
|
755
755
|
}),
|
|
@@ -757,16 +757,16 @@ var Er = P(function({ className: e, style: t, placeholderClassName: n, placehold
|
|
|
757
757
|
]
|
|
758
758
|
});
|
|
759
759
|
});
|
|
760
|
-
|
|
760
|
+
Tr.displayName = "ChatInputTextarea";
|
|
761
761
|
//#endregion
|
|
762
762
|
//#region src/components/chat-list/chat-list.tsx
|
|
763
|
-
var
|
|
764
|
-
function
|
|
765
|
-
let e = I(
|
|
763
|
+
var Er = N(null);
|
|
764
|
+
function Dr() {
|
|
765
|
+
let e = I(Er);
|
|
766
766
|
if (!e) throw Error("\"useChatListContext\" must be used within a ChatList");
|
|
767
767
|
return e;
|
|
768
768
|
}
|
|
769
|
-
function
|
|
769
|
+
function Or({ children: e, className: t, loadedCount: n, totalCount: r, hasMore: i, isLoading: a = !1, isLoadingMore: o = !1, hasError: s = !1, onLoadMore: c, getItemKey: l, "aria-label": u = "Chat list" }) {
|
|
770
770
|
let d = B(null), f = B(null), [p, m] = V(0), [h, g] = V(null), [, _] = V(0), v = F((e) => {
|
|
771
771
|
d.current = e, _((e) => e + 1);
|
|
772
772
|
}, []), y = F(() => {
|
|
@@ -803,7 +803,7 @@ function kr({ children: e, className: t, loadedCount: n, totalCount: r, hasMore:
|
|
|
803
803
|
y,
|
|
804
804
|
h
|
|
805
805
|
]);
|
|
806
|
-
return /* @__PURE__ */ H(
|
|
806
|
+
return /* @__PURE__ */ H(Er.Provider, {
|
|
807
807
|
value: S,
|
|
808
808
|
children: /* @__PURE__ */ H("div", {
|
|
809
809
|
"data-slot": "chat-list",
|
|
@@ -819,10 +819,10 @@ function kr({ children: e, className: t, loadedCount: n, totalCount: r, hasMore:
|
|
|
819
819
|
})
|
|
820
820
|
});
|
|
821
821
|
}
|
|
822
|
-
var
|
|
823
|
-
function
|
|
824
|
-
let { isLoading: i, loadedCount: a, skeletonContainer: o } =
|
|
825
|
-
return !(i && a === 0) || !o ? null :
|
|
822
|
+
var kr = ["w-2/3", "w-1/2"], Ar = ["w-full", "w-4/5"];
|
|
823
|
+
function jr({ children: e, rows: t = 16, className: n, rowClassName: r }) {
|
|
824
|
+
let { isLoading: i, loadedCount: a, skeletonContainer: o } = Dr();
|
|
825
|
+
return !(i && a === 0) || !o ? null : ft(/* @__PURE__ */ H("div", {
|
|
826
826
|
"data-slot": "chat-list-skeleton",
|
|
827
827
|
"data-testid": "chat-list-skeleton",
|
|
828
828
|
role: "status",
|
|
@@ -834,16 +834,16 @@ function Mr({ children: e, rows: t = 16, className: n, rowClassName: r }) {
|
|
|
834
834
|
className: M("flex shrink-0 flex-col gap-4 px-12 py-8", r),
|
|
835
835
|
children: [/* @__PURE__ */ H("div", {
|
|
836
836
|
className: "flex h-20 items-center",
|
|
837
|
-
children: /* @__PURE__ */ H(
|
|
837
|
+
children: /* @__PURE__ */ H(oe, { className: M("h-12", kr[t % 2]) })
|
|
838
838
|
}), /* @__PURE__ */ H("div", {
|
|
839
839
|
className: "flex h-16 items-center",
|
|
840
|
-
children: /* @__PURE__ */ H(
|
|
840
|
+
children: /* @__PURE__ */ H(oe, { className: M("h-10", Ar[t % 2]) })
|
|
841
841
|
})]
|
|
842
842
|
}, t))
|
|
843
843
|
}), o);
|
|
844
844
|
}
|
|
845
|
-
function
|
|
846
|
-
let { isEmpty: n } =
|
|
845
|
+
function Mr({ children: e, className: t }) {
|
|
846
|
+
let { isEmpty: n } = Dr();
|
|
847
847
|
return n ? /* @__PURE__ */ H("div", {
|
|
848
848
|
"data-slot": "chat-list-empty-state",
|
|
849
849
|
"data-testid": "chat-list-empty-state",
|
|
@@ -854,8 +854,8 @@ function Nr({ children: e, className: t }) {
|
|
|
854
854
|
children: e
|
|
855
855
|
}) : null;
|
|
856
856
|
}
|
|
857
|
-
function
|
|
858
|
-
let { hasError: i, loadedCount: a } =
|
|
857
|
+
function Nr({ children: e, error: t, className: n, messageClassName: r }) {
|
|
858
|
+
let { hasError: i, loadedCount: a } = Dr();
|
|
859
859
|
return i && a === 0 ? /* @__PURE__ */ H("div", {
|
|
860
860
|
"data-slot": "chat-list-error",
|
|
861
861
|
"data-testid": "chat-list-error",
|
|
@@ -870,29 +870,29 @@ function Pr({ children: e, error: t, className: n, messageClassName: r }) {
|
|
|
870
870
|
})
|
|
871
871
|
}) : null;
|
|
872
872
|
}
|
|
873
|
-
function
|
|
874
|
-
let { loadMoreContentRef: t, bumpLoadMore: n } =
|
|
873
|
+
function Pr({ children: e }) {
|
|
874
|
+
let { loadMoreContentRef: t, bumpLoadMore: n } = Dr();
|
|
875
875
|
return t.current = e ?? null, R(() => (n(), () => {
|
|
876
876
|
t.current = null, n();
|
|
877
877
|
}), [n, t]), null;
|
|
878
878
|
}
|
|
879
879
|
//#endregion
|
|
880
880
|
//#region src/components/chat-list/chat-list-items.tsx
|
|
881
|
-
var
|
|
882
|
-
let { loadedCount: s, hasMore: c, isLoading: l, isLoadingMore: u, onLoadMore: d, getItemKey: f, scrollElementRef: p, setScrollElement: m, loadMoreContentRef: h, loadMoreVersion: g, setSkeletonContainer: _ } =
|
|
881
|
+
var Fr = "chat-list-load-more", Ir = he(function({ children: e, className: t, listClassName: n, rowClassName: r, estimateSize: i = 54, overscan: a = 6, gap: o = 4 }) {
|
|
882
|
+
let { loadedCount: s, hasMore: c, isLoading: l, isLoadingMore: u, onLoadMore: d, getItemKey: f, scrollElementRef: p, setScrollElement: m, loadMoreContentRef: h, loadMoreVersion: g, setSkeletonContainer: _ } = Dr(), v = g >= 0 ? h.current : null, b = l && s === 0, x = c ? s + 1 : s, S = F((e) => e >= s ? Fr : f(e), [f, s]), C = pt({
|
|
883
883
|
count: b ? 0 : x,
|
|
884
884
|
getScrollElement: () => p.current,
|
|
885
885
|
estimateSize: () => i,
|
|
886
886
|
overscan: a,
|
|
887
887
|
gap: o,
|
|
888
888
|
getItemKey: S
|
|
889
|
-
}),
|
|
889
|
+
}), w = C.getVirtualItems();
|
|
890
890
|
return L(() => {
|
|
891
891
|
if (b) return;
|
|
892
|
-
let [e] = [...
|
|
892
|
+
let [e] = [...w].reverse();
|
|
893
893
|
e && e.index >= s - 1 && c && !u && d?.();
|
|
894
894
|
}, [
|
|
895
|
-
|
|
895
|
+
w,
|
|
896
896
|
s,
|
|
897
897
|
c,
|
|
898
898
|
u,
|
|
@@ -903,7 +903,7 @@ var Ir = "chat-list-load-more", Lr = ge(function({ children: e, className: t, li
|
|
|
903
903
|
"data-slot": "chat-list-items",
|
|
904
904
|
"data-testid": "chat-list-items",
|
|
905
905
|
className: M("flex min-h-0 flex-1 flex-col overflow-hidden", t)
|
|
906
|
-
}) : /* @__PURE__ */ H(
|
|
906
|
+
}) : /* @__PURE__ */ H(ae, {
|
|
907
907
|
ref: m,
|
|
908
908
|
"data-slot": "chat-list-items",
|
|
909
909
|
"data-testid": "chat-list-items",
|
|
@@ -913,14 +913,14 @@ var Ir = "chat-list-load-more", Lr = ge(function({ children: e, className: t, li
|
|
|
913
913
|
role: "list",
|
|
914
914
|
"aria-label": "Chats",
|
|
915
915
|
className: M("table relative w-full transform-gpu table-fixed", "space-y-[4px]", n),
|
|
916
|
-
style: { height: `${
|
|
917
|
-
children:
|
|
916
|
+
style: { height: `${C.getTotalSize()}px` },
|
|
917
|
+
children: w.map((t) => {
|
|
918
918
|
let n = t.index >= s;
|
|
919
919
|
return /* @__PURE__ */ H("li", {
|
|
920
920
|
"data-slot": "chat-list-items-row",
|
|
921
921
|
"data-index": t.index,
|
|
922
922
|
"data-load-more": n,
|
|
923
|
-
ref:
|
|
923
|
+
ref: C.measureElement,
|
|
924
924
|
role: n ? "status" : "listitem",
|
|
925
925
|
"aria-live": n ? "polite" : void 0,
|
|
926
926
|
"aria-busy": n ? u : void 0,
|
|
@@ -937,7 +937,7 @@ var Ir = "chat-list-load-more", Lr = ge(function({ children: e, className: t, li
|
|
|
937
937
|
})
|
|
938
938
|
})
|
|
939
939
|
});
|
|
940
|
-
}),
|
|
940
|
+
}), Lr = P(function({ children: e, className: t, asChild: n = !1, isSelected: r = !1, ...i }, a) {
|
|
941
941
|
return /* @__PURE__ */ H(n ? W : "div", {
|
|
942
942
|
ref: a,
|
|
943
943
|
"data-slot": "chat-list-item",
|
|
@@ -949,16 +949,16 @@ var Ir = "chat-list-load-more", Lr = ge(function({ children: e, className: t, li
|
|
|
949
949
|
children: e
|
|
950
950
|
});
|
|
951
951
|
});
|
|
952
|
-
|
|
952
|
+
Lr.displayName = "ChatListItem";
|
|
953
953
|
//#endregion
|
|
954
954
|
//#region src/components/chat-prompt-box/chat-prompt-box-context.tsx
|
|
955
|
-
var
|
|
956
|
-
function
|
|
957
|
-
let e = I(
|
|
955
|
+
var Rr = N(null);
|
|
956
|
+
function zr() {
|
|
957
|
+
let e = I(Rr);
|
|
958
958
|
if (!e) throw Error("\"useChatPromptBoxContext\" must be used within a ChatPromptBox");
|
|
959
959
|
return e;
|
|
960
960
|
}
|
|
961
|
-
function
|
|
961
|
+
function Br({ children: e, reportInputHeight: t, resetCompact: n }) {
|
|
962
962
|
let r = B(null), i = F((e) => {
|
|
963
963
|
r.current = e;
|
|
964
964
|
}, []), a = F(() => {
|
|
@@ -978,15 +978,15 @@ function Vr({ children: e, reportInputHeight: t, resetCompact: n }) {
|
|
|
978
978
|
a,
|
|
979
979
|
o
|
|
980
980
|
]);
|
|
981
|
-
return /* @__PURE__ */ H(
|
|
981
|
+
return /* @__PURE__ */ H(Rr.Provider, {
|
|
982
982
|
value: s,
|
|
983
983
|
children: e
|
|
984
984
|
});
|
|
985
985
|
}
|
|
986
986
|
//#endregion
|
|
987
987
|
//#region src/components/chat-prompt-box/chat-prompt-box-focus-plugin.tsx
|
|
988
|
-
function
|
|
989
|
-
let e =
|
|
988
|
+
function Vr() {
|
|
989
|
+
let e = cr(), { registerFocusInput: t, unregisterFocusInput: n } = zr();
|
|
990
990
|
return L(() => (t(() => {
|
|
991
991
|
e.focus();
|
|
992
992
|
}), () => {
|
|
@@ -999,32 +999,32 @@ function Hr() {
|
|
|
999
999
|
}
|
|
1000
1000
|
//#endregion
|
|
1001
1001
|
//#region src/components/chat-prompt-box/chat-prompt-box.tsx
|
|
1002
|
-
var
|
|
1003
|
-
function
|
|
1004
|
-
return e instanceof HTMLElement && !!e.closest(
|
|
1002
|
+
var Hr = 40, Ur = "button, a, input, select, textarea, [role=\"button\"]";
|
|
1003
|
+
function Wr(e) {
|
|
1004
|
+
return e instanceof HTMLElement && !!e.closest(Ur);
|
|
1005
1005
|
}
|
|
1006
|
-
var
|
|
1006
|
+
var Gr = P(function(e, t) {
|
|
1007
1007
|
let [n, r] = V(!0), i = F((e) => {
|
|
1008
|
-
e >
|
|
1008
|
+
e > Hr && r(!1);
|
|
1009
1009
|
}, []), a = F(() => {
|
|
1010
1010
|
r(!0);
|
|
1011
1011
|
}, []);
|
|
1012
|
-
return /* @__PURE__ */ H(
|
|
1012
|
+
return /* @__PURE__ */ H(Br, {
|
|
1013
1013
|
reportInputHeight: i,
|
|
1014
1014
|
resetCompact: a,
|
|
1015
|
-
children: /* @__PURE__ */ H(
|
|
1015
|
+
children: /* @__PURE__ */ H(Kr, {
|
|
1016
1016
|
ref: t,
|
|
1017
1017
|
"data-compact": n,
|
|
1018
1018
|
...e
|
|
1019
1019
|
})
|
|
1020
1020
|
});
|
|
1021
1021
|
});
|
|
1022
|
-
|
|
1023
|
-
var
|
|
1024
|
-
let { focusInput: o } =
|
|
1025
|
-
|
|
1022
|
+
Gr.displayName = "ChatPromptBox";
|
|
1023
|
+
var Kr = P(function({ className: e, innerClassName: t, children: n, onMouseDown: r, ...i }, a) {
|
|
1024
|
+
let { focusInput: o } = zr(), s = F((e) => {
|
|
1025
|
+
Wr(e.target) || o(), r?.(e);
|
|
1026
1026
|
}, [o, r]);
|
|
1027
|
-
return /* @__PURE__ */ U(
|
|
1027
|
+
return /* @__PURE__ */ U(Cr, {
|
|
1028
1028
|
ref: a,
|
|
1029
1029
|
"data-slot": "chat-prompt-box",
|
|
1030
1030
|
className: M("group/chat-prompt-box", "relative overflow-hidden", "cursor-text", "p-px", "rounded-[16px]", "bg-transparent", "hover:bg-promptbox-background-border-base", "data-[focused=true]:bg-promptbox-background-border-base", e),
|
|
@@ -1034,12 +1034,12 @@ var qr = P(function({ className: e, innerClassName: t, children: n, onMouseDown:
|
|
|
1034
1034
|
"data-slot": "chat-prompt-box-inner",
|
|
1035
1035
|
className: M("rounded-[15px]", "p-[4px]", "bg-[#171A20]", "group-hover/chat-prompt-box:bg-[#252931]", "group-data-[focused=true]/chat-prompt-box:bg-[linear-gradient(var(--color-promptbox-background-hover),var(--color-promptbox-background-hover)),var(--color-promptbox-background-base)]", "group-data-[focused=true]/chat-prompt-box:group-hover/chat-prompt-box:bg-[linear-gradient(var(--color-promptbox-background-hover),var(--color-promptbox-background-hover)),var(--color-promptbox-background-base)]", t),
|
|
1036
1036
|
children: n
|
|
1037
|
-
}), /* @__PURE__ */ H(
|
|
1037
|
+
}), /* @__PURE__ */ H(qr, {})]
|
|
1038
1038
|
});
|
|
1039
1039
|
});
|
|
1040
|
-
|
|
1041
|
-
function
|
|
1042
|
-
return /* @__PURE__ */ U(
|
|
1040
|
+
Kr.displayName = "ChatPromptBoxContainer";
|
|
1041
|
+
function qr() {
|
|
1042
|
+
return /* @__PURE__ */ U(_e, { children: [/* @__PURE__ */ H("div", {
|
|
1043
1043
|
"data-slot": "chat-prompt-box-glow-top",
|
|
1044
1044
|
className: M("absolute left-1/2 top-[-40px]", "translate-x-[-50%]", "pointer-events-none", "w-[380px] h-[72px]", "opacity-0 group-data-[focused=true]/chat-prompt-box:opacity-50"),
|
|
1045
1045
|
style: {
|
|
@@ -1055,7 +1055,7 @@ function Jr() {
|
|
|
1055
1055
|
}
|
|
1056
1056
|
})] });
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1058
|
+
function Jr({ className: e, children: t, ...n }) {
|
|
1059
1059
|
return /* @__PURE__ */ H("div", {
|
|
1060
1060
|
"data-slot": "chat-prompt-box-toolbar",
|
|
1061
1061
|
"data-testid": "chat-prompt-box-toolbar",
|
|
@@ -1064,7 +1064,7 @@ function Yr({ className: e, children: t, ...n }) {
|
|
|
1064
1064
|
children: t
|
|
1065
1065
|
});
|
|
1066
1066
|
}
|
|
1067
|
-
function
|
|
1067
|
+
function Yr({ className: e, children: t, ...n }) {
|
|
1068
1068
|
return /* @__PURE__ */ H("div", {
|
|
1069
1069
|
"data-slot": "chat-prompt-box-content",
|
|
1070
1070
|
"data-testid": "chat-prompt-box-content",
|
|
@@ -1073,8 +1073,8 @@ function Xr({ className: e, children: t, ...n }) {
|
|
|
1073
1073
|
children: t
|
|
1074
1074
|
});
|
|
1075
1075
|
}
|
|
1076
|
-
var
|
|
1077
|
-
let { reportInputHeight: o, resetCompact: s } =
|
|
1076
|
+
var Xr = P(function({ className: e, textareaClassName: t, placeholderClassName: n, children: r, ...i }, a) {
|
|
1077
|
+
let { reportInputHeight: o, resetCompact: s } = zr(), { hasValue: c } = xr(), { ref: l, height: u } = ue();
|
|
1078
1078
|
R(() => {
|
|
1079
1079
|
typeof u == "number" && o(u);
|
|
1080
1080
|
}, [u, o]), R(() => () => {
|
|
@@ -1089,17 +1089,17 @@ var Zr = P(function({ className: e, textareaClassName: t, placeholderClassName:
|
|
|
1089
1089
|
"data-slot": "chat-prompt-box-input",
|
|
1090
1090
|
"data-testid": "chat-prompt-box-input",
|
|
1091
1091
|
className: M("min-h-[40px]", "inline-flex justify-center items-center", "group-data-[compact=false]/chat-prompt-box:items-start", "group-data-[compact=false]/chat-prompt-box:min-h-[48px]", "order-2 grow min-w-0 flex-1", "[&>div]:flex-1 [&>div]:min-w-0", e),
|
|
1092
|
-
children: /* @__PURE__ */ U(
|
|
1092
|
+
children: /* @__PURE__ */ U(Tr, {
|
|
1093
1093
|
ref: d,
|
|
1094
1094
|
className: M("max-h-[72px]!", t),
|
|
1095
1095
|
placeholderClassName: M("leading-[24px]!", n),
|
|
1096
1096
|
...i,
|
|
1097
|
-
children: [/* @__PURE__ */ H(
|
|
1097
|
+
children: [/* @__PURE__ */ H(Vr, {}), r]
|
|
1098
1098
|
})
|
|
1099
1099
|
});
|
|
1100
1100
|
});
|
|
1101
|
-
|
|
1102
|
-
function
|
|
1101
|
+
Xr.displayName = "ChatPromptBoxInput";
|
|
1102
|
+
function Zr({ className: e, children: t, ...n }) {
|
|
1103
1103
|
return /* @__PURE__ */ H("div", {
|
|
1104
1104
|
"data-slot": "chat-prompt-box-actions-left",
|
|
1105
1105
|
"data-testid": "chat-prompt-box-actions-left",
|
|
@@ -1109,7 +1109,7 @@ function Qr({ className: e, children: t, ...n }) {
|
|
|
1109
1109
|
children: t
|
|
1110
1110
|
});
|
|
1111
1111
|
}
|
|
1112
|
-
function
|
|
1112
|
+
function Qr({ className: e, children: t, ...n }) {
|
|
1113
1113
|
return /* @__PURE__ */ H("div", {
|
|
1114
1114
|
"data-slot": "chat-prompt-box-actions-right",
|
|
1115
1115
|
"data-testid": "chat-prompt-box-actions-right",
|
|
@@ -1121,7 +1121,7 @@ function $r({ className: e, children: t, ...n }) {
|
|
|
1121
1121
|
}
|
|
1122
1122
|
//#endregion
|
|
1123
1123
|
//#region src/components/chat-message/chat-message.tsx
|
|
1124
|
-
function
|
|
1124
|
+
function $r({ children: e, className: t, isQuestion: n }) {
|
|
1125
1125
|
return /* @__PURE__ */ H("div", {
|
|
1126
1126
|
"data-slot": "chat-message",
|
|
1127
1127
|
"data-question": n,
|
|
@@ -1129,7 +1129,7 @@ function ei({ children: e, className: t, isQuestion: n }) {
|
|
|
1129
1129
|
children: e
|
|
1130
1130
|
});
|
|
1131
1131
|
}
|
|
1132
|
-
function
|
|
1132
|
+
function ei({ children: e, className: t }) {
|
|
1133
1133
|
return /* @__PURE__ */ H("div", {
|
|
1134
1134
|
"data-slot": "chat-message-content",
|
|
1135
1135
|
"data-bubble": !0,
|
|
@@ -1137,7 +1137,7 @@ function ti({ children: e, className: t }) {
|
|
|
1137
1137
|
children: e
|
|
1138
1138
|
});
|
|
1139
1139
|
}
|
|
1140
|
-
function
|
|
1140
|
+
function ti({ children: e, className: t }) {
|
|
1141
1141
|
return /* @__PURE__ */ H("div", {
|
|
1142
1142
|
"data-slot": "chat-message-actions",
|
|
1143
1143
|
className: M("transition-opacity duration-300", "md:opacity-0 group-hover/message:opacity-100", t),
|
|
@@ -1146,20 +1146,20 @@ function ni({ children: e, className: t }) {
|
|
|
1146
1146
|
}
|
|
1147
1147
|
//#endregion
|
|
1148
1148
|
//#region src/contexts/chat-context/utils.ts
|
|
1149
|
-
function
|
|
1150
|
-
return `__${
|
|
1149
|
+
function ni() {
|
|
1150
|
+
return `__${ht()}__`;
|
|
1151
1151
|
}
|
|
1152
1152
|
//#endregion
|
|
1153
1153
|
//#region src/contexts/chat-context/chat-context.tsx
|
|
1154
|
-
var
|
|
1154
|
+
var ri = N(null);
|
|
1155
1155
|
function X() {
|
|
1156
|
-
let e = I(
|
|
1156
|
+
let e = I(ri);
|
|
1157
1157
|
if (!e) throw Error("\"useChatContext\" must be used within a ChatProvider");
|
|
1158
1158
|
return e;
|
|
1159
1159
|
}
|
|
1160
|
-
function
|
|
1161
|
-
let [n, r] = V(
|
|
1162
|
-
let e =
|
|
1160
|
+
function ii({ children: e, chatId: t }) {
|
|
1161
|
+
let [n, r] = V(ni()), [i, a] = V(void 0), o = B(/* @__PURE__ */ new Set()), s = t || n, c = s === n, l = F(() => {
|
|
1162
|
+
let e = ni();
|
|
1163
1163
|
return r(e), e;
|
|
1164
1164
|
}, [r]), u = F((e) => {
|
|
1165
1165
|
a(e);
|
|
@@ -1192,20 +1192,20 @@ function ai({ children: e, chatId: t }) {
|
|
|
1192
1192
|
u,
|
|
1193
1193
|
d
|
|
1194
1194
|
]);
|
|
1195
|
-
return /* @__PURE__ */ H(
|
|
1195
|
+
return /* @__PURE__ */ H(ri.Provider, {
|
|
1196
1196
|
value: f,
|
|
1197
1197
|
children: e
|
|
1198
1198
|
});
|
|
1199
1199
|
}
|
|
1200
1200
|
//#endregion
|
|
1201
1201
|
//#region src/contexts/chat-conversation-context/chat-conversation-context.tsx
|
|
1202
|
-
var
|
|
1203
|
-
function
|
|
1204
|
-
let e = I(
|
|
1202
|
+
var ai = 3, oi = 250, si = N(null);
|
|
1203
|
+
function ci() {
|
|
1204
|
+
let e = I(si);
|
|
1205
1205
|
if (!e) throw Error("\"useChatConversationContext\" must be used within a ChatConversationProvider");
|
|
1206
1206
|
return e;
|
|
1207
1207
|
}
|
|
1208
|
-
function
|
|
1208
|
+
function li({ children: e, chatId: t, debug: n = !1 }) {
|
|
1209
1209
|
let [r, i] = V(!0), [a, o] = V({
|
|
1210
1210
|
isAtBottom: !0,
|
|
1211
1211
|
isSmoothScroll: !1,
|
|
@@ -1213,8 +1213,8 @@ function ui({ children: e, chatId: t, debug: n = !1 }) {
|
|
|
1213
1213
|
isProgrammaticScroll: !1,
|
|
1214
1214
|
userScrollIntent: !1,
|
|
1215
1215
|
scrollStrategy: "lastItem"
|
|
1216
|
-
}), s = B(null), c = B(null), l = B(null), u = B(null), d = B(null), f = B(null), p = B(0), m = B(!0), h = B(!1), g = B(!1), _ = B(!1), v = B(!1), y = B(null), b = B(null), x = B("lastItem"), S = B(0),
|
|
1217
|
-
|
|
1216
|
+
}), s = B(null), c = B(null), l = B(null), u = B(null), d = B(null), f = B(null), p = B(0), m = B(!0), h = B(!1), g = B(!1), _ = B(!1), v = B(!1), y = B(null), b = B(null), x = B("lastItem"), S = B(0), C = B(() => {}), w = B(() => {}), ee = B(() => {}), T = B(() => {});
|
|
1217
|
+
T.current = F(() => {
|
|
1218
1218
|
n && o({
|
|
1219
1219
|
isAtBottom: m.current,
|
|
1220
1220
|
isSmoothScroll: h.current,
|
|
@@ -1224,33 +1224,33 @@ function ui({ children: e, chatId: t, debug: n = !1 }) {
|
|
|
1224
1224
|
scrollStrategy: x.current
|
|
1225
1225
|
});
|
|
1226
1226
|
}, [n]);
|
|
1227
|
-
let
|
|
1227
|
+
let E = F(() => {
|
|
1228
1228
|
u.current?.disconnect(), u.current = null;
|
|
1229
1229
|
}, []);
|
|
1230
|
-
|
|
1231
|
-
let
|
|
1230
|
+
ee.current = E;
|
|
1231
|
+
let te = F(() => {
|
|
1232
1232
|
f.current?.disconnect(), f.current = null;
|
|
1233
1233
|
}, []), ne = F(() => {
|
|
1234
1234
|
d.current?.disconnect(), d.current = null;
|
|
1235
1235
|
}, []), re = B(() => {}), D = F(() => {
|
|
1236
1236
|
requestAnimationFrame(() => {
|
|
1237
1237
|
requestAnimationFrame(() => {
|
|
1238
|
-
_.current = !1, re.current(),
|
|
1238
|
+
_.current = !1, re.current(), T.current();
|
|
1239
1239
|
});
|
|
1240
1240
|
});
|
|
1241
1241
|
}, []), ie = F(() => {
|
|
1242
|
-
y.current &&= (clearTimeout(y.current), null), v.current && (v.current = !1,
|
|
1242
|
+
y.current &&= (clearTimeout(y.current), null), v.current && (v.current = !1, T.current());
|
|
1243
1243
|
}, []), O = F(() => {
|
|
1244
1244
|
v.current = !0, y.current && clearTimeout(y.current), y.current = setTimeout(() => {
|
|
1245
|
-
y.current = null, v.current = !1,
|
|
1246
|
-
},
|
|
1245
|
+
y.current = null, v.current = !1, T.current();
|
|
1246
|
+
}, oi), T.current();
|
|
1247
1247
|
}, []), ae = F(() => {
|
|
1248
|
-
x.current = "lastItem",
|
|
1248
|
+
x.current = "lastItem", ee.current(), T.current();
|
|
1249
1249
|
}, []), k = F((e) => {
|
|
1250
|
-
g.current !== e && (g.current = e, e && re.current(),
|
|
1250
|
+
g.current !== e && (g.current = e, e && re.current(), T.current());
|
|
1251
1251
|
}, []), oe = F(() => {
|
|
1252
1252
|
if (g.current) return;
|
|
1253
|
-
_.current = !0,
|
|
1253
|
+
_.current = !0, T.current();
|
|
1254
1254
|
let e = h.current ? "smooth" : "instant";
|
|
1255
1255
|
h.current = !0, requestAnimationFrame(() => {
|
|
1256
1256
|
if (g.current) {
|
|
@@ -1264,28 +1264,28 @@ function ui({ children: e, chatId: t, debug: n = !1 }) {
|
|
|
1264
1264
|
}) : s.current?.scrollTo({
|
|
1265
1265
|
top: s.current.scrollHeight,
|
|
1266
1266
|
behavior: e
|
|
1267
|
-
}), D(),
|
|
1267
|
+
}), D(), T.current();
|
|
1268
1268
|
});
|
|
1269
1269
|
}, [D]);
|
|
1270
|
-
|
|
1271
|
-
let
|
|
1270
|
+
C.current = oe;
|
|
1271
|
+
let A = F(() => {
|
|
1272
1272
|
let e = s.current;
|
|
1273
1273
|
if (!e) return;
|
|
1274
1274
|
let t = e.scrollHeight;
|
|
1275
|
-
t - e.clientHeight - e.scrollTop <= 1 && t === S.current || (S.current = t, _.current = !0,
|
|
1275
|
+
t - e.clientHeight - e.scrollTop <= 1 && t === S.current || (S.current = t, _.current = !0, T.current(), requestAnimationFrame(() => {
|
|
1276
1276
|
e.scrollTo({
|
|
1277
1277
|
top: t,
|
|
1278
1278
|
behavior: "instant"
|
|
1279
|
-
}), S.current = e.scrollHeight, D(),
|
|
1279
|
+
}), S.current = e.scrollHeight, D(), T.current();
|
|
1280
1280
|
}));
|
|
1281
|
-
}, [D]),
|
|
1281
|
+
}, [D]), j = F(() => {
|
|
1282
1282
|
let e = s.current;
|
|
1283
1283
|
if (!e) return;
|
|
1284
1284
|
let t = e.scrollHeight - e.clientHeight - e.scrollTop <= 1;
|
|
1285
|
-
(t || g.current) && (m.current = t, i(t), x.current === "end" && t &&
|
|
1286
|
-
}, [
|
|
1287
|
-
re.current =
|
|
1288
|
-
let
|
|
1285
|
+
(t || g.current) && (m.current = t, i(t), x.current === "end" && t && A(), T.current());
|
|
1286
|
+
}, [A]);
|
|
1287
|
+
re.current = j;
|
|
1288
|
+
let se = F(() => {
|
|
1289
1289
|
ne();
|
|
1290
1290
|
let e = s.current;
|
|
1291
1291
|
if (!e) return;
|
|
@@ -1293,42 +1293,42 @@ function ui({ children: e, chatId: t, debug: n = !1 }) {
|
|
|
1293
1293
|
re.current();
|
|
1294
1294
|
});
|
|
1295
1295
|
t.observe(e), d.current = t;
|
|
1296
|
-
}, [ne]),
|
|
1297
|
-
if (
|
|
1296
|
+
}, [ne]), ce = F((e) => {
|
|
1297
|
+
if (E(), x.current !== "end") return;
|
|
1298
1298
|
let t = new ResizeObserver(() => {
|
|
1299
|
-
x.current === "end" &&
|
|
1299
|
+
x.current === "end" && A();
|
|
1300
1300
|
});
|
|
1301
1301
|
t.observe(e), u.current = t;
|
|
1302
|
-
}, [
|
|
1303
|
-
|
|
1302
|
+
}, [E, A]);
|
|
1303
|
+
w.current = ce;
|
|
1304
1304
|
let le = F(() => {
|
|
1305
1305
|
if (!v.current || x.current === "end") return;
|
|
1306
1306
|
x.current = "end", ie();
|
|
1307
1307
|
let e = l.current;
|
|
1308
|
-
e &&
|
|
1309
|
-
}, [ie]),
|
|
1308
|
+
e && w.current(e), T.current();
|
|
1309
|
+
}, [ie]), M = F((e) => {
|
|
1310
1310
|
if (!e && !g.current) {
|
|
1311
|
-
|
|
1311
|
+
T.current();
|
|
1312
1312
|
return;
|
|
1313
1313
|
}
|
|
1314
1314
|
if (m.current = e, i(e), _.current) {
|
|
1315
|
-
|
|
1315
|
+
T.current();
|
|
1316
1316
|
return;
|
|
1317
1317
|
}
|
|
1318
|
-
e && (k(!1), le()),
|
|
1319
|
-
}, [le, k]),
|
|
1318
|
+
e && (k(!1), le()), T.current();
|
|
1319
|
+
}, [le, k]), ue = F((e) => {
|
|
1320
1320
|
if (e.target !== s.current) return;
|
|
1321
1321
|
let t = e.target, n = b.current ?? t.scrollTop, r = t.scrollTop;
|
|
1322
1322
|
if (b.current = r, _.current || !v.current) return;
|
|
1323
1323
|
let i = r < n;
|
|
1324
1324
|
if (t.scrollHeight - t.clientHeight - r <= 1) {
|
|
1325
|
-
x.current !== "end" &&
|
|
1325
|
+
x.current !== "end" && M(!0);
|
|
1326
1326
|
return;
|
|
1327
1327
|
}
|
|
1328
1328
|
i && (k(!0), ae());
|
|
1329
1329
|
}, [
|
|
1330
1330
|
ae,
|
|
1331
|
-
|
|
1331
|
+
M,
|
|
1332
1332
|
k
|
|
1333
1333
|
]), de = F((e) => {
|
|
1334
1334
|
let t = s.current;
|
|
@@ -1341,91 +1341,91 @@ function ui({ children: e, chatId: t, debug: n = !1 }) {
|
|
|
1341
1341
|
O();
|
|
1342
1342
|
}, [O]), pe = F(() => {
|
|
1343
1343
|
O();
|
|
1344
|
-
}, [O]),
|
|
1345
|
-
|
|
1344
|
+
}, [O]), N = F(() => {
|
|
1345
|
+
te();
|
|
1346
1346
|
let e = s.current, t = c.current;
|
|
1347
1347
|
if (!e || !t) return;
|
|
1348
1348
|
let n = new IntersectionObserver(([e]) => {
|
|
1349
|
-
e &&
|
|
1349
|
+
e && M(e.isIntersecting);
|
|
1350
1350
|
}, {
|
|
1351
1351
|
root: e,
|
|
1352
1352
|
threshold: 0
|
|
1353
1353
|
});
|
|
1354
1354
|
n.observe(t), f.current = n;
|
|
1355
|
-
}, [
|
|
1356
|
-
s.current && (s.current.removeEventListener("scroll",
|
|
1355
|
+
}, [te, M]), P = F((e) => {
|
|
1356
|
+
s.current && (s.current.removeEventListener("scroll", ue), s.current.removeEventListener("wheel", de), s.current.removeEventListener("touchstart", fe), s.current.removeEventListener("pointerdown", pe), ne()), s.current = e, e ? (b.current = e.scrollTop, S.current = e.scrollHeight, e.addEventListener("scroll", ue, { passive: !0 }), e.addEventListener("wheel", de, { passive: !0 }), e.addEventListener("touchstart", fe, { passive: !0 }), e.addEventListener("pointerdown", pe), N(), se(), j()) : (ie(), te(), ne());
|
|
1357
1357
|
}, [
|
|
1358
|
-
|
|
1359
|
-
|
|
1358
|
+
N,
|
|
1359
|
+
se,
|
|
1360
1360
|
ie,
|
|
1361
|
-
|
|
1361
|
+
te,
|
|
1362
1362
|
ne,
|
|
1363
1363
|
pe,
|
|
1364
|
-
|
|
1364
|
+
ue,
|
|
1365
1365
|
fe,
|
|
1366
1366
|
de,
|
|
1367
|
-
|
|
1368
|
-
]),
|
|
1369
|
-
c.current = e, e ?
|
|
1370
|
-
}, [
|
|
1367
|
+
j
|
|
1368
|
+
]), me = F((e) => {
|
|
1369
|
+
c.current = e, e ? N() : te();
|
|
1370
|
+
}, [N, te]), he = F((e) => {
|
|
1371
1371
|
let t = l.current;
|
|
1372
1372
|
if (e === null) {
|
|
1373
|
-
|
|
1373
|
+
E(), l.current = null, T.current();
|
|
1374
1374
|
return;
|
|
1375
1375
|
}
|
|
1376
1376
|
if (e === t) {
|
|
1377
|
-
x.current === "end" &&
|
|
1377
|
+
x.current === "end" && ce(e);
|
|
1378
1378
|
return;
|
|
1379
1379
|
}
|
|
1380
|
-
|
|
1380
|
+
E(), l.current = e, k(!1), m.current = !0, i(!0), x.current = "lastItem", e && ce(e), T.current();
|
|
1381
1381
|
}, [
|
|
1382
|
-
|
|
1383
|
-
|
|
1382
|
+
ce,
|
|
1383
|
+
E,
|
|
1384
1384
|
k
|
|
1385
|
-
]),
|
|
1386
|
-
if (p.current = e, e <
|
|
1385
|
+
]), I = F((e) => {
|
|
1386
|
+
if (p.current = e, e < ai) x.current = "lastItem", E();
|
|
1387
1387
|
else if (x.current === "end") {
|
|
1388
1388
|
let e = l.current;
|
|
1389
|
-
e &&
|
|
1389
|
+
e && ce(e);
|
|
1390
1390
|
}
|
|
1391
|
-
|
|
1392
|
-
}, [
|
|
1393
|
-
k(!1), p.current <
|
|
1394
|
-
}, [
|
|
1395
|
-
|
|
1391
|
+
T.current();
|
|
1392
|
+
}, [ce, E]), L = F(() => {
|
|
1393
|
+
k(!1), p.current < ai && (x.current = "lastItem", E()), T.current();
|
|
1394
|
+
}, [E, k]), ge = F(() => {
|
|
1395
|
+
L(), O(), le(), _.current = !0, T.current();
|
|
1396
1396
|
let e = h.current ? "smooth" : "instant";
|
|
1397
1397
|
h.current = !0, requestAnimationFrame(() => {
|
|
1398
1398
|
s.current?.scrollTo({
|
|
1399
1399
|
top: s.current.scrollHeight,
|
|
1400
1400
|
behavior: e
|
|
1401
|
-
}), D(),
|
|
1401
|
+
}), D(), T.current();
|
|
1402
1402
|
});
|
|
1403
1403
|
}, [
|
|
1404
1404
|
le,
|
|
1405
1405
|
D,
|
|
1406
1406
|
O,
|
|
1407
|
-
|
|
1408
|
-
]),
|
|
1407
|
+
L
|
|
1408
|
+
]), R = F(() => {
|
|
1409
1409
|
oe();
|
|
1410
|
-
}, [oe]),
|
|
1411
|
-
viewportRef:
|
|
1412
|
-
bottomTriggerRef:
|
|
1410
|
+
}, [oe]), _e = z(() => ({
|
|
1411
|
+
viewportRef: P,
|
|
1412
|
+
bottomTriggerRef: me,
|
|
1413
1413
|
lastItemRef: he,
|
|
1414
1414
|
isAtBottom: r,
|
|
1415
|
-
setMessageCount:
|
|
1416
|
-
scrollBottom:
|
|
1417
|
-
scrollToLatest:
|
|
1415
|
+
setMessageCount: I,
|
|
1416
|
+
scrollBottom: ge,
|
|
1417
|
+
scrollToLatest: R
|
|
1418
1418
|
}), [
|
|
1419
|
-
N,
|
|
1420
1419
|
P,
|
|
1420
|
+
me,
|
|
1421
1421
|
he,
|
|
1422
1422
|
r,
|
|
1423
|
+
I,
|
|
1423
1424
|
ge,
|
|
1424
|
-
|
|
1425
|
-
_e
|
|
1425
|
+
R
|
|
1426
1426
|
]);
|
|
1427
|
-
return /* @__PURE__ */ U(
|
|
1428
|
-
value:
|
|
1427
|
+
return /* @__PURE__ */ U(si.Provider, {
|
|
1428
|
+
value: _e,
|
|
1429
1429
|
children: [n && /* @__PURE__ */ H("code", {
|
|
1430
1430
|
className: "absolute top-0 left-0 z-50 w-full bg-red-500/90 p-8 text-white pointer-events-none",
|
|
1431
1431
|
children: JSON.stringify(a, null, 2)
|
|
@@ -1434,17 +1434,17 @@ function ui({ children: e, chatId: t, debug: n = !1 }) {
|
|
|
1434
1434
|
}
|
|
1435
1435
|
//#endregion
|
|
1436
1436
|
//#region src/components/chat-messages/chat-messages.tsx
|
|
1437
|
-
var
|
|
1438
|
-
function
|
|
1439
|
-
let e = I(
|
|
1437
|
+
var ui = N(null), di = N(!1);
|
|
1438
|
+
function fi() {
|
|
1439
|
+
let e = I(ui);
|
|
1440
1440
|
if (!e) throw Error("\"ChatMessagesList\" must be used within a ChatMessages");
|
|
1441
1441
|
return e;
|
|
1442
1442
|
}
|
|
1443
|
-
function
|
|
1444
|
-
let { setMessageCount: i } =
|
|
1443
|
+
function pi({ children: e, className: t, messageCount: n = 0, gap: r = 16 }) {
|
|
1444
|
+
let { setMessageCount: i } = ci(), a = z(() => ({ messageCount: n }), [n]);
|
|
1445
1445
|
return R(() => {
|
|
1446
1446
|
i(n);
|
|
1447
|
-
}, [n, i]), /* @__PURE__ */ H(
|
|
1447
|
+
}, [n, i]), /* @__PURE__ */ H(ui.Provider, {
|
|
1448
1448
|
value: a,
|
|
1449
1449
|
children: /* @__PURE__ */ H("div", {
|
|
1450
1450
|
"data-slot": "chat-messages",
|
|
@@ -1455,14 +1455,14 @@ function mi({ children: e, className: t, messageCount: n = 0, gap: r = 16 }) {
|
|
|
1455
1455
|
})
|
|
1456
1456
|
});
|
|
1457
1457
|
}
|
|
1458
|
-
function
|
|
1459
|
-
let { viewportRef: a, bottomTriggerRef: o, scrollToLatest: s } =
|
|
1458
|
+
function mi({ children: e, className: t, scrollAreaClassName: n, viewportClassName: r, bottomTriggerClassName: i }) {
|
|
1459
|
+
let { viewportRef: a, bottomTriggerRef: o, scrollToLatest: s } = ci(), { messageCount: c } = fi(), l = z(() => Array.from({ length: c }, (e, t) => t), [c]), u = c - 1;
|
|
1460
1460
|
return R(() => {
|
|
1461
1461
|
s();
|
|
1462
|
-
}, [c, s]), /* @__PURE__ */ U(
|
|
1462
|
+
}, [c, s]), /* @__PURE__ */ U(mt.Root, {
|
|
1463
1463
|
"data-slot": "chat-messages-scroll-area",
|
|
1464
1464
|
className: M("min-h-0 flex-1", "relative group/scroll-area", "overflow-y-hidden", "transform-gpu", n),
|
|
1465
|
-
children: [/* @__PURE__ */ H(
|
|
1465
|
+
children: [/* @__PURE__ */ H(mt.Viewport, {
|
|
1466
1466
|
ref: a,
|
|
1467
1467
|
"data-slot": "chat-messages-viewport",
|
|
1468
1468
|
className: M("@container-[size]", "will-change-scroll h-full w-full", r),
|
|
@@ -1474,7 +1474,7 @@ function hi({ children: e, className: t, scrollAreaClassName: n, viewportClassNa
|
|
|
1474
1474
|
"aria-label": "Message list",
|
|
1475
1475
|
"aria-atomic": "false",
|
|
1476
1476
|
className: M("m-0 flex flex-col gap-(--chat-messages-gap) p-0", t),
|
|
1477
|
-
children: [l.map((t) => /* @__PURE__ */ H(
|
|
1477
|
+
children: [l.map((t) => /* @__PURE__ */ H(hi, {
|
|
1478
1478
|
index: t,
|
|
1479
1479
|
isLast: t === u,
|
|
1480
1480
|
children: e
|
|
@@ -1485,20 +1485,20 @@ function hi({ children: e, className: t, scrollAreaClassName: n, viewportClassNa
|
|
|
1485
1485
|
"aria-hidden": "true"
|
|
1486
1486
|
})]
|
|
1487
1487
|
})
|
|
1488
|
-
}), /* @__PURE__ */ H(
|
|
1488
|
+
}), /* @__PURE__ */ H(_i, { orientation: "vertical" })]
|
|
1489
1489
|
});
|
|
1490
1490
|
}
|
|
1491
|
-
var
|
|
1491
|
+
var hi = he(function({ children: e, index: t, isLast: n }) {
|
|
1492
1492
|
return /* @__PURE__ */ H("li", {
|
|
1493
1493
|
"data-slot": "chat-messages-row",
|
|
1494
|
-
children: /* @__PURE__ */ H(
|
|
1494
|
+
children: /* @__PURE__ */ H(di.Provider, {
|
|
1495
1495
|
value: n,
|
|
1496
1496
|
children: e(t)
|
|
1497
1497
|
})
|
|
1498
1498
|
});
|
|
1499
1499
|
});
|
|
1500
|
-
function
|
|
1501
|
-
let r = I(
|
|
1500
|
+
function gi({ children: e, className: t, ...n }) {
|
|
1501
|
+
let r = I(di), { lastItemRef: i } = ci();
|
|
1502
1502
|
return /* @__PURE__ */ H("div", {
|
|
1503
1503
|
ref: r ? i : void 0,
|
|
1504
1504
|
"data-slot": "chat-message-list-group",
|
|
@@ -1508,27 +1508,27 @@ function _i({ children: e, className: t, ...n }) {
|
|
|
1508
1508
|
children: e
|
|
1509
1509
|
});
|
|
1510
1510
|
}
|
|
1511
|
-
function
|
|
1512
|
-
return /* @__PURE__ */ H(
|
|
1511
|
+
function _i({ className: e, orientation: t = "vertical", ...n }) {
|
|
1512
|
+
return /* @__PURE__ */ H(mt.ScrollAreaScrollbar, {
|
|
1513
1513
|
"data-slot": "scroll-area-scrollbar",
|
|
1514
1514
|
orientation: t,
|
|
1515
1515
|
className: M("opacity-0 group-hover/scroll-area:opacity-100", "rounded-[8px]", "bg-scrollbar-track hover:bg-scrollbar-track-hover", "transition-opacity duration-200 ease-in-out", "flextouch-none select-none transition-colors", t === "vertical" && "h-full w-scrollbar border-l border-l-transparent px-4 py-[12px]", t === "horizontal" && "h-scrollbar w-full border-t border-t-transparent px-[12px] py-4", e),
|
|
1516
1516
|
...n,
|
|
1517
|
-
children: /* @__PURE__ */ H(
|
|
1517
|
+
children: /* @__PURE__ */ H(mt.ScrollAreaThumb, {
|
|
1518
1518
|
"data-slot": "scroll-area-thumb",
|
|
1519
1519
|
className: M("relative flex-1 rounded-full", "bg-scrollbar-thumb hover:bg-scrollbar-thumb-hover", t === "vertical" && "w-scrollbar-thumb!", t === "horizontal" && "h-scrollbar-thumb!")
|
|
1520
1520
|
})
|
|
1521
1521
|
});
|
|
1522
1522
|
}
|
|
1523
|
-
var
|
|
1524
|
-
let { isAtBottom: i, scrollBottom: a } =
|
|
1523
|
+
var vi = he(function({ className: e, buttonClassName: t, tooltip: n, children: r }) {
|
|
1524
|
+
let { isAtBottom: i, scrollBottom: a } = ci();
|
|
1525
1525
|
return /* @__PURE__ */ H("div", {
|
|
1526
1526
|
"data-slot": "chat-messages-scroll-button",
|
|
1527
1527
|
"data-testid": "chat-message-history-scroll-button",
|
|
1528
1528
|
"data-hidden": i,
|
|
1529
1529
|
"aria-hidden": i ? !0 : void 0,
|
|
1530
1530
|
className: M("absolute", "px-[12px]", "bottom-0", "right-0 -translate-x-[12px]", "md:right-auto md:left-1/2 md:-translate-x-1/2", "-translate-y-[12px]", "flex items-center justify-center", "transition-opacity duration-200 ease-in-out", "data-[hidden=true]:pointer-events-none", "data-[hidden=true]:opacity-0 data-[hidden=false]:opacity-100", e),
|
|
1531
|
-
children: /* @__PURE__ */ H(
|
|
1531
|
+
children: /* @__PURE__ */ H(A, {
|
|
1532
1532
|
tooltip: n,
|
|
1533
1533
|
side: "top",
|
|
1534
1534
|
children: /* @__PURE__ */ H(f, {
|
|
@@ -1538,14 +1538,14 @@ var yi = ge(function({ className: e, buttonClassName: t, tooltip: n, children: r
|
|
|
1538
1538
|
onClick: () => a(),
|
|
1539
1539
|
tabIndex: -1,
|
|
1540
1540
|
"aria-label": n,
|
|
1541
|
-
children: r || /* @__PURE__ */ H(
|
|
1541
|
+
children: r || /* @__PURE__ */ H(_t, {})
|
|
1542
1542
|
})
|
|
1543
1543
|
})
|
|
1544
1544
|
});
|
|
1545
1545
|
});
|
|
1546
1546
|
//#endregion
|
|
1547
1547
|
//#region src/components/chat-message-attachment-card/chat-message-attachment-card.tsx
|
|
1548
|
-
function
|
|
1548
|
+
function yi({ className: e, children: t, isPreview: n, isInteractive: r = !0 }) {
|
|
1549
1549
|
return /* @__PURE__ */ H("div", {
|
|
1550
1550
|
role: "group",
|
|
1551
1551
|
"data-slot": "chat-message-attachment-card",
|
|
@@ -1556,7 +1556,7 @@ function bi({ className: e, children: t, isPreview: n, isInteractive: r = !0 })
|
|
|
1556
1556
|
children: t
|
|
1557
1557
|
});
|
|
1558
1558
|
}
|
|
1559
|
-
function
|
|
1559
|
+
function bi({ className: e, children: t }) {
|
|
1560
1560
|
return /* @__PURE__ */ H("div", {
|
|
1561
1561
|
"data-slot": "chat-message-attachment-card-content",
|
|
1562
1562
|
"data-testid": "chat-message-attachment-card-content",
|
|
@@ -1564,8 +1564,8 @@ function xi({ className: e, children: t }) {
|
|
|
1564
1564
|
children: t
|
|
1565
1565
|
});
|
|
1566
1566
|
}
|
|
1567
|
-
function
|
|
1568
|
-
return /* @__PURE__ */ H(
|
|
1567
|
+
function xi({ className: e, children: t }) {
|
|
1568
|
+
return /* @__PURE__ */ H(j, {
|
|
1569
1569
|
variant: "body-sm",
|
|
1570
1570
|
"data-slot": "chat-message-attachment-card-title",
|
|
1571
1571
|
"data-testid": "chat-message-attachment-card-title",
|
|
@@ -1573,7 +1573,7 @@ function Si({ className: e, children: t }) {
|
|
|
1573
1573
|
children: t
|
|
1574
1574
|
});
|
|
1575
1575
|
}
|
|
1576
|
-
function
|
|
1576
|
+
function Si({ className: e, imageClassName: t, previewSrc: n }) {
|
|
1577
1577
|
return /* @__PURE__ */ H("figure", {
|
|
1578
1578
|
"data-slot": "chat-message-attachment-card-preview",
|
|
1579
1579
|
"data-testid": "chat-message-attachment-card-preview",
|
|
@@ -1586,7 +1586,7 @@ function Ci({ className: e, imageClassName: t, previewSrc: n }) {
|
|
|
1586
1586
|
})
|
|
1587
1587
|
});
|
|
1588
1588
|
}
|
|
1589
|
-
function
|
|
1589
|
+
function Ci({ className: e, buttonClassName: t, onDelete: n }) {
|
|
1590
1590
|
return /* @__PURE__ */ H("div", {
|
|
1591
1591
|
role: "group",
|
|
1592
1592
|
"data-slot": "chat-message-attachment-card-actions",
|
|
@@ -1598,40 +1598,40 @@ function wi({ className: e, buttonClassName: t, onDelete: n }) {
|
|
|
1598
1598
|
onClick: n,
|
|
1599
1599
|
size: "xs",
|
|
1600
1600
|
className: M("size-[24px]", "text-icon-button-tertiary-icon", t),
|
|
1601
|
-
children: /* @__PURE__ */ H(
|
|
1601
|
+
children: /* @__PURE__ */ H(yt, {})
|
|
1602
1602
|
})
|
|
1603
1603
|
});
|
|
1604
1604
|
}
|
|
1605
1605
|
//#endregion
|
|
1606
1606
|
//#region src/components/chat-message-attachment-card/chat-message-attachment-card-icon.tsx
|
|
1607
|
-
var
|
|
1607
|
+
var wi = {
|
|
1608
1608
|
spreadsheet: {
|
|
1609
|
-
component:
|
|
1609
|
+
component: Ht,
|
|
1610
1610
|
className: "bg-data-d"
|
|
1611
1611
|
},
|
|
1612
1612
|
pdf: {
|
|
1613
|
-
component:
|
|
1613
|
+
component: Lt,
|
|
1614
1614
|
className: "bg-data-a"
|
|
1615
1615
|
},
|
|
1616
1616
|
presentation: {
|
|
1617
|
-
component:
|
|
1617
|
+
component: Rt,
|
|
1618
1618
|
className: "bg-data-e"
|
|
1619
1619
|
},
|
|
1620
1620
|
document: {
|
|
1621
|
-
component:
|
|
1621
|
+
component: St,
|
|
1622
1622
|
className: "bg-data-c"
|
|
1623
1623
|
},
|
|
1624
1624
|
code: {
|
|
1625
|
-
component:
|
|
1625
|
+
component: bt,
|
|
1626
1626
|
className: "bg-data-f"
|
|
1627
1627
|
},
|
|
1628
1628
|
unknown: {
|
|
1629
|
-
component:
|
|
1629
|
+
component: Ct,
|
|
1630
1630
|
className: "bg-data-f"
|
|
1631
1631
|
}
|
|
1632
1632
|
};
|
|
1633
|
-
function
|
|
1634
|
-
let { component: r, className: i } =
|
|
1633
|
+
function Ti({ icon: e, className: t, ...n }) {
|
|
1634
|
+
let { component: r, className: i } = wi[e];
|
|
1635
1635
|
return /* @__PURE__ */ H("span", {
|
|
1636
1636
|
"data-slot": "chat-message-attachment-card-icon",
|
|
1637
1637
|
"data-testid": "chat-attachment-icon",
|
|
@@ -1642,7 +1642,7 @@ function Ei({ icon: e, className: t, ...n }) {
|
|
|
1642
1642
|
}
|
|
1643
1643
|
//#endregion
|
|
1644
1644
|
//#region src/components/chat-message-attachment-card/utils.ts
|
|
1645
|
-
var
|
|
1645
|
+
var Ei = {
|
|
1646
1646
|
"application/pdf": "pdf",
|
|
1647
1647
|
"application/vnd.ms-excel": "spreadsheet",
|
|
1648
1648
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "spreadsheet",
|
|
@@ -1655,29 +1655,29 @@ var Di = {
|
|
|
1655
1655
|
"application/rtf": "document",
|
|
1656
1656
|
"application/vnd.oasis.opendocument.text": "document"
|
|
1657
1657
|
};
|
|
1658
|
-
function
|
|
1659
|
-
let t =
|
|
1660
|
-
return t ? t in
|
|
1658
|
+
function Di(e) {
|
|
1659
|
+
let t = Ut.getType(e.name);
|
|
1660
|
+
return t ? t in Ei ? Ei[t] : t.startsWith("text/") || t.includes("javascript") || t.includes("json") ? "code" : "unknown" : "unknown";
|
|
1661
1661
|
}
|
|
1662
1662
|
//#endregion
|
|
1663
1663
|
//#region src/components/markdown-viewer/utils.ts
|
|
1664
|
-
function
|
|
1664
|
+
function Oi(e) {
|
|
1665
1665
|
return e.startsWith("swi-");
|
|
1666
1666
|
}
|
|
1667
1667
|
//#endregion
|
|
1668
1668
|
//#region src/components/markdown-viewer/hooks.ts
|
|
1669
|
-
function
|
|
1670
|
-
let t = z(() => Object.keys(e).filter((e) =>
|
|
1669
|
+
function ki({ customComponents: e }) {
|
|
1670
|
+
let t = z(() => Object.keys(e).filter((e) => Oi(e) ? !0 : (console.warn(`[MarkdownViewer] Invalid custom component tag: ${e}`), !1)), [e]);
|
|
1671
1671
|
return {
|
|
1672
1672
|
components: e,
|
|
1673
|
-
remarkPlugins: z(() => [...Object.values(
|
|
1674
|
-
rehypePlugins: z(() => [...Object.values(
|
|
1675
|
-
...
|
|
1676
|
-
tagNames: [...
|
|
1673
|
+
remarkPlugins: z(() => [...Object.values(Kt)], []),
|
|
1674
|
+
rehypePlugins: z(() => [...Object.values(Gt), [qt, {
|
|
1675
|
+
...Jt,
|
|
1676
|
+
tagNames: [...Jt?.tagNames || [], ...t],
|
|
1677
1677
|
protocols: {
|
|
1678
|
-
...
|
|
1678
|
+
...Jt?.protocols,
|
|
1679
1679
|
href: [
|
|
1680
|
-
...
|
|
1680
|
+
...Jt?.protocols?.href ?? [],
|
|
1681
1681
|
"swisper",
|
|
1682
1682
|
"swisper://"
|
|
1683
1683
|
]
|
|
@@ -1687,9 +1687,9 @@ function Ai({ customComponents: e }) {
|
|
|
1687
1687
|
}
|
|
1688
1688
|
//#endregion
|
|
1689
1689
|
//#region src/components/markdown-viewer/markdown-viewer.tsx
|
|
1690
|
-
function
|
|
1691
|
-
let { components: a, remarkPlugins: o, rehypePlugins: s } =
|
|
1692
|
-
return /* @__PURE__ */ H(
|
|
1690
|
+
function Ai({ markdown: e, className: t, isStreaming: n = !1, hasCaret: r = !1, customComponents: i = {} }) {
|
|
1691
|
+
let { components: a, remarkPlugins: o, rehypePlugins: s } = ki({ customComponents: i });
|
|
1692
|
+
return /* @__PURE__ */ H(Wt, {
|
|
1693
1693
|
className: t,
|
|
1694
1694
|
caret: r ? "block" : void 0,
|
|
1695
1695
|
isAnimating: n,
|
|
@@ -1699,13 +1699,13 @@ function ji({ markdown: e, className: t, isStreaming: n = !1, hasCaret: r = !1,
|
|
|
1699
1699
|
linkSafety: { enabled: !1 },
|
|
1700
1700
|
remend: { handlers: [{
|
|
1701
1701
|
name: "swi-tag-filter",
|
|
1702
|
-
handle:
|
|
1702
|
+
handle: ji,
|
|
1703
1703
|
priority: 0
|
|
1704
1704
|
}] },
|
|
1705
1705
|
children: e
|
|
1706
1706
|
});
|
|
1707
1707
|
}
|
|
1708
|
-
function
|
|
1708
|
+
function ji(e, t = "|") {
|
|
1709
1709
|
let [n, r] = /<swi-(\w+)([^>]*)$/gm.exec(e) ?? [];
|
|
1710
1710
|
if (e.endsWith("<swi-")) return e + ">";
|
|
1711
1711
|
if (n) return e.replace(n, `<swi-${r}>`);
|
|
@@ -1726,9 +1726,9 @@ function Mi(e, t = "|") {
|
|
|
1726
1726
|
}
|
|
1727
1727
|
//#endregion
|
|
1728
1728
|
//#region src/components/chat-message-response/chat-message-response.tsx
|
|
1729
|
-
function
|
|
1729
|
+
function Mi({ message: e, isStreaming: t }) {
|
|
1730
1730
|
let n = z(() => ({}), []);
|
|
1731
|
-
return /* @__PURE__ */ H(
|
|
1731
|
+
return /* @__PURE__ */ H(Ai, {
|
|
1732
1732
|
hasCaret: !1,
|
|
1733
1733
|
markdown: e,
|
|
1734
1734
|
isStreaming: t,
|
|
@@ -1737,7 +1737,7 @@ function Ni({ message: e, isStreaming: t }) {
|
|
|
1737
1737
|
}
|
|
1738
1738
|
//#endregion
|
|
1739
1739
|
//#region src/components/chat-message-toolbar/chat-message-toolbar.tsx
|
|
1740
|
-
function
|
|
1740
|
+
function Ni({ children: e, className: t, reverse: n = !1, ...r }) {
|
|
1741
1741
|
return /* @__PURE__ */ H("div", {
|
|
1742
1742
|
"data-slot": "chat-message-toolbar",
|
|
1743
1743
|
"data-testid": "chat-message-toolbar",
|
|
@@ -1747,7 +1747,7 @@ function Pi({ children: e, className: t, reverse: n = !1, ...r }) {
|
|
|
1747
1747
|
children: e
|
|
1748
1748
|
});
|
|
1749
1749
|
}
|
|
1750
|
-
function
|
|
1750
|
+
function Pi({ children: e, className: t, ...n }) {
|
|
1751
1751
|
return /* @__PURE__ */ H("div", {
|
|
1752
1752
|
"data-slot": "chat-message-toolbar-actions",
|
|
1753
1753
|
"data-testid": "chat-message-toolbar-actions",
|
|
@@ -1757,7 +1757,7 @@ function Fi({ children: e, className: t, ...n }) {
|
|
|
1757
1757
|
children: e
|
|
1758
1758
|
});
|
|
1759
1759
|
}
|
|
1760
|
-
var
|
|
1760
|
+
var Fi = P(function({ children: e, className: t, tooltip: n, ...r }, i) {
|
|
1761
1761
|
let a = /* @__PURE__ */ H(f, {
|
|
1762
1762
|
ref: i,
|
|
1763
1763
|
variant: "tertiary",
|
|
@@ -1768,13 +1768,13 @@ var Ii = P(function({ children: e, className: t, tooltip: n, ...r }, i) {
|
|
|
1768
1768
|
...r,
|
|
1769
1769
|
children: e
|
|
1770
1770
|
});
|
|
1771
|
-
return n ? /* @__PURE__ */ H(
|
|
1771
|
+
return n ? /* @__PURE__ */ H(A, {
|
|
1772
1772
|
tooltip: n,
|
|
1773
1773
|
children: a
|
|
1774
1774
|
}) : a;
|
|
1775
1775
|
});
|
|
1776
|
-
|
|
1777
|
-
function
|
|
1776
|
+
Fi.displayName = "ChatMessageToolbarActionButton";
|
|
1777
|
+
function Ii({ className: e, children: t, ...n }) {
|
|
1778
1778
|
return /* @__PURE__ */ H("div", {
|
|
1779
1779
|
"data-slot": "chat-message-toolbar-timestamp",
|
|
1780
1780
|
className: M("text-action-active", e),
|
|
@@ -1784,26 +1784,26 @@ function Li({ className: e, children: t, ...n }) {
|
|
|
1784
1784
|
}
|
|
1785
1785
|
//#endregion
|
|
1786
1786
|
//#region src/components/chat-notification-card/utils.ts
|
|
1787
|
-
function
|
|
1787
|
+
function Li(e) {
|
|
1788
1788
|
return new Date(Date.now() + e * 60 * 1e3);
|
|
1789
1789
|
}
|
|
1790
|
-
var
|
|
1791
|
-
function
|
|
1790
|
+
var Ri = 60, zi = 1440, Bi = 6e4;
|
|
1791
|
+
function Vi(e, t) {
|
|
1792
1792
|
return `${e} ${t}${e === 1 ? "" : "s"}`;
|
|
1793
1793
|
}
|
|
1794
|
-
function
|
|
1795
|
-
let r = Math.max(0, Math.ceil((e.getTime() - n.getTime()) /
|
|
1796
|
-
return i > 0 && s.push(
|
|
1794
|
+
function Hi(e, t = "in", n = /* @__PURE__ */ new Date()) {
|
|
1795
|
+
let r = Math.max(0, Math.ceil((e.getTime() - n.getTime()) / Bi)), i = Math.floor(r / zi), a = Math.floor(r % zi / Ri), o = r % Ri, s = [];
|
|
1796
|
+
return i > 0 && s.push(Vi(i, "day")), a > 0 && s.push(Vi(a, "hour")), s.push(Vi(o, "minute")), [t, ...s].filter(Boolean).join(" ");
|
|
1797
1797
|
}
|
|
1798
1798
|
//#endregion
|
|
1799
1799
|
//#region src/components/chat-notification-card/chat-notification-card.tsx
|
|
1800
|
-
var
|
|
1801
|
-
function
|
|
1802
|
-
let e = I(
|
|
1800
|
+
var Ui = N(null);
|
|
1801
|
+
function Wi() {
|
|
1802
|
+
let e = I(Ui);
|
|
1803
1803
|
if (!e) throw Error("\"useChatNotificationCardContext\" must be used within a ChatNotificationCard");
|
|
1804
1804
|
return e;
|
|
1805
1805
|
}
|
|
1806
|
-
function
|
|
1806
|
+
function Gi({ children: e, variant: t = "default", className: n, overlayClassName: r, defaultExpanded: i = !1, expanded: a, onExpandedChange: o, onClick: s }) {
|
|
1807
1807
|
let [c, l] = V(i), u = a ?? c, d = F((e) => {
|
|
1808
1808
|
a === void 0 && l(e), o?.(e);
|
|
1809
1809
|
}, [a, o]), f = F(() => {
|
|
@@ -1817,7 +1817,7 @@ function Ki({ children: e, variant: t = "default", className: n, overlayClassNam
|
|
|
1817
1817
|
d,
|
|
1818
1818
|
f
|
|
1819
1819
|
]);
|
|
1820
|
-
return /* @__PURE__ */ H(
|
|
1820
|
+
return /* @__PURE__ */ H(Ui.Provider, {
|
|
1821
1821
|
value: p,
|
|
1822
1822
|
children: /* @__PURE__ */ U("div", {
|
|
1823
1823
|
role: "alert",
|
|
@@ -1835,7 +1835,7 @@ function Ki({ children: e, variant: t = "default", className: n, overlayClassNam
|
|
|
1835
1835
|
})
|
|
1836
1836
|
});
|
|
1837
1837
|
}
|
|
1838
|
-
function
|
|
1838
|
+
function Ki({ children: e, className: t }) {
|
|
1839
1839
|
return /* @__PURE__ */ H("header", {
|
|
1840
1840
|
"data-slot": "chat-notification-card-head",
|
|
1841
1841
|
"data-testid": "chat-notification-card-head",
|
|
@@ -1843,7 +1843,7 @@ function qi({ children: e, className: t }) {
|
|
|
1843
1843
|
children: e
|
|
1844
1844
|
});
|
|
1845
1845
|
}
|
|
1846
|
-
function
|
|
1846
|
+
function qi({ children: e, className: t }) {
|
|
1847
1847
|
return /* @__PURE__ */ H("div", {
|
|
1848
1848
|
"data-slot": "chat-notification-card-header",
|
|
1849
1849
|
"data-testid": "chat-notification-card-header",
|
|
@@ -1851,7 +1851,7 @@ function Ji({ children: e, className: t }) {
|
|
|
1851
1851
|
children: e
|
|
1852
1852
|
});
|
|
1853
1853
|
}
|
|
1854
|
-
function
|
|
1854
|
+
function Ji({ children: e, className: t }) {
|
|
1855
1855
|
return /* @__PURE__ */ H("div", {
|
|
1856
1856
|
"data-slot": "chat-notification-card-header-icon",
|
|
1857
1857
|
"data-testid": "chat-notification-card-header-icon",
|
|
@@ -1859,7 +1859,7 @@ function Yi({ children: e, className: t }) {
|
|
|
1859
1859
|
children: e
|
|
1860
1860
|
});
|
|
1861
1861
|
}
|
|
1862
|
-
function
|
|
1862
|
+
function Yi({ children: e, className: t }) {
|
|
1863
1863
|
return /* @__PURE__ */ H("div", {
|
|
1864
1864
|
"data-slot": "chat-notification-card-header-title",
|
|
1865
1865
|
"data-testid": "chat-notification-card-header-title",
|
|
@@ -1867,8 +1867,8 @@ function Xi({ children: e, className: t }) {
|
|
|
1867
1867
|
children: e
|
|
1868
1868
|
});
|
|
1869
1869
|
}
|
|
1870
|
-
function
|
|
1871
|
-
return /* @__PURE__ */ H(
|
|
1870
|
+
function Xi({ children: e, className: t }) {
|
|
1871
|
+
return /* @__PURE__ */ H(j, {
|
|
1872
1872
|
variant: "body-sm",
|
|
1873
1873
|
fontWeight: "semibold",
|
|
1874
1874
|
"data-slot": "chat-notification-card-header-title-label",
|
|
@@ -1878,13 +1878,13 @@ function Zi({ children: e, className: t }) {
|
|
|
1878
1878
|
children: /* @__PURE__ */ H("span", { children: e })
|
|
1879
1879
|
});
|
|
1880
1880
|
}
|
|
1881
|
-
var
|
|
1881
|
+
var Zi = {
|
|
1882
1882
|
low: "info",
|
|
1883
1883
|
medium: "warning",
|
|
1884
1884
|
high: "error"
|
|
1885
1885
|
};
|
|
1886
|
-
function
|
|
1887
|
-
let a =
|
|
1886
|
+
function Qi({ children: e, priority: n = "medium", className: r, ...i }) {
|
|
1887
|
+
let a = Zi[n];
|
|
1888
1888
|
return n === "low" ? null : /* @__PURE__ */ H(t, {
|
|
1889
1889
|
"data-slot": "chat-notification-card-header-status",
|
|
1890
1890
|
"data-testid": "chat-notification-card-header-status",
|
|
@@ -1897,7 +1897,7 @@ function $i({ children: e, priority: n = "medium", className: r, ...i }) {
|
|
|
1897
1897
|
children: e
|
|
1898
1898
|
});
|
|
1899
1899
|
}
|
|
1900
|
-
function
|
|
1900
|
+
function $i({ children: e, className: t }) {
|
|
1901
1901
|
return /* @__PURE__ */ H("div", {
|
|
1902
1902
|
"data-slot": "chat-notification-card-actions",
|
|
1903
1903
|
"data-testid": "chat-notification-card-actions",
|
|
@@ -1906,8 +1906,8 @@ function ea({ children: e, className: t }) {
|
|
|
1906
1906
|
children: e
|
|
1907
1907
|
});
|
|
1908
1908
|
}
|
|
1909
|
-
function
|
|
1910
|
-
return /* @__PURE__ */ H(
|
|
1909
|
+
function ea({ children: e, className: t }) {
|
|
1910
|
+
return /* @__PURE__ */ H(j, {
|
|
1911
1911
|
variant: "caption",
|
|
1912
1912
|
"data-slot": "chat-notification-card-timestamp",
|
|
1913
1913
|
"data-testid": "chat-notification-card-timestamp",
|
|
@@ -1916,7 +1916,7 @@ function ta({ children: e, className: t }) {
|
|
|
1916
1916
|
children: /* @__PURE__ */ H("span", { children: e })
|
|
1917
1917
|
});
|
|
1918
1918
|
}
|
|
1919
|
-
function
|
|
1919
|
+
function ta({ children: e, className: t }) {
|
|
1920
1920
|
function n(e) {
|
|
1921
1921
|
e.stopPropagation();
|
|
1922
1922
|
}
|
|
@@ -1933,7 +1933,7 @@ function na({ children: e, className: t }) {
|
|
|
1933
1933
|
children: e
|
|
1934
1934
|
});
|
|
1935
1935
|
}
|
|
1936
|
-
var
|
|
1936
|
+
var na = P(function({ className: e, isRead: t = !1, onRead: n, ...r }, i) {
|
|
1937
1937
|
function a() {
|
|
1938
1938
|
n?.(!t);
|
|
1939
1939
|
}
|
|
@@ -1947,11 +1947,11 @@ var ra = P(function({ className: e, isRead: t = !1, onRead: n, ...r }, i) {
|
|
|
1947
1947
|
className: e,
|
|
1948
1948
|
onClick: a,
|
|
1949
1949
|
...r,
|
|
1950
|
-
children: H(t ?
|
|
1950
|
+
children: H(t ? Bt : zt, {})
|
|
1951
1951
|
});
|
|
1952
1952
|
});
|
|
1953
|
-
|
|
1954
|
-
var
|
|
1953
|
+
na.displayName = "ChatNotificationCardReadActionButton";
|
|
1954
|
+
var ra = P(function({ className: t, labelClassName: n, cancelLabelClassName: r, snoozeUntilDate: i, cancelLabel: a = "Cancel", formatDate: o = Hi, onCancel: s, onClick: c, onMouseEnter: l, onMouseLeave: u, ...d }, p) {
|
|
1955
1955
|
let [m, h] = V(!1), g = i && i > /* @__PURE__ */ new Date();
|
|
1956
1956
|
L(() => {
|
|
1957
1957
|
g || h(!1);
|
|
@@ -1970,7 +1970,7 @@ var ia = P(function({ className: t, labelClassName: n, cancelLabelClassName: r,
|
|
|
1970
1970
|
"data-slot": "chat-notification-card-snooze-button",
|
|
1971
1971
|
"data-snoozed": "true",
|
|
1972
1972
|
"data-hover": m,
|
|
1973
|
-
startIcon: H(m ?
|
|
1973
|
+
startIcon: H(m ? yt : Vt, {}),
|
|
1974
1974
|
variant: "tertiary",
|
|
1975
1975
|
size: "md",
|
|
1976
1976
|
onMouseEnter: _,
|
|
@@ -1997,11 +1997,11 @@ var ia = P(function({ className: t, labelClassName: n, cancelLabelClassName: r,
|
|
|
1997
1997
|
className: M("group/snooze-button", t),
|
|
1998
1998
|
onClick: c,
|
|
1999
1999
|
...d,
|
|
2000
|
-
children: /* @__PURE__ */ H(
|
|
2000
|
+
children: /* @__PURE__ */ H(Vt, {})
|
|
2001
2001
|
});
|
|
2002
2002
|
});
|
|
2003
|
-
|
|
2004
|
-
var
|
|
2003
|
+
ra.displayName = "ChatNotificationCardSnoozeButton";
|
|
2004
|
+
var ia = P(function({ className: e, ...t }, n) {
|
|
2005
2005
|
return /* @__PURE__ */ H(f, {
|
|
2006
2006
|
ref: n,
|
|
2007
2007
|
"data-slot": "chat-notification-card-delete-button",
|
|
@@ -2010,11 +2010,11 @@ var aa = P(function({ className: e, ...t }, n) {
|
|
|
2010
2010
|
variant: "tertiary",
|
|
2011
2011
|
className: e,
|
|
2012
2012
|
...t,
|
|
2013
|
-
children: /* @__PURE__ */ H(
|
|
2013
|
+
children: /* @__PURE__ */ H(xt, {})
|
|
2014
2014
|
});
|
|
2015
2015
|
});
|
|
2016
|
-
|
|
2017
|
-
var
|
|
2016
|
+
ia.displayName = "ChatNotificationCardDeleteButton";
|
|
2017
|
+
var aa = P(function({ className: e, ...t }, n) {
|
|
2018
2018
|
return /* @__PURE__ */ H(f, {
|
|
2019
2019
|
ref: n,
|
|
2020
2020
|
"data-slot": "chat-notification-card-close-button",
|
|
@@ -2023,20 +2023,20 @@ var oa = P(function({ className: e, ...t }, n) {
|
|
|
2023
2023
|
variant: "tertiary",
|
|
2024
2024
|
className: e,
|
|
2025
2025
|
...t,
|
|
2026
|
-
children: /* @__PURE__ */ H(
|
|
2026
|
+
children: /* @__PURE__ */ H(yt, {})
|
|
2027
2027
|
});
|
|
2028
2028
|
});
|
|
2029
|
-
|
|
2030
|
-
function
|
|
2029
|
+
aa.displayName = "ChatNotificationCardCloseButton";
|
|
2030
|
+
function oa({ children: e, className: t }) {
|
|
2031
2031
|
return /* @__PURE__ */ U("div", {
|
|
2032
2032
|
"data-slot": "chat-notification-card-content",
|
|
2033
2033
|
"data-testid": "chat-notification-card-content",
|
|
2034
2034
|
className: M("flex flex-col items-start text-left gap-4", "relative pr-[40px]", t),
|
|
2035
|
-
children: [e, /* @__PURE__ */ H(
|
|
2035
|
+
children: [e, /* @__PURE__ */ H(ua, {})]
|
|
2036
2036
|
});
|
|
2037
2037
|
}
|
|
2038
|
-
function
|
|
2039
|
-
return /* @__PURE__ */ H(
|
|
2038
|
+
function sa({ children: e, className: t }) {
|
|
2039
|
+
return /* @__PURE__ */ H(j, {
|
|
2040
2040
|
variant: "body-sm",
|
|
2041
2041
|
fontWeight: "semibold",
|
|
2042
2042
|
"data-slot": "chat-notification-card-content-title",
|
|
@@ -2046,8 +2046,8 @@ function ca({ children: e, className: t }) {
|
|
|
2046
2046
|
children: /* @__PURE__ */ H("span", { children: e })
|
|
2047
2047
|
});
|
|
2048
2048
|
}
|
|
2049
|
-
function
|
|
2050
|
-
return /* @__PURE__ */ H(
|
|
2049
|
+
function ca({ children: e, className: t }) {
|
|
2050
|
+
return /* @__PURE__ */ H(j, {
|
|
2051
2051
|
variant: "body-sm",
|
|
2052
2052
|
"data-slot": "chat-notification-card-content-description",
|
|
2053
2053
|
"data-testid": "chat-notification-card-content-description",
|
|
@@ -2056,7 +2056,7 @@ function la({ children: e, className: t }) {
|
|
|
2056
2056
|
children: /* @__PURE__ */ H("div", { children: e })
|
|
2057
2057
|
});
|
|
2058
2058
|
}
|
|
2059
|
-
function
|
|
2059
|
+
function la({ children: e, className: t }) {
|
|
2060
2060
|
return /* @__PURE__ */ H("div", {
|
|
2061
2061
|
"data-slot": "chat-notification-card-content-actions",
|
|
2062
2062
|
"data-testid": "chat-notification-card-content-actions",
|
|
@@ -2065,8 +2065,8 @@ function ua({ children: e, className: t }) {
|
|
|
2065
2065
|
children: e
|
|
2066
2066
|
});
|
|
2067
2067
|
}
|
|
2068
|
-
var
|
|
2069
|
-
let { isExpanded: a, toggleExpanded: o } =
|
|
2068
|
+
var ua = P(function({ className: e, onMouseDown: t, onClick: n, ...r }, i) {
|
|
2069
|
+
let { isExpanded: a, toggleExpanded: o } = Wi();
|
|
2070
2070
|
function s(e) {
|
|
2071
2071
|
e.stopPropagation(), t?.(e);
|
|
2072
2072
|
}
|
|
@@ -2084,30 +2084,30 @@ var da = P(function({ className: e, onMouseDown: t, onClick: n, ...r }, i) {
|
|
|
2084
2084
|
onMouseDown: s,
|
|
2085
2085
|
onClick: c,
|
|
2086
2086
|
...r,
|
|
2087
|
-
children: H(a ?
|
|
2087
|
+
children: H(a ? vt : _t, {})
|
|
2088
2088
|
});
|
|
2089
2089
|
});
|
|
2090
|
-
|
|
2091
|
-
var
|
|
2090
|
+
ua.displayName = "ChatNotificationCardExpandButton";
|
|
2091
|
+
var da = Ji, fa = ca, pa = ea;
|
|
2092
2092
|
//#endregion
|
|
2093
2093
|
//#region src/components/chat-notification-popup/chat-notification-popup.tsx
|
|
2094
|
-
function
|
|
2095
|
-
return /* @__PURE__ */ H(
|
|
2094
|
+
function ma({ children: e, ...t }) {
|
|
2095
|
+
return /* @__PURE__ */ H(D, {
|
|
2096
2096
|
...t,
|
|
2097
2097
|
children: e
|
|
2098
2098
|
});
|
|
2099
2099
|
}
|
|
2100
|
-
var
|
|
2101
|
-
return /* @__PURE__ */ H(
|
|
2100
|
+
var ha = P(function({ children: e, ...t }, n) {
|
|
2101
|
+
return /* @__PURE__ */ H(O, {
|
|
2102
2102
|
ref: n,
|
|
2103
2103
|
"data-slot": "chat-notification-popup-trigger",
|
|
2104
2104
|
...t,
|
|
2105
2105
|
children: e
|
|
2106
2106
|
});
|
|
2107
2107
|
});
|
|
2108
|
-
|
|
2109
|
-
var
|
|
2110
|
-
return /* @__PURE__ */ H(
|
|
2108
|
+
ha.displayName = "ChatNotificationPopupTrigger";
|
|
2109
|
+
var ga = P(function({ children: e, className: t, ...n }, r) {
|
|
2110
|
+
return /* @__PURE__ */ H(ie, {
|
|
2111
2111
|
ref: r,
|
|
2112
2112
|
"data-slot": "chat-notification-popup-content",
|
|
2113
2113
|
className: M("md:w-[467px]", t),
|
|
@@ -2115,10 +2115,10 @@ var _a = P(function({ children: e, className: t, ...n }, r) {
|
|
|
2115
2115
|
children: e
|
|
2116
2116
|
});
|
|
2117
2117
|
});
|
|
2118
|
-
|
|
2118
|
+
ga.displayName = "ChatNotificationPopupContent";
|
|
2119
2119
|
//#endregion
|
|
2120
2120
|
//#region src/components/chat-reply/chat-reply.tsx
|
|
2121
|
-
function
|
|
2121
|
+
function _a({ className: e, children: t, hasPadding: n = !0 }) {
|
|
2122
2122
|
return /* @__PURE__ */ H("ul", {
|
|
2123
2123
|
"data-testid": "chat-replies",
|
|
2124
2124
|
"data-slot": "chat-replies",
|
|
@@ -2127,7 +2127,7 @@ function va({ className: e, children: t, hasPadding: n = !0 }) {
|
|
|
2127
2127
|
children: t
|
|
2128
2128
|
});
|
|
2129
2129
|
}
|
|
2130
|
-
function
|
|
2130
|
+
function va({ className: e, children: t, isMultiline: n = !1, ...r }) {
|
|
2131
2131
|
return /* @__PURE__ */ H("li", {
|
|
2132
2132
|
"data-testid": "chat-reply",
|
|
2133
2133
|
"data-slot": "chat-reply",
|
|
@@ -2137,7 +2137,7 @@ function ya({ className: e, children: t, isMultiline: n = !1, ...r }) {
|
|
|
2137
2137
|
children: t
|
|
2138
2138
|
});
|
|
2139
2139
|
}
|
|
2140
|
-
function
|
|
2140
|
+
function ya({ className: e, children: n, ...r }) {
|
|
2141
2141
|
return /* @__PURE__ */ H(t, {
|
|
2142
2142
|
variant: "outlined",
|
|
2143
2143
|
size: "sm",
|
|
@@ -2149,8 +2149,8 @@ function ba({ className: e, children: n, ...r }) {
|
|
|
2149
2149
|
children: n
|
|
2150
2150
|
});
|
|
2151
2151
|
}
|
|
2152
|
-
function
|
|
2153
|
-
return /* @__PURE__ */ H(
|
|
2152
|
+
function ba({ className: e, children: t, asChild: n = !1, ...r }) {
|
|
2153
|
+
return /* @__PURE__ */ H(j, {
|
|
2154
2154
|
"data-testid": "chat-reply-value",
|
|
2155
2155
|
"data-slot": "chat-reply-value",
|
|
2156
2156
|
variant: "body-sm",
|
|
@@ -2162,13 +2162,13 @@ function xa({ className: e, children: t, asChild: n = !1, ...r }) {
|
|
|
2162
2162
|
}
|
|
2163
2163
|
//#endregion
|
|
2164
2164
|
//#region src/components/chat-suggestion/chat-suggestion.tsx
|
|
2165
|
-
var
|
|
2166
|
-
function
|
|
2167
|
-
let e = I(
|
|
2165
|
+
var xa = N(null);
|
|
2166
|
+
function Sa() {
|
|
2167
|
+
let e = I(xa);
|
|
2168
2168
|
if (!e) throw Error("\"useChatSuggestionContext\" must be used within a ChatSuggestion");
|
|
2169
2169
|
return e;
|
|
2170
2170
|
}
|
|
2171
|
-
var
|
|
2171
|
+
var Ca = P(function({ children: e, className: t, hasLoop: n = !0, ...r }, i) {
|
|
2172
2172
|
return /* @__PURE__ */ H(p, {
|
|
2173
2173
|
asChild: !0,
|
|
2174
2174
|
hasLoop: n,
|
|
@@ -2178,31 +2178,31 @@ var wa = P(function({ children: e, className: t, hasLoop: n = !0, ...r }, i) {
|
|
|
2178
2178
|
"data-slot": "chat-suggestions",
|
|
2179
2179
|
"data-testid": "chat-suggestions",
|
|
2180
2180
|
className: M("m-0 p-0 list-none flex flex-col items-stretch gap-0", t),
|
|
2181
|
-
children:
|
|
2181
|
+
children: fe.map(e, (e, t) => me(e) ? pe(e, { index: t }) : e)
|
|
2182
2182
|
})
|
|
2183
2183
|
});
|
|
2184
2184
|
});
|
|
2185
|
-
|
|
2186
|
-
var
|
|
2185
|
+
Ca.displayName = "ChatSuggestions";
|
|
2186
|
+
var wa = P(function({ index: e, children: t, className: n, triggerClassName: r, onHover: i, onMouseEnter: a, ...o }, s) {
|
|
2187
2187
|
let c = z(() => ({ index: e }), [e]);
|
|
2188
2188
|
function l(e) {
|
|
2189
2189
|
a?.(e), i?.();
|
|
2190
2190
|
}
|
|
2191
|
-
return /* @__PURE__ */ H(
|
|
2191
|
+
return /* @__PURE__ */ H(xa.Provider, {
|
|
2192
2192
|
value: c,
|
|
2193
2193
|
children: /* @__PURE__ */ U(m, {
|
|
2194
2194
|
ref: s,
|
|
2195
2195
|
"data-slot": "chat-suggestion",
|
|
2196
|
-
className:
|
|
2196
|
+
className: se(M("relative items-start gap-0 p-4 text-typography-text-secondary", n), { highlighted: "bg-layout-accent-low-background-hover-default" }),
|
|
2197
2197
|
...o,
|
|
2198
2198
|
onMouseEnter: l,
|
|
2199
2199
|
children: [/* @__PURE__ */ H(_, { className: M("absolute inset-0 rounded-[inherit] outline-none", r) }), t]
|
|
2200
2200
|
})
|
|
2201
2201
|
});
|
|
2202
2202
|
});
|
|
2203
|
-
|
|
2204
|
-
function
|
|
2205
|
-
let { index: r = 0 } =
|
|
2203
|
+
wa.displayName = "ChatSuggestion";
|
|
2204
|
+
function Ta({ children: e, className: t, innerClassName: n }) {
|
|
2205
|
+
let { index: r = 0 } = Sa();
|
|
2206
2206
|
return /* @__PURE__ */ H("span", {
|
|
2207
2207
|
"aria-hidden": "true",
|
|
2208
2208
|
"data-slot": "chat-suggestion-label-icon",
|
|
@@ -2211,18 +2211,18 @@ function Ea({ children: e, className: t, innerClassName: n }) {
|
|
|
2211
2211
|
"aria-hidden": "true",
|
|
2212
2212
|
"data-slot": "chat-suggestion-label-icon-inner",
|
|
2213
2213
|
className: M("size-[32px]", "inline-flex items-center justify-center", "px-8 py-[7px]", "[&_svg]:size-[18px]!", n),
|
|
2214
|
-
children: e || /* @__PURE__ */ H(
|
|
2214
|
+
children: e || /* @__PURE__ */ H(j, {
|
|
2215
2215
|
variant: "caption-md",
|
|
2216
|
-
fontWeight: "
|
|
2217
|
-
className: "text-inherit",
|
|
2216
|
+
fontWeight: "normal",
|
|
2217
|
+
className: "text-inherit leading-none",
|
|
2218
2218
|
asChild: !0,
|
|
2219
2219
|
children: /* @__PURE__ */ H("span", { children: r + 1 })
|
|
2220
|
-
})
|
|
2220
|
+
})
|
|
2221
2221
|
})
|
|
2222
2222
|
});
|
|
2223
2223
|
}
|
|
2224
|
-
function
|
|
2225
|
-
return /* @__PURE__ */ H(
|
|
2224
|
+
function Ea({ children: e, className: t, isMultiline: n = !0 }) {
|
|
2225
|
+
return /* @__PURE__ */ H(j, {
|
|
2226
2226
|
variant: "body-small-low",
|
|
2227
2227
|
"data-slot": "chat-suggestion-label",
|
|
2228
2228
|
"data-multiline": n,
|
|
@@ -2231,7 +2231,7 @@ function Da({ children: e, className: t, isMultiline: n = !0 }) {
|
|
|
2231
2231
|
children: /* @__PURE__ */ H(g, { children: e })
|
|
2232
2232
|
});
|
|
2233
2233
|
}
|
|
2234
|
-
function
|
|
2234
|
+
function Da({ children: e, className: t }) {
|
|
2235
2235
|
return /* @__PURE__ */ H("div", {
|
|
2236
2236
|
role: "group",
|
|
2237
2237
|
"data-slot": "chat-suggestion-actions",
|
|
@@ -2239,7 +2239,7 @@ function Oa({ children: e, className: t }) {
|
|
|
2239
2239
|
children: e
|
|
2240
2240
|
});
|
|
2241
2241
|
}
|
|
2242
|
-
var
|
|
2242
|
+
var Oa = P(function({ className: e, children: t, ...n }, r) {
|
|
2243
2243
|
return /* @__PURE__ */ H(h, {
|
|
2244
2244
|
ref: r,
|
|
2245
2245
|
className: M("pointer-events-auto", e),
|
|
@@ -2247,30 +2247,30 @@ var ka = P(function({ className: e, children: t, ...n }, r) {
|
|
|
2247
2247
|
children: t
|
|
2248
2248
|
});
|
|
2249
2249
|
});
|
|
2250
|
-
|
|
2250
|
+
Oa.displayName = "ChatSuggestionAction";
|
|
2251
2251
|
//#endregion
|
|
2252
2252
|
//#region src/components/chat-thread/chat-thread.tsx
|
|
2253
|
-
function
|
|
2253
|
+
function ka(e, t) {
|
|
2254
2254
|
let n = P((t, n) => e({
|
|
2255
2255
|
...t,
|
|
2256
2256
|
ref: n
|
|
2257
2257
|
}));
|
|
2258
2258
|
return n.displayName = t, n;
|
|
2259
2259
|
}
|
|
2260
|
-
var
|
|
2261
|
-
function
|
|
2260
|
+
var Aa = ka(Yt.Viewport, "ChatThreadViewportPrimitive"), ja = ka(Yt.Content, "ChatThreadContentPrimitive"), Ma = ka(Yt.Item, "ChatThreadItemPrimitive");
|
|
2261
|
+
function Na(e, t) {
|
|
2262
2262
|
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
2263
2263
|
}
|
|
2264
|
-
var
|
|
2264
|
+
var Pa = 12, Fa = "--chat-thread-group-min-height", Ia = {
|
|
2265
2265
|
scrollToEnd: () => !1,
|
|
2266
2266
|
scrollToMessage: () => !1,
|
|
2267
2267
|
scrollToStart: () => !1
|
|
2268
|
-
},
|
|
2269
|
-
function
|
|
2270
|
-
return I(
|
|
2268
|
+
}, La = N(null);
|
|
2269
|
+
function Ra() {
|
|
2270
|
+
return I(La) ?? Ia;
|
|
2271
2271
|
}
|
|
2272
|
-
function
|
|
2273
|
-
let { scrollToEnd: t, scrollToMessage: n, scrollToStart: r } =
|
|
2272
|
+
function za({ children: e }) {
|
|
2273
|
+
let { scrollToEnd: t, scrollToMessage: n, scrollToStart: r } = Xt(), i = z(() => ({
|
|
2274
2274
|
scrollToEnd: t,
|
|
2275
2275
|
scrollToMessage: n,
|
|
2276
2276
|
scrollToStart: r
|
|
@@ -2279,27 +2279,27 @@ function Ba({ children: e }) {
|
|
|
2279
2279
|
n,
|
|
2280
2280
|
r
|
|
2281
2281
|
]);
|
|
2282
|
-
return /* @__PURE__ */ H(
|
|
2282
|
+
return /* @__PURE__ */ H(La.Provider, {
|
|
2283
2283
|
value: i,
|
|
2284
2284
|
children: e
|
|
2285
2285
|
});
|
|
2286
2286
|
}
|
|
2287
|
-
var
|
|
2288
|
-
function
|
|
2289
|
-
let t = I(
|
|
2287
|
+
var Ba = N(null);
|
|
2288
|
+
function Va(e) {
|
|
2289
|
+
let t = I(Ba);
|
|
2290
2290
|
if (!t) throw Error(`[web-chat-ui] <${e}> must be rendered inside <ChatThreadProvider>`);
|
|
2291
2291
|
return t;
|
|
2292
2292
|
}
|
|
2293
|
-
function
|
|
2293
|
+
function Ha(e, t, n) {
|
|
2294
2294
|
return {
|
|
2295
2295
|
id: e,
|
|
2296
2296
|
conversationId: t ?? null,
|
|
2297
2297
|
knownGroupIds: n.length === 0 ? null : new Set(n)
|
|
2298
2298
|
};
|
|
2299
2299
|
}
|
|
2300
|
-
function
|
|
2301
|
-
let [u, d] = V(() =>
|
|
2302
|
-
(u.conversationId !== (t ?? null) || u.knownGroupIds === null != (n.length === 0)) && d(
|
|
2300
|
+
function Ua({ children: e, conversationId: t, groupIds: n, isStreaming: r = !1, scrollMode: i = "anchor", autoScroll: a = i === "follow" || !r, defaultScrollPosition: o = "end", scrollPreviousItemPeek: s = 0, scrollMargin: c = Pa, ...l }) {
|
|
2301
|
+
let [u, d] = V(() => Ha(0, t, n));
|
|
2302
|
+
(u.conversationId !== (t ?? null) || u.knownGroupIds === null != (n.length === 0)) && d(Ha(u.id + 1, t, n));
|
|
2303
2303
|
let { knownGroupIds: f } = u, p = z(() => ({
|
|
2304
2304
|
isStreaming: r,
|
|
2305
2305
|
scrollMargin: c,
|
|
@@ -2311,23 +2311,23 @@ function Wa({ children: e, conversationId: t, groupIds: n, isStreaming: r = !1,
|
|
|
2311
2311
|
i,
|
|
2312
2312
|
f
|
|
2313
2313
|
]);
|
|
2314
|
-
return /* @__PURE__ */ H(
|
|
2314
|
+
return /* @__PURE__ */ H(Yt.Provider, {
|
|
2315
2315
|
autoScroll: a,
|
|
2316
2316
|
scrollPreviousItemPeek: s,
|
|
2317
2317
|
scrollMargin: c,
|
|
2318
2318
|
defaultScrollPosition: o,
|
|
2319
2319
|
...l,
|
|
2320
|
-
children: /* @__PURE__ */ U(
|
|
2320
|
+
children: /* @__PURE__ */ U(Ba.Provider, {
|
|
2321
2321
|
value: p,
|
|
2322
|
-
children: [i === "follow" && /* @__PURE__ */ H(
|
|
2322
|
+
children: [i === "follow" && /* @__PURE__ */ H(Wa, {
|
|
2323
2323
|
groupIds: n,
|
|
2324
2324
|
knownGroupIds: f
|
|
2325
|
-
}), /* @__PURE__ */ H(
|
|
2325
|
+
}), /* @__PURE__ */ H(za, { children: e })]
|
|
2326
2326
|
})
|
|
2327
2327
|
}, u.id);
|
|
2328
2328
|
}
|
|
2329
|
-
function
|
|
2330
|
-
let { scrollToEnd: n } =
|
|
2329
|
+
function Wa({ groupIds: e, knownGroupIds: t }) {
|
|
2330
|
+
let { scrollToEnd: n } = Xt(), r = e.at(-1);
|
|
2331
2331
|
return R(() => {
|
|
2332
2332
|
r === void 0 || t === null || t.has(r) || n({ behavior: "auto" });
|
|
2333
2333
|
}, [
|
|
@@ -2336,13 +2336,13 @@ function Ga({ groupIds: e, knownGroupIds: t }) {
|
|
|
2336
2336
|
n
|
|
2337
2337
|
]), null;
|
|
2338
2338
|
}
|
|
2339
|
-
var
|
|
2340
|
-
let { isStreaming: h, scrollMargin: g, scrollMode: _ } =
|
|
2341
|
-
y.current = e,
|
|
2339
|
+
var Ga = P(function({ children: e, className: t, viewportClassName: n, contentClassName: r, viewportRef: i, contentRef: a, scrollButton: o = !0, scrollButtonClassName: s, scrollButtonTooltip: c, isLoading: l = !1, hasError: u = !1, error: d, renderError: f, ...p }, m) {
|
|
2340
|
+
let { isStreaming: h, scrollMargin: g, scrollMode: _ } = Va("ChatThread"), v = _ === "anchor", y = B(null), b = B(null), x = F((e) => {
|
|
2341
|
+
y.current = e, Na(i, e), Na(m, e?.parentElement ?? null);
|
|
2342
2342
|
}, [i, m]), S = F((e) => {
|
|
2343
|
-
b.current = e,
|
|
2343
|
+
b.current = e, Na(a, e);
|
|
2344
2344
|
}, [a]);
|
|
2345
|
-
return
|
|
2345
|
+
return Ka(y, b, g, v), /* @__PURE__ */ U(Yt.Root, {
|
|
2346
2346
|
"data-slot": "chat-thread",
|
|
2347
2347
|
"data-testid": "chat-thread",
|
|
2348
2348
|
"data-scroll-mode": _,
|
|
@@ -2352,7 +2352,7 @@ var Ka = P(function({ children: e, className: t, viewportClassName: n, contentCl
|
|
|
2352
2352
|
className: M("relative flex flex-col flex-1 min-h-0 overflow-hidden", t),
|
|
2353
2353
|
...p,
|
|
2354
2354
|
children: [
|
|
2355
|
-
/* @__PURE__ */ H(
|
|
2355
|
+
/* @__PURE__ */ H(Aa, {
|
|
2356
2356
|
ref: x,
|
|
2357
2357
|
"data-slot": "chat-thread-viewport",
|
|
2358
2358
|
"aria-label": "Chat message history",
|
|
@@ -2362,7 +2362,7 @@ var Ka = P(function({ children: e, className: t, viewportClassName: n, contentCl
|
|
|
2362
2362
|
scrollbarWidth: "thin",
|
|
2363
2363
|
scrollbarColor: "var(--color-scrollbar-thumb) transparent"
|
|
2364
2364
|
},
|
|
2365
|
-
children: /* @__PURE__ */ H(
|
|
2365
|
+
children: /* @__PURE__ */ H(ja, {
|
|
2366
2366
|
ref: S,
|
|
2367
2367
|
"data-slot": "chat-thread-content",
|
|
2368
2368
|
"aria-busy": h,
|
|
@@ -2371,29 +2371,29 @@ var Ka = P(function({ children: e, className: t, viewportClassName: n, contentCl
|
|
|
2371
2371
|
children: e
|
|
2372
2372
|
})
|
|
2373
2373
|
}),
|
|
2374
|
-
u && !l && /* @__PURE__ */ H(
|
|
2374
|
+
u && !l && /* @__PURE__ */ H(Za, {
|
|
2375
2375
|
error: d,
|
|
2376
2376
|
children: f?.(d)
|
|
2377
2377
|
}),
|
|
2378
|
-
o && /* @__PURE__ */ H(
|
|
2378
|
+
o && /* @__PURE__ */ H(Xa, {
|
|
2379
2379
|
className: s,
|
|
2380
2380
|
tooltip: c
|
|
2381
2381
|
})
|
|
2382
2382
|
]
|
|
2383
2383
|
});
|
|
2384
2384
|
});
|
|
2385
|
-
|
|
2386
|
-
function
|
|
2385
|
+
Ga.displayName = "ChatThread";
|
|
2386
|
+
function Ka(e, t, n, r) {
|
|
2387
2387
|
R(() => {
|
|
2388
2388
|
let i = e.current, a = t.current;
|
|
2389
2389
|
if (!i || !a) return;
|
|
2390
2390
|
if (!r) {
|
|
2391
|
-
a.style.removeProperty(
|
|
2391
|
+
a.style.removeProperty(Fa);
|
|
2392
2392
|
return;
|
|
2393
2393
|
}
|
|
2394
2394
|
let o = () => {
|
|
2395
2395
|
let { paddingTop: e, paddingBottom: t } = window.getComputedStyle(a), r = i.clientHeight - (Number.parseFloat(e) || 0) - (Number.parseFloat(t) || 0) - n;
|
|
2396
|
-
a.style.setProperty(
|
|
2396
|
+
a.style.setProperty(Fa, `${Math.max(0, r)}px`);
|
|
2397
2397
|
};
|
|
2398
2398
|
if (o(), typeof ResizeObserver > "u") return;
|
|
2399
2399
|
let s = new ResizeObserver(o);
|
|
@@ -2405,9 +2405,9 @@ function qa(e, t, n, r) {
|
|
|
2405
2405
|
r
|
|
2406
2406
|
]);
|
|
2407
2407
|
}
|
|
2408
|
-
var
|
|
2409
|
-
let { knownGroupIds: a, scrollMode: o } =
|
|
2410
|
-
return /* @__PURE__ */ H(
|
|
2408
|
+
var qa = P(function({ groupId: e, className: t, children: n, ...r }, i) {
|
|
2409
|
+
let { knownGroupIds: a, scrollMode: o } = Va("ChatThreadGroup"), s = o === "anchor" && a !== null && !a.has(e);
|
|
2410
|
+
return /* @__PURE__ */ H(Ma, {
|
|
2411
2411
|
ref: i,
|
|
2412
2412
|
messageId: `chat-thread-group-${e}`,
|
|
2413
2413
|
scrollAnchor: s,
|
|
@@ -2418,8 +2418,8 @@ var Ja = P(function({ groupId: e, className: t, children: n, ...r }, i) {
|
|
|
2418
2418
|
children: n
|
|
2419
2419
|
});
|
|
2420
2420
|
});
|
|
2421
|
-
|
|
2422
|
-
var
|
|
2421
|
+
qa.displayName = "ChatThreadGroup";
|
|
2422
|
+
var Ja = P(function({ messageId: e, children: t, ...n }, r) {
|
|
2423
2423
|
return /* @__PURE__ */ H("div", {
|
|
2424
2424
|
ref: r,
|
|
2425
2425
|
"data-slot": "chat-thread-question",
|
|
@@ -2429,8 +2429,8 @@ var Ya = P(function({ messageId: e, children: t, ...n }, r) {
|
|
|
2429
2429
|
children: t
|
|
2430
2430
|
});
|
|
2431
2431
|
});
|
|
2432
|
-
|
|
2433
|
-
var
|
|
2432
|
+
Ja.displayName = "ChatThreadQuestion";
|
|
2433
|
+
var Ya = P(function({ messageId: e, children: t, ...n }, r) {
|
|
2434
2434
|
return /* @__PURE__ */ H("div", {
|
|
2435
2435
|
ref: r,
|
|
2436
2436
|
"data-slot": "chat-thread-answer",
|
|
@@ -2440,18 +2440,18 @@ var Xa = P(function({ messageId: e, children: t, ...n }, r) {
|
|
|
2440
2440
|
children: t
|
|
2441
2441
|
});
|
|
2442
2442
|
});
|
|
2443
|
-
|
|
2444
|
-
function
|
|
2445
|
-
let { end: n } =
|
|
2443
|
+
Ya.displayName = "ChatThreadAnswer";
|
|
2444
|
+
function Xa({ className: e, tooltip: t }) {
|
|
2445
|
+
let { end: n } = Zt();
|
|
2446
2446
|
return /* @__PURE__ */ H("div", {
|
|
2447
2447
|
"data-slot": "chat-thread-scroll-button",
|
|
2448
2448
|
"data-testid": "chat-message-history-scroll-button",
|
|
2449
2449
|
"data-hidden": !n,
|
|
2450
2450
|
"aria-hidden": !n || void 0,
|
|
2451
2451
|
className: M("absolute", "px-[12px]", "bottom-0", "right-0 -translate-x-[12px]", "md:right-auto md:left-1/2 md:-translate-x-1/2", "-translate-y-[12px]", "flex items-center justify-center", "transition-opacity duration-200 ease-in-out", "data-[hidden=true]:pointer-events-none", "data-[hidden=true]:opacity-0 data-[hidden=false]:opacity-100", e),
|
|
2452
|
-
children: /* @__PURE__ */ H(
|
|
2452
|
+
children: /* @__PURE__ */ H(Yt.Button, {
|
|
2453
2453
|
direction: "end",
|
|
2454
|
-
render: ({ inert: e, children: n, ...r }) => /* @__PURE__ */ H(
|
|
2454
|
+
render: ({ inert: e, children: n, ...r }) => /* @__PURE__ */ H(A, {
|
|
2455
2455
|
tooltip: t,
|
|
2456
2456
|
side: "top",
|
|
2457
2457
|
children: /* @__PURE__ */ H(f, {
|
|
@@ -2462,13 +2462,13 @@ function Za({ className: e, tooltip: t }) {
|
|
|
2462
2462
|
size: "md",
|
|
2463
2463
|
tabIndex: -1,
|
|
2464
2464
|
"aria-label": t,
|
|
2465
|
-
children: /* @__PURE__ */ H(
|
|
2465
|
+
children: /* @__PURE__ */ H(_t, {})
|
|
2466
2466
|
})
|
|
2467
2467
|
})
|
|
2468
2468
|
})
|
|
2469
2469
|
});
|
|
2470
2470
|
}
|
|
2471
|
-
function
|
|
2471
|
+
function Za({ children: e, error: t, className: n }) {
|
|
2472
2472
|
return /* @__PURE__ */ H("div", {
|
|
2473
2473
|
"data-slot": "chat-thread-error-state",
|
|
2474
2474
|
"data-testid": "chat-message-history-error-state",
|
|
@@ -2484,7 +2484,7 @@ function Qa({ children: e, error: t, className: n }) {
|
|
|
2484
2484
|
}
|
|
2485
2485
|
//#endregion
|
|
2486
2486
|
//#region src/components/chat-artifact/chat-artifact.tsx
|
|
2487
|
-
function
|
|
2487
|
+
function Qa({ asChild: e = !1, className: t, children: n, ...r }) {
|
|
2488
2488
|
return /* @__PURE__ */ H(e ? W : "button", {
|
|
2489
2489
|
role: "group",
|
|
2490
2490
|
"data-slot": "chat-artifact",
|
|
@@ -2494,7 +2494,7 @@ function $a({ asChild: e = !1, className: t, children: n, ...r }) {
|
|
|
2494
2494
|
children: n
|
|
2495
2495
|
});
|
|
2496
2496
|
}
|
|
2497
|
-
function
|
|
2497
|
+
function $a({ className: e, children: t }) {
|
|
2498
2498
|
return /* @__PURE__ */ H("span", {
|
|
2499
2499
|
"data-slot": "chat-artifact-icon",
|
|
2500
2500
|
"data-testid": "chat-artifact-icon",
|
|
@@ -2505,7 +2505,7 @@ function eo({ className: e, children: t }) {
|
|
|
2505
2505
|
})
|
|
2506
2506
|
});
|
|
2507
2507
|
}
|
|
2508
|
-
function
|
|
2508
|
+
function eo({ className: e, children: t }) {
|
|
2509
2509
|
return /* @__PURE__ */ H("div", {
|
|
2510
2510
|
"data-slot": "chat-artifact-content",
|
|
2511
2511
|
"data-testid": "chat-artifact-content",
|
|
@@ -2513,8 +2513,8 @@ function to({ className: e, children: t }) {
|
|
|
2513
2513
|
children: t
|
|
2514
2514
|
});
|
|
2515
2515
|
}
|
|
2516
|
-
function
|
|
2517
|
-
return /* @__PURE__ */ H(
|
|
2516
|
+
function to({ className: e, children: t }) {
|
|
2517
|
+
return /* @__PURE__ */ H(j, {
|
|
2518
2518
|
variant: "body-sm",
|
|
2519
2519
|
"data-slot": "chat-artifact-title",
|
|
2520
2520
|
"data-testid": "chat-artifact-title",
|
|
@@ -2522,8 +2522,8 @@ function no({ className: e, children: t }) {
|
|
|
2522
2522
|
children: t
|
|
2523
2523
|
});
|
|
2524
2524
|
}
|
|
2525
|
-
function
|
|
2526
|
-
return /* @__PURE__ */ H(
|
|
2525
|
+
function no({ className: e, children: t }) {
|
|
2526
|
+
return /* @__PURE__ */ H(j, {
|
|
2527
2527
|
variant: "caption-md",
|
|
2528
2528
|
"data-slot": "chat-artifact-caption",
|
|
2529
2529
|
"data-testid": "chat-artifact-caption",
|
|
@@ -2531,7 +2531,7 @@ function ro({ className: e, children: t }) {
|
|
|
2531
2531
|
children: t
|
|
2532
2532
|
});
|
|
2533
2533
|
}
|
|
2534
|
-
function
|
|
2534
|
+
function ro({ className: e, children: t }) {
|
|
2535
2535
|
return /* @__PURE__ */ H("div", {
|
|
2536
2536
|
role: "group",
|
|
2537
2537
|
"data-slot": "chat-artifact-actions",
|
|
@@ -2542,10 +2542,10 @@ function io({ className: e, children: t }) {
|
|
|
2542
2542
|
}
|
|
2543
2543
|
//#endregion
|
|
2544
2544
|
//#region src/components/canvas-shell/canvas-shell.tsx
|
|
2545
|
-
function
|
|
2546
|
-
return /* @__PURE__ */ H(
|
|
2545
|
+
function io({ className: e, children: t, ...n }) {
|
|
2546
|
+
return /* @__PURE__ */ H(ne, {
|
|
2547
2547
|
isCollapsible: !1,
|
|
2548
|
-
children: /* @__PURE__ */ H(
|
|
2548
|
+
children: /* @__PURE__ */ H(S, {
|
|
2549
2549
|
"data-slot": "canvas-shell",
|
|
2550
2550
|
className: e,
|
|
2551
2551
|
...n,
|
|
@@ -2553,8 +2553,8 @@ function ao({ className: e, children: t, ...n }) {
|
|
|
2553
2553
|
})
|
|
2554
2554
|
});
|
|
2555
2555
|
}
|
|
2556
|
-
function
|
|
2557
|
-
return /* @__PURE__ */ H(
|
|
2556
|
+
function ao({ className: e, children: t, hasBorder: n = !0, ...r }) {
|
|
2557
|
+
return /* @__PURE__ */ H(te, {
|
|
2558
2558
|
"data-slot": "canvas-shell-header",
|
|
2559
2559
|
hasBorder: n,
|
|
2560
2560
|
className: e,
|
|
@@ -2562,33 +2562,33 @@ function oo({ className: e, children: t, hasBorder: n = !0, ...r }) {
|
|
|
2562
2562
|
children: t
|
|
2563
2563
|
});
|
|
2564
2564
|
}
|
|
2565
|
-
function
|
|
2566
|
-
return /* @__PURE__ */ H(
|
|
2565
|
+
function oo({ className: e, children: t, ...n }) {
|
|
2566
|
+
return /* @__PURE__ */ H(re, {
|
|
2567
2567
|
"data-slot": "canvas-shell-title",
|
|
2568
2568
|
className: e,
|
|
2569
2569
|
...n,
|
|
2570
2570
|
children: t
|
|
2571
2571
|
});
|
|
2572
2572
|
}
|
|
2573
|
-
function
|
|
2574
|
-
return /* @__PURE__ */ H(
|
|
2573
|
+
function so({ className: e, children: t, ...n }) {
|
|
2574
|
+
return /* @__PURE__ */ H(w, {
|
|
2575
2575
|
"data-slot": "canvas-shell-close-trigger",
|
|
2576
2576
|
className: e,
|
|
2577
2577
|
...n,
|
|
2578
2578
|
children: t
|
|
2579
2579
|
});
|
|
2580
2580
|
}
|
|
2581
|
-
function
|
|
2581
|
+
function co({ className: e, children: t, isFullScreen: n, labels: r, ...i }) {
|
|
2582
2582
|
return /* @__PURE__ */ H(C, {
|
|
2583
2583
|
"data-slot": "canvas-shell-full-screen-trigger",
|
|
2584
2584
|
"aria-pressed": n,
|
|
2585
2585
|
"aria-label": n ? r?.exit ?? "Exit full screen" : r?.enter ?? "Full screen",
|
|
2586
2586
|
className: M("max-md:hidden", e),
|
|
2587
2587
|
...i,
|
|
2588
|
-
children: t || /* @__PURE__ */ H(
|
|
2588
|
+
children: t || /* @__PURE__ */ H(It, {})
|
|
2589
2589
|
});
|
|
2590
2590
|
}
|
|
2591
|
-
function
|
|
2591
|
+
function lo({ className: e, children: t, menuClassName: n, onOpenChange: r, ...i }) {
|
|
2592
2592
|
let [a, o] = V(!1);
|
|
2593
2593
|
function s(e) {
|
|
2594
2594
|
o(e), r?.(e);
|
|
@@ -2604,7 +2604,7 @@ function uo({ className: e, children: t, menuClassName: n, onOpenChange: r, ...i
|
|
|
2604
2604
|
"aria-label": "More options",
|
|
2605
2605
|
className: e,
|
|
2606
2606
|
...i,
|
|
2607
|
-
children: /* @__PURE__ */ H(
|
|
2607
|
+
children: /* @__PURE__ */ H(Ft, {})
|
|
2608
2608
|
})
|
|
2609
2609
|
}), /* @__PURE__ */ H(v, {
|
|
2610
2610
|
className: M("w-[200px]", n),
|
|
@@ -2612,14 +2612,14 @@ function uo({ className: e, children: t, menuClassName: n, onOpenChange: r, ...i
|
|
|
2612
2612
|
})]
|
|
2613
2613
|
});
|
|
2614
2614
|
}
|
|
2615
|
-
var
|
|
2616
|
-
function
|
|
2615
|
+
var uo = ce;
|
|
2616
|
+
function fo({ className: e, children: t, bodyClassName: n, hasPadding: r = !0, hasScroll: i = !0, ...a }) {
|
|
2617
2617
|
return /* @__PURE__ */ H(T, {
|
|
2618
2618
|
"data-slot": "canvas-shell-content",
|
|
2619
2619
|
"data-has-scroll": i,
|
|
2620
2620
|
className: e,
|
|
2621
2621
|
...a,
|
|
2622
|
-
children: /* @__PURE__ */ H(
|
|
2622
|
+
children: /* @__PURE__ */ H(ee, {
|
|
2623
2623
|
"data-slot": "canvas-shell-content-body",
|
|
2624
2624
|
hasPadding: r,
|
|
2625
2625
|
hasScroll: i,
|
|
@@ -2628,7 +2628,7 @@ function po({ className: e, children: t, bodyClassName: n, hasPadding: r = !0, h
|
|
|
2628
2628
|
})
|
|
2629
2629
|
});
|
|
2630
2630
|
}
|
|
2631
|
-
function
|
|
2631
|
+
function po({ className: e, children: t, ...n }) {
|
|
2632
2632
|
return /* @__PURE__ */ H(E, {
|
|
2633
2633
|
"data-slot": "canvas-shell-footer",
|
|
2634
2634
|
className: e,
|
|
@@ -2638,7 +2638,7 @@ function mo({ className: e, children: t, ...n }) {
|
|
|
2638
2638
|
}
|
|
2639
2639
|
//#endregion
|
|
2640
2640
|
//#region src/components/new-chat-trigger/new-chat-trigger.tsx
|
|
2641
|
-
var
|
|
2641
|
+
var mo = P(({ asChild: e = !1, children: t, onClick: n, ...r }, i) => {
|
|
2642
2642
|
let { goToNewChat: a } = X(), o = e ? W : "button";
|
|
2643
2643
|
function s(e) {
|
|
2644
2644
|
n?.(e), a();
|
|
@@ -2651,10 +2651,10 @@ var ho = P(({ asChild: e = !1, children: t, onClick: n, ...r }, i) => {
|
|
|
2651
2651
|
children: t
|
|
2652
2652
|
});
|
|
2653
2653
|
});
|
|
2654
|
-
|
|
2654
|
+
mo.displayName = "NewChatTrigger";
|
|
2655
2655
|
//#endregion
|
|
2656
2656
|
//#region src/components/chat-thinking-process/chat-thinking-process.tsx
|
|
2657
|
-
var
|
|
2657
|
+
var ho = P(function({ children: e, className: t, defaultOpen: r = !1, isStreaming: i = !1, ...a }, o) {
|
|
2658
2658
|
return /* @__PURE__ */ H(n, {
|
|
2659
2659
|
defaultOpen: r,
|
|
2660
2660
|
asChild: !0,
|
|
@@ -2669,8 +2669,8 @@ var go = P(function({ children: e, className: t, defaultOpen: r = !1, isStreamin
|
|
|
2669
2669
|
})
|
|
2670
2670
|
});
|
|
2671
2671
|
});
|
|
2672
|
-
|
|
2673
|
-
function
|
|
2672
|
+
ho.displayName = "ChatThinkingProcess";
|
|
2673
|
+
function go({ children: e, className: t, ...n }) {
|
|
2674
2674
|
return /* @__PURE__ */ U(a, {
|
|
2675
2675
|
"data-slot": "chat-thinking-process-trigger",
|
|
2676
2676
|
"data-testid": "chat-thinking-process-trigger",
|
|
@@ -2679,7 +2679,7 @@ function _o({ children: e, className: t, ...n }) {
|
|
|
2679
2679
|
children: [e, /* @__PURE__ */ H("style", { children: "\n @keyframes shimmer {\n 100% {\n mask-position: left;\n }\n }\n " })]
|
|
2680
2680
|
});
|
|
2681
2681
|
}
|
|
2682
|
-
function
|
|
2682
|
+
function _o({ children: e, className: t, ...n }) {
|
|
2683
2683
|
return /* @__PURE__ */ H("span", {
|
|
2684
2684
|
"data-slot": "chat-thinking-process-trigger-icon",
|
|
2685
2685
|
"data-testid": "chat-thinking-process-trigger-icon",
|
|
@@ -2688,8 +2688,8 @@ function vo({ children: e, className: t, ...n }) {
|
|
|
2688
2688
|
children: e
|
|
2689
2689
|
});
|
|
2690
2690
|
}
|
|
2691
|
-
function
|
|
2692
|
-
return /* @__PURE__ */ H(
|
|
2691
|
+
function vo({ children: e, className: t, ...n }) {
|
|
2692
|
+
return /* @__PURE__ */ H(j, {
|
|
2693
2693
|
asChild: !0,
|
|
2694
2694
|
variant: "body-sm",
|
|
2695
2695
|
"data-slot": "chat-thinking-process-trigger-label",
|
|
@@ -2701,7 +2701,7 @@ function yo({ children: e, className: t, ...n }) {
|
|
|
2701
2701
|
})
|
|
2702
2702
|
});
|
|
2703
2703
|
}
|
|
2704
|
-
function
|
|
2704
|
+
function yo({ className: e, ...t }) {
|
|
2705
2705
|
return /* @__PURE__ */ H(r, {
|
|
2706
2706
|
"data-slot": "chat-thinking-process-trigger-arrow",
|
|
2707
2707
|
"data-testid": "chat-thinking-process-trigger-arrow",
|
|
@@ -2709,9 +2709,9 @@ function bo({ className: e, ...t }) {
|
|
|
2709
2709
|
...t
|
|
2710
2710
|
});
|
|
2711
2711
|
}
|
|
2712
|
-
function
|
|
2712
|
+
function bo({ children: e, className: t, itemsClassName: n, rowClassName: r, markerClassName: a, connectorClassName: o, previewClassName: s, hasLastMessagePreview: c = !0, ...l }) {
|
|
2713
2713
|
let { lastItemContent: u, lastItemIndex: d } = z(() => {
|
|
2714
|
-
let t =
|
|
2714
|
+
let t = de.Children.toArray(e);
|
|
2715
2715
|
return {
|
|
2716
2716
|
lastItemContent: t.at(-1),
|
|
2717
2717
|
lastItemIndex: String(t.length)
|
|
@@ -2722,9 +2722,9 @@ function xo({ children: e, className: t, itemsClassName: n, rowClassName: r, mar
|
|
|
2722
2722
|
"data-testid": "chat-thinking-process-content",
|
|
2723
2723
|
"data-preview": c,
|
|
2724
2724
|
className: M("pt-8", t),
|
|
2725
|
-
children: [c && u && /* @__PURE__ */ H(
|
|
2725
|
+
children: [c && u && /* @__PURE__ */ H(Qt, {
|
|
2726
2726
|
mode: "wait",
|
|
2727
|
-
children: /* @__PURE__ */ H(
|
|
2727
|
+
children: /* @__PURE__ */ H(xo, {
|
|
2728
2728
|
contentId: d,
|
|
2729
2729
|
className: s,
|
|
2730
2730
|
children: u
|
|
@@ -2734,7 +2734,7 @@ function xo({ children: e, className: t, itemsClassName: n, rowClassName: r, mar
|
|
|
2734
2734
|
"data-testid": "chat-thinking-process-content-items",
|
|
2735
2735
|
className: M("flex flex-col", n),
|
|
2736
2736
|
...l,
|
|
2737
|
-
children:
|
|
2737
|
+
children: de.Children.map(e, (e) => /* @__PURE__ */ U("div", {
|
|
2738
2738
|
"data-slot": "chat-thinking-process-content-row",
|
|
2739
2739
|
className: M("relative flex gap-8 text-text-secondary text-sm last:pb-0", "pl-8", "last:[&>div:first-child>span:last-child]:hidden", r),
|
|
2740
2740
|
children: [/* @__PURE__ */ U("div", {
|
|
@@ -2755,8 +2755,8 @@ function xo({ children: e, className: t, itemsClassName: n, rowClassName: r, mar
|
|
|
2755
2755
|
})]
|
|
2756
2756
|
});
|
|
2757
2757
|
}
|
|
2758
|
-
function
|
|
2759
|
-
return /* @__PURE__ */ H(
|
|
2758
|
+
function xo({ children: e, className: t, contentId: n }) {
|
|
2759
|
+
return /* @__PURE__ */ H($t.div, {
|
|
2760
2760
|
"data-slot": "chat-thinking-process-content-preview",
|
|
2761
2761
|
"data-testid": "chat-thinking-process-content-preview",
|
|
2762
2762
|
initial: { opacity: 0 },
|
|
@@ -2770,7 +2770,7 @@ function So({ children: e, className: t, contentId: n }) {
|
|
|
2770
2770
|
children: e
|
|
2771
2771
|
}, n);
|
|
2772
2772
|
}
|
|
2773
|
-
function
|
|
2773
|
+
function So({ children: e, className: t, ...n }) {
|
|
2774
2774
|
return /* @__PURE__ */ H("div", {
|
|
2775
2775
|
"data-slot": "chat-thinking-process-content-item",
|
|
2776
2776
|
"data-testid": "chat-thinking-process-content-item",
|
|
@@ -2781,14 +2781,14 @@ function Co({ children: e, className: t, ...n }) {
|
|
|
2781
2781
|
}
|
|
2782
2782
|
//#endregion
|
|
2783
2783
|
//#region src/components/deprecated-empty-state.ts
|
|
2784
|
-
var
|
|
2784
|
+
var Co = s, wo = u, To = d, Eo = l, Do = c, Oo = {
|
|
2785
2785
|
paragraph: "editor-paragraph",
|
|
2786
2786
|
text: {
|
|
2787
2787
|
bold: "editor-text-bold",
|
|
2788
2788
|
italic: "editor-text-italic",
|
|
2789
2789
|
underline: "editor-text-underline"
|
|
2790
2790
|
}
|
|
2791
|
-
},
|
|
2791
|
+
}, ko = class e extends $e {
|
|
2792
2792
|
__src;
|
|
2793
2793
|
__altText;
|
|
2794
2794
|
static getType() {
|
|
@@ -2826,7 +2826,7 @@ var wo = s, To = u, Eo = d, Do = l, Oo = c, ko = {
|
|
|
2826
2826
|
return { img: () => ({
|
|
2827
2827
|
conversion: (e) => {
|
|
2828
2828
|
let t = e.getAttribute("src") || "", n = e.getAttribute("alt") || "";
|
|
2829
|
-
return t ? { node:
|
|
2829
|
+
return t ? { node: Ao(t, n) } : null;
|
|
2830
2830
|
},
|
|
2831
2831
|
priority: 0
|
|
2832
2832
|
}) };
|
|
@@ -2841,21 +2841,21 @@ var wo = s, To = u, Eo = d, Do = l, Oo = c, ko = {
|
|
|
2841
2841
|
};
|
|
2842
2842
|
}
|
|
2843
2843
|
static importJSON(e) {
|
|
2844
|
-
return
|
|
2844
|
+
return Ao(e.src, e.altText);
|
|
2845
2845
|
}
|
|
2846
2846
|
isInline() {
|
|
2847
2847
|
return !1;
|
|
2848
2848
|
}
|
|
2849
2849
|
};
|
|
2850
|
-
function
|
|
2851
|
-
return new
|
|
2850
|
+
function Ao(e, t) {
|
|
2851
|
+
return new ko(e, t);
|
|
2852
2852
|
}
|
|
2853
|
-
function
|
|
2854
|
-
return e instanceof
|
|
2853
|
+
function jo(e) {
|
|
2854
|
+
return e instanceof ko;
|
|
2855
2855
|
}
|
|
2856
2856
|
//#endregion
|
|
2857
2857
|
//#region src/components/rich-text-area/transformers.ts
|
|
2858
|
-
function
|
|
2858
|
+
function Mo(e) {
|
|
2859
2859
|
let t = /font-size\s*:\s*([^;]+)/i, n = /font-family\s*:\s*([^;]+)/i, r = /(?<![\w-])color\s*:\s*([^;]+)/i, i = t.exec(e), a = n.exec(e), o = r.exec(e);
|
|
2860
2860
|
return {
|
|
2861
2861
|
fontSize: i ? i[1].trim() : null,
|
|
@@ -2863,7 +2863,7 @@ function No(e) {
|
|
|
2863
2863
|
color: o ? o[1].trim() : null
|
|
2864
2864
|
};
|
|
2865
2865
|
}
|
|
2866
|
-
var
|
|
2866
|
+
var No = {
|
|
2867
2867
|
type: "text-match",
|
|
2868
2868
|
trigger: "",
|
|
2869
2869
|
regExp: /./,
|
|
@@ -2871,126 +2871,126 @@ var Po = {
|
|
|
2871
2871
|
dependencies: [],
|
|
2872
2872
|
export: (e) => {
|
|
2873
2873
|
if (!J(e)) return null;
|
|
2874
|
-
let t = e.getStyle() ?? "", n = e.getTextContent(), r =
|
|
2874
|
+
let t = e.getStyle() ?? "", n = e.getTextContent(), r = Mo(t);
|
|
2875
2875
|
if (r.fontSize || r.fontFamily || r.color) {
|
|
2876
2876
|
let e = "";
|
|
2877
2877
|
return r.fontSize && (e += `font-size: ${r.fontSize};`), r.fontFamily && (e += `font-family: ${r.fontFamily};`), r.color && (e += `color: ${r.color};`), `<span style="${e}">${n}</span>`;
|
|
2878
2878
|
}
|
|
2879
2879
|
return null;
|
|
2880
2880
|
}
|
|
2881
|
-
},
|
|
2881
|
+
}, Po = {
|
|
2882
2882
|
type: "text-match",
|
|
2883
2883
|
trigger: "",
|
|
2884
2884
|
regExp: /<span\s+style="([^"]+)">(.+?)<\/span>/,
|
|
2885
2885
|
importRegExp: /<span\s+style="([^"]+)">(.+?)<\/span>/,
|
|
2886
2886
|
dependencies: [],
|
|
2887
2887
|
replace: (e, t) => {
|
|
2888
|
-
let [, n, r] = t, i =
|
|
2888
|
+
let [, n, r] = t, i = He(r);
|
|
2889
2889
|
return i.setFormat(e.getFormat()), i.setStyle(n), e.replace(i), i;
|
|
2890
2890
|
}
|
|
2891
|
-
},
|
|
2891
|
+
}, Fo = {
|
|
2892
2892
|
type: "text-match",
|
|
2893
2893
|
trigger: "",
|
|
2894
2894
|
regExp: /<ins>(.*?)<\/ins>/,
|
|
2895
2895
|
importRegExp: /<ins>(.*?)<\/ins>/,
|
|
2896
2896
|
dependencies: [],
|
|
2897
2897
|
replace: (e, t) => {
|
|
2898
|
-
let n =
|
|
2898
|
+
let n = He(t[1]);
|
|
2899
2899
|
return n.setFormat(e.getFormat()), n.hasFormat("underline") || n.toggleFormat("underline"), e.replace(n), n;
|
|
2900
2900
|
},
|
|
2901
2901
|
export: (e) => !J(e) || !e.hasFormat("underline") ? null : `<ins>${e.getTextContent()}</ins>`
|
|
2902
|
-
},
|
|
2902
|
+
}, Io = (e) => {
|
|
2903
2903
|
let t = /text-align:\s*(\w+)/i.exec(e);
|
|
2904
2904
|
return t ? t[1].trim() : null;
|
|
2905
|
-
},
|
|
2905
|
+
}, Lo = {
|
|
2906
2906
|
type: "element",
|
|
2907
2907
|
dependencies: [],
|
|
2908
2908
|
regExp: /<div\s+style="([^"]+)">(.*?)<\/div>/,
|
|
2909
2909
|
replace: (e, t, n) => {
|
|
2910
|
-
let r =
|
|
2910
|
+
let r = Io(n[1]);
|
|
2911
2911
|
if (!r) return !1;
|
|
2912
2912
|
if (!n[2]) return;
|
|
2913
2913
|
let i = t[0];
|
|
2914
2914
|
J(i) && i.setTextContent(n[2]), e.setFormat(r), e.append(...t);
|
|
2915
2915
|
},
|
|
2916
2916
|
export: (e, t) => {
|
|
2917
|
-
if (!
|
|
2917
|
+
if (!Ke(e)) return null;
|
|
2918
2918
|
let n = e.getFormatType();
|
|
2919
2919
|
return !n || n === "left" ? null : `<div style="text-align: ${n}">${t(e)}</div>`;
|
|
2920
2920
|
}
|
|
2921
|
-
},
|
|
2921
|
+
}, Ro = {
|
|
2922
2922
|
type: "text-match",
|
|
2923
2923
|
trigger: "",
|
|
2924
2924
|
regExp: /./,
|
|
2925
2925
|
importRegExp: /./,
|
|
2926
|
-
dependencies: [
|
|
2927
|
-
export: (e) =>
|
|
2928
|
-
},
|
|
2926
|
+
dependencies: [ko],
|
|
2927
|
+
export: (e) => jo(e) ? `<img src="${e.__src}" alt="${e.__altText}" />` : null
|
|
2928
|
+
}, zo = {
|
|
2929
2929
|
type: "text-match",
|
|
2930
2930
|
trigger: "",
|
|
2931
2931
|
regExp: /<img\s+src="([^"]+)"\s+alt="([^"]*)"[^>]*\/?>/,
|
|
2932
2932
|
importRegExp: /<img\s+src="([^"]+)"\s+alt="([^"]*)"[^>]*\/?>/,
|
|
2933
|
-
dependencies: [
|
|
2933
|
+
dependencies: [ko],
|
|
2934
2934
|
replace: (e, t) => {
|
|
2935
|
-
let [, n, r] = t, i =
|
|
2935
|
+
let [, n, r] = t, i = Ao(n, r);
|
|
2936
2936
|
e.replace(i);
|
|
2937
2937
|
}
|
|
2938
|
-
},
|
|
2939
|
-
...
|
|
2938
|
+
}, Bo = [
|
|
2939
|
+
...Re,
|
|
2940
|
+
No,
|
|
2941
|
+
Fo,
|
|
2942
|
+
Lo,
|
|
2943
|
+
Ro
|
|
2944
|
+
], Vo = [
|
|
2945
|
+
...Re,
|
|
2940
2946
|
Po,
|
|
2941
|
-
Io,
|
|
2942
|
-
Ro,
|
|
2943
|
-
zo
|
|
2944
|
-
], Ho = [
|
|
2945
|
-
...ze,
|
|
2946
2947
|
Fo,
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
Bo
|
|
2948
|
+
Lo,
|
|
2949
|
+
zo
|
|
2950
2950
|
];
|
|
2951
2951
|
//#endregion
|
|
2952
2952
|
//#region src/components/rich-text-area/html-config.ts
|
|
2953
|
-
function
|
|
2953
|
+
function Ho(e) {
|
|
2954
2954
|
let t = e.nodeName.toLowerCase();
|
|
2955
2955
|
if (t !== "h1" && t !== "h2" && t !== "h3" && t !== "h4" && t !== "h5" && t !== "h6") return null;
|
|
2956
|
-
let n =
|
|
2956
|
+
let n = je(t), r = e.getAttribute("style") ?? "";
|
|
2957
2957
|
if (n.setStyle(r), e.style) {
|
|
2958
2958
|
let t = e.style.textAlign;
|
|
2959
|
-
(t === "left" || t === "right" || t === "center" || t === "justify" || t === "start" || t === "end") && n.setFormat(t),
|
|
2959
|
+
(t === "left" || t === "right" || t === "center" || t === "justify" || t === "start" || t === "end") && n.setFormat(t), ut(e, n);
|
|
2960
2960
|
}
|
|
2961
2961
|
return { node: n };
|
|
2962
2962
|
}
|
|
2963
|
-
function
|
|
2963
|
+
function Uo(e) {
|
|
2964
2964
|
if (e.getAttribute("__lexicallisttype") === "check" || e.classList.contains("contains-task-list")) return !0;
|
|
2965
|
-
for (let t of e.childNodes) if (
|
|
2965
|
+
for (let t of e.childNodes) if (lt(t) && t.hasAttribute("aria-checked")) return !0;
|
|
2966
2966
|
return !1;
|
|
2967
2967
|
}
|
|
2968
|
-
function
|
|
2968
|
+
function Wo(e) {
|
|
2969
2969
|
let t = e.nodeName.toLowerCase(), n = null;
|
|
2970
2970
|
if (t === "ol") {
|
|
2971
2971
|
let t = e.start;
|
|
2972
|
-
n =
|
|
2973
|
-
} else t === "ul" && (n =
|
|
2972
|
+
n = Ce("number", t);
|
|
2973
|
+
} else t === "ul" && (n = Uo(e) ? Ce("check") : Ce("bullet"));
|
|
2974
2974
|
if (!n) return null;
|
|
2975
2975
|
let r = e.getAttribute("style") ?? "";
|
|
2976
2976
|
return n.setStyle(r), { node: n };
|
|
2977
2977
|
}
|
|
2978
|
-
function
|
|
2978
|
+
function Go(e) {
|
|
2979
2979
|
if (e.classList.contains("task-list-item")) {
|
|
2980
2980
|
for (let t of e.children) if (t.tagName === "INPUT") {
|
|
2981
2981
|
let n = t;
|
|
2982
2982
|
if (n.getAttribute("type") === "checkbox") {
|
|
2983
|
-
let t = n.hasAttribute("checked"), r =
|
|
2983
|
+
let t = n.hasAttribute("checked"), r = Se(t), i = e.getAttribute("style") ?? "";
|
|
2984
2984
|
return r.setStyle(i), { node: r };
|
|
2985
2985
|
}
|
|
2986
2986
|
}
|
|
2987
2987
|
}
|
|
2988
|
-
let t = e.getAttribute("aria-checked"), n =
|
|
2988
|
+
let t = e.getAttribute("aria-checked"), n = Se(t === "true" || t !== "false" && void 0), r = e.getAttribute("style") ?? "";
|
|
2989
2989
|
return n.setStyle(r), { node: n };
|
|
2990
2990
|
}
|
|
2991
2991
|
var Z = 4;
|
|
2992
|
-
function
|
|
2993
|
-
let { color: t, fontSize: n, fontFamily: r } =
|
|
2992
|
+
function Ko(e) {
|
|
2993
|
+
let { color: t, fontSize: n, fontFamily: r } = Mo(e.getAttribute("style") ?? "");
|
|
2994
2994
|
if (!t && !n && !r) return null;
|
|
2995
2995
|
let i = e.style;
|
|
2996
2996
|
return {
|
|
@@ -3004,59 +3004,59 @@ function qo(e) {
|
|
|
3004
3004
|
node: null
|
|
3005
3005
|
};
|
|
3006
3006
|
}
|
|
3007
|
-
var
|
|
3007
|
+
var qo = {
|
|
3008
3008
|
h1: () => ({
|
|
3009
|
-
conversion:
|
|
3009
|
+
conversion: Ho,
|
|
3010
3010
|
priority: Z
|
|
3011
3011
|
}),
|
|
3012
3012
|
h2: () => ({
|
|
3013
|
-
conversion:
|
|
3013
|
+
conversion: Ho,
|
|
3014
3014
|
priority: Z
|
|
3015
3015
|
}),
|
|
3016
3016
|
h3: () => ({
|
|
3017
|
-
conversion:
|
|
3017
|
+
conversion: Ho,
|
|
3018
3018
|
priority: Z
|
|
3019
3019
|
}),
|
|
3020
3020
|
h4: () => ({
|
|
3021
|
-
conversion:
|
|
3021
|
+
conversion: Ho,
|
|
3022
3022
|
priority: Z
|
|
3023
3023
|
}),
|
|
3024
3024
|
h5: () => ({
|
|
3025
|
-
conversion:
|
|
3025
|
+
conversion: Ho,
|
|
3026
3026
|
priority: Z
|
|
3027
3027
|
}),
|
|
3028
3028
|
h6: () => ({
|
|
3029
|
-
conversion:
|
|
3029
|
+
conversion: Ho,
|
|
3030
3030
|
priority: Z
|
|
3031
3031
|
}),
|
|
3032
3032
|
ul: () => ({
|
|
3033
|
-
conversion:
|
|
3033
|
+
conversion: Wo,
|
|
3034
3034
|
priority: Z
|
|
3035
3035
|
}),
|
|
3036
3036
|
ol: () => ({
|
|
3037
|
-
conversion:
|
|
3037
|
+
conversion: Wo,
|
|
3038
3038
|
priority: Z
|
|
3039
3039
|
}),
|
|
3040
3040
|
li: () => ({
|
|
3041
|
-
conversion:
|
|
3041
|
+
conversion: Go,
|
|
3042
3042
|
priority: Z
|
|
3043
3043
|
}),
|
|
3044
3044
|
span: () => ({
|
|
3045
|
-
conversion:
|
|
3045
|
+
conversion: Ko,
|
|
3046
3046
|
priority: Z
|
|
3047
3047
|
})
|
|
3048
3048
|
};
|
|
3049
|
-
function
|
|
3049
|
+
function Jo(e) {
|
|
3050
3050
|
return (t, n) => {
|
|
3051
3051
|
let r = e.prototype.exportDOM.call(n, t), i = n.getStyle();
|
|
3052
3052
|
return r.element && i && r.element.setAttribute("style", i), r;
|
|
3053
3053
|
};
|
|
3054
3054
|
}
|
|
3055
|
-
var
|
|
3056
|
-
[
|
|
3057
|
-
[
|
|
3058
|
-
[
|
|
3059
|
-
]),
|
|
3055
|
+
var Yo = /* @__PURE__ */ new Map([
|
|
3056
|
+
[Me, Jo(Me)],
|
|
3057
|
+
[Te, Jo(Te)],
|
|
3058
|
+
[we, Jo(we)]
|
|
3059
|
+
]), Xo = class e extends et {
|
|
3060
3060
|
static getType() {
|
|
3061
3061
|
return "div-block";
|
|
3062
3062
|
}
|
|
@@ -3073,7 +3073,7 @@ var Xo = /* @__PURE__ */ new Map([
|
|
|
3073
3073
|
}
|
|
3074
3074
|
static importDOM() {
|
|
3075
3075
|
return { div: () => ({
|
|
3076
|
-
conversion:
|
|
3076
|
+
conversion: Zo,
|
|
3077
3077
|
priority: 4
|
|
3078
3078
|
}) };
|
|
3079
3079
|
}
|
|
@@ -3085,7 +3085,7 @@ var Xo = /* @__PURE__ */ new Map([
|
|
|
3085
3085
|
} : e;
|
|
3086
3086
|
}
|
|
3087
3087
|
static importJSON(e) {
|
|
3088
|
-
let t =
|
|
3088
|
+
let t = Qo().updateFromJSON(e);
|
|
3089
3089
|
return e.style !== void 0 && t.setStyle(e.style), t;
|
|
3090
3090
|
}
|
|
3091
3091
|
updateFromJSON(e) {
|
|
@@ -3098,32 +3098,32 @@ var Xo = /* @__PURE__ */ new Map([
|
|
|
3098
3098
|
if (this.getNextSibling() !== null) return this.selectNext(), this.remove(), !0;
|
|
3099
3099
|
if (this.getPreviousSibling() !== null) return this.selectPrevious(), this.remove(), !0;
|
|
3100
3100
|
} else {
|
|
3101
|
-
let e =
|
|
3101
|
+
let e = Be();
|
|
3102
3102
|
return e.setFormat(this.getFormatType()), e.setStyle(this.getStyle()), e.setIndent(this.getIndent()), e.setDirection(this.getDirection()), t.forEach((t) => e.append(t)), this.replace(e), !0;
|
|
3103
3103
|
}
|
|
3104
3104
|
return !1;
|
|
3105
3105
|
}
|
|
3106
3106
|
};
|
|
3107
|
-
function
|
|
3108
|
-
let t =
|
|
3107
|
+
function Zo(e) {
|
|
3108
|
+
let t = Qo(), n = e.getAttribute("style") ?? "";
|
|
3109
3109
|
if (t.setStyle(n), e.style) {
|
|
3110
3110
|
let n = e.style.textAlign;
|
|
3111
|
-
(n === "left" || n === "right" || n === "center" || n === "justify" || n === "start" || n === "end") && t.setFormat(n),
|
|
3111
|
+
(n === "left" || n === "right" || n === "center" || n === "justify" || n === "start" || n === "end") && t.setFormat(n), ut(e, t);
|
|
3112
3112
|
}
|
|
3113
3113
|
return { node: t };
|
|
3114
3114
|
}
|
|
3115
|
-
function
|
|
3116
|
-
return new
|
|
3115
|
+
function Qo() {
|
|
3116
|
+
return new Xo();
|
|
3117
3117
|
}
|
|
3118
3118
|
//#endregion
|
|
3119
3119
|
//#region src/components/rich-text-area/plugins/value-plugin.tsx
|
|
3120
|
-
var
|
|
3121
|
-
function
|
|
3120
|
+
var $o = 50;
|
|
3121
|
+
function es({ onChange: e, source: t = "markdown", emittedValuesRef: n }) {
|
|
3122
3122
|
let r = F((r, i, a) => {
|
|
3123
3123
|
if (!a.has("focus") && e) try {
|
|
3124
3124
|
r.read(() => {
|
|
3125
|
-
let r = t === "html" ?
|
|
3126
|
-
n && (n.current.push(r), n.current.splice(0, n.current.length -
|
|
3125
|
+
let r = t === "html" ? an(i) : Ie(Bo);
|
|
3126
|
+
n && (n.current.push(r), n.current.splice(0, n.current.length - $o)), e(r);
|
|
3127
3127
|
});
|
|
3128
3128
|
} catch {}
|
|
3129
3129
|
}, [
|
|
@@ -3131,16 +3131,16 @@ function ts({ onChange: e, source: t = "markdown", emittedValuesRef: n }) {
|
|
|
3131
3131
|
t,
|
|
3132
3132
|
n
|
|
3133
3133
|
]);
|
|
3134
|
-
return /* @__PURE__ */ H(
|
|
3134
|
+
return /* @__PURE__ */ H(dt, { onChange: r });
|
|
3135
3135
|
}
|
|
3136
3136
|
//#endregion
|
|
3137
3137
|
//#region src/components/rich-text-area/hooks.ts
|
|
3138
3138
|
function Q() {
|
|
3139
|
-
let [e] =
|
|
3139
|
+
let [e] = Pe();
|
|
3140
3140
|
return e;
|
|
3141
3141
|
}
|
|
3142
|
-
function
|
|
3143
|
-
let [e] =
|
|
3142
|
+
function ts() {
|
|
3143
|
+
let [e] = Pe();
|
|
3144
3144
|
return F(() => {
|
|
3145
3145
|
let t = "";
|
|
3146
3146
|
return e.getEditorState().read(() => {
|
|
@@ -3150,7 +3150,7 @@ function ns() {
|
|
|
3150
3150
|
}
|
|
3151
3151
|
//#endregion
|
|
3152
3152
|
//#region src/components/rich-text-area/plugins/disabled-plugin.tsx
|
|
3153
|
-
function
|
|
3153
|
+
function ns({ isDisabled: e }) {
|
|
3154
3154
|
let t = Q();
|
|
3155
3155
|
return L(() => {
|
|
3156
3156
|
t.setEditable(!e);
|
|
@@ -3158,50 +3158,50 @@ function rs({ isDisabled: e }) {
|
|
|
3158
3158
|
}
|
|
3159
3159
|
//#endregion
|
|
3160
3160
|
//#region src/components/rich-text-area/plugins/controlled-plugin.tsx
|
|
3161
|
-
function
|
|
3161
|
+
function rs({ controlledRef: e }) {
|
|
3162
3162
|
let t = B(null);
|
|
3163
|
-
return
|
|
3163
|
+
return ge(e, () => ({ focus: () => {
|
|
3164
3164
|
Promise.resolve().then(() => {
|
|
3165
3165
|
t.current?.focus();
|
|
3166
3166
|
});
|
|
3167
|
-
} }), []), /* @__PURE__ */ H(
|
|
3167
|
+
} }), []), /* @__PURE__ */ H(sn, { editorRef: t });
|
|
3168
3168
|
}
|
|
3169
3169
|
//#endregion
|
|
3170
3170
|
//#region src/components/rich-text-area/utils/index.ts
|
|
3171
|
-
function
|
|
3171
|
+
function is(e) {
|
|
3172
3172
|
let t = e.getRootElement();
|
|
3173
3173
|
t && (t.scrollTop = t.scrollHeight);
|
|
3174
3174
|
}
|
|
3175
|
-
function
|
|
3175
|
+
function as() {
|
|
3176
3176
|
let e = G().getLastDescendant();
|
|
3177
3177
|
if (e && J(e)) {
|
|
3178
|
-
let t =
|
|
3179
|
-
t.anchor.set(e.getKey(), n, "text"), t.focus.set(e.getKey(), n, "text"),
|
|
3178
|
+
let t = Ve(), n = e.getTextContentSize();
|
|
3179
|
+
t.anchor.set(e.getKey(), n, "text"), t.focus.set(e.getKey(), n, "text"), Je(t);
|
|
3180
3180
|
} else {
|
|
3181
|
-
|
|
3181
|
+
qe();
|
|
3182
3182
|
let e = K();
|
|
3183
3183
|
if (q(e)) {
|
|
3184
3184
|
let t = e.focus.getNode(), n = J(t) ? t.getTextContentSize() : 0;
|
|
3185
|
-
e.anchor.set(e.focus.key, e.focus.offset, e.focus.type), e.focus.set(e.focus.key, n, e.focus.type),
|
|
3185
|
+
e.anchor.set(e.focus.key, e.focus.offset, e.focus.type), e.focus.set(e.focus.key, n, e.focus.type), Je(e);
|
|
3186
3186
|
}
|
|
3187
3187
|
}
|
|
3188
3188
|
}
|
|
3189
|
-
function
|
|
3189
|
+
function os(e, t) {
|
|
3190
3190
|
let n = new DOMParser().parseFromString(t, "text/html");
|
|
3191
|
-
return
|
|
3191
|
+
return on(e, n).map((e) => {
|
|
3192
3192
|
if (J(e)) {
|
|
3193
|
-
let t =
|
|
3193
|
+
let t = Be();
|
|
3194
3194
|
return t.append(e), t;
|
|
3195
3195
|
}
|
|
3196
3196
|
return e;
|
|
3197
3197
|
});
|
|
3198
3198
|
}
|
|
3199
|
-
function
|
|
3199
|
+
function ss(e, t) {
|
|
3200
3200
|
let n = G();
|
|
3201
|
-
n.clear(),
|
|
3201
|
+
n.clear(), os(e, t).forEach((e) => n.append(e));
|
|
3202
3202
|
}
|
|
3203
|
-
function
|
|
3204
|
-
let n = K(), r =
|
|
3203
|
+
function cs(e, t) {
|
|
3204
|
+
let n = K(), r = os(e, t);
|
|
3205
3205
|
if (q(n)) n.insertNodes(r);
|
|
3206
3206
|
else {
|
|
3207
3207
|
let e = G();
|
|
@@ -3210,8 +3210,8 @@ function ls(e, t) {
|
|
|
3210
3210
|
}
|
|
3211
3211
|
//#endregion
|
|
3212
3212
|
//#region src/components/rich-text-area/plugins/controlled-value-plugin.tsx
|
|
3213
|
-
function
|
|
3214
|
-
let r = Q(), i = B(), a = B(!!e?.trim()), o =
|
|
3213
|
+
function ls({ value: e, source: t = "markdown", emittedValuesRef: n }) {
|
|
3214
|
+
let r = Q(), i = B(), a = B(!!e?.trim()), o = le("desktop");
|
|
3215
3215
|
return L(() => {
|
|
3216
3216
|
if (!r || e === i.current) return;
|
|
3217
3217
|
if (i.current = e, n && e !== void 0) {
|
|
@@ -3220,20 +3220,20 @@ function us({ value: e, source: t = "markdown", emittedValuesRef: n }) {
|
|
|
3220
3220
|
}
|
|
3221
3221
|
let s = "";
|
|
3222
3222
|
if (r.getEditorState().read(() => {
|
|
3223
|
-
s = t === "html" ?
|
|
3223
|
+
s = t === "html" ? an(r) : Ie(Bo);
|
|
3224
3224
|
}), e !== void 0 && e !== s) {
|
|
3225
3225
|
if (e === "") {
|
|
3226
3226
|
r.update(() => {
|
|
3227
|
-
|
|
3227
|
+
ze(at), t === "html" ? G().clear() : Fe("", Vo), as();
|
|
3228
3228
|
}, { discrete: !0 }), Promise.resolve().then(() => {
|
|
3229
3229
|
o ? r.focus() : r.blur();
|
|
3230
3230
|
});
|
|
3231
3231
|
return;
|
|
3232
3232
|
}
|
|
3233
3233
|
r.update(() => {
|
|
3234
|
-
|
|
3234
|
+
ze(at), t === "html" ? ss(r, e) : Fe(e, Vo), as();
|
|
3235
3235
|
}), a.current && (a.current = !1, Promise.resolve().then(() => {
|
|
3236
|
-
requestAnimationFrame(() =>
|
|
3236
|
+
requestAnimationFrame(() => is(r));
|
|
3237
3237
|
})), o && Promise.resolve().then(() => {
|
|
3238
3238
|
r.focus();
|
|
3239
3239
|
});
|
|
@@ -3248,7 +3248,7 @@ function us({ value: e, source: t = "markdown", emittedValuesRef: n }) {
|
|
|
3248
3248
|
}
|
|
3249
3249
|
//#endregion
|
|
3250
3250
|
//#region src/components/rich-text-area/plugins/blur-plugin.tsx
|
|
3251
|
-
function
|
|
3251
|
+
function us({ onBlur: e }) {
|
|
3252
3252
|
let t = Q();
|
|
3253
3253
|
return L(() => {
|
|
3254
3254
|
if (!e) return;
|
|
@@ -3264,7 +3264,7 @@ function ds({ onBlur: e }) {
|
|
|
3264
3264
|
}
|
|
3265
3265
|
//#endregion
|
|
3266
3266
|
//#region src/components/rich-text-area/plugins/focus-plugin.tsx
|
|
3267
|
-
function
|
|
3267
|
+
function ds({ onFocusChange: e }) {
|
|
3268
3268
|
let t = Q();
|
|
3269
3269
|
return L(() => {
|
|
3270
3270
|
if (!e) return;
|
|
@@ -3283,68 +3283,68 @@ function fs({ onFocusChange: e }) {
|
|
|
3283
3283
|
}
|
|
3284
3284
|
//#endregion
|
|
3285
3285
|
//#region src/components/rich-text-area/plugins/image-drop-plugin.tsx
|
|
3286
|
-
var
|
|
3286
|
+
var fs = st("INSERT_IMAGE_COMMAND"), ps = "helvetiq:insert-image", ms = class extends CustomEvent {
|
|
3287
3287
|
constructor(e) {
|
|
3288
|
-
super(
|
|
3288
|
+
super(ps, { detail: e });
|
|
3289
3289
|
}
|
|
3290
3290
|
};
|
|
3291
|
-
function
|
|
3291
|
+
function hs() {
|
|
3292
3292
|
let e = Q();
|
|
3293
|
-
return L(() => e.registerCommand(
|
|
3294
|
-
let e =
|
|
3295
|
-
|
|
3296
|
-
}), !0),
|
|
3293
|
+
return L(() => e.registerCommand(fs, (t) => (e.update(() => {
|
|
3294
|
+
let e = Ao(t.src, t.altText);
|
|
3295
|
+
We([e]);
|
|
3296
|
+
}), !0), Ze), [e]), L(() => {
|
|
3297
3297
|
if (!e.getRootElement()) return;
|
|
3298
3298
|
function t(t) {
|
|
3299
3299
|
let n = t;
|
|
3300
|
-
e.dispatchCommand(
|
|
3300
|
+
e.dispatchCommand(fs, n.detail);
|
|
3301
3301
|
}
|
|
3302
|
-
return document.addEventListener(
|
|
3303
|
-
document.removeEventListener(
|
|
3302
|
+
return document.addEventListener(ps, t), () => {
|
|
3303
|
+
document.removeEventListener(ps, t);
|
|
3304
3304
|
};
|
|
3305
3305
|
}, [e]), null;
|
|
3306
3306
|
}
|
|
3307
3307
|
//#endregion
|
|
3308
3308
|
//#region src/components/rich-text-area/plugins/html-paste-plugin.tsx
|
|
3309
|
-
var
|
|
3309
|
+
var gs = st("PASTE_HTML_COMMAND"), _s = st("INSERT_HTML_COMMAND"), vs = "helvetiq:paste-html", ys = "helvetiq:insert-html", bs = class extends CustomEvent {
|
|
3310
3310
|
constructor(e) {
|
|
3311
|
-
super(
|
|
3311
|
+
super(vs, { detail: e });
|
|
3312
3312
|
}
|
|
3313
|
-
},
|
|
3313
|
+
}, xs = class extends CustomEvent {
|
|
3314
3314
|
constructor(e) {
|
|
3315
|
-
super(
|
|
3315
|
+
super(ys, { detail: e });
|
|
3316
3316
|
}
|
|
3317
3317
|
};
|
|
3318
|
-
function
|
|
3318
|
+
function Ss() {
|
|
3319
3319
|
let e = Q();
|
|
3320
|
-
return L(() => e.registerCommand(
|
|
3320
|
+
return L(() => e.registerCommand(gs, (t) => (e.update(() => {
|
|
3321
3321
|
let n = G();
|
|
3322
3322
|
n.clear();
|
|
3323
|
-
let r = new DOMParser().parseFromString(t.html, "text/html"), i =
|
|
3323
|
+
let r = new DOMParser().parseFromString(t.html, "text/html"), i = on(e, r);
|
|
3324
3324
|
n.append(...i);
|
|
3325
|
-
}), !0),
|
|
3326
|
-
let n = new DOMParser().parseFromString(t.html, "text/html"), r =
|
|
3327
|
-
|
|
3328
|
-
}), !0),
|
|
3325
|
+
}), !0), Ze), [e]), L(() => e.registerCommand(_s, (t) => (e.update(() => {
|
|
3326
|
+
let n = new DOMParser().parseFromString(t.html, "text/html"), r = on(e, n);
|
|
3327
|
+
We(r);
|
|
3328
|
+
}), !0), Ze), [e]), L(() => {
|
|
3329
3329
|
if (!e.getRootElement()) return;
|
|
3330
3330
|
function t(t) {
|
|
3331
3331
|
let n = t;
|
|
3332
|
-
e.dispatchCommand(
|
|
3332
|
+
e.dispatchCommand(gs, n.detail);
|
|
3333
3333
|
}
|
|
3334
3334
|
function n(t) {
|
|
3335
3335
|
let n = t;
|
|
3336
|
-
e.dispatchCommand(
|
|
3336
|
+
e.dispatchCommand(_s, n.detail);
|
|
3337
3337
|
}
|
|
3338
|
-
return document.addEventListener(
|
|
3339
|
-
document.removeEventListener(
|
|
3338
|
+
return document.addEventListener(vs, t), document.addEventListener(ys, n), () => {
|
|
3339
|
+
document.removeEventListener(vs, t), document.removeEventListener(ys, n);
|
|
3340
3340
|
};
|
|
3341
3341
|
}, [e]), null;
|
|
3342
3342
|
}
|
|
3343
3343
|
//#endregion
|
|
3344
3344
|
//#region src/components/rich-text-area/plugins/markdown-plain-paste-plugin.tsx
|
|
3345
|
-
function
|
|
3345
|
+
function Cs() {
|
|
3346
3346
|
let e = Q();
|
|
3347
|
-
return L(() => e.registerCommand(
|
|
3347
|
+
return L(() => e.registerCommand(rt, (t) => {
|
|
3348
3348
|
let { clipboardData: n } = t;
|
|
3349
3349
|
if (!n) return !1;
|
|
3350
3350
|
let r = n.getData("text/plain");
|
|
@@ -3356,18 +3356,18 @@ function ws() {
|
|
|
3356
3356
|
}
|
|
3357
3357
|
let t = G();
|
|
3358
3358
|
t.clear(), r.split(/\r?\n/).forEach((e) => {
|
|
3359
|
-
let n =
|
|
3360
|
-
e.length > 0 && n.append(
|
|
3359
|
+
let n = Be();
|
|
3360
|
+
e.length > 0 && n.append(He(e)), t.append(n);
|
|
3361
3361
|
});
|
|
3362
3362
|
}), !0) : !1;
|
|
3363
|
-
},
|
|
3363
|
+
}, Xe), [e]), null;
|
|
3364
3364
|
}
|
|
3365
3365
|
//#endregion
|
|
3366
3366
|
//#region src/components/rich-text-area/plugins/file-attachment-plugin.tsx
|
|
3367
|
-
var
|
|
3368
|
-
function
|
|
3367
|
+
var ws = st("ATTACH_FILE_COMMAND");
|
|
3368
|
+
function Ts({ acceptedFiles: e = [], isMultiple: t = !1, onFileAttach: n }) {
|
|
3369
3369
|
let r = Q(), i = B(null);
|
|
3370
|
-
L(() => r.registerCommand(
|
|
3370
|
+
L(() => r.registerCommand(ws, () => (i.current?.click(), !0), Ze), [r]);
|
|
3371
3371
|
function a(e) {
|
|
3372
3372
|
let r = Array.from(e.target.files ?? []);
|
|
3373
3373
|
if (t) n?.(r);
|
|
@@ -3389,45 +3389,45 @@ function Es({ acceptedFiles: e = [], isMultiple: t = !1, onFileAttach: n }) {
|
|
|
3389
3389
|
}
|
|
3390
3390
|
//#endregion
|
|
3391
3391
|
//#region src/components/rich-text-area/styled.tsx
|
|
3392
|
-
var
|
|
3392
|
+
var Es = P(({ className: e, children: t, ...n }, r) => /* @__PURE__ */ H("div", {
|
|
3393
3393
|
ref: r,
|
|
3394
3394
|
className: M("w-full resize-none border-none outline-none bg-transparent font-[inherit] text-[inherit] flex items-center [&_.editor-paragraph]:m-0 [&_.editor-paragraph]:min-h-[26px] [&_.editor-text-bold]:font-bold [&_.editor-text-italic]:italic [&_.editor-text-underline]:underline", e),
|
|
3395
3395
|
...n,
|
|
3396
3396
|
children: t
|
|
3397
3397
|
}));
|
|
3398
|
-
|
|
3398
|
+
Es.displayName = "Wrapper";
|
|
3399
3399
|
//#endregion
|
|
3400
3400
|
//#region src/components/rich-text-area/rich-text-area.tsx
|
|
3401
|
-
var
|
|
3401
|
+
var Ds = {
|
|
3402
3402
|
namespace: "helvetiq",
|
|
3403
|
-
theme:
|
|
3403
|
+
theme: Oo,
|
|
3404
3404
|
editable: !0,
|
|
3405
3405
|
nodes: [
|
|
3406
|
-
Ee,
|
|
3407
3406
|
Te,
|
|
3407
|
+
we,
|
|
3408
|
+
Me,
|
|
3408
3409
|
Ne,
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
Zo,
|
|
3414
|
-
rn,
|
|
3410
|
+
ve,
|
|
3411
|
+
be,
|
|
3412
|
+
ko,
|
|
3413
|
+
Xo,
|
|
3415
3414
|
nn,
|
|
3416
|
-
|
|
3415
|
+
tn,
|
|
3416
|
+
rn
|
|
3417
3417
|
],
|
|
3418
3418
|
html: {
|
|
3419
|
-
import:
|
|
3420
|
-
export:
|
|
3419
|
+
import: qo,
|
|
3420
|
+
export: Yo
|
|
3421
3421
|
},
|
|
3422
3422
|
onError: (e) => {
|
|
3423
3423
|
console.error("Lexical error:", e);
|
|
3424
3424
|
}
|
|
3425
3425
|
};
|
|
3426
|
-
function
|
|
3426
|
+
function Os({ children: e, name: t, value: n, source: r = "markdown", className: i, containerClassName: a, placeholderClassName: o, placeholder: s = "", isDisabled: c = !1, onChange: l, onBlur: u, onKeyDown: d, onFocusChange: f, forwardedRef: p, ...m }) {
|
|
3427
3427
|
let h = B([]);
|
|
3428
|
-
return /* @__PURE__ */ H(
|
|
3429
|
-
initialConfig:
|
|
3430
|
-
children: /* @__PURE__ */ U(
|
|
3428
|
+
return /* @__PURE__ */ H(Ee, {
|
|
3429
|
+
initialConfig: Ds,
|
|
3430
|
+
children: /* @__PURE__ */ U(Es, {
|
|
3431
3431
|
"data-slot": "rich-text-area",
|
|
3432
3432
|
"data-testid": "rich-text-area",
|
|
3433
3433
|
"aria-disabled": c,
|
|
@@ -3435,13 +3435,13 @@ function ks({ children: e, name: t, value: n, source: r = "markdown", className:
|
|
|
3435
3435
|
className: M("relative size-full overflow-hidden", "data-[disabled=true]:opacity-80", "data-[disabled=true]:cursor-not-allowed data-[disabled=true]:select-none", a),
|
|
3436
3436
|
...m,
|
|
3437
3437
|
children: [
|
|
3438
|
-
/* @__PURE__ */ H(
|
|
3439
|
-
contentEditable: /* @__PURE__ */ H(
|
|
3438
|
+
/* @__PURE__ */ H(Ae, {
|
|
3439
|
+
contentEditable: /* @__PURE__ */ H(De, {
|
|
3440
3440
|
"data-slot": "rich-text-area-editable",
|
|
3441
3441
|
className: M("relative inset-0 overflow-y-auto", i),
|
|
3442
3442
|
"data-name": t,
|
|
3443
3443
|
"aria-placeholder": s,
|
|
3444
|
-
placeholder: /* @__PURE__ */ H(
|
|
3444
|
+
placeholder: /* @__PURE__ */ H(j, {
|
|
3445
3445
|
variant: "body",
|
|
3446
3446
|
className: M("absolute left-0 top-0", "text-text-tertiary", "pointer-events-none user-select-none", o),
|
|
3447
3447
|
asChild: !0,
|
|
@@ -3456,38 +3456,38 @@ function ks({ children: e, name: t, value: n, source: r = "markdown", className:
|
|
|
3456
3456
|
minHeight: "20px"
|
|
3457
3457
|
}
|
|
3458
3458
|
}),
|
|
3459
|
-
ErrorBoundary:
|
|
3459
|
+
ErrorBoundary: Oe
|
|
3460
3460
|
}),
|
|
3461
|
-
/* @__PURE__ */ H(
|
|
3462
|
-
/* @__PURE__ */ H(
|
|
3461
|
+
/* @__PURE__ */ H(ns, { isDisabled: c }),
|
|
3462
|
+
/* @__PURE__ */ H(ls, {
|
|
3463
3463
|
value: n,
|
|
3464
3464
|
source: r,
|
|
3465
3465
|
emittedValuesRef: h
|
|
3466
3466
|
}),
|
|
3467
|
-
/* @__PURE__ */ H(
|
|
3467
|
+
/* @__PURE__ */ H(es, {
|
|
3468
3468
|
onChange: l,
|
|
3469
3469
|
source: r,
|
|
3470
3470
|
emittedValuesRef: h
|
|
3471
3471
|
}),
|
|
3472
|
-
/* @__PURE__ */ H(
|
|
3473
|
-
/* @__PURE__ */ H(
|
|
3474
|
-
/* @__PURE__ */ H(
|
|
3475
|
-
/* @__PURE__ */ H(
|
|
3476
|
-
/* @__PURE__ */ H(
|
|
3477
|
-
r === "markdown" && /* @__PURE__ */ H(
|
|
3472
|
+
/* @__PURE__ */ H(us, { onBlur: u }),
|
|
3473
|
+
/* @__PURE__ */ H(ke, {}),
|
|
3474
|
+
/* @__PURE__ */ H(rs, { controlledRef: p ?? null }),
|
|
3475
|
+
/* @__PURE__ */ H(ds, { onFocusChange: f }),
|
|
3476
|
+
/* @__PURE__ */ H(en, {}),
|
|
3477
|
+
r === "markdown" && /* @__PURE__ */ H(Cs, {}),
|
|
3478
3478
|
e
|
|
3479
3479
|
]
|
|
3480
3480
|
})
|
|
3481
3481
|
});
|
|
3482
3482
|
}
|
|
3483
|
-
var
|
|
3483
|
+
var ks = P((e, t) => /* @__PURE__ */ H(Os, {
|
|
3484
3484
|
...e,
|
|
3485
3485
|
forwardedRef: t
|
|
3486
3486
|
}));
|
|
3487
|
-
|
|
3487
|
+
ks.displayName = "RichTextArea";
|
|
3488
3488
|
//#endregion
|
|
3489
3489
|
//#region src/components/rich-text-field/constants.ts
|
|
3490
|
-
var
|
|
3490
|
+
var As = "Arial, sans-serif", js = [
|
|
3491
3491
|
{
|
|
3492
3492
|
value: "Arial, sans-serif",
|
|
3493
3493
|
label: "Arial"
|
|
@@ -3524,7 +3524,7 @@ var js = "Arial, sans-serif", Ms = [
|
|
|
3524
3524
|
value: "\"Brush Script MT\", cursive",
|
|
3525
3525
|
label: "Brush Script MT"
|
|
3526
3526
|
}
|
|
3527
|
-
],
|
|
3527
|
+
], Ms = As, Ns = [
|
|
3528
3528
|
{
|
|
3529
3529
|
label: "10",
|
|
3530
3530
|
value: "10"
|
|
@@ -3553,11 +3553,11 @@ var js = "Arial, sans-serif", Ms = [
|
|
|
3553
3553
|
label: "48",
|
|
3554
3554
|
value: "48"
|
|
3555
3555
|
}
|
|
3556
|
-
],
|
|
3556
|
+
], Ps = "left", Fs = "#000000";
|
|
3557
3557
|
//#endregion
|
|
3558
3558
|
//#region src/components/rich-text-field/components/toolbar-select.tsx
|
|
3559
|
-
function
|
|
3560
|
-
return /* @__PURE__ */ H(
|
|
3559
|
+
function Is({ className: e, selectItemClassName: t, ...n }) {
|
|
3560
|
+
return /* @__PURE__ */ H(k, {
|
|
3561
3561
|
fullWidth: !1,
|
|
3562
3562
|
size: "small",
|
|
3563
3563
|
className: M(e),
|
|
@@ -3567,44 +3567,44 @@ function Ls({ className: e, selectItemClassName: t, ...n }) {
|
|
|
3567
3567
|
}
|
|
3568
3568
|
//#endregion
|
|
3569
3569
|
//#region src/components/rich-text-field/components/alignment-select.tsx
|
|
3570
|
-
function
|
|
3570
|
+
function Ls(e) {
|
|
3571
3571
|
return e === "center" || e === "right" ? e : e === "end" ? "right" : "left";
|
|
3572
3572
|
}
|
|
3573
|
-
var
|
|
3573
|
+
var Rs = {
|
|
3574
3574
|
left: {
|
|
3575
3575
|
label: "Left",
|
|
3576
|
-
icon: /* @__PURE__ */ H(
|
|
3576
|
+
icon: /* @__PURE__ */ H(Tt, { fontSize: "inherit" })
|
|
3577
3577
|
},
|
|
3578
3578
|
center: {
|
|
3579
3579
|
label: "Center",
|
|
3580
|
-
icon: /* @__PURE__ */ H(
|
|
3580
|
+
icon: /* @__PURE__ */ H(wt, { fontSize: "inherit" })
|
|
3581
3581
|
},
|
|
3582
3582
|
right: {
|
|
3583
3583
|
label: "Right",
|
|
3584
|
-
icon: /* @__PURE__ */ H(
|
|
3584
|
+
icon: /* @__PURE__ */ H(Et, { fontSize: "inherit" })
|
|
3585
3585
|
}
|
|
3586
3586
|
};
|
|
3587
|
-
function
|
|
3588
|
-
let t = Q(), [n, r] = V(
|
|
3587
|
+
function zs({ className: e }) {
|
|
3588
|
+
let t = Q(), [n, r] = V(Ps), i = z(() => Object.entries(Rs).map(([e, { label: t, icon: n }]) => ({
|
|
3589
3589
|
value: e,
|
|
3590
3590
|
label: t,
|
|
3591
3591
|
icon: n
|
|
3592
3592
|
})), []), a = F(() => {
|
|
3593
3593
|
let e = K();
|
|
3594
3594
|
if (q(e)) {
|
|
3595
|
-
let t = e.anchor.getNode(), n = t.getParent(), i =
|
|
3596
|
-
|
|
3595
|
+
let t = e.anchor.getNode(), n = t.getParent(), i = Ge(t) ? t : n;
|
|
3596
|
+
Ge(i) && r(Ls(i.getFormatType() || "left"));
|
|
3597
3597
|
}
|
|
3598
3598
|
}, []);
|
|
3599
|
-
L(() =>
|
|
3599
|
+
L(() => ln(t.registerUpdateListener(({ editorState: e }) => {
|
|
3600
3600
|
e.read(() => {
|
|
3601
3601
|
a();
|
|
3602
3602
|
});
|
|
3603
|
-
}), t.registerCommand(
|
|
3603
|
+
}), t.registerCommand(it, () => (a(), !1), Qe)), [t, a]);
|
|
3604
3604
|
function o(e) {
|
|
3605
|
-
t.dispatchCommand(
|
|
3605
|
+
t.dispatchCommand(tt, e);
|
|
3606
3606
|
}
|
|
3607
|
-
return /* @__PURE__ */ H(
|
|
3607
|
+
return /* @__PURE__ */ H(Is, {
|
|
3608
3608
|
shouldShowOnlyIcon: !0,
|
|
3609
3609
|
options: i,
|
|
3610
3610
|
value: n,
|
|
@@ -3627,91 +3627,91 @@ function $({ className: e, children: t, isActive: n, isDisabled: r = !1, ...i })
|
|
|
3627
3627
|
}
|
|
3628
3628
|
//#endregion
|
|
3629
3629
|
//#region src/components/rich-text-field/components/attachment-button.tsx
|
|
3630
|
-
function
|
|
3630
|
+
function Bs(e) {
|
|
3631
3631
|
let t = Q();
|
|
3632
3632
|
function n() {
|
|
3633
|
-
t.dispatchCommand(
|
|
3633
|
+
t.dispatchCommand(ws, void 0);
|
|
3634
3634
|
}
|
|
3635
3635
|
return /* @__PURE__ */ H($, {
|
|
3636
3636
|
"data-testid": "attachment-button",
|
|
3637
3637
|
"aria-label": "Add Attachment",
|
|
3638
3638
|
onClick: n,
|
|
3639
3639
|
...e,
|
|
3640
|
-
children: /* @__PURE__ */ H(
|
|
3640
|
+
children: /* @__PURE__ */ H(gt, {})
|
|
3641
3641
|
});
|
|
3642
3642
|
}
|
|
3643
3643
|
//#endregion
|
|
3644
3644
|
//#region src/components/rich-text-field/utils.ts
|
|
3645
|
-
function
|
|
3645
|
+
function Vs(e) {
|
|
3646
3646
|
let t;
|
|
3647
|
-
for (let n of
|
|
3648
|
-
return t ||
|
|
3647
|
+
for (let n of mn(e, { silent: !0 })) n.type === "declaration" && n.value && (t ||= {}, t[n.property] = n.value);
|
|
3648
|
+
return t || Hs;
|
|
3649
3649
|
}
|
|
3650
|
-
var
|
|
3651
|
-
function
|
|
3652
|
-
return typeof e == "string" ?
|
|
3650
|
+
var Hs = Object.freeze({});
|
|
3651
|
+
function Us(e) {
|
|
3652
|
+
return typeof e == "string" ? Vs(e) : Hs;
|
|
3653
3653
|
}
|
|
3654
|
-
function
|
|
3654
|
+
function Ws(e) {
|
|
3655
3655
|
let t = [];
|
|
3656
3656
|
for (let [n, r] of Object.entries(e)) n && r && t.push(`${n}: ${r};`);
|
|
3657
3657
|
return t.sort().join(" ");
|
|
3658
3658
|
}
|
|
3659
|
-
function
|
|
3659
|
+
function Gs(e, t) {
|
|
3660
3660
|
return e === t || !e && !t;
|
|
3661
3661
|
}
|
|
3662
|
-
function
|
|
3662
|
+
function Ks(e, t) {
|
|
3663
3663
|
if (e === t) return !0;
|
|
3664
|
-
for (let n in e) if (!(n in t &&
|
|
3664
|
+
for (let n in e) if (!(n in t && Gs(e[n], t[n]))) return !1;
|
|
3665
3665
|
for (let n in t) if (!(n in e)) return !1;
|
|
3666
3666
|
return !0;
|
|
3667
3667
|
}
|
|
3668
|
-
var
|
|
3669
|
-
isEqual:
|
|
3670
|
-
parse:
|
|
3671
|
-
unparse:
|
|
3668
|
+
var qs = ct("style", {
|
|
3669
|
+
isEqual: Ks,
|
|
3670
|
+
parse: Us,
|
|
3671
|
+
unparse: Ws
|
|
3672
3672
|
});
|
|
3673
|
-
function
|
|
3674
|
-
return
|
|
3673
|
+
function Js(e, t) {
|
|
3674
|
+
return Ye(e, qs, t);
|
|
3675
3675
|
}
|
|
3676
|
-
function
|
|
3677
|
-
return e ===
|
|
3676
|
+
function Ys(e, t) {
|
|
3677
|
+
return e === Hs || e === t ? t : {
|
|
3678
3678
|
...e,
|
|
3679
3679
|
...t
|
|
3680
3680
|
};
|
|
3681
3681
|
}
|
|
3682
|
-
|
|
3683
|
-
function
|
|
3682
|
+
st("PATCH_TEXT_STYLE_COMMAND");
|
|
3683
|
+
function Xs(e) {
|
|
3684
3684
|
let t = K();
|
|
3685
3685
|
if (!t) {
|
|
3686
|
-
let e =
|
|
3686
|
+
let e = Ue();
|
|
3687
3687
|
if (!e) return !1;
|
|
3688
|
-
t = e.clone(),
|
|
3688
|
+
t = e.clone(), Je(t);
|
|
3689
3689
|
}
|
|
3690
|
-
let n = typeof e == "function" ? e : (t) =>
|
|
3690
|
+
let n = typeof e == "function" ? e : (t) => Ys(t, e);
|
|
3691
3691
|
if (q(t) && t.isCollapsed()) {
|
|
3692
3692
|
let e = t.focus.getNode();
|
|
3693
|
-
J(e) &&
|
|
3694
|
-
} else
|
|
3693
|
+
J(e) && Js(e, n);
|
|
3694
|
+
} else un((e) => Js(e, n));
|
|
3695
3695
|
return !0;
|
|
3696
3696
|
}
|
|
3697
|
-
function
|
|
3697
|
+
function Zs(e) {
|
|
3698
3698
|
let t = e.anchor, n = e.focus, r = e.anchor.getNode(), i = e.focus.getNode();
|
|
3699
|
-
return r === i ? r : e.isBackward() ?
|
|
3699
|
+
return r === i ? r : e.isBackward() ? fn(n) ? r : i : fn(t) ? r : i;
|
|
3700
3700
|
}
|
|
3701
|
-
var
|
|
3701
|
+
var Qs = (e, t, n, r) => {
|
|
3702
3702
|
e.update(() => {
|
|
3703
|
-
if (r &&
|
|
3703
|
+
if (r && ze(at), e.isEditable()) {
|
|
3704
3704
|
let e = K();
|
|
3705
|
-
e !== null &&
|
|
3705
|
+
e !== null && pn(e, { "font-size": t + "px" });
|
|
3706
3706
|
}
|
|
3707
3707
|
});
|
|
3708
|
-
},
|
|
3709
|
-
function
|
|
3710
|
-
let e = I(
|
|
3708
|
+
}, $s = (e) => e.startsWith("http") ? e : `https://${e}`, ec = N(null);
|
|
3709
|
+
function tc() {
|
|
3710
|
+
let e = I(ec);
|
|
3711
3711
|
if (!e) throw Error("\"useRichTextFieldContext\" must be used within a RichTextFieldContextProvider");
|
|
3712
3712
|
return e;
|
|
3713
3713
|
}
|
|
3714
|
-
function
|
|
3714
|
+
function nc(e) {
|
|
3715
3715
|
let t = e.trim(), n = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t);
|
|
3716
3716
|
if (n) {
|
|
3717
3717
|
let e = n[1];
|
|
@@ -3726,49 +3726,49 @@ function rc(e) {
|
|
|
3726
3726
|
let e = (e) => Math.max(0, Math.min(255, e)), [t, n, i] = r.slice(1, 4).map((t) => e(Number.parseInt(t, 10))), a = (e) => e.toString(16).padStart(2, "0");
|
|
3727
3727
|
return `#${a(t)}${a(n)}${a(i)}`;
|
|
3728
3728
|
}
|
|
3729
|
-
return
|
|
3729
|
+
return Fs;
|
|
3730
3730
|
}
|
|
3731
|
-
function
|
|
3732
|
-
let t = Q(), [n, r] = V(
|
|
3731
|
+
function rc({ children: e }) {
|
|
3732
|
+
let t = Q(), [n, r] = V(Ms), [i, a] = V("16"), [o, s] = V(!1), [c, l] = V(!1), [u, d] = V(!1), [f, p] = V(Fs), [m, h] = V(!1), g = F(() => {
|
|
3733
3733
|
let e = K();
|
|
3734
3734
|
if (q(e)) {
|
|
3735
|
-
r(
|
|
3736
|
-
let t =
|
|
3735
|
+
r(dn(e, "font-family", Ms));
|
|
3736
|
+
let t = dn(e, "font-size", "16px");
|
|
3737
3737
|
a(t ? t.replace("px", "") : "16"), s(e.hasFormat("bold")), l(e.hasFormat("italic")), d(e.hasFormat("underline"));
|
|
3738
|
-
let n =
|
|
3739
|
-
p(
|
|
3740
|
-
let i =
|
|
3738
|
+
let n = dn(e, "color", "#000000") || "#000000";
|
|
3739
|
+
p(nc(n));
|
|
3740
|
+
let i = Zs(e), o = i.getParent(), c = ye(o) || ye(i);
|
|
3741
3741
|
h(c);
|
|
3742
3742
|
}
|
|
3743
3743
|
}, []);
|
|
3744
|
-
L(() =>
|
|
3744
|
+
L(() => ln(t.registerUpdateListener(({ editorState: e }) => {
|
|
3745
3745
|
e.read(() => {
|
|
3746
3746
|
g();
|
|
3747
3747
|
});
|
|
3748
|
-
}), t.registerCommand(
|
|
3748
|
+
}), t.registerCommand(it, () => (g(), !1), Qe)), [t, g]);
|
|
3749
3749
|
let _ = F((e) => {
|
|
3750
3750
|
t.update(() => {
|
|
3751
|
-
|
|
3751
|
+
ze(ot);
|
|
3752
3752
|
let t = K();
|
|
3753
|
-
t !== null &&
|
|
3753
|
+
t !== null && pn(t, { "font-family": e });
|
|
3754
3754
|
});
|
|
3755
3755
|
}, [t]), v = F((e) => {
|
|
3756
|
-
|
|
3756
|
+
Qs(t, e, null, !1);
|
|
3757
3757
|
}, [t]), y = F(() => {
|
|
3758
|
-
t.dispatchCommand(
|
|
3758
|
+
t.dispatchCommand(nt, "bold");
|
|
3759
3759
|
}, [t]), b = F(() => {
|
|
3760
|
-
t.dispatchCommand(
|
|
3760
|
+
t.dispatchCommand(nt, "italic");
|
|
3761
3761
|
}, [t]), x = F(() => {
|
|
3762
|
-
t.dispatchCommand(
|
|
3762
|
+
t.dispatchCommand(nt, "underline");
|
|
3763
3763
|
}, [t]), S = F((e) => {
|
|
3764
3764
|
t.update(() => {
|
|
3765
|
-
|
|
3765
|
+
ze(ot);
|
|
3766
3766
|
let t = K();
|
|
3767
|
-
t !== null &&
|
|
3767
|
+
t !== null && pn(t, { color: e });
|
|
3768
3768
|
});
|
|
3769
|
-
}, [t]),
|
|
3770
|
-
m ? (h(!1), t.dispatchCommand(
|
|
3771
|
-
}, [m, h]),
|
|
3769
|
+
}, [t]), C = F(() => {
|
|
3770
|
+
m ? (h(!1), t.dispatchCommand(xe, null)) : (h(!0), t.dispatchCommand(xe, $s("https://")));
|
|
3771
|
+
}, [m, h]), w = z(() => ({
|
|
3772
3772
|
fontFamily: n,
|
|
3773
3773
|
fontSize: i,
|
|
3774
3774
|
textColor: f,
|
|
@@ -3782,7 +3782,7 @@ function ic({ children: e }) {
|
|
|
3782
3782
|
onBold: y,
|
|
3783
3783
|
onItalic: b,
|
|
3784
3784
|
onUnderline: x,
|
|
3785
|
-
onLink:
|
|
3785
|
+
onLink: C
|
|
3786
3786
|
}), [
|
|
3787
3787
|
n,
|
|
3788
3788
|
i,
|
|
@@ -3797,35 +3797,35 @@ function ic({ children: e }) {
|
|
|
3797
3797
|
y,
|
|
3798
3798
|
b,
|
|
3799
3799
|
x,
|
|
3800
|
-
|
|
3800
|
+
C
|
|
3801
3801
|
]);
|
|
3802
|
-
return /* @__PURE__ */ H(
|
|
3803
|
-
value:
|
|
3802
|
+
return /* @__PURE__ */ H(ec.Provider, {
|
|
3803
|
+
value: w,
|
|
3804
3804
|
children: e
|
|
3805
3805
|
});
|
|
3806
3806
|
}
|
|
3807
3807
|
//#endregion
|
|
3808
3808
|
//#region src/components/rich-text-field/components/bold-button.tsx
|
|
3809
|
-
function
|
|
3810
|
-
let { isBold: t, onBold: n } =
|
|
3809
|
+
function ic({ ...e }) {
|
|
3810
|
+
let { isBold: t, onBold: n } = tc();
|
|
3811
3811
|
return /* @__PURE__ */ H($, {
|
|
3812
3812
|
"data-testid": "bold-button",
|
|
3813
3813
|
"aria-label": "Format Bold",
|
|
3814
3814
|
isActive: t,
|
|
3815
3815
|
onClick: n,
|
|
3816
3816
|
...e,
|
|
3817
|
-
children: /* @__PURE__ */ H(
|
|
3817
|
+
children: /* @__PURE__ */ H(Dt, {})
|
|
3818
3818
|
});
|
|
3819
3819
|
}
|
|
3820
3820
|
//#endregion
|
|
3821
3821
|
//#region src/components/rich-text-field/components/clean-format-button.tsx
|
|
3822
|
-
function
|
|
3822
|
+
function ac({ ...e }) {
|
|
3823
3823
|
let t = Q(), n = F(() => {
|
|
3824
3824
|
t.update(() => {
|
|
3825
3825
|
let e = K();
|
|
3826
3826
|
if (q(e)) {
|
|
3827
|
-
|
|
3828
|
-
for (let t of e.extract()) J(t) && (t.setFormat(0), t.setStyle(""),
|
|
3827
|
+
Xs(() => Hs);
|
|
3828
|
+
for (let t of e.extract()) J(t) && (t.setFormat(0), t.setStyle(""), cn(t).setFormat(""));
|
|
3829
3829
|
}
|
|
3830
3830
|
});
|
|
3831
3831
|
}, [t]);
|
|
@@ -3834,47 +3834,47 @@ function oc({ ...e }) {
|
|
|
3834
3834
|
"aria-label": "Reset Formatting",
|
|
3835
3835
|
onClick: n,
|
|
3836
3836
|
...e,
|
|
3837
|
-
children: /* @__PURE__ */ H(
|
|
3837
|
+
children: /* @__PURE__ */ H(Ot, {})
|
|
3838
3838
|
});
|
|
3839
3839
|
}
|
|
3840
3840
|
//#endregion
|
|
3841
3841
|
//#region src/components/rich-text-field/components/image-button.tsx
|
|
3842
|
-
function
|
|
3842
|
+
function oc({ ...e }) {
|
|
3843
3843
|
return /* @__PURE__ */ H($, {
|
|
3844
3844
|
"data-testid": "image-button",
|
|
3845
3845
|
"aria-label": "Add Image",
|
|
3846
3846
|
...e,
|
|
3847
|
-
children: /* @__PURE__ */ H(
|
|
3847
|
+
children: /* @__PURE__ */ H(Mt, {})
|
|
3848
3848
|
});
|
|
3849
3849
|
}
|
|
3850
3850
|
//#endregion
|
|
3851
3851
|
//#region src/components/rich-text-field/components/italic-button.tsx
|
|
3852
|
-
function
|
|
3853
|
-
let { isItalic: t, onItalic: n } =
|
|
3852
|
+
function sc({ ...e }) {
|
|
3853
|
+
let { isItalic: t, onItalic: n } = tc();
|
|
3854
3854
|
return /* @__PURE__ */ H($, {
|
|
3855
3855
|
"data-testid": "italic-button",
|
|
3856
3856
|
"aria-label": "Format Italics",
|
|
3857
3857
|
isActive: t,
|
|
3858
3858
|
onClick: n,
|
|
3859
3859
|
...e,
|
|
3860
|
-
children: /* @__PURE__ */ H(
|
|
3860
|
+
children: /* @__PURE__ */ H(At, {})
|
|
3861
3861
|
});
|
|
3862
3862
|
}
|
|
3863
3863
|
//#endregion
|
|
3864
3864
|
//#region src/components/rich-text-field/components/link-button.tsx
|
|
3865
|
-
function
|
|
3865
|
+
function cc({ isActive: e, ...t }) {
|
|
3866
3866
|
return /* @__PURE__ */ H($, {
|
|
3867
3867
|
"data-testid": "link-button",
|
|
3868
3868
|
"aria-label": "Add Link",
|
|
3869
3869
|
...t,
|
|
3870
|
-
children: H(e ?
|
|
3870
|
+
children: H(e ? Pt : Nt, {})
|
|
3871
3871
|
});
|
|
3872
3872
|
}
|
|
3873
3873
|
//#endregion
|
|
3874
3874
|
//#region src/components/rich-text-field/components/size-select.tsx
|
|
3875
|
-
function
|
|
3876
|
-
let { fontSize: t, onFontSize: n } =
|
|
3877
|
-
return /* @__PURE__ */ H(
|
|
3875
|
+
function lc({ className: e }) {
|
|
3876
|
+
let { fontSize: t, onFontSize: n } = tc(), r = z(() => [...Ns], []);
|
|
3877
|
+
return /* @__PURE__ */ H(Is, {
|
|
3878
3878
|
"data-testid": "size-select",
|
|
3879
3879
|
options: r,
|
|
3880
3880
|
value: t,
|
|
@@ -3884,8 +3884,8 @@ function uc({ className: e }) {
|
|
|
3884
3884
|
}
|
|
3885
3885
|
//#endregion
|
|
3886
3886
|
//#region src/components/rich-text-field/components/text-color-button.tsx
|
|
3887
|
-
function
|
|
3888
|
-
let { textColor: n, onTextColor: r } =
|
|
3887
|
+
function uc({ wrapperClassName: e, ...t }) {
|
|
3888
|
+
let { textColor: n, onTextColor: r } = tc(), i = n === Fs;
|
|
3889
3889
|
function a(e) {
|
|
3890
3890
|
r(e.target.value);
|
|
3891
3891
|
}
|
|
@@ -3898,7 +3898,7 @@ function dc({ wrapperClassName: e, ...t }) {
|
|
|
3898
3898
|
...t,
|
|
3899
3899
|
children: /* @__PURE__ */ H("span", {
|
|
3900
3900
|
style: i ? {} : { color: n },
|
|
3901
|
-
children: /* @__PURE__ */ H(
|
|
3901
|
+
children: /* @__PURE__ */ H(kt, {})
|
|
3902
3902
|
})
|
|
3903
3903
|
}), /* @__PURE__ */ H("input", {
|
|
3904
3904
|
type: "color",
|
|
@@ -3919,9 +3919,9 @@ function dc({ wrapperClassName: e, ...t }) {
|
|
|
3919
3919
|
}
|
|
3920
3920
|
//#endregion
|
|
3921
3921
|
//#region src/components/rich-text-field/components/typography-select.tsx
|
|
3922
|
-
function
|
|
3923
|
-
let { fontFamily: t, onFontFamily: n } =
|
|
3924
|
-
return /* @__PURE__ */ H(
|
|
3922
|
+
function dc({ className: e }) {
|
|
3923
|
+
let { fontFamily: t, onFontFamily: n } = tc(), r = z(() => [...js], []);
|
|
3924
|
+
return /* @__PURE__ */ H(Is, {
|
|
3925
3925
|
"data-testid": "typography-select",
|
|
3926
3926
|
options: r,
|
|
3927
3927
|
value: t,
|
|
@@ -3931,37 +3931,37 @@ function fc({ className: e }) {
|
|
|
3931
3931
|
}
|
|
3932
3932
|
//#endregion
|
|
3933
3933
|
//#region src/components/rich-text-field/components/underline-button.tsx
|
|
3934
|
-
function
|
|
3935
|
-
let { isUnderline: t, onUnderline: n } =
|
|
3934
|
+
function fc({ ...e }) {
|
|
3935
|
+
let { isUnderline: t, onUnderline: n } = tc();
|
|
3936
3936
|
return /* @__PURE__ */ H($, {
|
|
3937
3937
|
"data-testid": "underline-button",
|
|
3938
3938
|
"aria-label": "Format Underline",
|
|
3939
3939
|
isActive: t,
|
|
3940
3940
|
onClick: n,
|
|
3941
3941
|
...e,
|
|
3942
|
-
children: /* @__PURE__ */ H(
|
|
3942
|
+
children: /* @__PURE__ */ H(jt, {})
|
|
3943
3943
|
});
|
|
3944
3944
|
}
|
|
3945
3945
|
//#endregion
|
|
3946
3946
|
//#region src/components/rich-text-field/components/formatting-toolbar-plugin.tsx
|
|
3947
|
-
var
|
|
3947
|
+
var pc = ({ hasAttachments: e }) => /* @__PURE__ */ U(_e, { children: [
|
|
3948
|
+
/* @__PURE__ */ H(dc, {}),
|
|
3949
|
+
/* @__PURE__ */ H(lc, {}),
|
|
3950
|
+
/* @__PURE__ */ H(o, { orientation: "vertical" }),
|
|
3951
|
+
/* @__PURE__ */ H(ic, {}),
|
|
3952
|
+
/* @__PURE__ */ H(sc, {}),
|
|
3948
3953
|
/* @__PURE__ */ H(fc, {}),
|
|
3949
3954
|
/* @__PURE__ */ H(uc, {}),
|
|
3950
3955
|
/* @__PURE__ */ H(o, { orientation: "vertical" }),
|
|
3951
|
-
/* @__PURE__ */ H(
|
|
3952
|
-
/* @__PURE__ */ H(
|
|
3953
|
-
/* @__PURE__ */ H(
|
|
3954
|
-
/* @__PURE__ */ H(dc, {}),
|
|
3955
|
-
/* @__PURE__ */ H(o, { orientation: "vertical" }),
|
|
3956
|
-
/* @__PURE__ */ H(lc, { isDisabled: !0 }),
|
|
3957
|
-
/* @__PURE__ */ H(Vs, { isDisabled: !e }),
|
|
3958
|
-
/* @__PURE__ */ H(sc, { isDisabled: !0 }),
|
|
3956
|
+
/* @__PURE__ */ H(cc, { isDisabled: !0 }),
|
|
3957
|
+
/* @__PURE__ */ H(Bs, { isDisabled: !e }),
|
|
3958
|
+
/* @__PURE__ */ H(oc, { isDisabled: !0 }),
|
|
3959
3959
|
/* @__PURE__ */ H(o, { orientation: "vertical" }),
|
|
3960
|
-
/* @__PURE__ */ H(
|
|
3960
|
+
/* @__PURE__ */ H(zs, {}),
|
|
3961
3961
|
/* @__PURE__ */ H(o, { orientation: "vertical" }),
|
|
3962
|
-
/* @__PURE__ */ H(
|
|
3962
|
+
/* @__PURE__ */ H(ac, {})
|
|
3963
3963
|
] });
|
|
3964
|
-
function
|
|
3964
|
+
function mc({ className: e, children: t = pc, hasAttachments: n = !1 }) {
|
|
3965
3965
|
return /* @__PURE__ */ H("div", {
|
|
3966
3966
|
"data-testid": "formatting-toolbar",
|
|
3967
3967
|
"data-slot": "rich-text-field-toolbar",
|
|
@@ -3971,9 +3971,9 @@ function hc({ className: e, children: t = mc, hasAttachments: n = !1 }) {
|
|
|
3971
3971
|
}
|
|
3972
3972
|
//#endregion
|
|
3973
3973
|
//#region src/components/rich-text-field/rich-text-field.tsx
|
|
3974
|
-
var
|
|
3974
|
+
var hc = P(({ children: e, className: t, placeholderClassName: n, containerClassName: r, toolbarPlacement: i = "top", toolbarChildren: a, toolbarClassName: o, isMultipleAttachments: s, enableAttachments: c, acceptedFiles: l, onFileAttach: u, ...d }, f) => {
|
|
3975
3975
|
let p = i === "top";
|
|
3976
|
-
return /* @__PURE__ */ U(
|
|
3976
|
+
return /* @__PURE__ */ U(ks, {
|
|
3977
3977
|
ref: f,
|
|
3978
3978
|
"data-testid": "rich-text-field",
|
|
3979
3979
|
"data-slot": "rich-text-field",
|
|
@@ -3982,21 +3982,21 @@ var gc = P(({ children: e, className: t, placeholderClassName: n, containerClass
|
|
|
3982
3982
|
containerClassName: M("h-rich-text-field-height", "rounded-rich-text-field-toolbar", p ? "pt-rich-text-field-toolbar-height" : "pb-rich-text-field-toolbar-height", r),
|
|
3983
3983
|
className: M("p-rich-text-field-editor-padding", "bg-rich-text-field-background", "size-full", t),
|
|
3984
3984
|
...d,
|
|
3985
|
-
children: [/* @__PURE__ */ H(
|
|
3985
|
+
children: [/* @__PURE__ */ H(rc, { children: /* @__PURE__ */ H(mc, {
|
|
3986
3986
|
hasAttachments: c,
|
|
3987
3987
|
className: M("absolute right-0 w-full", p ? "top-0" : "bottom-0", o),
|
|
3988
3988
|
children: a
|
|
3989
|
-
}) }), /* @__PURE__ */ H(
|
|
3989
|
+
}) }), /* @__PURE__ */ H(Ts, {
|
|
3990
3990
|
acceptedFiles: l,
|
|
3991
3991
|
onFileAttach: u,
|
|
3992
3992
|
isMultiple: s
|
|
3993
3993
|
})]
|
|
3994
3994
|
});
|
|
3995
3995
|
});
|
|
3996
|
-
|
|
3996
|
+
hc.displayName = "RichTextField";
|
|
3997
3997
|
//#endregion
|
|
3998
3998
|
//#region src/components/topmenu/topmenu.tsx
|
|
3999
|
-
var
|
|
3999
|
+
var gc = hn("flex shrink-0 items-center justify-end", {
|
|
4000
4000
|
variants: {
|
|
4001
4001
|
size: {
|
|
4002
4002
|
md: ["px-[4px]", "rounded-overlay-tools-wrapper bg-overlay-tools-background-base"],
|
|
@@ -4021,7 +4021,7 @@ var _c = gn("flex shrink-0 items-center justify-end", {
|
|
|
4021
4021
|
hasBorder: !0
|
|
4022
4022
|
}
|
|
4023
4023
|
});
|
|
4024
|
-
function
|
|
4024
|
+
function _c({ className: e, children: t, ...n }) {
|
|
4025
4025
|
return /* @__PURE__ */ H("div", {
|
|
4026
4026
|
"data-slot": "topmenu",
|
|
4027
4027
|
role: "group",
|
|
@@ -4030,11 +4030,11 @@ function vc({ className: e, children: t, ...n }) {
|
|
|
4030
4030
|
children: t
|
|
4031
4031
|
});
|
|
4032
4032
|
}
|
|
4033
|
-
function
|
|
4033
|
+
function vc({ className: e, size: t, hasBorder: n, children: r, ...i }) {
|
|
4034
4034
|
return /* @__PURE__ */ H("div", {
|
|
4035
4035
|
"data-slot": "topmenu-actions",
|
|
4036
4036
|
"data-size": t ?? "lg",
|
|
4037
|
-
className: M(
|
|
4037
|
+
className: M(gc({
|
|
4038
4038
|
size: t,
|
|
4039
4039
|
hasBorder: n
|
|
4040
4040
|
}), e),
|
|
@@ -4044,42 +4044,42 @@ function yc({ className: e, size: t, hasBorder: n, children: r, ...i }) {
|
|
|
4044
4044
|
}
|
|
4045
4045
|
//#endregion
|
|
4046
4046
|
//#region src/domain/actions/constants.ts
|
|
4047
|
-
var
|
|
4047
|
+
var yc = "swisper";
|
|
4048
4048
|
//#endregion
|
|
4049
4049
|
//#region src/domain/actions/utils/index.ts
|
|
4050
|
-
function
|
|
4051
|
-
let n = `${
|
|
4050
|
+
function bc(e, t) {
|
|
4051
|
+
let n = `${yc}://action/${e}`;
|
|
4052
4052
|
return t ? `${n}?${new URLSearchParams(t).toString()}` : n;
|
|
4053
4053
|
}
|
|
4054
|
-
function
|
|
4055
|
-
return `[${t}](${
|
|
4054
|
+
function xc({ action: e, label: t, params: n }) {
|
|
4055
|
+
return `[${t}](${bc(e, n)})`;
|
|
4056
4056
|
}
|
|
4057
|
-
function
|
|
4057
|
+
function Sc(e) {
|
|
4058
4058
|
if (!e?.startsWith("swisper://")) return !1;
|
|
4059
4059
|
let t = new URL(e);
|
|
4060
4060
|
return t.protocol === "swisper:" && t.hostname === "action" && t.pathname.startsWith("/") && t.pathname.split("/").length === 2;
|
|
4061
4061
|
}
|
|
4062
|
-
function
|
|
4062
|
+
function Cc(e) {
|
|
4063
4063
|
let t;
|
|
4064
4064
|
try {
|
|
4065
4065
|
t = new URL(e);
|
|
4066
4066
|
} catch {
|
|
4067
4067
|
return null;
|
|
4068
4068
|
}
|
|
4069
|
-
return
|
|
4069
|
+
return Sc(e) ? {
|
|
4070
4070
|
option: t.pathname.replace("/", ""),
|
|
4071
4071
|
payload: Object.fromEntries(t.searchParams.entries())
|
|
4072
4072
|
} : null;
|
|
4073
4073
|
}
|
|
4074
|
-
function
|
|
4074
|
+
function wc(e) {
|
|
4075
4075
|
for (let t of e) if (t.type === "text" && typeof t.value == "string") return t.value;
|
|
4076
4076
|
return null;
|
|
4077
4077
|
}
|
|
4078
|
-
function
|
|
4079
|
-
let t =
|
|
4080
|
-
return
|
|
4078
|
+
function Tc(e) {
|
|
4079
|
+
let t = vn().use(_n).use(gn).parse(e), n = null;
|
|
4080
|
+
return yn(t, (e) => {
|
|
4081
4081
|
if (e.type !== "link") return;
|
|
4082
|
-
let t =
|
|
4082
|
+
let t = Cc(e.url), r = wc(e.children);
|
|
4083
4083
|
if (t && r) {
|
|
4084
4084
|
n = {
|
|
4085
4085
|
label: r,
|
|
@@ -4093,23 +4093,23 @@ function Ec(e) {
|
|
|
4093
4093
|
}
|
|
4094
4094
|
//#endregion
|
|
4095
4095
|
//#region src/domain/actions/hooks/index.ts
|
|
4096
|
-
function
|
|
4097
|
-
return z(() => e.map((e) =>
|
|
4096
|
+
function Ec(e) {
|
|
4097
|
+
return z(() => e.map((e) => Tc(e) || { label: e }).filter((e) => e !== null), [e]);
|
|
4098
4098
|
}
|
|
4099
4099
|
//#endregion
|
|
4100
4100
|
//#region src/hooks/use-chat-stream-message.ts
|
|
4101
|
-
function
|
|
4101
|
+
function Dc(e) {
|
|
4102
4102
|
return JSON.parse(e);
|
|
4103
4103
|
}
|
|
4104
|
-
function
|
|
4104
|
+
function Oc(e) {
|
|
4105
4105
|
return e instanceof Error ? e.name === "AbortError" || e.name === "TimeoutError" : !1;
|
|
4106
4106
|
}
|
|
4107
|
-
function
|
|
4107
|
+
function kc(e, t) {
|
|
4108
4108
|
return e instanceof Error ? e : Error(t);
|
|
4109
4109
|
}
|
|
4110
|
-
function
|
|
4110
|
+
function Ac() {
|
|
4111
4111
|
return { streamMessage: F(async ({ stream: e, abortController: t, timeout: n = 2e4, tokenParser: r, onChunkReceived: i, onAbort: a, onFinish: o, onError: s }) => {
|
|
4112
|
-
let c = r ??
|
|
4112
|
+
let c = r ?? Dc, l, u = !1, d = () => {
|
|
4113
4113
|
l !== void 0 && (clearTimeout(l), l = void 0);
|
|
4114
4114
|
}, f = (e) => {
|
|
4115
4115
|
u || (u = !0, d(), a?.(e));
|
|
@@ -4120,7 +4120,7 @@ function jc() {
|
|
|
4120
4120
|
}, n));
|
|
4121
4121
|
};
|
|
4122
4122
|
try {
|
|
4123
|
-
let n = "", r = new TextDecoder("utf-8"), a =
|
|
4123
|
+
let n = "", r = new TextDecoder("utf-8"), a = bn({
|
|
4124
4124
|
onEvent(e) {
|
|
4125
4125
|
try {
|
|
4126
4126
|
n += e.data;
|
|
@@ -4136,7 +4136,7 @@ function jc() {
|
|
|
4136
4136
|
}
|
|
4137
4137
|
});
|
|
4138
4138
|
for (t?.signal.addEventListener("abort", () => {
|
|
4139
|
-
let e =
|
|
4139
|
+
let e = kc(t.signal.reason, "Stream aborted");
|
|
4140
4140
|
f(e);
|
|
4141
4141
|
}, { once: !0 }), p(); !u;) {
|
|
4142
4142
|
let { value: t, done: n } = await e.read(), i = r.decode(t, { stream: !0 });
|
|
@@ -4145,8 +4145,8 @@ function jc() {
|
|
|
4145
4145
|
d(), !u && !t?.signal.aborted && o?.(n);
|
|
4146
4146
|
} catch (e) {
|
|
4147
4147
|
let n = e;
|
|
4148
|
-
if (u || t?.signal.aborted ||
|
|
4149
|
-
u || f(
|
|
4148
|
+
if (u || t?.signal.aborted || Oc(n)) {
|
|
4149
|
+
u || f(kc(n, "Stream aborted"));
|
|
4150
4150
|
return;
|
|
4151
4151
|
}
|
|
4152
4152
|
t?.abort(n), console.error("Error while reading stream:", n), s?.(n);
|
|
@@ -4155,7 +4155,7 @@ function jc() {
|
|
|
4155
4155
|
}
|
|
4156
4156
|
//#endregion
|
|
4157
4157
|
//#region src/hooks/use-on-chat-changed.ts
|
|
4158
|
-
function
|
|
4158
|
+
function jc(e) {
|
|
4159
4159
|
let { chatId: t, isNewChat: n } = X(), r = B(n), i = B(t), a = B(e);
|
|
4160
4160
|
a.current = e, r.current = n, L(() => {
|
|
4161
4161
|
i.current !== t && (a.current({
|
|
@@ -4167,19 +4167,19 @@ function Mc(e) {
|
|
|
4167
4167
|
}
|
|
4168
4168
|
//#endregion
|
|
4169
4169
|
//#region src/hooks/use-current-chat-id.ts
|
|
4170
|
-
function
|
|
4170
|
+
function Mc() {
|
|
4171
4171
|
let { chatId: e } = X();
|
|
4172
4172
|
return e;
|
|
4173
4173
|
}
|
|
4174
4174
|
//#endregion
|
|
4175
4175
|
//#region src/hooks/use-is-current-chat-new.ts
|
|
4176
|
-
function
|
|
4176
|
+
function Nc() {
|
|
4177
4177
|
let { isNewChat: e } = X();
|
|
4178
4178
|
return e;
|
|
4179
4179
|
}
|
|
4180
4180
|
//#endregion
|
|
4181
4181
|
//#region src/hooks/use-loaded-chat-ids.ts
|
|
4182
|
-
function
|
|
4182
|
+
function Pc() {
|
|
4183
4183
|
let { loadedChatIdsRef: e } = X();
|
|
4184
4184
|
return {
|
|
4185
4185
|
getIsChatLoaded: F((t) => e.current?.has(t) ?? !1, []),
|
|
@@ -4193,7 +4193,7 @@ function Fc() {
|
|
|
4193
4193
|
}
|
|
4194
4194
|
//#endregion
|
|
4195
4195
|
//#region src/hooks/use-chat-prompt-placeholder.ts
|
|
4196
|
-
function
|
|
4196
|
+
function Fc() {
|
|
4197
4197
|
let { promptPlaceholder: e, setPromptPlaceholder: t, clearPromptPlaceholder: n } = X();
|
|
4198
4198
|
return {
|
|
4199
4199
|
promptPlaceholder: e,
|
|
@@ -4202,6 +4202,6 @@ function Ic() {
|
|
|
4202
4202
|
};
|
|
4203
4203
|
}
|
|
4204
4204
|
//#endregion
|
|
4205
|
-
export {
|
|
4205
|
+
export { ss as $replaceEditorHTMLContent, cs as $replaceEditorSelectionHTMLContent, as as $setSelectionToEnd, zs as AlignmentSelect, Bs as AttachmentButton, ic as BoldButton, yc as CHAT_ACTION_PROTOCOL, io as CanvasShell, so as CanvasShellCloseTrigger, fo as CanvasShellContent, po as CanvasShellFooter, co as CanvasShellFullScreenTrigger, ao as CanvasShellHeader, lo as CanvasShellOptionsButton, oo as CanvasShellTitle, Qa as ChatArtifact, ro as ChatArtifactActions, no as ChatArtifactCaption, eo as ChatArtifactContent, $a as ChatArtifactIcon, to as ChatArtifactTitle, Wn as ChatCard, kn as ChatCardActionButton, On as ChatCardActions, Vn as ChatCardAttribute, Hn as ChatCardAttributeLabel, Un as ChatCardAttributeValue, Bn as ChatCardAttributes, Mn as ChatCardBody, An as ChatCardCollapsibleButton, Yn as ChatCardContainer, Nn as ChatCardContent, Fn as ChatCardFooter, Rn as ChatCardFooterActions, In as ChatCardFooterNotes, Ln as ChatCardFooterPrice, zn as ChatCardForm, Cn as ChatCardHeader, Tn as ChatCardHeaderContent, wn as ChatCardIcon, jn as ChatCardMedia, Pn as ChatCardPreview, Dn as ChatCardSubTitle, En as ChatCardTitle, tr as ChatContainer, rr as ChatContainerPrompt, ir as ChatContainerWelcome, li as ChatConversationProvider, Cr as ChatInput, Tr as ChatInputTextarea, Or as ChatList, Mr as ChatListEmptyState, Nr as ChatListError, Lr as ChatListItem, Ir as ChatListItems, Pr as ChatListLoadMore, jr as ChatListSkeleton, $r as ChatMessage, ti as ChatMessageActions, yi as ChatMessageAttachmentCard, Ci as ChatMessageAttachmentCardActions, bi as ChatMessageAttachmentCardContent, Ti as ChatMessageAttachmentCardIcon, Si as ChatMessageAttachmentCardPreview, xi as ChatMessageAttachmentCardTitle, ei as ChatMessageContent, gi as ChatMessageListGroup, Mi as ChatMessageResponse, Ni as ChatMessageToolbar, Fi as ChatMessageToolbarActionButton, Pi as ChatMessageToolbarActions, Ii as ChatMessageToolbarTimestamp, pi as ChatMessages, mi as ChatMessagesList, vi as ChatMessagesScrollButton, Gi as ChatNotificationCard, $i as ChatNotificationCardActions, ta as ChatNotificationCardButtons, aa as ChatNotificationCardCloseButton, oa as ChatNotificationCardContent, la as ChatNotificationCardContentActions, ca as ChatNotificationCardContentDescription, sa as ChatNotificationCardContentTitle, ia as ChatNotificationCardDeleteButton, fa as ChatNotificationCardDescription, ua as ChatNotificationCardExpandButton, Ki as ChatNotificationCardHead, qi as ChatNotificationCardHeader, Ji as ChatNotificationCardHeaderIcon, Qi as ChatNotificationCardHeaderStatus, Yi as ChatNotificationCardHeaderTitle, Xi as ChatNotificationCardHeaderTitleLabel, da as ChatNotificationCardIcon, na as ChatNotificationCardReadActionButton, ra as ChatNotificationCardSnoozeButton, pa as ChatNotificationCardTimeStamp, ea as ChatNotificationCardTimestamp, ma as ChatNotificationPopup, ga as ChatNotificationPopupContent, ha as ChatNotificationPopupTrigger, Gr as ChatPromptBox, Zr as ChatPromptBoxActionsLeft, Qr as ChatPromptBoxActionsRight, Yr as ChatPromptBoxContent, Xr as ChatPromptBoxInput, Jr as ChatPromptBoxToolbar, ii as ChatProvider, _a as ChatReplies, va as ChatReply, ya as ChatReplyLabel, ba as ChatReplyValue, wa as ChatSuggestion, Oa as ChatSuggestionAction, Da as ChatSuggestionActions, Ea as ChatSuggestionLabel, Ta as ChatSuggestionLabelIcon, Ca as ChatSuggestions, ho as ChatThinkingProcess, bo as ChatThinkingProcessContent, So as ChatThinkingProcessContentItem, go as ChatThinkingProcessTrigger, yo as ChatThinkingProcessTriggerArrow, _o as ChatThinkingProcessTriggerIcon, vo as ChatThinkingProcessTriggerLabel, Ga as ChatThread, Ya as ChatThreadAnswer, Za as ChatThreadErrorState, qa as ChatThreadGroup, Ua as ChatThreadProvider, Ja as ChatThreadQuestion, ac as CleanFormatButton, Jn as EditableChatCardContextProvider, Co as EmptyState, Do as EmptyStateActionRow, Eo as EmptyStateDescription, wo as EmptyStateIcon, To as EmptyStateTitle, mc as FormattingToolbarPlugin, Ss as HtmlPastePlugin, _s as INSERT_HTML_COMMAND, ys as INSERT_HTML_EVENT, fs as INSERT_IMAGE_COMMAND, ps as INSERT_IMAGE_EVENT_NAME, ms as ImageAddedEvent, oc as ImageButton, hs as ImageDropPlugin, xs as InsertHtmlEvent, sc as ItalicButton, cc as LinkButton, Ai as MarkdownViewer, mo as NewChatTrigger, gs as PASTE_HTML_COMMAND, vs as PASTE_HTML_EVENT, bs as PasteHtmlEvent, ks as RichTextArea, hc as RichTextField, lc as SizeSelect, uc as TextColorButton, $ as ToolbarButton, _c as TopMenu, vc as TopMenuActions, dc as TypographySelect, fc as UnderlineButton, uo as canvasShellContentPadding, xc as createChatActionLink, Tc as extractChatActionFromLink, Hi as formatSnoozeDate, Di as getAttachmentIcon, Li as getSnoozeUntilDate, Sc as isChatActionURL, is as scrollRichTextAreaToBottom, Ec as useChatActions, X as useChatContext, ci as useChatConversationContext, xr as useChatInputContext, Dr as useChatListContext, Pc as useChatLoadedIds, Wi as useChatNotificationCardContext, Fc as useChatPromptPlaceholder, Ac as useChatStreamMessage, Sa as useChatSuggestionContext, Ra as useChatThread, Zt as useChatThreadScrollable, Mc as useCurrentChatId, Gn as useEditChatCard, qn as useEditableChatCardContext, Nc as useIsCurrentChatNew, jc as useOnChatChanged, Q as useRichTextAreaEditor, ts as useRichTextAreaSelectedText };
|
|
4206
4206
|
|
|
4207
4207
|
//# sourceMappingURL=index.es.js.map
|