@epam/ai-dial-conversation-input 1.3.0-dev.274 → 1.3.0-dev.276
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/index.js +1357 -916
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AttachmentErrorReason as e, AttachmentType as t, DeploymentIcon as n, MIME_TYPE_EXT_MAP as r, RESIZABLE_TEXTAREA_CLASS_NAME as i, RequestStatus as a, ResponseFormat as o, SELECT_LIST_MAX_HEIGHT_PX as s, buildCssVars as c, mergeClasses as l, normalizeMimeType as u, useIsMobile as d } from "@epam/ai-dial-chat-shared";
|
|
2
|
-
import { BASE_ICON_SIZE as f, BottomSheet as p, Button as m, ButtonVariant as h, CloseButton as g, DIAL_ICON_SIZE as _, DIAL_KIT_ICON_STROKE as v, Dropdown as y, ElementSize as b, ErrorText as x, GhostIconButton as S, Highlight as C, LiveRegion as w, LiveRegionElement as T, LiveRegionPoliteness as E, MenuItemMark as D, NeutralButton as O, NeutralIconButton as k, Notification as ee, NotificationType as A, NotificationVariant as
|
|
3
|
-
import { Fragment as
|
|
4
|
-
import { AttachmentTray as
|
|
5
|
-
import { IconArrowNarrowRight as
|
|
6
|
-
import { createElement as
|
|
2
|
+
import { BASE_ICON_SIZE as f, BottomSheet as p, Button as m, ButtonVariant as h, CloseButton as g, DIAL_ICON_SIZE as _, DIAL_KIT_ICON_STROKE as v, Dropdown as y, ElementSize as b, ErrorText as x, GhostIconButton as S, Highlight as C, LiveRegion as w, LiveRegionElement as T, LiveRegionPoliteness as E, MenuItemMark as D, NeutralButton as O, NeutralIconButton as k, Notification as ee, NotificationType as A, NotificationVariant as j, Popup as M, PopupSize as N, PrimaryButton as P, PrimaryIconButton as te, RadioGroup as F, RadioGroupOrientation as ne, Search as re, Skeleton as I, SkeletonVariant as L, Slider as R, Spinner as ie, Textarea as ae, TextareaResize as oe, ToggleChip as se, Tooltip as ce } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { Fragment as le, jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
4
|
+
import { AttachmentTray as ue, MAX_UPLOADS_PER_MINUTE as de, generateAttachmentId as fe, useClipboardPaste as pe } from "@epam/ai-dial-attachment-input";
|
|
5
|
+
import { IconArrowNarrowRight as me, IconCheck as he, IconChevronDown as ge, IconChevronRight as _e, IconFile as ve, IconMicrophone as ye, IconPaperclip as be, IconPlayerStop as xe, IconPlus as Se, IconSettings as Ce, IconTool as we, IconX as Te } from "@tabler/icons-react";
|
|
6
|
+
import { Fragment as Ee, createElement as De, forwardRef as Oe, memo as ke, useCallback as V, useEffect as H, useId as Ae, useImperativeHandle as je, useLayoutEffect as Me, useMemo as U, useRef as W, useState as G, useSyncExternalStore as Ne } from "react";
|
|
7
7
|
//#region src/constants/public-class-names.ts
|
|
8
|
-
var
|
|
8
|
+
var K = {
|
|
9
9
|
wrapper: "dial-ci-wrapper",
|
|
10
10
|
actionRow: "dial-ci-action-row",
|
|
11
11
|
textareaWrap: "dial-ci-textarea-wrap",
|
|
@@ -20,7 +20,7 @@ var U = {
|
|
|
20
20
|
modelMenuItem: "dial-ci-model-menu-item",
|
|
21
21
|
modelMenuItemSelected: "dial-ci-model-menu-item-selected",
|
|
22
22
|
usageBanner: "dial-ci-usage-banner"
|
|
23
|
-
},
|
|
23
|
+
}, Pe = {
|
|
24
24
|
backdrop: "_backdrop_1ym62_8",
|
|
25
25
|
sheet: "_sheet_1ym62_12",
|
|
26
26
|
title: "_title_1ym62_16",
|
|
@@ -32,7 +32,7 @@ var U = {
|
|
|
32
32
|
"--ci-sheet-text": f?.sheetText,
|
|
33
33
|
"--ci-sheet-divider": f?.divider
|
|
34
34
|
});
|
|
35
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ z(p, {
|
|
36
36
|
open: e,
|
|
37
37
|
onClose: r,
|
|
38
38
|
title: t,
|
|
@@ -48,11 +48,11 @@ var U = {
|
|
|
48
48
|
...v,
|
|
49
49
|
...g
|
|
50
50
|
},
|
|
51
|
-
className: l(
|
|
52
|
-
overlayClassName: l(
|
|
51
|
+
className: l(Pe.sheet, d),
|
|
52
|
+
overlayClassName: l(Pe.backdrop, h),
|
|
53
53
|
portalId: m,
|
|
54
|
-
headerClassName:
|
|
55
|
-
titleClassName: l(
|
|
54
|
+
headerClassName: Pe.divider,
|
|
55
|
+
titleClassName: l(Pe.title, u),
|
|
56
56
|
children: _
|
|
57
57
|
});
|
|
58
58
|
}, Ie = async (e, t, n) => {
|
|
@@ -60,18 +60,18 @@ var U = {
|
|
|
60
60
|
for (let t = 0; t < e.length; t++) t > 0 && await new Promise((e) => setTimeout(e, r)), i.push(n(e[t]));
|
|
61
61
|
await Promise.allSettled(i);
|
|
62
62
|
}, Le = ({ initialAttachments: n, onUploadAttachment: r, onAttachmentsChange: i, validateAttachment: o, pendingDropFiles: s, onDropFilesConsumed: c, isDropDisabled: l = !1, pendingAttachments: u, onPendingAttachmentsConsumed: d, onExpandPastedText: f, maximumAttachmentsAmount: p, baseAttachmentsAmount: m = 0, onAttachmentsLimitExceeded: h }) => {
|
|
63
|
-
let [g, _] =
|
|
64
|
-
|
|
63
|
+
let [g, _] = G(n), v = W(g);
|
|
64
|
+
H(() => {
|
|
65
65
|
v.current = g;
|
|
66
|
-
}, [g]),
|
|
66
|
+
}, [g]), H(() => () => {
|
|
67
67
|
v.current.forEach((e) => {
|
|
68
68
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
69
69
|
});
|
|
70
70
|
}, []);
|
|
71
|
-
let y =
|
|
71
|
+
let y = V((e) => e.map((e) => {
|
|
72
72
|
let n = e.type.startsWith("image/"), r = e.type.startsWith("audio/"), i = n ? URL.createObjectURL(e) : void 0, o = r ? URL.createObjectURL(e) : void 0;
|
|
73
73
|
return {
|
|
74
|
-
id:
|
|
74
|
+
id: fe(),
|
|
75
75
|
name: e.name,
|
|
76
76
|
contentType: e.type,
|
|
77
77
|
file: e,
|
|
@@ -80,22 +80,22 @@ var U = {
|
|
|
80
80
|
previewUrl: i,
|
|
81
81
|
playUrl: o
|
|
82
82
|
};
|
|
83
|
-
}), []), b =
|
|
84
|
-
|
|
83
|
+
}), []), b = W(i);
|
|
84
|
+
H(() => {
|
|
85
85
|
b.current = i;
|
|
86
86
|
}, [i]);
|
|
87
|
-
let x =
|
|
87
|
+
let x = W(!0), S = V((e) => {
|
|
88
88
|
_((t) => {
|
|
89
89
|
let n = e(t);
|
|
90
90
|
return n === t ? t : n;
|
|
91
91
|
});
|
|
92
92
|
}, []);
|
|
93
|
-
|
|
93
|
+
H(() => {
|
|
94
94
|
x.current ? x.current = !1 : b.current?.(g);
|
|
95
95
|
}, [g]);
|
|
96
|
-
let C =
|
|
96
|
+
let C = V((e) => {
|
|
97
97
|
_(e);
|
|
98
|
-
}, []), w =
|
|
98
|
+
}, []), w = V(async (t) => {
|
|
99
99
|
if (r) {
|
|
100
100
|
S((e) => e.map((e) => e.id === t.id ? {
|
|
101
101
|
...e,
|
|
@@ -118,7 +118,7 @@ var U = {
|
|
|
118
118
|
} : e));
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
}, [r, S]), T =
|
|
121
|
+
}, [r, S]), T = V((e, t = !0) => {
|
|
122
122
|
let n = new Set(v.current.map((e) => e.id)), r = e.filter((e) => !n.has(e.id));
|
|
123
123
|
if (r.length !== 0) {
|
|
124
124
|
if (p != null && p > 0 && Number.isFinite(p)) {
|
|
@@ -139,7 +139,7 @@ var U = {
|
|
|
139
139
|
status: a.Error,
|
|
140
140
|
errorReason: n
|
|
141
141
|
} : e));
|
|
142
|
-
}), Ie(e,
|
|
142
|
+
}), Ie(e, de, w);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
}, [
|
|
@@ -149,8 +149,8 @@ var U = {
|
|
|
149
149
|
S,
|
|
150
150
|
w,
|
|
151
151
|
o
|
|
152
|
-
]), E =
|
|
153
|
-
|
|
152
|
+
]), E = W(/* @__PURE__ */ new WeakSet());
|
|
153
|
+
H(() => {
|
|
154
154
|
if (s.length === 0) {
|
|
155
155
|
E.current = /* @__PURE__ */ new WeakSet();
|
|
156
156
|
return;
|
|
@@ -163,13 +163,13 @@ var U = {
|
|
|
163
163
|
l,
|
|
164
164
|
c,
|
|
165
165
|
s
|
|
166
|
-
]),
|
|
166
|
+
]), H(() => {
|
|
167
167
|
u.length !== 0 && (T(u, !1), d?.());
|
|
168
168
|
}, [
|
|
169
169
|
T,
|
|
170
170
|
d,
|
|
171
171
|
u
|
|
172
|
-
]),
|
|
172
|
+
]), H(() => {
|
|
173
173
|
if (!o) return;
|
|
174
174
|
let t = !1, n = [], r = v.current.map((r) => {
|
|
175
175
|
if (r.status === a.Loading) return r;
|
|
@@ -196,7 +196,7 @@ var U = {
|
|
|
196
196
|
S,
|
|
197
197
|
w
|
|
198
198
|
]);
|
|
199
|
-
let D =
|
|
199
|
+
let D = V((e) => {
|
|
200
200
|
S((t) => {
|
|
201
201
|
let n = t.find((t) => t.id === e);
|
|
202
202
|
return n?.previewUrl && URL.revokeObjectURL(n.previewUrl), n?.playUrl && URL.revokeObjectURL(n.playUrl), t.filter((t) => t.id !== e);
|
|
@@ -208,11 +208,11 @@ var U = {
|
|
|
208
208
|
addAttachments: T,
|
|
209
209
|
resetAttachments: C,
|
|
210
210
|
handleRemove: D,
|
|
211
|
-
handleRetry:
|
|
211
|
+
handleRetry: V((e) => {
|
|
212
212
|
let t = g.find((t) => t.id === e);
|
|
213
213
|
t && w(t);
|
|
214
214
|
}, [g, w]),
|
|
215
|
-
handleExpand:
|
|
215
|
+
handleExpand: V(async (e) => {
|
|
216
216
|
let n = g.find((t) => t.id === e);
|
|
217
217
|
if (!n || n.type !== t.Pasted) return;
|
|
218
218
|
let r = await n.file.text();
|
|
@@ -238,17 +238,17 @@ var U = {
|
|
|
238
238
|
}, Be = (e, t) => e.startsWith(t) && !e.slice(t.length).includes(t), Ve = "[role=\"option\"]:not([aria-disabled=\"true\"])", He = /* @__PURE__ */ function(e) {
|
|
239
239
|
return e.Next = "next", e.Previous = "previous", e;
|
|
240
240
|
}({}), Ue = ({ config: e, message: t }) => {
|
|
241
|
-
let [n, r] =
|
|
241
|
+
let [n, r] = G(!1), [i, a] = G(null), [o, s] = G(null), c = W(null);
|
|
242
242
|
c.current = i;
|
|
243
243
|
let l = e != null && i != null && i <= t.length ? (() => {
|
|
244
244
|
let n = t.slice(i, Re(t, i));
|
|
245
245
|
return Be(n, e.triggerPrefix) ? n.slice(e.triggerPrefix.length) : "";
|
|
246
|
-
})() : "", u =
|
|
246
|
+
})() : "", u = V((t, n, i) => {
|
|
247
247
|
if (e == null || i) return;
|
|
248
248
|
let { start: c, end: l } = ze(t, n), u = t.slice(c, l);
|
|
249
249
|
Be(u, e.triggerPrefix) ? (a(c), u === e.triggerPrefix || o !== c ? (r(!0), s(null)) : r(!1)) : (r(!1), s(null), a(null));
|
|
250
250
|
}, [e, o]);
|
|
251
|
-
|
|
251
|
+
H(() => {
|
|
252
252
|
if (e == null) {
|
|
253
253
|
r(!1), s(null), a(null);
|
|
254
254
|
return;
|
|
@@ -258,11 +258,11 @@ var U = {
|
|
|
258
258
|
let i = Math.min(n, t.length);
|
|
259
259
|
Be(t.slice(i, Re(t, i)), e.triggerPrefix) || (r(!1), s(null), a(null));
|
|
260
260
|
}, [e, t]);
|
|
261
|
-
let d =
|
|
261
|
+
let d = V(() => {
|
|
262
262
|
r(!1), s(i);
|
|
263
|
-
}, [i]), f =
|
|
263
|
+
}, [i]), f = V(() => {
|
|
264
264
|
r(!1);
|
|
265
|
-
}, []), p =
|
|
265
|
+
}, []), p = V((n) => {
|
|
266
266
|
if (e == null) return;
|
|
267
267
|
let { start: i, end: s } = ze(t, n);
|
|
268
268
|
Be(t.slice(i, s), e.triggerPrefix) ? (a(i), r(o !== i)) : (a(null), r(!1));
|
|
@@ -270,11 +270,11 @@ var U = {
|
|
|
270
270
|
e,
|
|
271
271
|
t,
|
|
272
272
|
o
|
|
273
|
-
]), m =
|
|
274
|
-
|
|
273
|
+
]), m = Ae(), h = W(null), [g, _] = G(null);
|
|
274
|
+
H(() => {
|
|
275
275
|
_(null);
|
|
276
276
|
}, [n, l]);
|
|
277
|
-
let v =
|
|
277
|
+
let v = V(() => Array.from(h.current?.querySelectorAll(Ve) ?? []), []), y = V((e) => {
|
|
278
278
|
let t = v();
|
|
279
279
|
if (t.length === 0) {
|
|
280
280
|
_(null);
|
|
@@ -282,7 +282,7 @@ var U = {
|
|
|
282
282
|
}
|
|
283
283
|
let n = t.findIndex((e) => e.id === g), r = t[e === "next" ? (n + 1) % t.length : (n <= 0 ? t.length : n) - 1];
|
|
284
284
|
_(r.id), r.scrollIntoView?.({ block: "nearest" });
|
|
285
|
-
}, [v, g]), b =
|
|
285
|
+
}, [v, g]), b = V(() => v().find((e) => e.id === g) ?? null, [v, g]);
|
|
286
286
|
return {
|
|
287
287
|
isMenuOpen: n,
|
|
288
288
|
query: l,
|
|
@@ -298,17 +298,17 @@ var U = {
|
|
|
298
298
|
getActiveOption: b
|
|
299
299
|
};
|
|
300
300
|
}, We = (e, t) => !e.slice(0, t).includes("\n"), Ge = (e, t) => !e.slice(t).includes("\n"), Ke = (e) => {
|
|
301
|
-
let t =
|
|
301
|
+
let t = W(e);
|
|
302
302
|
t.current = e;
|
|
303
|
-
let n =
|
|
303
|
+
let n = W(-1), r = W(""), i = V((e, i, a) => {
|
|
304
304
|
let o = t.current;
|
|
305
305
|
return !o || o.length === 0 ? null : e === "up" ? !We(i, a) || n.current === 0 ? null : (n.current === -1 ? (r.current = i, n.current = o.length - 1) : --n.current, o[n.current]) : n.current === -1 || !Ge(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
|
|
306
|
-
}, []), a =
|
|
306
|
+
}, []), a = V(() => {
|
|
307
307
|
n.current = -1, r.current = "";
|
|
308
|
-
}, []), o =
|
|
308
|
+
}, []), o = V(() => {
|
|
309
309
|
n.current = -1, r.current = "";
|
|
310
310
|
}, []);
|
|
311
|
-
return
|
|
311
|
+
return U(() => ({
|
|
312
312
|
navigate: i,
|
|
313
313
|
notifyChange: a,
|
|
314
314
|
reset: o
|
|
@@ -322,11 +322,11 @@ var U = {
|
|
|
322
322
|
if (n <= t) return;
|
|
323
323
|
let r = t;
|
|
324
324
|
o.filter((e) => e.offset >= t && e.offset <= n).forEach((t) => {
|
|
325
|
-
t.offset > r && s.push(/* @__PURE__ */
|
|
325
|
+
t.offset > r && s.push(/* @__PURE__ */ z("span", {
|
|
326
326
|
"aria-hidden": !0,
|
|
327
327
|
children: e.slice(r, t.offset)
|
|
328
328
|
}, `text-${l++}`)), s.push(t.node), r = t.offset;
|
|
329
|
-
}), r < n && s.push(/* @__PURE__ */
|
|
329
|
+
}), r < n && s.push(/* @__PURE__ */ z("span", {
|
|
330
330
|
"aria-hidden": !0,
|
|
331
331
|
children: e.slice(r, n)
|
|
332
332
|
}, `text-${l++}`));
|
|
@@ -334,10 +334,10 @@ var U = {
|
|
|
334
334
|
return a.forEach((t, n) => {
|
|
335
335
|
if (u(c, t.start), t.start + t.length <= c) return;
|
|
336
336
|
let a = e.slice(t.start, t.start + t.length);
|
|
337
|
-
s.push(t.render ? /* @__PURE__ */
|
|
337
|
+
s.push(t.render ? /* @__PURE__ */ z("span", {
|
|
338
338
|
className: "pointer-events-auto",
|
|
339
339
|
children: t.render()
|
|
340
|
-
}, `range-${n}`) : /* @__PURE__ */
|
|
340
|
+
}, `range-${n}`) : /* @__PURE__ */ z("span", {
|
|
341
341
|
"aria-hidden": !0,
|
|
342
342
|
className: t.isUnsupported ? i : r,
|
|
343
343
|
children: a
|
|
@@ -360,12 +360,12 @@ var U = {
|
|
|
360
360
|
let a = document.createRange();
|
|
361
361
|
return a.setStart(r.node, r.offset), a.setEnd(i.node, i.offset), a;
|
|
362
362
|
}, Xe = ({ textareaRef: e, message: t, isMirrorActive: n }) => {
|
|
363
|
-
let r =
|
|
363
|
+
let r = W(null), [i, a] = G([]), o = V(() => {
|
|
364
364
|
let t = e.current, n = r.current;
|
|
365
365
|
if (t == null || n == null) return;
|
|
366
366
|
let i = t.offsetWidth > t.clientWidth;
|
|
367
367
|
n.style.scrollbarGutter = i ? "stable" : "", n.scrollTop = t.scrollTop;
|
|
368
|
-
}, [e]), s =
|
|
368
|
+
}, [e]), s = V(() => {
|
|
369
369
|
let t = e.current, i = r.current, o = t?.selectionStart, s = t?.selectionEnd;
|
|
370
370
|
if (!n || t == null || i == null || o == null || s == null || o === s) {
|
|
371
371
|
a((e) => e.length === 0 ? e : []);
|
|
@@ -379,14 +379,14 @@ var U = {
|
|
|
379
379
|
let l = i.getBoundingClientRect();
|
|
380
380
|
a(Array.from(c.getClientRects()).map((e) => new DOMRect(e.left - l.left, e.top - l.top + i.scrollTop, e.width, e.height)));
|
|
381
381
|
}, [n, e]);
|
|
382
|
-
return
|
|
382
|
+
return Me(() => {
|
|
383
383
|
n && o(), s();
|
|
384
384
|
}, [
|
|
385
385
|
n,
|
|
386
386
|
o,
|
|
387
387
|
s,
|
|
388
388
|
t
|
|
389
|
-
]),
|
|
389
|
+
]), H(() => {
|
|
390
390
|
if (!n) return;
|
|
391
391
|
let t = e.current;
|
|
392
392
|
if (t == null || typeof ResizeObserver > "u") return;
|
|
@@ -406,8 +406,8 @@ var U = {
|
|
|
406
406
|
syncMirrorToTextarea: o
|
|
407
407
|
};
|
|
408
408
|
}, Ze = ({ messageProp: e, messageRevision: t }) => {
|
|
409
|
-
let [n, r] =
|
|
410
|
-
return
|
|
409
|
+
let [n, r] = G(e), i = W(null);
|
|
410
|
+
return H(() => {
|
|
411
411
|
r(e);
|
|
412
412
|
}, [e, t]), {
|
|
413
413
|
message: n,
|
|
@@ -418,16 +418,16 @@ var U = {
|
|
|
418
418
|
let i = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value")?.set;
|
|
419
419
|
i ? i.call(e, t) : e.value = t, e.setSelectionRange(n, r), e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
420
420
|
}, $e = (e) => e.key.toLowerCase() === "z" && (e.ctrlKey || e.metaKey) && !e.shiftKey && !e.altKey, et = ({ insertion: e, textareaRef: t }) => {
|
|
421
|
-
let n = e?.revision, r =
|
|
421
|
+
let n = e?.revision, r = W(e?.text);
|
|
422
422
|
r.current = e?.text;
|
|
423
|
-
let i =
|
|
424
|
-
return
|
|
423
|
+
let i = W(n), a = W(null), o = W(!1);
|
|
424
|
+
return H(() => {
|
|
425
425
|
document.activeElement === t.current && (o.current = !0);
|
|
426
426
|
let e = (e) => {
|
|
427
427
|
e.target === t.current && (o.current = !0);
|
|
428
428
|
};
|
|
429
429
|
return document.addEventListener("focusin", e), () => document.removeEventListener("focusin", e);
|
|
430
|
-
}, [t]),
|
|
430
|
+
}, [t]), H(() => {
|
|
431
431
|
if (n === i.current) return;
|
|
432
432
|
i.current = n;
|
|
433
433
|
let e = r.current;
|
|
@@ -462,7 +462,7 @@ var U = {
|
|
|
462
462
|
"audio/ogg;codecs=opus",
|
|
463
463
|
"audio/webm"
|
|
464
464
|
], it = 100, at = 100, ot = .01, st = ({ onAttachAudio: e, onTranscribeAudio: t, onTranscript: n, errorLabel: i = "Voice input failed" }) => {
|
|
465
|
-
let [a, o] =
|
|
465
|
+
let [a, o] = G("idle"), [s, c] = G(null), l = W(null), d = W(null), f = W({
|
|
466
466
|
onAttachAudio: e,
|
|
467
467
|
onTranscribeAudio: t,
|
|
468
468
|
onTranscript: n,
|
|
@@ -474,7 +474,7 @@ var U = {
|
|
|
474
474
|
onTranscript: n,
|
|
475
475
|
errorLabel: i
|
|
476
476
|
};
|
|
477
|
-
let p =
|
|
477
|
+
let p = V((e = "dictation") => {
|
|
478
478
|
if (d.current) return;
|
|
479
479
|
let t = { controller: new AbortController() };
|
|
480
480
|
d.current = t, c(null), o("recording");
|
|
@@ -545,10 +545,10 @@ var U = {
|
|
|
545
545
|
x(e);
|
|
546
546
|
}
|
|
547
547
|
})();
|
|
548
|
-
}, []), m =
|
|
548
|
+
}, []), m = V(() => d.current?.stop?.(), []), h = V(() => {
|
|
549
549
|
d.current?.controller.abort(), d.current = null, c(null), o("idle");
|
|
550
550
|
}, []);
|
|
551
|
-
return
|
|
551
|
+
return H(() => () => {
|
|
552
552
|
d.current?.controller.abort(), d.current = null;
|
|
553
553
|
}, []), {
|
|
554
554
|
state: a,
|
|
@@ -574,7 +574,7 @@ var U = {
|
|
|
574
574
|
"--ci-sheet-item-active": f?.itemActiveBg,
|
|
575
575
|
"--ci-sheet-icon": f?.itemIcon
|
|
576
576
|
});
|
|
577
|
-
return /* @__PURE__ */
|
|
577
|
+
return /* @__PURE__ */ z(Fe, {
|
|
578
578
|
isOpen: e,
|
|
579
579
|
title: t,
|
|
580
580
|
closeLabel: n,
|
|
@@ -583,23 +583,23 @@ var U = {
|
|
|
583
583
|
className: o,
|
|
584
584
|
titleClassName: s,
|
|
585
585
|
colors: f?.shell,
|
|
586
|
-
children: /* @__PURE__ */
|
|
586
|
+
children: /* @__PURE__ */ z("ul", {
|
|
587
587
|
role: "list",
|
|
588
588
|
className: "flex flex-col",
|
|
589
589
|
style: h,
|
|
590
|
-
children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */
|
|
590
|
+
children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ z("li", { children: /* @__PURE__ */ z(m, {
|
|
591
591
|
type: "button",
|
|
592
592
|
className: l(ut.item, "w-full gap-3 px-4 py-[10px] text-start"),
|
|
593
|
-
iconBefore: /* @__PURE__ */
|
|
593
|
+
iconBefore: /* @__PURE__ */ z("span", {
|
|
594
594
|
className: ut.itemIcon,
|
|
595
595
|
children: n
|
|
596
596
|
}),
|
|
597
|
-
iconAfter: r ? /* @__PURE__ */
|
|
597
|
+
iconAfter: r ? /* @__PURE__ */ z("span", {
|
|
598
598
|
className: "ms-auto",
|
|
599
599
|
children: r
|
|
600
600
|
}) : null,
|
|
601
601
|
textClassName: d,
|
|
602
|
-
label: /* @__PURE__ */
|
|
602
|
+
label: /* @__PURE__ */ z("span", {
|
|
603
603
|
className: u,
|
|
604
604
|
children: t
|
|
605
605
|
}),
|
|
@@ -608,8 +608,8 @@ var U = {
|
|
|
608
608
|
})
|
|
609
609
|
});
|
|
610
610
|
}, ft = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
611
|
-
let [s, c] =
|
|
612
|
-
|
|
611
|
+
let [s, c] = G(t), [l, u] = G(n), [d, f] = G(r), p = W(o);
|
|
612
|
+
H(() => {
|
|
613
613
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
614
614
|
}, [
|
|
615
615
|
o,
|
|
@@ -626,7 +626,7 @@ var U = {
|
|
|
626
626
|
setResponseFormat: c,
|
|
627
627
|
setSystemPrompt: u,
|
|
628
628
|
setTemperature: f,
|
|
629
|
-
handleSubmit:
|
|
629
|
+
handleSubmit: V(() => {
|
|
630
630
|
if (!m) return;
|
|
631
631
|
let t = {};
|
|
632
632
|
e.responseFormat && s != null && (t.responseFormat = s), e.systemPrompt && (t.systemPrompt = l), e.temperature && (t.temperature = d), i(t), a();
|
|
@@ -640,17 +640,17 @@ var U = {
|
|
|
640
640
|
a
|
|
641
641
|
])
|
|
642
642
|
};
|
|
643
|
-
}, pt = { label: "_label_14i7c_1" },
|
|
643
|
+
}, pt = { label: "_label_14i7c_1" }, q = ({ features: e, responseFormat: t, systemPrompt: n, temperature: r, onResponseFormatChange: a, onSystemPromptChange: s, onTemperatureChange: u, responseFormatLabel: d = "Response format", responseFormatHint: f = "Applies to new and existing messages", responseFormatMarkdownLabel: p = "Markdown", responseFormatPlainTextLabel: m = "Plain text", systemPromptLabel: h = "System prompt", systemPromptTooltip: g = "Enter a prompt", temperatureLabel: _ = "Temperature", temperatureLabels: v = [
|
|
644
644
|
"Precise",
|
|
645
645
|
"Neutral",
|
|
646
646
|
"Creative"
|
|
647
647
|
], temperatureHint: y, labelClassName: b = "!dial-small-semi-text", colors: x }) => {
|
|
648
648
|
let S = c({ "--csf-label-text": x?.labelText }), C = l(b, pt.label, "gap-1");
|
|
649
|
-
return /* @__PURE__ */
|
|
649
|
+
return /* @__PURE__ */ B("div", {
|
|
650
650
|
className: "flex flex-col gap-4 px-6 pb-3",
|
|
651
651
|
style: S,
|
|
652
652
|
children: [
|
|
653
|
-
e.responseFormat && /* @__PURE__ */
|
|
653
|
+
e.responseFormat && /* @__PURE__ */ z(F, {
|
|
654
654
|
id: "response-format",
|
|
655
655
|
labelProps: {
|
|
656
656
|
label: d,
|
|
@@ -658,7 +658,7 @@ var U = {
|
|
|
658
658
|
caption: f
|
|
659
659
|
},
|
|
660
660
|
optionsClassName: "mb-2",
|
|
661
|
-
orientation:
|
|
661
|
+
orientation: ne.Column,
|
|
662
662
|
value: t ?? o.Markdown,
|
|
663
663
|
items: [{
|
|
664
664
|
value: o.Markdown,
|
|
@@ -669,18 +669,18 @@ var U = {
|
|
|
669
669
|
}],
|
|
670
670
|
onChange: (e) => a(e)
|
|
671
671
|
}),
|
|
672
|
-
e.systemPrompt && /* @__PURE__ */
|
|
672
|
+
e.systemPrompt && /* @__PURE__ */ z(ae, {
|
|
673
673
|
value: n,
|
|
674
674
|
placeholder: g,
|
|
675
675
|
className: i,
|
|
676
|
-
resize:
|
|
676
|
+
resize: oe.Vertical,
|
|
677
677
|
labelProps: {
|
|
678
678
|
className: C,
|
|
679
679
|
label: h
|
|
680
680
|
},
|
|
681
681
|
onChange: (e) => s(e ?? "")
|
|
682
682
|
}),
|
|
683
|
-
e.temperature && /* @__PURE__ */
|
|
683
|
+
e.temperature && /* @__PURE__ */ z(R, {
|
|
684
684
|
labelProps: {
|
|
685
685
|
label: _,
|
|
686
686
|
className: C,
|
|
@@ -697,7 +697,7 @@ var U = {
|
|
|
697
697
|
})
|
|
698
698
|
]
|
|
699
699
|
});
|
|
700
|
-
},
|
|
700
|
+
}, mt = ({ isOpen: e, onBack: t, backLabel: n, onClose: r, closeLabel: i, style: a, features: o, initialResponseFormat: s, initialSystemPrompt: c, initialTemperature: u, onSave: d, title: f = "Chat settings", responseFormatLabel: p, responseFormatHint: m, responseFormatMarkdownLabel: h, responseFormatPlainTextLabel: g, systemPromptLabel: _, systemPromptTooltip: v, temperatureLabel: y, temperatureLabels: b, temperatureHint: x, saveLabel: S = "Apply changes", saveDisabledTooltip: C }) => {
|
|
701
701
|
let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: D, setResponseFormat: O, setSystemPrompt: k, setTemperature: ee, handleSubmit: A } = ft({
|
|
702
702
|
isOpen: e,
|
|
703
703
|
features: o,
|
|
@@ -707,7 +707,7 @@ var U = {
|
|
|
707
707
|
onSave: d,
|
|
708
708
|
onClose: r
|
|
709
709
|
});
|
|
710
|
-
return /* @__PURE__ */
|
|
710
|
+
return /* @__PURE__ */ B(Fe, {
|
|
711
711
|
isOpen: e,
|
|
712
712
|
title: f,
|
|
713
713
|
closeLabel: i,
|
|
@@ -715,7 +715,7 @@ var U = {
|
|
|
715
715
|
onBack: t,
|
|
716
716
|
backLabel: n,
|
|
717
717
|
style: a,
|
|
718
|
-
children: [/* @__PURE__ */
|
|
718
|
+
children: [/* @__PURE__ */ z(q, {
|
|
719
719
|
features: o,
|
|
720
720
|
responseFormat: w,
|
|
721
721
|
systemPrompt: T,
|
|
@@ -732,13 +732,13 @@ var U = {
|
|
|
732
732
|
temperatureLabel: y,
|
|
733
733
|
temperatureLabels: b,
|
|
734
734
|
temperatureHint: x
|
|
735
|
-
}), /* @__PURE__ */
|
|
735
|
+
}), /* @__PURE__ */ z("div", {
|
|
736
736
|
className: l("px-6 py-4 mobile:pb-8"),
|
|
737
|
-
children: /* @__PURE__ */
|
|
737
|
+
children: /* @__PURE__ */ z(ce, {
|
|
738
738
|
tooltip: C,
|
|
739
739
|
hideTooltip: D || !C,
|
|
740
740
|
triggerClassName: "w-full",
|
|
741
|
-
children: /* @__PURE__ */
|
|
741
|
+
children: /* @__PURE__ */ z(P, {
|
|
742
742
|
label: S,
|
|
743
743
|
onClick: A,
|
|
744
744
|
disabled: !D,
|
|
@@ -747,7 +747,7 @@ var U = {
|
|
|
747
747
|
})
|
|
748
748
|
})]
|
|
749
749
|
});
|
|
750
|
-
},
|
|
750
|
+
}, ht = { modal: "_modal_kl0h0_1" }, gt = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", titleClassName: s = "dial-h1-text", responseFormatLabel: l, responseFormatHint: u, responseFormatMarkdownLabel: d, responseFormatPlainTextLabel: f, systemPromptLabel: p, systemPromptTooltip: m, temperatureLabel: g, temperatureLabels: _, temperatureHint: v, saveLabel: y = "Apply changes", saveDisabledTooltip: b, backgroundClassName: x = ht.modal, colors: S }) => {
|
|
751
751
|
let { responseFormat: C, systemPrompt: w, temperature: T, canSubmit: E, setResponseFormat: D, setSystemPrompt: O, setTemperature: k, handleSubmit: ee } = ft({
|
|
752
752
|
features: e,
|
|
753
753
|
initialResponseFormat: t,
|
|
@@ -756,11 +756,11 @@ var U = {
|
|
|
756
756
|
onSave: i,
|
|
757
757
|
onClose: a
|
|
758
758
|
});
|
|
759
|
-
return /* @__PURE__ */
|
|
759
|
+
return /* @__PURE__ */ z(M, {
|
|
760
760
|
open: !0,
|
|
761
761
|
header: o,
|
|
762
762
|
titleClassName: s,
|
|
763
|
-
size:
|
|
763
|
+
size: N.Sm,
|
|
764
764
|
onClose: a,
|
|
765
765
|
className: x,
|
|
766
766
|
overlayStyle: c({ "--csm-bg": S?.background }),
|
|
@@ -774,7 +774,7 @@ var U = {
|
|
|
774
774
|
hideTooltip: E
|
|
775
775
|
} : void 0
|
|
776
776
|
}],
|
|
777
|
-
children: /* @__PURE__ */
|
|
777
|
+
children: /* @__PURE__ */ z(q, {
|
|
778
778
|
features: e,
|
|
779
779
|
responseFormat: C,
|
|
780
780
|
systemPrompt: w,
|
|
@@ -801,7 +801,7 @@ var U = {
|
|
|
801
801
|
"--tbs-icon-text": p?.iconText,
|
|
802
802
|
"--tbs-selected-icon-text": p?.selectedIconText
|
|
803
803
|
});
|
|
804
|
-
return /* @__PURE__ */
|
|
804
|
+
return /* @__PURE__ */ z(Fe, {
|
|
805
805
|
isOpen: e,
|
|
806
806
|
title: o,
|
|
807
807
|
closeLabel: i,
|
|
@@ -809,30 +809,30 @@ var U = {
|
|
|
809
809
|
onBack: t,
|
|
810
810
|
backLabel: n,
|
|
811
811
|
style: a,
|
|
812
|
-
children: /* @__PURE__ */
|
|
812
|
+
children: /* @__PURE__ */ z("ul", {
|
|
813
813
|
role: "menu",
|
|
814
814
|
className: "flex flex-col pb-4",
|
|
815
815
|
style: h,
|
|
816
|
-
children: s.map((e) => /* @__PURE__ */
|
|
816
|
+
children: s.map((e) => /* @__PURE__ */ z("li", {
|
|
817
817
|
role: "none",
|
|
818
|
-
children: /* @__PURE__ */
|
|
818
|
+
children: /* @__PURE__ */ z(m, {
|
|
819
819
|
type: "button",
|
|
820
820
|
role: "menuitemcheckbox",
|
|
821
821
|
"aria-checked": e.isSelected,
|
|
822
822
|
className: "w-full gap-3 px-4 py-[10px] text-start",
|
|
823
|
-
iconBefore: /* @__PURE__ */
|
|
823
|
+
iconBefore: /* @__PURE__ */ z("span", {
|
|
824
824
|
className: l("flex items-center", _t.icon),
|
|
825
825
|
children: e.icon
|
|
826
826
|
}),
|
|
827
|
-
iconAfter: e.isSelected ? /* @__PURE__ */
|
|
827
|
+
iconAfter: e.isSelected ? /* @__PURE__ */ z("span", {
|
|
828
828
|
className: l("ms-auto", _t.selectedIcon),
|
|
829
|
-
children: /* @__PURE__ */
|
|
829
|
+
children: /* @__PURE__ */ z(he, {
|
|
830
830
|
size: f,
|
|
831
831
|
"aria-hidden": !0,
|
|
832
832
|
stroke: v
|
|
833
833
|
})
|
|
834
834
|
}) : null,
|
|
835
|
-
label: /* @__PURE__ */
|
|
835
|
+
label: /* @__PURE__ */ z("span", {
|
|
836
836
|
className: d,
|
|
837
837
|
children: e.label
|
|
838
838
|
}),
|
|
@@ -845,14 +845,14 @@ var U = {
|
|
|
845
845
|
toolIcon: "_toolIcon_ma5s5_1",
|
|
846
846
|
chevronIcon: "_chevronIcon_ma5s5_5"
|
|
847
847
|
}, bt = ({ onAttachClick: e, onRecordVoice: t, recordVoiceLabel: n = "Record voice", attachLabel: r, addMenuTitle: i, menuTitle: a, menuCloseLabel: s, style: u, listClassName: p = "w-[240px]", isDisabled: m = !1, chatSettings: h, extraMenuItems: g, toolsMenuItems: b = [], onToolToggle: x, toolsMenuTitle: C = "Tools", toolsBackLabel: w = "Back", menuOverlays: T, getCaretPosition: E, colors: O }) => {
|
|
848
|
-
let k = d(), [ee, A] =
|
|
848
|
+
let k = d(), [ee, A] = G(!1), [j, M] = G(!1), [N, P] = G(!1), [te, F] = G(null), [ne, re] = G(!1), I = U(() => c({
|
|
849
849
|
"--aab-tool-icon": O?.toolIcon,
|
|
850
850
|
"--aab-chevron-icon": O?.chevronIcon
|
|
851
|
-
}), [O?.toolIcon, O?.chevronIcon]),
|
|
851
|
+
}), [O?.toolIcon, O?.chevronIcon]), L = b.length > 0 && x != null, R = T != null && T.length > 0, ie = U(() => b.map((e) => ({
|
|
852
852
|
key: e.id,
|
|
853
853
|
label: e.label,
|
|
854
|
-
icon: /* @__PURE__ */
|
|
855
|
-
style:
|
|
854
|
+
icon: /* @__PURE__ */ z("span", {
|
|
855
|
+
style: I,
|
|
856
856
|
className: l("flex items-center", yt.toolIcon),
|
|
857
857
|
children: e.icon
|
|
858
858
|
}),
|
|
@@ -863,12 +863,12 @@ var U = {
|
|
|
863
863
|
})), [
|
|
864
864
|
b,
|
|
865
865
|
x,
|
|
866
|
-
|
|
867
|
-
]),
|
|
866
|
+
I
|
|
867
|
+
]), ae = U(() => [
|
|
868
868
|
...e == null ? [] : [{
|
|
869
869
|
key: "attach",
|
|
870
870
|
label: r,
|
|
871
|
-
icon: /* @__PURE__ */
|
|
871
|
+
icon: /* @__PURE__ */ z(be, {
|
|
872
872
|
size: f,
|
|
873
873
|
"aria-hidden": !0,
|
|
874
874
|
stroke: v
|
|
@@ -876,36 +876,36 @@ var U = {
|
|
|
876
876
|
onClick: e
|
|
877
877
|
}],
|
|
878
878
|
...g ?? [],
|
|
879
|
-
...
|
|
879
|
+
...L ? [{
|
|
880
880
|
key: "tools",
|
|
881
881
|
label: C,
|
|
882
|
-
icon: /* @__PURE__ */
|
|
882
|
+
icon: /* @__PURE__ */ z(we, {
|
|
883
883
|
size: f,
|
|
884
884
|
"aria-hidden": !0,
|
|
885
885
|
stroke: v
|
|
886
886
|
}),
|
|
887
887
|
onClick: k ? () => {
|
|
888
|
-
|
|
888
|
+
P(!0), A(!1);
|
|
889
889
|
} : () => void 0,
|
|
890
|
-
...k ? { iconAfter: /* @__PURE__ */
|
|
890
|
+
...k ? { iconAfter: /* @__PURE__ */ z(_e, {
|
|
891
891
|
size: f,
|
|
892
892
|
stroke: v,
|
|
893
|
-
style:
|
|
893
|
+
style: I,
|
|
894
894
|
className: l("rtl:scale-x-[-1]", yt.chevronIcon),
|
|
895
895
|
"aria-hidden": !0
|
|
896
|
-
}) } : { children:
|
|
896
|
+
}) } : { children: ie }
|
|
897
897
|
}] : [],
|
|
898
898
|
...(T ?? []).map((e) => ({
|
|
899
899
|
key: e.key,
|
|
900
900
|
label: e.title,
|
|
901
901
|
icon: e.icon,
|
|
902
902
|
onClick: k ? () => {
|
|
903
|
-
|
|
903
|
+
F(e.key), A(!1);
|
|
904
904
|
} : () => void 0,
|
|
905
|
-
...k ? { iconAfter: /* @__PURE__ */
|
|
905
|
+
...k ? { iconAfter: /* @__PURE__ */ z(_e, {
|
|
906
906
|
size: f,
|
|
907
907
|
stroke: v,
|
|
908
|
-
style:
|
|
908
|
+
style: I,
|
|
909
909
|
className: l("rtl:scale-x-[-1]", yt.chevronIcon),
|
|
910
910
|
"aria-hidden": !0
|
|
911
911
|
}) } : {
|
|
@@ -913,37 +913,37 @@ var U = {
|
|
|
913
913
|
key: `${e.key}-panel`,
|
|
914
914
|
label: ""
|
|
915
915
|
}],
|
|
916
|
-
renderSubMenu: () => e.renderOverlay(() =>
|
|
916
|
+
renderSubMenu: () => e.renderOverlay(() => re(!1), E?.() ?? 0)
|
|
917
917
|
}
|
|
918
918
|
})),
|
|
919
919
|
...t == null ? [] : [{
|
|
920
920
|
key: "record-voice",
|
|
921
921
|
label: n,
|
|
922
|
-
icon: /* @__PURE__ */
|
|
922
|
+
icon: /* @__PURE__ */ z(ye, {
|
|
923
923
|
size: f,
|
|
924
924
|
"aria-hidden": !0,
|
|
925
925
|
stroke: v
|
|
926
926
|
}),
|
|
927
927
|
onClick: () => {
|
|
928
|
-
A(!1),
|
|
928
|
+
A(!1), re(!1), t();
|
|
929
929
|
}
|
|
930
930
|
}],
|
|
931
931
|
...h == null ? [] : [{
|
|
932
932
|
key: "chat-settings",
|
|
933
933
|
label: h.menuItemLabel ?? "Chat settings",
|
|
934
|
-
icon: /* @__PURE__ */
|
|
934
|
+
icon: /* @__PURE__ */ z(Ce, {
|
|
935
935
|
size: f,
|
|
936
936
|
"aria-hidden": !0,
|
|
937
937
|
stroke: v
|
|
938
938
|
}),
|
|
939
|
-
iconAfter: k ? /* @__PURE__ */
|
|
939
|
+
iconAfter: k ? /* @__PURE__ */ z(_e, {
|
|
940
940
|
size: f,
|
|
941
941
|
stroke: v,
|
|
942
|
-
style:
|
|
942
|
+
style: I,
|
|
943
943
|
className: l("rtl:scale-x-[-1]", yt.chevronIcon),
|
|
944
944
|
"aria-hidden": !0
|
|
945
945
|
}) : null,
|
|
946
|
-
onClick: () =>
|
|
946
|
+
onClick: () => M(!0)
|
|
947
947
|
}]
|
|
948
948
|
], [
|
|
949
949
|
r,
|
|
@@ -953,25 +953,25 @@ var U = {
|
|
|
953
953
|
h,
|
|
954
954
|
g,
|
|
955
955
|
k,
|
|
956
|
-
|
|
956
|
+
L,
|
|
957
957
|
C,
|
|
958
|
-
|
|
958
|
+
ie,
|
|
959
959
|
T,
|
|
960
960
|
E,
|
|
961
|
-
|
|
961
|
+
I
|
|
962
962
|
]);
|
|
963
|
-
if (
|
|
964
|
-
let
|
|
963
|
+
if (ae.length === 0) return null;
|
|
964
|
+
let oe = /* @__PURE__ */ z(y, {
|
|
965
965
|
matchReferenceWidth: !1,
|
|
966
966
|
placement: "bottom-start",
|
|
967
967
|
listClassName: p,
|
|
968
968
|
overlayContentClassName: "flex flex-col gap-1",
|
|
969
|
-
items:
|
|
969
|
+
items: ae,
|
|
970
970
|
disabled: m,
|
|
971
|
-
open:
|
|
972
|
-
onOpenChange:
|
|
973
|
-
children: /* @__PURE__ */
|
|
974
|
-
icon: /* @__PURE__ */
|
|
971
|
+
open: R ? ne : void 0,
|
|
972
|
+
onOpenChange: R ? re : void 0,
|
|
973
|
+
children: /* @__PURE__ */ z(S, {
|
|
974
|
+
icon: /* @__PURE__ */ z(Se, {
|
|
975
975
|
size: _.LG,
|
|
976
976
|
"aria-hidden": !0,
|
|
977
977
|
stroke: v
|
|
@@ -981,9 +981,9 @@ var U = {
|
|
|
981
981
|
disabled: m
|
|
982
982
|
})
|
|
983
983
|
});
|
|
984
|
-
return /* @__PURE__ */
|
|
985
|
-
/* @__PURE__ */
|
|
986
|
-
icon: /* @__PURE__ */
|
|
984
|
+
return /* @__PURE__ */ z(le, { children: k ? /* @__PURE__ */ B(le, { children: [
|
|
985
|
+
/* @__PURE__ */ z(S, {
|
|
986
|
+
icon: /* @__PURE__ */ z(Se, {
|
|
987
987
|
size: _.LG,
|
|
988
988
|
"aria-hidden": !0,
|
|
989
989
|
stroke: v
|
|
@@ -993,52 +993,52 @@ var U = {
|
|
|
993
993
|
disabled: m,
|
|
994
994
|
onClick: () => A(!0)
|
|
995
995
|
}),
|
|
996
|
-
/* @__PURE__ */
|
|
996
|
+
/* @__PURE__ */ z(dt, {
|
|
997
997
|
isOpen: ee,
|
|
998
998
|
title: a,
|
|
999
999
|
closeLabel: s,
|
|
1000
1000
|
onClose: () => A(!1),
|
|
1001
1001
|
style: u,
|
|
1002
|
-
items:
|
|
1002
|
+
items: ae,
|
|
1003
1003
|
className: "pb-4",
|
|
1004
1004
|
btnTextClassName: "flex-1"
|
|
1005
1005
|
}),
|
|
1006
|
-
|
|
1007
|
-
isOpen:
|
|
1006
|
+
L && /* @__PURE__ */ z(vt, {
|
|
1007
|
+
isOpen: N,
|
|
1008
1008
|
onBack: () => {
|
|
1009
|
-
|
|
1009
|
+
P(!1), A(!0);
|
|
1010
1010
|
},
|
|
1011
1011
|
backLabel: w,
|
|
1012
|
-
onClose: () =>
|
|
1012
|
+
onClose: () => P(!1),
|
|
1013
1013
|
closeLabel: s,
|
|
1014
1014
|
style: u,
|
|
1015
1015
|
title: C,
|
|
1016
1016
|
items: b,
|
|
1017
1017
|
onToolToggle: x
|
|
1018
1018
|
}),
|
|
1019
|
-
T?.map((e) => /* @__PURE__ */
|
|
1020
|
-
isOpen:
|
|
1019
|
+
T?.map((e) => /* @__PURE__ */ z(Fe, {
|
|
1020
|
+
isOpen: te === e.key,
|
|
1021
1021
|
title: e.title,
|
|
1022
1022
|
closeLabel: s,
|
|
1023
1023
|
onBack: () => {
|
|
1024
|
-
|
|
1024
|
+
F(null), A(!0);
|
|
1025
1025
|
},
|
|
1026
1026
|
backLabel: e.backLabel ?? "Back",
|
|
1027
|
-
onClose: () =>
|
|
1027
|
+
onClose: () => F(null),
|
|
1028
1028
|
style: u,
|
|
1029
|
-
children: /* @__PURE__ */
|
|
1029
|
+
children: /* @__PURE__ */ z("div", {
|
|
1030
1030
|
role: "menu",
|
|
1031
1031
|
"aria-label": e.title,
|
|
1032
|
-
children: e.renderOverlay(() =>
|
|
1032
|
+
children: e.renderOverlay(() => F(null), E?.() ?? 0)
|
|
1033
1033
|
})
|
|
1034
1034
|
}, e.key)),
|
|
1035
|
-
h != null && /* @__PURE__ */
|
|
1036
|
-
isOpen:
|
|
1035
|
+
h != null && /* @__PURE__ */ z(mt, {
|
|
1036
|
+
isOpen: j,
|
|
1037
1037
|
onBack: () => {
|
|
1038
|
-
|
|
1038
|
+
M(!1), A(!0);
|
|
1039
1039
|
},
|
|
1040
1040
|
backLabel: h.backLabel ?? "Back",
|
|
1041
|
-
onClose: () =>
|
|
1041
|
+
onClose: () => M(!1),
|
|
1042
1042
|
closeLabel: s,
|
|
1043
1043
|
style: u,
|
|
1044
1044
|
features: h.features,
|
|
@@ -1059,13 +1059,13 @@ var U = {
|
|
|
1059
1059
|
saveLabel: h.saveLabel,
|
|
1060
1060
|
saveDisabledTooltip: h.saveDisabledTooltip
|
|
1061
1061
|
})
|
|
1062
|
-
] }) : /* @__PURE__ */
|
|
1062
|
+
] }) : /* @__PURE__ */ B(le, { children: [oe, h != null && j && /* @__PURE__ */ z(gt, {
|
|
1063
1063
|
features: h.features,
|
|
1064
1064
|
initialResponseFormat: h.responseFormat ?? o.Markdown,
|
|
1065
1065
|
initialSystemPrompt: h.systemPrompt,
|
|
1066
1066
|
initialTemperature: h.temperature,
|
|
1067
1067
|
onSave: h.onSave,
|
|
1068
|
-
onClose: () =>
|
|
1068
|
+
onClose: () => M(!1),
|
|
1069
1069
|
title: h.title,
|
|
1070
1070
|
responseFormatLabel: h.responseFormatLabel,
|
|
1071
1071
|
responseFormatHint: h.responseFormatHint,
|
|
@@ -1103,50 +1103,50 @@ var U = {
|
|
|
1103
1103
|
"--ci-chip-state-text": u?.chipStateText,
|
|
1104
1104
|
"--ci-chip-close": u?.chipClose,
|
|
1105
1105
|
"--ci-chip-close-hover": u?.chipCloseHover
|
|
1106
|
-
}), p = (e) => /* @__PURE__ */
|
|
1106
|
+
}), p = (e) => /* @__PURE__ */ z("span", {
|
|
1107
1107
|
className: l(xt.chipIcon, "flex shrink-0"),
|
|
1108
1108
|
children: e.icon
|
|
1109
|
-
}), m = (e) => /* @__PURE__ */
|
|
1109
|
+
}), m = (e) => /* @__PURE__ */ B("span", {
|
|
1110
1110
|
className: "flex min-w-0 items-center",
|
|
1111
|
-
children: [/* @__PURE__ */
|
|
1111
|
+
children: [/* @__PURE__ */ B("span", {
|
|
1112
1112
|
className: l(xt.chipText, s?.fontClassName || "dial-small-paragraph-text", "truncate"),
|
|
1113
|
-
children: [e.label, d && /* @__PURE__ */
|
|
1113
|
+
children: [e.label, d && /* @__PURE__ */ z("span", {
|
|
1114
1114
|
"aria-hidden": !0,
|
|
1115
1115
|
children: ":"
|
|
1116
1116
|
})]
|
|
1117
|
-
}), d && /* @__PURE__ */
|
|
1117
|
+
}), d && /* @__PURE__ */ z("span", {
|
|
1118
1118
|
className: l(xt.chipState, s?.stateClassName || "dial-tiny-lead-text", "ms-1 shrink-0"),
|
|
1119
1119
|
"aria-hidden": !0,
|
|
1120
1120
|
children: e.isSelected ? a : o
|
|
1121
1121
|
})]
|
|
1122
1122
|
});
|
|
1123
|
-
return /* @__PURE__ */
|
|
1123
|
+
return /* @__PURE__ */ z("div", {
|
|
1124
1124
|
className: "flex flex-wrap items-center gap-2",
|
|
1125
1125
|
style: f,
|
|
1126
|
-
children: e.map((e) => r ? /* @__PURE__ */
|
|
1126
|
+
children: e.map((e) => r ? /* @__PURE__ */ B("div", {
|
|
1127
1127
|
className: l(xt.chip, e.isSelected && xt.chipSelected, "flex min-w-0 items-center gap-1.5 rounded-full border py-1 ps-2 pe-1 transition-colors"),
|
|
1128
|
-
children: [/* @__PURE__ */
|
|
1128
|
+
children: [/* @__PURE__ */ B("button", {
|
|
1129
1129
|
type: "button",
|
|
1130
1130
|
onClick: () => t(e.id),
|
|
1131
1131
|
"aria-pressed": e.isSelected,
|
|
1132
1132
|
className: "flex min-w-0 items-center gap-1.5",
|
|
1133
|
-
children: [/* @__PURE__ */
|
|
1133
|
+
children: [/* @__PURE__ */ z("span", {
|
|
1134
1134
|
className: "flex shrink-0",
|
|
1135
1135
|
"aria-hidden": !0,
|
|
1136
1136
|
children: p(e)
|
|
1137
1137
|
}), m(e)]
|
|
1138
|
-
}), /* @__PURE__ */
|
|
1138
|
+
}), /* @__PURE__ */ z("button", {
|
|
1139
1139
|
type: "button",
|
|
1140
1140
|
onClick: () => n(e.id),
|
|
1141
1141
|
"aria-label": i(e.label),
|
|
1142
1142
|
className: l(xt.chipClose, "flex shrink-0 items-center rounded p-0.5 transition-colors"),
|
|
1143
|
-
children: /* @__PURE__ */
|
|
1143
|
+
children: /* @__PURE__ */ z(Te, {
|
|
1144
1144
|
size: 12,
|
|
1145
1145
|
"aria-hidden": !0,
|
|
1146
1146
|
stroke: v
|
|
1147
1147
|
})
|
|
1148
1148
|
})]
|
|
1149
|
-
}, e.id) : /* @__PURE__ */
|
|
1149
|
+
}, e.id) : /* @__PURE__ */ z(se, {
|
|
1150
1150
|
icon: p(e),
|
|
1151
1151
|
label: m(e),
|
|
1152
1152
|
isSelected: e.isSelected,
|
|
@@ -1154,7 +1154,7 @@ var U = {
|
|
|
1154
1154
|
className: l(xt.chip, e.isSelected && xt.chipSelected, "h-auto min-w-0 gap-1.5 border px-2 py-1 transition-colors")
|
|
1155
1155
|
}, e.id))
|
|
1156
1156
|
});
|
|
1157
|
-
},
|
|
1157
|
+
}, J = {
|
|
1158
1158
|
wrapper: "_wrapper_13067_2",
|
|
1159
1159
|
wrapperDisabled: "_wrapperDisabled_13067_9",
|
|
1160
1160
|
textarea: "_textarea_13067_13",
|
|
@@ -1174,7 +1174,7 @@ var U = {
|
|
|
1174
1174
|
recordingDot: "_recordingDot_18zb5_15",
|
|
1175
1175
|
"recording-pulse": "_recording-pulse_18zb5_1"
|
|
1176
1176
|
}, Tt = 3, Et = 4, Dt = 200, Ot = ({ state: e, analyserNodeRef: t, onStop: n, onDiscard: r, attachButton: i, stopLabel: a = "Stop recording", discardLabel: o = "Discard recording", processingLabel: s = "Transcribing audio…", style: c, className: u, embedded: d = !1 }) => {
|
|
1177
|
-
let f =
|
|
1177
|
+
let f = W(null), p = W(new Float32Array(Dt)), m = W(0), h = W(0), g = e === tt.Recording, y = e === tt.Processing, b = V((e) => {
|
|
1178
1178
|
let t = e.getContext("2d");
|
|
1179
1179
|
if (!t) return;
|
|
1180
1180
|
e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
|
|
@@ -1188,7 +1188,7 @@ var U = {
|
|
|
1188
1188
|
}
|
|
1189
1189
|
t.restore();
|
|
1190
1190
|
}, []);
|
|
1191
|
-
|
|
1191
|
+
H(() => {
|
|
1192
1192
|
if (!g) return;
|
|
1193
1193
|
let e = f.current;
|
|
1194
1194
|
if (!e) return;
|
|
@@ -1217,7 +1217,7 @@ var U = {
|
|
|
1217
1217
|
g,
|
|
1218
1218
|
t,
|
|
1219
1219
|
b
|
|
1220
|
-
]),
|
|
1220
|
+
]), H(() => {
|
|
1221
1221
|
let e = f.current;
|
|
1222
1222
|
if (!e) return;
|
|
1223
1223
|
let t = new ResizeObserver(() => {
|
|
@@ -1225,11 +1225,11 @@ var U = {
|
|
|
1225
1225
|
});
|
|
1226
1226
|
return t.observe(e), () => t.disconnect();
|
|
1227
1227
|
}, [b]);
|
|
1228
|
-
let x = /* @__PURE__ */
|
|
1228
|
+
let x = /* @__PURE__ */ B("div", {
|
|
1229
1229
|
className: "flex shrink-0 items-center justify-end gap-1",
|
|
1230
1230
|
children: [
|
|
1231
|
-
/* @__PURE__ */
|
|
1232
|
-
icon: /* @__PURE__ */
|
|
1231
|
+
/* @__PURE__ */ z(k, {
|
|
1232
|
+
icon: /* @__PURE__ */ z(Te, {
|
|
1233
1233
|
size: _.LG,
|
|
1234
1234
|
"aria-hidden": !0,
|
|
1235
1235
|
stroke: v
|
|
@@ -1238,8 +1238,8 @@ var U = {
|
|
|
1238
1238
|
className: "mobile:min-h-11 mobile:min-w-11",
|
|
1239
1239
|
onClick: r
|
|
1240
1240
|
}),
|
|
1241
|
-
g && /* @__PURE__ */
|
|
1242
|
-
icon: /* @__PURE__ */
|
|
1241
|
+
g && /* @__PURE__ */ z(te, {
|
|
1242
|
+
icon: /* @__PURE__ */ z(he, {
|
|
1243
1243
|
size: _.LG,
|
|
1244
1244
|
"aria-hidden": !0,
|
|
1245
1245
|
stroke: v
|
|
@@ -1249,80 +1249,80 @@ var U = {
|
|
|
1249
1249
|
"aria-label": a,
|
|
1250
1250
|
className: "mobile:min-h-11 mobile:min-w-11"
|
|
1251
1251
|
}),
|
|
1252
|
-
y && /* @__PURE__ */
|
|
1252
|
+
y && /* @__PURE__ */ z("span", {
|
|
1253
1253
|
className: "flex size-[40px] shrink-0 items-center justify-center mobile:min-h-11 mobile:min-w-11",
|
|
1254
|
-
children: /* @__PURE__ */
|
|
1254
|
+
children: /* @__PURE__ */ z(ie, {
|
|
1255
1255
|
size: 20,
|
|
1256
1256
|
ariaLabel: s
|
|
1257
1257
|
})
|
|
1258
1258
|
})
|
|
1259
1259
|
]
|
|
1260
1260
|
});
|
|
1261
|
-
return /* @__PURE__ */
|
|
1261
|
+
return /* @__PURE__ */ z("div", {
|
|
1262
1262
|
className: u,
|
|
1263
|
-
children: /* @__PURE__ */
|
|
1263
|
+
children: /* @__PURE__ */ B("div", {
|
|
1264
1264
|
style: c,
|
|
1265
|
-
className: l("flex w-full min-w-0 flex-col justify-center gap-2", !d &&
|
|
1266
|
-
children: [/* @__PURE__ */
|
|
1265
|
+
className: l("flex w-full min-w-0 flex-col justify-center gap-2", !d && J.wrapper, !d && "min-h-[64px] max-w-[748px] rounded-xl border px-3 shadow-md"),
|
|
1266
|
+
children: [/* @__PURE__ */ B("div", {
|
|
1267
1267
|
className: "flex min-w-0 flex-1 items-center gap-3",
|
|
1268
|
-
children: [g && /* @__PURE__ */
|
|
1268
|
+
children: [g && /* @__PURE__ */ z("span", {
|
|
1269
1269
|
className: l(wt.recordingDot, "pointer-events-none block size-[8px] rounded-3xl"),
|
|
1270
1270
|
"aria-hidden": !0
|
|
1271
|
-
}), /* @__PURE__ */
|
|
1271
|
+
}), /* @__PURE__ */ z("canvas", {
|
|
1272
1272
|
ref: f,
|
|
1273
1273
|
height: 26,
|
|
1274
1274
|
"aria-hidden": !0,
|
|
1275
1275
|
className: l(wt.waveformCanvas, "h-[26px] min-w-0 flex-1")
|
|
1276
1276
|
})]
|
|
1277
|
-
}), /* @__PURE__ */
|
|
1277
|
+
}), /* @__PURE__ */ B("div", {
|
|
1278
1278
|
className: "flex items-center justify-between gap-2",
|
|
1279
|
-
children: [i ?? /* @__PURE__ */
|
|
1279
|
+
children: [i ?? /* @__PURE__ */ z("span", { "aria-hidden": !0 }), x]
|
|
1280
1280
|
})]
|
|
1281
1281
|
})
|
|
1282
1282
|
});
|
|
1283
|
-
}, kt = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", sendTooltip: r }) => /* @__PURE__ */
|
|
1283
|
+
}, kt = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", sendTooltip: r }) => /* @__PURE__ */ z(te, {
|
|
1284
1284
|
"aria-label": n,
|
|
1285
1285
|
onClick: () => e?.(),
|
|
1286
1286
|
disabled: t,
|
|
1287
1287
|
tooltipProps: r ? { tooltip: r } : void 0,
|
|
1288
|
-
icon: /* @__PURE__ */
|
|
1288
|
+
icon: /* @__PURE__ */ z(me, {
|
|
1289
1289
|
size: _.LG,
|
|
1290
1290
|
className: "rtl:scale-x-[-1]",
|
|
1291
1291
|
stroke: v
|
|
1292
1292
|
})
|
|
1293
|
-
}), At = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */
|
|
1294
|
-
icon: /* @__PURE__ */
|
|
1293
|
+
}), At = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ z(k, {
|
|
1294
|
+
icon: /* @__PURE__ */ z(xe, {
|
|
1295
1295
|
size: _.LG,
|
|
1296
1296
|
stroke: v
|
|
1297
1297
|
}),
|
|
1298
1298
|
onClick: () => e?.(),
|
|
1299
1299
|
"aria-label": t
|
|
1300
|
-
}), jt = ({ size: e = 20 }) => /* @__PURE__ */ I
|
|
1301
|
-
variant:
|
|
1300
|
+
}), jt = ({ size: e = 20 }) => /* @__PURE__ */ z(I, {
|
|
1301
|
+
variant: L.Circular,
|
|
1302
1302
|
width: e,
|
|
1303
1303
|
height: e,
|
|
1304
1304
|
active: !0
|
|
1305
|
-
}), Mt = ({ loadingLabel: e }) => /* @__PURE__ */
|
|
1305
|
+
}), Mt = ({ loadingLabel: e }) => /* @__PURE__ */ B("span", {
|
|
1306
1306
|
className: "flex min-w-0 flex-1 items-center",
|
|
1307
|
-
children: [/* @__PURE__ */ I
|
|
1308
|
-
variant:
|
|
1307
|
+
children: [/* @__PURE__ */ z(I, {
|
|
1308
|
+
variant: L.Text,
|
|
1309
1309
|
width: "100%",
|
|
1310
1310
|
height: 16,
|
|
1311
1311
|
active: !0
|
|
1312
|
-
}), e && /* @__PURE__ */
|
|
1312
|
+
}), e && /* @__PURE__ */ z("span", {
|
|
1313
1313
|
className: "sr-only",
|
|
1314
1314
|
children: e
|
|
1315
1315
|
})]
|
|
1316
|
-
}), Nt = () => /* @__PURE__ */
|
|
1316
|
+
}), Nt = () => /* @__PURE__ */ z("div", {
|
|
1317
1317
|
"aria-hidden": "true",
|
|
1318
|
-
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */
|
|
1318
|
+
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ B("div", {
|
|
1319
1319
|
className: "flex h-11 items-center gap-3 px-4",
|
|
1320
|
-
children: [/* @__PURE__ */
|
|
1320
|
+
children: [/* @__PURE__ */ z(jt, {}), /* @__PURE__ */ z(Mt, {})]
|
|
1321
1321
|
}, t))
|
|
1322
1322
|
}), Pt = (e) => e.displayName ?? e.id, Ft = (e, t) => {
|
|
1323
1323
|
let n = t.trim().toLowerCase();
|
|
1324
1324
|
return n ? e.filter((e) => Pt(e).toLowerCase().includes(n)) : e;
|
|
1325
|
-
}, It = (e, t, r, i = 18, a) => /* @__PURE__ */
|
|
1325
|
+
}, It = (e, t, r, i = 18, a) => /* @__PURE__ */ z(n, {
|
|
1326
1326
|
src: e,
|
|
1327
1327
|
size: i,
|
|
1328
1328
|
labels: { tooltip: a },
|
|
@@ -1335,16 +1335,16 @@ var U = {
|
|
|
1335
1335
|
selectedItemText: "_selectedItemText_1u7db_26",
|
|
1336
1336
|
checkIcon: "_checkIcon_1u7db_30"
|
|
1337
1337
|
}, Rt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, styles: i }) => {
|
|
1338
|
-
let [a, o] =
|
|
1338
|
+
let [a, o] = G(""), s = U(() => e?.find((e) => e.id === t), [e, t]), u = r?.loading !== void 0, d = !u && !s && !!t, f = U(() => u ? /* @__PURE__ */ z(jt, { size: _.LG }) : It(s?.iconUrl, s?.type, s?.displayName ?? s?.id ?? "", _.LG, d ? r?.unavailableTooltip ?? "This deployment is no longer available" : void 0), [
|
|
1339
1339
|
u,
|
|
1340
1340
|
s,
|
|
1341
1341
|
d,
|
|
1342
1342
|
r?.unavailableTooltip
|
|
1343
|
-
]), p = s?.displayName ?? s?.id, m = s?.displayVersion, h = p ? `${r?.ariaLabel ?? "Select model"}: ${p}` : r?.ariaLabel ?? "Select model", g =
|
|
1343
|
+
]), p = s?.displayName ?? s?.id, m = s?.displayVersion, h = p ? `${r?.ariaLabel ?? "Select model"}: ${p}` : r?.ariaLabel ?? "Select model", g = U(() => {
|
|
1344
1344
|
if (u) return Array.from({ length: 7 }, (e, t) => ({
|
|
1345
1345
|
key: `__loading-${t}`,
|
|
1346
|
-
icon: /* @__PURE__ */
|
|
1347
|
-
label: /* @__PURE__ */
|
|
1346
|
+
icon: /* @__PURE__ */ z(jt, {}),
|
|
1347
|
+
label: /* @__PURE__ */ z(Mt, { loadingLabel: t === 0 ? r?.loading : void 0 }),
|
|
1348
1348
|
disabled: !0
|
|
1349
1349
|
}));
|
|
1350
1350
|
if (!e || e.length === 0) {
|
|
@@ -1360,7 +1360,7 @@ var U = {
|
|
|
1360
1360
|
let r = e.id === t;
|
|
1361
1361
|
return {
|
|
1362
1362
|
key: e.id,
|
|
1363
|
-
label: /* @__PURE__ */
|
|
1363
|
+
label: /* @__PURE__ */ z(C, {
|
|
1364
1364
|
text: Pt(e),
|
|
1365
1365
|
query: a,
|
|
1366
1366
|
maxLines: 1
|
|
@@ -1368,7 +1368,7 @@ var U = {
|
|
|
1368
1368
|
icon: It(e.iconUrl, e.type, e.displayName ?? e.id),
|
|
1369
1369
|
mark: D.Check,
|
|
1370
1370
|
checked: r,
|
|
1371
|
-
className: l(o?.itemText && Lt.itemText, o?.itemHoverBackground && Lt.itemHover, r && o?.selectedItemBackground && Lt.selectedItemBackground, r && o?.selectedItemText && Lt.selectedItemText, r && o?.checkIcon && Lt.checkIcon, i?.itemClassName, r && i?.selectedItemClassName,
|
|
1371
|
+
className: l(o?.itemText && Lt.itemText, o?.itemHoverBackground && Lt.itemHover, r && o?.selectedItemBackground && Lt.selectedItemBackground, r && o?.selectedItemText && Lt.selectedItemText, r && o?.checkIcon && Lt.checkIcon, i?.itemClassName, r && i?.selectedItemClassName, K.modelMenuItem, r && K.modelMenuItemSelected),
|
|
1372
1372
|
onClick: () => n?.(e.id)
|
|
1373
1373
|
};
|
|
1374
1374
|
});
|
|
@@ -1382,7 +1382,7 @@ var U = {
|
|
|
1382
1382
|
i?.itemClassName,
|
|
1383
1383
|
i?.selectedItemClassName,
|
|
1384
1384
|
i?.colors
|
|
1385
|
-
]), v =
|
|
1385
|
+
]), v = U(() => c({
|
|
1386
1386
|
"--ms-item-text": i?.colors?.itemText,
|
|
1387
1387
|
"--ms-item-hover-bg": i?.colors?.itemHoverBackground,
|
|
1388
1388
|
"--ms-selected-item-bg": i?.colors?.selectedItemBackground,
|
|
@@ -1395,10 +1395,10 @@ var U = {
|
|
|
1395
1395
|
selectedLabel: p,
|
|
1396
1396
|
selectedVersion: m,
|
|
1397
1397
|
menuItems: g,
|
|
1398
|
-
menuHeader:
|
|
1398
|
+
menuHeader: U(() => !u && e && e.length > 0 ? /* @__PURE__ */ z("div", {
|
|
1399
1399
|
style: c({ "--ms-search-header-bg": i?.colors?.searchHeaderBackground }),
|
|
1400
|
-
className: l("sticky top-0 z-10 pe-2 pt-2 pb-1", Lt.searchHeader, i?.searchHeaderClassName,
|
|
1401
|
-
children: /* @__PURE__ */
|
|
1400
|
+
className: l("sticky top-0 z-10 pe-2 pt-2 pb-1", Lt.searchHeader, i?.searchHeaderClassName, K.modelMenuSearch),
|
|
1401
|
+
children: /* @__PURE__ */ z(re, {
|
|
1402
1402
|
value: a,
|
|
1403
1403
|
placeholder: r?.searchPlaceholder ?? "Search",
|
|
1404
1404
|
size: b.Small,
|
|
@@ -1418,24 +1418,46 @@ var U = {
|
|
|
1418
1418
|
e || o("");
|
|
1419
1419
|
}
|
|
1420
1420
|
};
|
|
1421
|
-
},
|
|
1421
|
+
}, Y = typeof window < "u" ? Me : H;
|
|
1422
|
+
function zt(e) {
|
|
1423
|
+
let t = e;
|
|
1424
|
+
for (; t;) {
|
|
1425
|
+
if (t.dir) return t.dir === "rtl";
|
|
1426
|
+
t = t.parentElement;
|
|
1427
|
+
}
|
|
1428
|
+
return !1;
|
|
1429
|
+
}
|
|
1430
|
+
function X() {
|
|
1431
|
+
return () => {};
|
|
1432
|
+
}
|
|
1433
|
+
function Z() {
|
|
1434
|
+
return Ne(X, () => !1, () => !0);
|
|
1435
|
+
}
|
|
1436
|
+
function Q(e) {
|
|
1437
|
+
return e?.ownerDocument.defaultView ?? window;
|
|
1438
|
+
}
|
|
1422
1439
|
function Bt(e) {
|
|
1440
|
+
return Q(e).ResizeObserver ?? (typeof ResizeObserver < "u" ? ResizeObserver : void 0);
|
|
1441
|
+
}
|
|
1442
|
+
function Vt(e) {
|
|
1423
1443
|
if (e !== void 0) switch (typeof e) {
|
|
1424
1444
|
case "number": return e;
|
|
1425
1445
|
case "string": if (e.endsWith("px")) return parseFloat(e);
|
|
1426
1446
|
}
|
|
1427
1447
|
}
|
|
1428
|
-
function
|
|
1429
|
-
let { styleHeight: s, styleWidth: c } =
|
|
1430
|
-
styleHeight:
|
|
1431
|
-
styleWidth:
|
|
1432
|
-
}), [o?.height, o?.width]), [l, u] =
|
|
1448
|
+
function Ht({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
|
|
1449
|
+
let { styleHeight: s, styleWidth: c } = U(() => ({
|
|
1450
|
+
styleHeight: Vt(o?.height),
|
|
1451
|
+
styleWidth: Vt(o?.width)
|
|
1452
|
+
}), [o?.height, o?.width]), [l, u] = G({
|
|
1433
1453
|
height: t,
|
|
1434
1454
|
width: n
|
|
1435
1455
|
}), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
|
|
1436
|
-
return
|
|
1456
|
+
return Y(() => {
|
|
1437
1457
|
if (i === null || d) return;
|
|
1438
|
-
let t =
|
|
1458
|
+
let t = Bt(i);
|
|
1459
|
+
if (!t) return;
|
|
1460
|
+
let n = new t((e) => {
|
|
1439
1461
|
for (let t of e) {
|
|
1440
1462
|
let { contentRect: e, target: n } = t;
|
|
1441
1463
|
i === n && u((t) => t.height === e.height && t.width === e.width ? t : {
|
|
@@ -1444,8 +1466,8 @@ function Vt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1444
1466
|
});
|
|
1445
1467
|
}
|
|
1446
1468
|
});
|
|
1447
|
-
return
|
|
1448
|
-
|
|
1469
|
+
return n.observe(i, { box: e }), () => {
|
|
1470
|
+
n?.unobserve(i);
|
|
1449
1471
|
};
|
|
1450
1472
|
}, [
|
|
1451
1473
|
e,
|
|
@@ -1453,7 +1475,7 @@ function Vt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1453
1475
|
i,
|
|
1454
1476
|
s,
|
|
1455
1477
|
c
|
|
1456
|
-
]),
|
|
1478
|
+
]), U(() => ({
|
|
1457
1479
|
height: s ?? l.height,
|
|
1458
1480
|
width: c ?? l.width
|
|
1459
1481
|
}), [
|
|
@@ -1462,110 +1484,200 @@ function Vt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1462
1484
|
c
|
|
1463
1485
|
]);
|
|
1464
1486
|
}
|
|
1465
|
-
function
|
|
1466
|
-
let t =
|
|
1467
|
-
throw Error("Cannot call
|
|
1487
|
+
function Ut(e) {
|
|
1488
|
+
let t = W(() => {
|
|
1489
|
+
throw Error("Cannot call an event handler while rendering.");
|
|
1468
1490
|
});
|
|
1469
|
-
return
|
|
1491
|
+
return Y(() => {
|
|
1470
1492
|
t.current = e;
|
|
1471
|
-
}, [e]),
|
|
1493
|
+
}, [e]), V((...e) => t.current?.(...e), [t]);
|
|
1472
1494
|
}
|
|
1473
|
-
var
|
|
1474
|
-
function
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1495
|
+
var $ = /* @__PURE__ */ new WeakMap();
|
|
1496
|
+
function Wt(e = !1, t = document) {
|
|
1497
|
+
let n = $.get(t);
|
|
1498
|
+
if (n === void 0 || e) {
|
|
1499
|
+
let e = t.createElement("div"), r = e.style;
|
|
1500
|
+
r.width = "50px", r.height = "50px", r.overflow = "scroll", r.direction = "rtl";
|
|
1501
|
+
let i = t.createElement("div"), a = i.style;
|
|
1502
|
+
a.width = "100px", a.height = "100px", e.appendChild(i), t.body.appendChild(e), e.scrollLeft > 0 ? n = "positive-descending" : (e.scrollLeft = 1, n = e.scrollLeft === 0 ? "negative" : "positive-ascending"), t.body.removeChild(e), $.set(t, n);
|
|
1480
1503
|
}
|
|
1481
|
-
return
|
|
1504
|
+
return n;
|
|
1482
1505
|
}
|
|
1483
|
-
function
|
|
1484
|
-
if (t === "horizontal" && n) switch (
|
|
1506
|
+
function Gt({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
1507
|
+
if (t === "horizontal" && n) switch (Wt(!1, e?.ownerDocument ?? document)) {
|
|
1485
1508
|
case "negative": return -r;
|
|
1486
1509
|
case "positive-descending": if (e) {
|
|
1487
|
-
let { clientWidth: t,
|
|
1488
|
-
return
|
|
1510
|
+
let { clientWidth: t, scrollWidth: n } = e;
|
|
1511
|
+
return n - t - r;
|
|
1489
1512
|
}
|
|
1490
1513
|
}
|
|
1491
1514
|
return r;
|
|
1492
1515
|
}
|
|
1493
|
-
function
|
|
1516
|
+
function Kt({ container: e, element: t, onChange: n }) {
|
|
1517
|
+
let r = Q(t), i = Bt(t), a = r.MutationObserver ?? (typeof MutationObserver < "u" ? MutationObserver : void 0), o = i ? new i(n) : void 0, s = (e) => !e.isConnected || (e.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0, c = a ? new a((e) => {
|
|
1518
|
+
e.some((e) => Array.from(e.addedNodes).some(s) || e.removedNodes.length > 0 && e.nextSibling !== null && s(e.nextSibling)) && (u(), n());
|
|
1519
|
+
}) : void 0, l = /* @__PURE__ */ new Set(), u = () => {
|
|
1520
|
+
for (let e of l) o?.unobserve(e);
|
|
1521
|
+
l.clear(), c?.disconnect();
|
|
1522
|
+
let n = t;
|
|
1523
|
+
for (; n !== e;) {
|
|
1524
|
+
let e = n.parentElement;
|
|
1525
|
+
if (e === null) break;
|
|
1526
|
+
if (o) for (let e = n.previousElementSibling; e !== null; e = e.previousElementSibling) l.add(e), o.observe(e);
|
|
1527
|
+
c?.observe(e, { childList: !0 }), n = e;
|
|
1528
|
+
}
|
|
1529
|
+
};
|
|
1530
|
+
return u(), () => {
|
|
1531
|
+
o?.disconnect(), c?.disconnect();
|
|
1532
|
+
};
|
|
1533
|
+
}
|
|
1534
|
+
function qt(e) {
|
|
1535
|
+
return e.window === e;
|
|
1536
|
+
}
|
|
1537
|
+
function Jt(e, t) {
|
|
1538
|
+
return t === "window" ? e ? Q(e) : null : t ?? null;
|
|
1539
|
+
}
|
|
1540
|
+
function Yt(e, t) {
|
|
1541
|
+
return qt(e) ? t === "vertical" ? e.scrollY : e.scrollX : t === "vertical" ? e.scrollTop : e.scrollLeft;
|
|
1542
|
+
}
|
|
1543
|
+
function Xt(e, t) {
|
|
1544
|
+
let n = qt(e) ? e.document.scrollingElement ?? e.document.documentElement : e;
|
|
1545
|
+
return t === "vertical" ? n.scrollHeight - n.clientHeight : n.scrollWidth - n.clientWidth;
|
|
1546
|
+
}
|
|
1547
|
+
function Zt(e, t) {
|
|
1548
|
+
let { overflowX: n, overflowY: r } = Q(e).getComputedStyle(e), i = t === "vertical" ? r : n;
|
|
1549
|
+
return i === "visible" || i === "clip" ? !1 : t === "vertical" ? e.scrollHeight - e.clientHeight > 1 : e.scrollWidth - e.clientWidth > 1;
|
|
1550
|
+
}
|
|
1551
|
+
function Qt({ containerElement: e, direction: t, isRtl: n, scrollTarget: r }) {
|
|
1552
|
+
let i = t === "vertical", a, o;
|
|
1553
|
+
if (qt(r)) {
|
|
1554
|
+
let { documentElement: e } = r.document;
|
|
1555
|
+
a = 0, o = i ? e.clientHeight : e.clientWidth;
|
|
1556
|
+
} else {
|
|
1557
|
+
let e = r.getBoundingClientRect();
|
|
1558
|
+
a = i ? e.top + r.clientTop : e.left + r.clientLeft, o = i ? r.clientHeight : r.clientWidth;
|
|
1559
|
+
}
|
|
1560
|
+
let s = a + o, c = e.getBoundingClientRect(), l = i ? c.top + e.clientTop : c.left + e.clientLeft, u = i ? e.clientHeight : e.clientWidth, d = l + u, f = Gt({
|
|
1561
|
+
containerElement: e,
|
|
1562
|
+
direction: t,
|
|
1563
|
+
isRtl: n,
|
|
1564
|
+
scrollOffset: i ? e.scrollTop : e.scrollLeft
|
|
1565
|
+
}), p = !i && n ? d - s : a - l, m = p + o, h = Math.max(0, p), g = Math.min(u, m);
|
|
1566
|
+
return {
|
|
1567
|
+
offset: f + h,
|
|
1568
|
+
size: Math.max(0, g - h),
|
|
1569
|
+
viewportOffset: f + p,
|
|
1570
|
+
viewportSize: o
|
|
1571
|
+
};
|
|
1572
|
+
}
|
|
1573
|
+
function $t({ direction: e, isRtl: t, scrollTarget: n, viewportSize: r }) {
|
|
1574
|
+
let i = qt(n) ? n.document.documentElement : n, a = Q(i).getComputedStyle(i), o = (e) => {
|
|
1575
|
+
let t = parseFloat(e ?? "");
|
|
1576
|
+
return !Number.isFinite(t) || t < 0 ? 0 : e.endsWith("px") ? t : e.endsWith("%") ? t * r / 100 : 0;
|
|
1577
|
+
};
|
|
1578
|
+
if (e === "vertical") return {
|
|
1579
|
+
end: o(a.scrollPaddingBottom),
|
|
1580
|
+
start: o(a.scrollPaddingTop)
|
|
1581
|
+
};
|
|
1582
|
+
let s = o(a.scrollPaddingLeft), c = o(a.scrollPaddingRight);
|
|
1583
|
+
return t ? {
|
|
1584
|
+
end: s,
|
|
1585
|
+
start: c
|
|
1586
|
+
} : {
|
|
1587
|
+
end: c,
|
|
1588
|
+
start: s
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1591
|
+
function en(e, t = "Assertion error") {
|
|
1494
1592
|
if (!e) throw console.error(t), Error(t);
|
|
1495
1593
|
}
|
|
1496
|
-
function
|
|
1594
|
+
function tn(e, t) {
|
|
1497
1595
|
if (e === t) return !0;
|
|
1498
|
-
if (!!e != !!t || (
|
|
1499
|
-
for (let n in e) if (!Object.is(t[n], e[n])) return !1;
|
|
1596
|
+
if (!!e != !!t || (en(e !== void 0), en(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
|
|
1597
|
+
for (let n in e) if (!Object.hasOwn(t, n) || !Object.is(t[n], e[n])) return !1;
|
|
1500
1598
|
return !0;
|
|
1501
1599
|
}
|
|
1502
|
-
function
|
|
1600
|
+
function nn({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
1503
1601
|
if (t === 0) return 0;
|
|
1504
1602
|
if (typeof n == "number") return t * n;
|
|
1505
1603
|
{
|
|
1506
1604
|
let n = e.get(e.size === 0 ? 0 : e.size - 1);
|
|
1507
|
-
return
|
|
1605
|
+
return en(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
|
|
1508
1606
|
}
|
|
1509
1607
|
}
|
|
1510
|
-
function
|
|
1511
|
-
if (
|
|
1512
|
-
let
|
|
1608
|
+
function rn({ align: e, cachedBounds: t, clamp: n = !0, index: r, itemCount: i, itemSize: a, containerScrollOffset: o, containerSize: s }) {
|
|
1609
|
+
if (r < 0 || r >= i) throw RangeError(`Invalid index specified: ${r}`, { cause: `Index ${r} is not within the range of 0 - ${i - 1}` });
|
|
1610
|
+
let c = t.get(r), l = nn({
|
|
1513
1611
|
cachedBounds: t,
|
|
1514
|
-
itemCount:
|
|
1515
|
-
itemSize:
|
|
1516
|
-
}),
|
|
1517
|
-
switch (e === "smart" && (e =
|
|
1518
|
-
case "start": return
|
|
1519
|
-
case "end": return
|
|
1520
|
-
case "center": return c.scrollOffset
|
|
1521
|
-
default: return
|
|
1612
|
+
itemCount: i,
|
|
1613
|
+
itemSize: a
|
|
1614
|
+
}), u = (e) => n ? Math.max(0, Math.min(l - s, e)) : e, d = u(c.scrollOffset), f = n ? Math.max(0, c.scrollOffset - s + c.size) : c.scrollOffset - s + c.size, p = c.size > s ? o >= c.scrollOffset && o <= f : o >= f && o <= c.scrollOffset;
|
|
1615
|
+
switch (e === "smart" && (e = p ? "auto" : "center"), e) {
|
|
1616
|
+
case "start": return d;
|
|
1617
|
+
case "end": return f;
|
|
1618
|
+
case "center": return u(c.scrollOffset + c.size / 2 - s / 2);
|
|
1619
|
+
default: return p ? o : o < f ? f : d;
|
|
1522
1620
|
}
|
|
1523
1621
|
}
|
|
1524
|
-
function
|
|
1525
|
-
let a = r - 1
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1622
|
+
function an({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
|
|
1623
|
+
let a = r - 1;
|
|
1624
|
+
if (r === 0) return {
|
|
1625
|
+
startIndexVisible: 0,
|
|
1626
|
+
stopIndexVisible: -1,
|
|
1627
|
+
startIndexOverscan: 0,
|
|
1628
|
+
stopIndexOverscan: -1
|
|
1629
|
+
};
|
|
1630
|
+
let o, s, { itemSize: c } = e;
|
|
1631
|
+
if (c !== void 0) c > 0 ? (o = Math.max(0, Math.min(a, Math.floor(t / c))), s = Math.max(o, Math.min(a, Math.ceil((t + n) / c) - 1))) : (o = 0, s = 0);
|
|
1632
|
+
else {
|
|
1633
|
+
let r = 0, i = Math.min(a, Math.max(0, e.size - 1));
|
|
1634
|
+
for (; r < i;) {
|
|
1635
|
+
let n = Math.floor((r + i) / 2), a = e.get(n);
|
|
1636
|
+
a.scrollOffset + a.size > t ? i = n : r = n + 1;
|
|
1637
|
+
}
|
|
1638
|
+
for (; r < a;) {
|
|
1639
|
+
let n = e.get(r);
|
|
1640
|
+
if (n.scrollOffset + n.size > t) break;
|
|
1641
|
+
r++;
|
|
1642
|
+
}
|
|
1643
|
+
for (o = r, s = r; s < a;) {
|
|
1644
|
+
let r = e.get(s);
|
|
1645
|
+
if (r.scrollOffset + r.size >= t + n) break;
|
|
1646
|
+
s++;
|
|
1647
|
+
}
|
|
1535
1648
|
}
|
|
1536
|
-
return
|
|
1649
|
+
return {
|
|
1537
1650
|
startIndexVisible: o,
|
|
1538
1651
|
stopIndexVisible: s,
|
|
1539
|
-
startIndexOverscan:
|
|
1540
|
-
stopIndexOverscan:
|
|
1652
|
+
startIndexOverscan: Math.max(0, o - i),
|
|
1653
|
+
stopIndexOverscan: Math.min(a, s + i)
|
|
1541
1654
|
};
|
|
1542
1655
|
}
|
|
1543
|
-
function
|
|
1656
|
+
function on({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1544
1657
|
let r = /* @__PURE__ */ new Map();
|
|
1545
1658
|
return {
|
|
1659
|
+
itemSize: typeof n == "number" ? n : void 0,
|
|
1546
1660
|
get(i) {
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
case "number": a = n;
|
|
1554
|
-
}
|
|
1661
|
+
if (en(i < e, `Invalid index ${i}`), typeof n == "number") return en(i >= 0, `Invalid index ${i}`), {
|
|
1662
|
+
size: n,
|
|
1663
|
+
scrollOffset: i * n
|
|
1664
|
+
};
|
|
1665
|
+
for (; r.size - 1 < i;) {
|
|
1666
|
+
let e = r.size, a = n(e, t);
|
|
1555
1667
|
if (e === 0) r.set(e, {
|
|
1556
1668
|
size: a,
|
|
1557
1669
|
scrollOffset: 0
|
|
1558
1670
|
});
|
|
1559
1671
|
else {
|
|
1560
1672
|
let t = r.get(e - 1);
|
|
1561
|
-
|
|
1673
|
+
en(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
|
|
1562
1674
|
scrollOffset: t.scrollOffset + t.size,
|
|
1563
1675
|
size: a
|
|
1564
1676
|
});
|
|
1565
1677
|
}
|
|
1566
1678
|
}
|
|
1567
1679
|
let a = r.get(i);
|
|
1568
|
-
return
|
|
1680
|
+
return en(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
|
|
1569
1681
|
},
|
|
1570
1682
|
set(e, t) {
|
|
1571
1683
|
r.set(e, t);
|
|
@@ -1575,8 +1687,8 @@ function qt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1575
1687
|
}
|
|
1576
1688
|
};
|
|
1577
1689
|
}
|
|
1578
|
-
function
|
|
1579
|
-
return
|
|
1690
|
+
function sn({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1691
|
+
return U(() => on({
|
|
1580
1692
|
itemCount: e,
|
|
1581
1693
|
itemProps: t,
|
|
1582
1694
|
itemSize: n
|
|
@@ -1586,278 +1698,607 @@ function Jt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1586
1698
|
n
|
|
1587
1699
|
]);
|
|
1588
1700
|
}
|
|
1589
|
-
function
|
|
1701
|
+
function cn({ containerSize: e, itemSize: t }) {
|
|
1590
1702
|
let n;
|
|
1591
1703
|
switch (typeof t) {
|
|
1592
1704
|
case "string":
|
|
1593
|
-
|
|
1705
|
+
en(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), en(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseFloat(t) / 100;
|
|
1594
1706
|
break;
|
|
1595
1707
|
default: n = t;
|
|
1596
1708
|
}
|
|
1597
|
-
return n;
|
|
1709
|
+
return typeof n == "number" && !(Number.isFinite(n) && n > 0) && (n = 0), n;
|
|
1598
1710
|
}
|
|
1599
|
-
function
|
|
1600
|
-
let { height:
|
|
1601
|
-
defaultHeight:
|
|
1602
|
-
defaultWidth:
|
|
1711
|
+
function ln({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, defaultScrollOffset: r = 0, direction: i, isRtl: a = !1, itemCount: o, itemProps: s, itemSize: c, onResize: l, overscanCount: u, scrollElement: d }) {
|
|
1712
|
+
let f = d !== void 0, p = f ? Jt(e, d) : e, { height: m = n, width: h = n } = Ht({
|
|
1713
|
+
defaultHeight: i === "vertical" ? n : void 0,
|
|
1714
|
+
defaultWidth: i === "horizontal" ? n : void 0,
|
|
1603
1715
|
element: e,
|
|
1604
|
-
mode:
|
|
1716
|
+
mode: i === "vertical" ? "only-height" : "only-width",
|
|
1605
1717
|
style: t
|
|
1606
|
-
}),
|
|
1718
|
+
}), g = W({
|
|
1607
1719
|
height: 0,
|
|
1608
1720
|
width: 0
|
|
1609
|
-
}),
|
|
1610
|
-
containerSize:
|
|
1611
|
-
itemSize:
|
|
1721
|
+
}), [_, v] = G(n), y = f ? _ : i === "vertical" ? m : h, b = cn({
|
|
1722
|
+
containerSize: y,
|
|
1723
|
+
itemSize: c
|
|
1612
1724
|
});
|
|
1613
|
-
|
|
1614
|
-
if (typeof
|
|
1615
|
-
let e =
|
|
1616
|
-
(e.height !==
|
|
1617
|
-
height:
|
|
1618
|
-
width:
|
|
1619
|
-
}, { ...e }), e.height =
|
|
1725
|
+
Y(() => {
|
|
1726
|
+
if (typeof l == "function") {
|
|
1727
|
+
let e = g.current;
|
|
1728
|
+
(e.height !== m || e.width !== h) && (l({
|
|
1729
|
+
height: m,
|
|
1730
|
+
width: h
|
|
1731
|
+
}, { ...e }), e.height = m, e.width = h);
|
|
1620
1732
|
}
|
|
1621
1733
|
}, [
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1734
|
+
m,
|
|
1735
|
+
l,
|
|
1736
|
+
h
|
|
1625
1737
|
]);
|
|
1626
|
-
let
|
|
1627
|
-
itemCount:
|
|
1628
|
-
itemProps:
|
|
1629
|
-
itemSize:
|
|
1630
|
-
}),
|
|
1631
|
-
cachedBounds:
|
|
1632
|
-
containerScrollOffset:
|
|
1633
|
-
containerSize:
|
|
1634
|
-
itemCount:
|
|
1635
|
-
overscanCount:
|
|
1636
|
-
})), { startIndexVisible:
|
|
1637
|
-
startIndexVisible: Math.min(
|
|
1638
|
-
startIndexOverscan: Math.min(
|
|
1639
|
-
stopIndexVisible: Math.min(
|
|
1640
|
-
stopIndexOverscan: Math.min(
|
|
1641
|
-
},
|
|
1642
|
-
cachedBounds:
|
|
1643
|
-
itemCount:
|
|
1644
|
-
itemSize:
|
|
1738
|
+
let x = sn({
|
|
1739
|
+
itemCount: o,
|
|
1740
|
+
itemProps: s,
|
|
1741
|
+
itemSize: b
|
|
1742
|
+
}), S = Z(), [C] = G(() => S || f ? 0 : r), w = V((e) => x.get(e), [x]), [T, E] = G(() => an({
|
|
1743
|
+
cachedBounds: x,
|
|
1744
|
+
containerScrollOffset: C,
|
|
1745
|
+
containerSize: y,
|
|
1746
|
+
itemCount: o,
|
|
1747
|
+
overscanCount: u
|
|
1748
|
+
})), { startIndexVisible: D, startIndexOverscan: O, stopIndexVisible: k, stopIndexOverscan: ee } = {
|
|
1749
|
+
startIndexVisible: Math.min(o - 1, T.startIndexVisible),
|
|
1750
|
+
startIndexOverscan: Math.min(o - 1, T.startIndexOverscan),
|
|
1751
|
+
stopIndexVisible: Math.min(o - 1, T.stopIndexVisible),
|
|
1752
|
+
stopIndexOverscan: Math.min(o - 1, T.stopIndexOverscan)
|
|
1753
|
+
}, A = V(() => nn({
|
|
1754
|
+
cachedBounds: x,
|
|
1755
|
+
itemCount: o,
|
|
1756
|
+
itemSize: b
|
|
1645
1757
|
}), [
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
]),
|
|
1650
|
-
let n =
|
|
1758
|
+
x,
|
|
1759
|
+
o,
|
|
1760
|
+
b
|
|
1761
|
+
]), j = V((t) => {
|
|
1762
|
+
let n = Gt({
|
|
1651
1763
|
containerElement: e,
|
|
1652
|
-
direction:
|
|
1653
|
-
isRtl:
|
|
1764
|
+
direction: i,
|
|
1765
|
+
isRtl: a,
|
|
1654
1766
|
scrollOffset: t
|
|
1655
1767
|
});
|
|
1656
|
-
return
|
|
1657
|
-
cachedBounds:
|
|
1768
|
+
return an({
|
|
1769
|
+
cachedBounds: x,
|
|
1658
1770
|
containerScrollOffset: n,
|
|
1659
|
-
containerSize:
|
|
1660
|
-
itemCount:
|
|
1661
|
-
overscanCount:
|
|
1771
|
+
containerSize: y,
|
|
1772
|
+
itemCount: o,
|
|
1773
|
+
overscanCount: u
|
|
1662
1774
|
});
|
|
1663
1775
|
}, [
|
|
1664
|
-
|
|
1776
|
+
x,
|
|
1665
1777
|
e,
|
|
1666
|
-
|
|
1667
|
-
r,
|
|
1778
|
+
y,
|
|
1668
1779
|
i,
|
|
1669
1780
|
a,
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1781
|
+
o,
|
|
1782
|
+
u
|
|
1783
|
+
]), M = W(!1);
|
|
1784
|
+
Y(() => {
|
|
1785
|
+
if (!e || o === 0 || f || M.current || (M.current = !0, r <= 0)) return;
|
|
1786
|
+
let t = i === "horizontal" && zt(e);
|
|
1787
|
+
if (Gt({
|
|
1788
|
+
containerElement: e,
|
|
1789
|
+
direction: i,
|
|
1790
|
+
isRtl: t,
|
|
1791
|
+
scrollOffset: i === "vertical" ? e.scrollTop : e.scrollLeft
|
|
1792
|
+
}) !== 0) return;
|
|
1793
|
+
let n = Gt({
|
|
1794
|
+
containerElement: e,
|
|
1795
|
+
direction: i,
|
|
1796
|
+
isRtl: t,
|
|
1797
|
+
scrollOffset: r
|
|
1798
|
+
});
|
|
1799
|
+
typeof e.scrollTo == "function" ? e.scrollTo({
|
|
1800
|
+
behavior: "instant",
|
|
1801
|
+
[i === "vertical" ? "top" : "left"]: n
|
|
1802
|
+
}) : i === "vertical" ? e.scrollTop = n : e.scrollLeft = n;
|
|
1803
|
+
}, [e, o]), Y(() => {
|
|
1804
|
+
if (f && e && p) return;
|
|
1805
|
+
let t = e && !f ? j(i === "vertical" ? e.scrollTop : e.scrollLeft) : an({
|
|
1806
|
+
cachedBounds: x,
|
|
1807
|
+
containerScrollOffset: C,
|
|
1808
|
+
containerSize: y,
|
|
1809
|
+
itemCount: o,
|
|
1810
|
+
overscanCount: u
|
|
1811
|
+
});
|
|
1812
|
+
E((e) => tn(t, e) ? e : t);
|
|
1675
1813
|
}, [
|
|
1814
|
+
x,
|
|
1676
1815
|
e,
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1816
|
+
y,
|
|
1817
|
+
i,
|
|
1818
|
+
j,
|
|
1819
|
+
C,
|
|
1820
|
+
f,
|
|
1821
|
+
o,
|
|
1822
|
+
u,
|
|
1823
|
+
p
|
|
1824
|
+
]), Y(() => {
|
|
1825
|
+
if (!e || f) return;
|
|
1681
1826
|
let t = () => {
|
|
1682
|
-
|
|
1683
|
-
let { scrollLeft: n, scrollTop:
|
|
1827
|
+
E((t) => {
|
|
1828
|
+
let { scrollLeft: n, scrollTop: r } = e, s = Gt({
|
|
1684
1829
|
containerElement: e,
|
|
1685
|
-
direction:
|
|
1686
|
-
isRtl:
|
|
1687
|
-
scrollOffset:
|
|
1688
|
-
}), c =
|
|
1689
|
-
cachedBounds:
|
|
1830
|
+
direction: i,
|
|
1831
|
+
isRtl: a,
|
|
1832
|
+
scrollOffset: i === "vertical" ? r : n
|
|
1833
|
+
}), c = an({
|
|
1834
|
+
cachedBounds: x,
|
|
1690
1835
|
containerScrollOffset: s,
|
|
1691
|
-
containerSize:
|
|
1692
|
-
itemCount:
|
|
1693
|
-
overscanCount:
|
|
1836
|
+
containerSize: y,
|
|
1837
|
+
itemCount: o,
|
|
1838
|
+
overscanCount: u
|
|
1694
1839
|
});
|
|
1695
|
-
return
|
|
1840
|
+
return tn(c, t) ? t : c;
|
|
1696
1841
|
});
|
|
1697
1842
|
};
|
|
1698
1843
|
return e.addEventListener("scroll", t), () => {
|
|
1699
1844
|
e.removeEventListener("scroll", t);
|
|
1700
1845
|
};
|
|
1701
1846
|
}, [
|
|
1702
|
-
|
|
1847
|
+
x,
|
|
1703
1848
|
e,
|
|
1704
|
-
|
|
1705
|
-
|
|
1849
|
+
y,
|
|
1850
|
+
i,
|
|
1706
1851
|
a,
|
|
1707
|
-
|
|
1852
|
+
f,
|
|
1853
|
+
o,
|
|
1854
|
+
u
|
|
1855
|
+
]);
|
|
1856
|
+
let N = Ut(() => {
|
|
1857
|
+
if (!e || !p) return;
|
|
1858
|
+
let { offset: t, size: n, viewportSize: r } = Qt({
|
|
1859
|
+
containerElement: e,
|
|
1860
|
+
direction: i,
|
|
1861
|
+
isRtl: a,
|
|
1862
|
+
scrollTarget: p
|
|
1863
|
+
});
|
|
1864
|
+
v(r);
|
|
1865
|
+
let s = an({
|
|
1866
|
+
cachedBounds: x,
|
|
1867
|
+
containerScrollOffset: t,
|
|
1868
|
+
containerSize: n,
|
|
1869
|
+
itemCount: o,
|
|
1870
|
+
overscanCount: u
|
|
1871
|
+
});
|
|
1872
|
+
E((e) => tn(s, e) ? e : s);
|
|
1873
|
+
});
|
|
1874
|
+
return Y(() => {
|
|
1875
|
+
f && N();
|
|
1876
|
+
}), Y(() => {
|
|
1877
|
+
if (!f || !e || !p) return;
|
|
1878
|
+
let t = Q(e), n = () => N();
|
|
1879
|
+
p.addEventListener("scroll", n, { passive: !0 }), e.addEventListener("scroll", n, { passive: !0 }), t.addEventListener("resize", n);
|
|
1880
|
+
let r, i = Bt(e);
|
|
1881
|
+
i && !qt(p) && (r = new i(n), r.observe(p));
|
|
1882
|
+
let a = Kt({
|
|
1883
|
+
container: qt(p) ? p.document.documentElement : p,
|
|
1884
|
+
element: e,
|
|
1885
|
+
onChange: n
|
|
1886
|
+
});
|
|
1887
|
+
return () => {
|
|
1888
|
+
p.removeEventListener("scroll", n), e.removeEventListener("scroll", n), t.removeEventListener("resize", n), r?.disconnect(), a();
|
|
1889
|
+
};
|
|
1890
|
+
}, [
|
|
1891
|
+
e,
|
|
1892
|
+
f,
|
|
1893
|
+
p,
|
|
1894
|
+
N
|
|
1708
1895
|
]), {
|
|
1709
|
-
getCellBounds:
|
|
1710
|
-
getEstimatedSize:
|
|
1711
|
-
|
|
1712
|
-
let
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1896
|
+
getCellBounds: w,
|
|
1897
|
+
getEstimatedSize: A,
|
|
1898
|
+
getScrollPositionForIndex: Ut(({ align: t = "auto", index: n }) => {
|
|
1899
|
+
let r = ({ clamp: e, containerScrollOffset: r, containerSize: i, padding: a }) => {
|
|
1900
|
+
if (a.start === 0 && a.end === 0) return rn({
|
|
1901
|
+
align: t,
|
|
1902
|
+
cachedBounds: x,
|
|
1903
|
+
clamp: e,
|
|
1904
|
+
containerScrollOffset: r,
|
|
1905
|
+
containerSize: i,
|
|
1906
|
+
index: n,
|
|
1907
|
+
itemCount: o,
|
|
1908
|
+
itemSize: b
|
|
1909
|
+
});
|
|
1910
|
+
let s = rn({
|
|
1911
|
+
align: t,
|
|
1912
|
+
cachedBounds: x,
|
|
1913
|
+
clamp: !1,
|
|
1914
|
+
containerScrollOffset: r + a.start,
|
|
1915
|
+
containerSize: Math.max(0, i - a.start - a.end),
|
|
1916
|
+
index: n,
|
|
1917
|
+
itemCount: o,
|
|
1918
|
+
itemSize: b
|
|
1919
|
+
}) - a.start;
|
|
1920
|
+
return e ? Math.max(0, Math.min(A() - i, s)) : s;
|
|
1921
|
+
};
|
|
1922
|
+
if (f && e && p && !Zt(e, i)) {
|
|
1923
|
+
let { viewportOffset: t, viewportSize: n } = Qt({
|
|
1924
|
+
containerElement: e,
|
|
1925
|
+
direction: i,
|
|
1926
|
+
isRtl: a,
|
|
1927
|
+
scrollTarget: p
|
|
1928
|
+
}), o = r({
|
|
1929
|
+
clamp: !1,
|
|
1930
|
+
containerScrollOffset: t,
|
|
1931
|
+
containerSize: n,
|
|
1932
|
+
padding: $t({
|
|
1933
|
+
direction: i,
|
|
1934
|
+
isRtl: a,
|
|
1935
|
+
scrollTarget: p,
|
|
1936
|
+
viewportSize: n
|
|
1937
|
+
})
|
|
1938
|
+
}) - t, s = i === "horizontal" && a ? -o : o;
|
|
1939
|
+
return {
|
|
1940
|
+
scrollOffset: Yt(p, i) + s,
|
|
1941
|
+
scrollTarget: p
|
|
1942
|
+
};
|
|
1943
|
+
}
|
|
1944
|
+
let s = e ? i === "vertical" ? e.scrollTop : e.scrollLeft : 0, c = f && e ? i === "vertical" ? e.clientHeight : e.clientWidth : y, l = r({
|
|
1945
|
+
clamp: !0,
|
|
1946
|
+
containerScrollOffset: Gt({
|
|
1723
1947
|
containerElement: e,
|
|
1724
|
-
direction:
|
|
1725
|
-
isRtl:
|
|
1948
|
+
direction: i,
|
|
1949
|
+
isRtl: a,
|
|
1726
1950
|
scrollOffset: s
|
|
1727
|
-
}),
|
|
1728
|
-
|
|
1729
|
-
|
|
1951
|
+
}),
|
|
1952
|
+
containerSize: c,
|
|
1953
|
+
padding: e ? $t({
|
|
1954
|
+
direction: i,
|
|
1955
|
+
isRtl: a,
|
|
1956
|
+
scrollTarget: e,
|
|
1957
|
+
viewportSize: c
|
|
1958
|
+
}) : {
|
|
1959
|
+
end: 0,
|
|
1960
|
+
start: 0
|
|
1961
|
+
}
|
|
1962
|
+
});
|
|
1963
|
+
if (e && (!f || p)) {
|
|
1964
|
+
if (l = Gt({
|
|
1965
|
+
containerElement: e,
|
|
1966
|
+
direction: i,
|
|
1967
|
+
isRtl: a,
|
|
1968
|
+
scrollOffset: l
|
|
1969
|
+
}), !f && typeof e.scrollTo != "function") {
|
|
1970
|
+
let e = j(l);
|
|
1971
|
+
tn(T, e) || E(e);
|
|
1730
1972
|
}
|
|
1731
|
-
return
|
|
1973
|
+
return {
|
|
1974
|
+
scrollOffset: l,
|
|
1975
|
+
scrollTarget: e
|
|
1976
|
+
};
|
|
1732
1977
|
}
|
|
1733
1978
|
}),
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1979
|
+
scrollTarget: p,
|
|
1980
|
+
startIndexOverscan: O,
|
|
1981
|
+
startIndexVisible: D,
|
|
1982
|
+
stopIndexOverscan: ee,
|
|
1983
|
+
stopIndexVisible: k
|
|
1738
1984
|
};
|
|
1739
1985
|
}
|
|
1740
|
-
function
|
|
1741
|
-
|
|
1986
|
+
function un(e) {
|
|
1987
|
+
let [t, n] = G(e);
|
|
1988
|
+
return tn(t, e) ? t : (n(e), e);
|
|
1742
1989
|
}
|
|
1743
|
-
function
|
|
1990
|
+
function dn(e, t) {
|
|
1744
1991
|
let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
|
|
1745
|
-
return
|
|
1992
|
+
return tn(n, a) && tn(r, o) && tn(i, s);
|
|
1993
|
+
}
|
|
1994
|
+
var fn = "data-react-window-index", pn = "data-index";
|
|
1995
|
+
function mn(e) {
|
|
1996
|
+
let t = e.getAttribute(fn) ?? e.getAttribute(pn);
|
|
1997
|
+
return t !== null && /^\d+$/.test(t) ? Number(t) : void 0;
|
|
1998
|
+
}
|
|
1999
|
+
var hn = 1e3, gn = 500;
|
|
2000
|
+
function _n(e) {
|
|
2001
|
+
return 1 - (1 - e) ** 3;
|
|
2002
|
+
}
|
|
2003
|
+
function vn({ direction: e, element: t, getCellBounds: n, isDynamicSize: r, itemCount: i, itemElements: a, scrollTarget: o, getScrollPositionForIndex: s }) {
|
|
2004
|
+
let c = e === "vertical", l = W(null), u = W(void 0), d = Ut(() => {
|
|
2005
|
+
l.current = null, u.current !== void 0 && (u.current.view.cancelAnimationFrame(u.current.id), u.current = void 0);
|
|
2006
|
+
}), f = Ut(() => {
|
|
2007
|
+
let e = Q(t);
|
|
2008
|
+
u.current = {
|
|
2009
|
+
id: e.requestAnimationFrame(p),
|
|
2010
|
+
view: e
|
|
2011
|
+
};
|
|
2012
|
+
}), p = Ut(() => {
|
|
2013
|
+
u.current = void 0;
|
|
2014
|
+
let o = l.current;
|
|
2015
|
+
if (!o) return;
|
|
2016
|
+
let p = performance.now();
|
|
2017
|
+
if (!t || !r || o.index >= i || o.animation !== void 0 && p >= o.animation.deadline) {
|
|
2018
|
+
d();
|
|
2019
|
+
return;
|
|
2020
|
+
}
|
|
2021
|
+
let m = s({
|
|
2022
|
+
align: o.align,
|
|
2023
|
+
index: o.index
|
|
2024
|
+
});
|
|
2025
|
+
if (m !== void 0) {
|
|
2026
|
+
let { scrollOffset: t, scrollTarget: r } = m, s = Math.max(0, Math.min(t, Xt(r, e)));
|
|
2027
|
+
o.animation === void 0 && (o.animation = {
|
|
2028
|
+
deadline: p + (o.smooth ? gn : 0) + hn,
|
|
2029
|
+
startOffset: Yt(r, e),
|
|
2030
|
+
startTime: p
|
|
2031
|
+
});
|
|
2032
|
+
let l = o.smooth ? (p - o.animation.startTime) / gn : 1;
|
|
2033
|
+
if (l < 1) {
|
|
2034
|
+
let { startOffset: e } = o.animation;
|
|
2035
|
+
o.stableFrames = 0, r.scrollTo({
|
|
2036
|
+
behavior: "instant",
|
|
2037
|
+
[c ? "top" : "left"]: e + (s - e) * _n(l)
|
|
2038
|
+
});
|
|
2039
|
+
} else if (Math.abs(s - Yt(r, e)) > 1) o.stableFrames = 0, r.scrollTo({
|
|
2040
|
+
behavior: "instant",
|
|
2041
|
+
[c ? "top" : "left"]: s
|
|
2042
|
+
});
|
|
2043
|
+
else {
|
|
2044
|
+
let e = a.current;
|
|
2045
|
+
if (!(e.some((e) => mn(e) === o.index) && e.every((e) => {
|
|
2046
|
+
let t = mn(e);
|
|
2047
|
+
if (t === void 0 || t >= i) return !0;
|
|
2048
|
+
let r = c ? e.offsetHeight : e.offsetWidth;
|
|
2049
|
+
return Math.abs(n(t).size - r) <= 1;
|
|
2050
|
+
}))) o.stableFrames = 0;
|
|
2051
|
+
else if (++o.stableFrames >= 2) {
|
|
2052
|
+
d();
|
|
2053
|
+
return;
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
f();
|
|
2058
|
+
});
|
|
2059
|
+
return Y(() => {
|
|
2060
|
+
let e = o ?? t;
|
|
2061
|
+
if (!e) return;
|
|
2062
|
+
let n = (e) => {
|
|
2063
|
+
switch (e.key) {
|
|
2064
|
+
case "ArrowUp":
|
|
2065
|
+
case "ArrowDown":
|
|
2066
|
+
case "ArrowLeft":
|
|
2067
|
+
case "ArrowRight":
|
|
2068
|
+
case "PageUp":
|
|
2069
|
+
case "PageDown":
|
|
2070
|
+
case "Home":
|
|
2071
|
+
case "End":
|
|
2072
|
+
case " ": d();
|
|
2073
|
+
}
|
|
2074
|
+
};
|
|
2075
|
+
return e.addEventListener("wheel", d, { passive: !0 }), e.addEventListener("touchstart", d, { passive: !0 }), e.addEventListener("pointerdown", d), e.addEventListener("keydown", n), () => {
|
|
2076
|
+
d(), e.removeEventListener("wheel", d), e.removeEventListener("touchstart", d), e.removeEventListener("pointerdown", d), e.removeEventListener("keydown", n);
|
|
2077
|
+
};
|
|
2078
|
+
}, [
|
|
2079
|
+
d,
|
|
2080
|
+
t,
|
|
2081
|
+
o
|
|
2082
|
+
]), V(({ align: n = "auto", behavior: i = "auto", index: a }) => {
|
|
2083
|
+
if (r && n === "smart") {
|
|
2084
|
+
let t = s({
|
|
2085
|
+
align: "auto",
|
|
2086
|
+
index: a
|
|
2087
|
+
});
|
|
2088
|
+
n = t === void 0 || t.scrollOffset === Yt(t.scrollTarget, e) ? "auto" : "center";
|
|
2089
|
+
}
|
|
2090
|
+
let o = s({
|
|
2091
|
+
align: n,
|
|
2092
|
+
index: a
|
|
2093
|
+
});
|
|
2094
|
+
if (d(), o && typeof o.scrollTarget.scrollTo == "function") {
|
|
2095
|
+
let { scrollOffset: e, scrollTarget: s } = o;
|
|
2096
|
+
if (r) {
|
|
2097
|
+
let e = i === "smooth" && t?.ownerDocument.visibilityState !== "hidden";
|
|
2098
|
+
if (l.current = {
|
|
2099
|
+
align: n,
|
|
2100
|
+
index: a,
|
|
2101
|
+
smooth: e,
|
|
2102
|
+
stableFrames: 0
|
|
2103
|
+
}, f(), e) return;
|
|
2104
|
+
}
|
|
2105
|
+
s.scrollTo({
|
|
2106
|
+
behavior: r ? "instant" : i,
|
|
2107
|
+
[c ? "top" : "left"]: e
|
|
2108
|
+
});
|
|
2109
|
+
}
|
|
2110
|
+
}, [
|
|
2111
|
+
d,
|
|
2112
|
+
e,
|
|
2113
|
+
t,
|
|
2114
|
+
r,
|
|
2115
|
+
c,
|
|
2116
|
+
f,
|
|
2117
|
+
s
|
|
2118
|
+
]);
|
|
2119
|
+
}
|
|
2120
|
+
function yn({ callback: e, element: t, enabled: n = !0 }) {
|
|
2121
|
+
let r = Ut(e);
|
|
2122
|
+
H(() => {
|
|
2123
|
+
if (!n || !t) return;
|
|
2124
|
+
let e = Q(t), i = e.requestAnimationFrame(() => {
|
|
2125
|
+
i = e.requestAnimationFrame(r);
|
|
2126
|
+
});
|
|
2127
|
+
return () => {
|
|
2128
|
+
e.cancelAnimationFrame(i);
|
|
2129
|
+
};
|
|
2130
|
+
}, [
|
|
2131
|
+
t,
|
|
2132
|
+
n,
|
|
2133
|
+
r
|
|
2134
|
+
]);
|
|
2135
|
+
}
|
|
2136
|
+
function bn({ elements: e, isFlowLayout: t, rowCount: n, startIndex: r, stopIndex: i }) {
|
|
2137
|
+
if (r < 0 || i < r) return [];
|
|
2138
|
+
let a = [], o = /* @__PURE__ */ new Set(), s = !0;
|
|
2139
|
+
for (let t of e) {
|
|
2140
|
+
let e = t.getAttribute("aria-posinset");
|
|
2141
|
+
if (e === null) continue;
|
|
2142
|
+
let c = Number(e) - 1;
|
|
2143
|
+
if (!/^\d+$/.test(e) || c < r || c > i || o.has(c) || t.getAttribute("aria-setsize") !== `${n}`) {
|
|
2144
|
+
s = !1;
|
|
2145
|
+
break;
|
|
2146
|
+
}
|
|
2147
|
+
o.add(c), a.push({
|
|
2148
|
+
element: t,
|
|
2149
|
+
index: c
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
if (s && a.length > 0) return a;
|
|
2153
|
+
let c = Math.min(e.length, i - r + 1);
|
|
2154
|
+
return (t ? e.slice(e.length - c) : e.slice(0, c)).map((e, t) => ({
|
|
2155
|
+
element: e,
|
|
2156
|
+
index: r + t
|
|
2157
|
+
}));
|
|
1746
2158
|
}
|
|
1747
|
-
function
|
|
2159
|
+
function xn(e) {
|
|
1748
2160
|
return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
|
|
1749
2161
|
}
|
|
1750
|
-
var
|
|
1751
|
-
function
|
|
1752
|
-
let
|
|
1753
|
-
|
|
1754
|
-
|
|
2162
|
+
var Sn = "data-react-window-sizer";
|
|
2163
|
+
function Cn({ children: e, className: t, defaultHeight: n = 0, defaultScrollOffset: r = 0, listRef: i, onResize: a, onRowsRendered: o, overscanCount: s = 3, rowComponent: c, rowCount: l, rowHeight: u, rowKey: d, rowProps: f, scrollElement: p, tagName: m = "div", style: h, ...g }) {
|
|
2164
|
+
let _ = un(f), v = U(() => ke(c, dn), [c]), [y, b] = G(null), x = xn(u), S = U(() => x ? (e) => u.getRowHeight(e) ?? u.getAverageRowHeight() : u, [x, u]), C = Z(), [w, T] = G(() => C && x), E = W(u);
|
|
2165
|
+
Y(() => {
|
|
2166
|
+
w && E.current !== u && T(!1);
|
|
2167
|
+
}, [w, u]), yn({
|
|
2168
|
+
callback: () => T(!1),
|
|
2169
|
+
element: y,
|
|
2170
|
+
enabled: w
|
|
2171
|
+
});
|
|
2172
|
+
let { getCellBounds: D, getEstimatedSize: O, scrollTarget: k, getScrollPositionForIndex: ee, startIndexOverscan: A, startIndexVisible: j, stopIndexOverscan: M, stopIndexVisible: N } = ln({
|
|
2173
|
+
containerElement: y,
|
|
2174
|
+
containerStyle: h,
|
|
1755
2175
|
defaultContainerSize: n,
|
|
2176
|
+
defaultScrollOffset: r,
|
|
2177
|
+
direction: "vertical",
|
|
2178
|
+
itemCount: l,
|
|
2179
|
+
itemProps: _,
|
|
2180
|
+
itemSize: S,
|
|
2181
|
+
onResize: a,
|
|
2182
|
+
overscanCount: s,
|
|
2183
|
+
scrollElement: p
|
|
2184
|
+
}), P = W([]), te = vn({
|
|
1756
2185
|
direction: "vertical",
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
2186
|
+
element: y,
|
|
2187
|
+
getCellBounds: D,
|
|
2188
|
+
isDynamicSize: x,
|
|
2189
|
+
itemCount: l,
|
|
2190
|
+
itemElements: P,
|
|
2191
|
+
scrollTarget: k,
|
|
2192
|
+
getScrollPositionForIndex: ee
|
|
1762
2193
|
});
|
|
1763
|
-
|
|
2194
|
+
je(i, () => ({
|
|
1764
2195
|
get element() {
|
|
1765
|
-
return
|
|
2196
|
+
return y;
|
|
1766
2197
|
},
|
|
1767
|
-
scrollToRow
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
if (
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
});
|
|
1785
|
-
if (v) return l.observeRowElements(e);
|
|
2198
|
+
scrollToRow: te
|
|
2199
|
+
}), [y, te]);
|
|
2200
|
+
let F = w && x && A === 0;
|
|
2201
|
+
Y(() => {
|
|
2202
|
+
if (!y) return;
|
|
2203
|
+
let e = Array.from(y.children).filter((e) => !e.hasAttribute(Sn)), t = bn({
|
|
2204
|
+
elements: e,
|
|
2205
|
+
isFlowLayout: F,
|
|
2206
|
+
rowCount: l,
|
|
2207
|
+
startIndex: A,
|
|
2208
|
+
stopIndex: M
|
|
2209
|
+
}), n = t.map(({ element: e }) => e);
|
|
2210
|
+
if (e.forEach((e) => {
|
|
2211
|
+
n.includes(e) || e.removeAttribute(fn);
|
|
2212
|
+
}), t.forEach(({ element: e, index: t }) => {
|
|
2213
|
+
e.setAttribute(fn, `${t}`);
|
|
2214
|
+
}), P.current = n, x) return u.observeRowElements(n);
|
|
1786
2215
|
}, [
|
|
1787
|
-
g,
|
|
1788
2216
|
v,
|
|
2217
|
+
y,
|
|
2218
|
+
x,
|
|
2219
|
+
F,
|
|
1789
2220
|
l,
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
2221
|
+
u,
|
|
2222
|
+
d,
|
|
2223
|
+
_,
|
|
2224
|
+
A,
|
|
2225
|
+
M
|
|
2226
|
+
]), H(() => {
|
|
2227
|
+
A >= 0 && M >= 0 && o && o({
|
|
2228
|
+
startIndex: j,
|
|
2229
|
+
stopIndex: N
|
|
1796
2230
|
}, {
|
|
1797
|
-
startIndex:
|
|
1798
|
-
stopIndex:
|
|
2231
|
+
startIndex: A,
|
|
2232
|
+
stopIndex: M
|
|
1799
2233
|
});
|
|
1800
2234
|
}, [
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
2235
|
+
o,
|
|
2236
|
+
A,
|
|
2237
|
+
j,
|
|
2238
|
+
M,
|
|
2239
|
+
N
|
|
1806
2240
|
]);
|
|
1807
|
-
let
|
|
2241
|
+
let ne = U(() => {
|
|
1808
2242
|
let e = [];
|
|
1809
|
-
if (
|
|
1810
|
-
let n =
|
|
1811
|
-
e.push(/* @__PURE__ */
|
|
1812
|
-
...
|
|
2243
|
+
if (l > 0) for (let t = A; t <= M; t++) {
|
|
2244
|
+
let n = D(t);
|
|
2245
|
+
e.push(/* @__PURE__ */ De(v, {
|
|
2246
|
+
..._,
|
|
1813
2247
|
ariaAttributes: {
|
|
1814
2248
|
"aria-posinset": t + 1,
|
|
1815
|
-
"aria-setsize":
|
|
2249
|
+
"aria-setsize": l,
|
|
1816
2250
|
role: "listitem"
|
|
1817
2251
|
},
|
|
1818
|
-
key: t,
|
|
2252
|
+
key: d ? d(t, _) : t,
|
|
1819
2253
|
index: t,
|
|
1820
|
-
style: {
|
|
2254
|
+
style: F ? { width: "100%" } : {
|
|
1821
2255
|
position: "absolute",
|
|
1822
2256
|
left: 0,
|
|
1823
2257
|
transform: `translateY(${n.scrollOffset}px)`,
|
|
1824
|
-
height:
|
|
2258
|
+
height: x ? void 0 : n.size,
|
|
1825
2259
|
width: "100%"
|
|
1826
2260
|
}
|
|
1827
2261
|
}));
|
|
1828
2262
|
}
|
|
1829
2263
|
return e;
|
|
1830
2264
|
}, [
|
|
1831
|
-
h,
|
|
1832
|
-
y,
|
|
1833
2265
|
v,
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
2266
|
+
D,
|
|
2267
|
+
x,
|
|
2268
|
+
F,
|
|
2269
|
+
l,
|
|
2270
|
+
d,
|
|
2271
|
+
_,
|
|
2272
|
+
A,
|
|
2273
|
+
M
|
|
2274
|
+
]), re = /* @__PURE__ */ z("div", {
|
|
1839
2275
|
"aria-hidden": !0,
|
|
2276
|
+
[Sn]: "",
|
|
1840
2277
|
style: {
|
|
1841
|
-
|
|
2278
|
+
position: F ? "absolute" : void 0,
|
|
2279
|
+
top: F ? 0 : void 0,
|
|
2280
|
+
height: O(),
|
|
1842
2281
|
width: "100%",
|
|
1843
2282
|
zIndex: -1
|
|
1844
2283
|
}
|
|
1845
|
-
});
|
|
1846
|
-
return
|
|
2284
|
+
}, "sizer"), I = /* @__PURE__ */ z(Ee, { children: e }, "children"), L = /* @__PURE__ */ z(Ee, { children: ne }, "rows");
|
|
2285
|
+
return De(m, {
|
|
1847
2286
|
role: "list",
|
|
1848
|
-
...
|
|
2287
|
+
...g,
|
|
1849
2288
|
className: t,
|
|
1850
|
-
ref:
|
|
2289
|
+
ref: b,
|
|
1851
2290
|
style: {
|
|
1852
2291
|
position: "relative",
|
|
1853
|
-
maxHeight: "100%",
|
|
1854
2292
|
flexGrow: 1,
|
|
1855
|
-
|
|
1856
|
-
|
|
2293
|
+
...p === void 0 && {
|
|
2294
|
+
maxHeight: "100%",
|
|
2295
|
+
overflowY: "auto"
|
|
2296
|
+
},
|
|
2297
|
+
...h
|
|
1857
2298
|
}
|
|
1858
|
-
},
|
|
2299
|
+
}, ...F ? [I, L] : [L, I], re);
|
|
1859
2300
|
}
|
|
1860
|
-
var
|
|
2301
|
+
var wn = /* @__PURE__ */ Object.assign(Cn, { displayName: "List" }), Tn = {
|
|
1861
2302
|
search: "_search_5skzl_1",
|
|
1862
2303
|
divider: "_divider_5skzl_5",
|
|
1863
2304
|
item: "_item_5skzl_9",
|
|
@@ -1866,29 +2307,29 @@ var Z = {
|
|
|
1866
2307
|
stateLabel: "_stateLabel_5skzl_27",
|
|
1867
2308
|
itemSelectedBackground: "_itemSelectedBackground_5skzl_37",
|
|
1868
2309
|
itemSelectedText: "_itemSelectedText_5skzl_41"
|
|
1869
|
-
},
|
|
2310
|
+
}, En = 44, Dn = 8, On = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: o, itemClassName: s, selectedItemClassName: c, hasSelectedBackground: u, hasSelectedText: d, onSelect: f }) => {
|
|
1870
2311
|
let p = r[e], h = It(p.iconUrl, p.type, p.displayName ?? p.id, _.SM), g = p.id === i;
|
|
1871
|
-
return /* @__PURE__ */
|
|
2312
|
+
return /* @__PURE__ */ z("div", {
|
|
1872
2313
|
style: t,
|
|
1873
2314
|
...n,
|
|
1874
|
-
children: /* @__PURE__ */
|
|
2315
|
+
children: /* @__PURE__ */ z(m, {
|
|
1875
2316
|
type: "button",
|
|
1876
2317
|
"aria-current": g ? "true" : void 0,
|
|
1877
|
-
className: l(
|
|
1878
|
-
iconBefore: /* @__PURE__ */
|
|
1879
|
-
className:
|
|
2318
|
+
className: l(Tn.item, "h-full w-full gap-3 px-4", g && u && Tn.itemSelectedBackground, g && d && Tn.itemSelectedText, s, g && c, K.modelMenuItem, g && K.modelMenuItemSelected),
|
|
2319
|
+
iconBefore: /* @__PURE__ */ z("span", {
|
|
2320
|
+
className: Tn.itemIcon,
|
|
1880
2321
|
children: h
|
|
1881
2322
|
}),
|
|
1882
|
-
label: /* @__PURE__ */
|
|
2323
|
+
label: /* @__PURE__ */ B("span", {
|
|
1883
2324
|
className: "flex flex-1 items-center justify-between gap-2",
|
|
1884
|
-
children: [/* @__PURE__ */
|
|
2325
|
+
children: [/* @__PURE__ */ z(C, {
|
|
1885
2326
|
text: p.displayName ?? p.id,
|
|
1886
2327
|
query: o,
|
|
1887
2328
|
maxLines: 1,
|
|
1888
2329
|
className: l(a, "min-w-0 flex-1 text-start")
|
|
1889
|
-
}), g && /* @__PURE__ */
|
|
2330
|
+
}), g && /* @__PURE__ */ z(he, {
|
|
1890
2331
|
size: _.SM,
|
|
1891
|
-
className:
|
|
2332
|
+
className: Tn.checkIcon,
|
|
1892
2333
|
"aria-hidden": !0,
|
|
1893
2334
|
stroke: v
|
|
1894
2335
|
})]
|
|
@@ -1896,9 +2337,9 @@ var Z = {
|
|
|
1896
2337
|
onClick: () => f(p.id)
|
|
1897
2338
|
})
|
|
1898
2339
|
});
|
|
1899
|
-
},
|
|
1900
|
-
let [v, y] =
|
|
1901
|
-
|
|
2340
|
+
}, kn = ({ isOpen: e, title: t, closeLabel: n, searchPlaceholder: r = "Search", onClose: i, deployments: a, selectedDeploymentId: o, onSelect: s, loadingLabel: u, errorLabel: d, emptyLabel: f, style: p, titleClassName: m = "dial-body-semi-text", labelClassName: h = "dial-small-text", colors: g, menuStyles: _ }) => {
|
|
2341
|
+
let [v, y] = G("");
|
|
2342
|
+
H(() => {
|
|
1902
2343
|
e || y("");
|
|
1903
2344
|
}, [e]);
|
|
1904
2345
|
let x = a && a.length > 0, S = u !== void 0, C = !x && !S ? d ?? f : void 0, T = x ? Ft(a, v) : [], E = (e) => {
|
|
@@ -1913,44 +2354,44 @@ var Z = {
|
|
|
1913
2354
|
"--ci-sheet-selected-bg": D?.selectedItemBackground,
|
|
1914
2355
|
"--ci-sheet-selected-text": D?.selectedItemText
|
|
1915
2356
|
});
|
|
1916
|
-
return /* @__PURE__ */
|
|
2357
|
+
return /* @__PURE__ */ z(Fe, {
|
|
1917
2358
|
isOpen: e,
|
|
1918
2359
|
title: t,
|
|
1919
2360
|
closeLabel: n,
|
|
1920
2361
|
onClose: i,
|
|
1921
2362
|
style: p,
|
|
1922
2363
|
titleClassName: m,
|
|
1923
|
-
className: l("max-h-[80dvh]", _?.className,
|
|
2364
|
+
className: l("max-h-[80dvh]", _?.className, K.modelMenu),
|
|
1924
2365
|
colors: g?.shell,
|
|
1925
|
-
children: /* @__PURE__ */
|
|
2366
|
+
children: /* @__PURE__ */ B("div", {
|
|
1926
2367
|
className: "contents",
|
|
1927
2368
|
style: O,
|
|
1928
2369
|
children: [
|
|
1929
|
-
/* @__PURE__ */
|
|
2370
|
+
/* @__PURE__ */ z(w, {
|
|
1930
2371
|
visuallyHidden: !0,
|
|
1931
2372
|
children: S ? u : null
|
|
1932
2373
|
}),
|
|
1933
|
-
x && !S && /* @__PURE__ */
|
|
2374
|
+
x && !S && /* @__PURE__ */ B(le, { children: [/* @__PURE__ */ z("div", {
|
|
1934
2375
|
style: c({ "--ci-sheet-search-bg": _?.colors?.searchHeaderBackground }),
|
|
1935
|
-
className: l("shrink-0 px-4 py-[10px]",
|
|
1936
|
-
children: /* @__PURE__ */
|
|
2376
|
+
className: l("shrink-0 px-4 py-[10px]", Tn.search, _?.searchHeaderClassName, K.modelMenuSearch),
|
|
2377
|
+
children: /* @__PURE__ */ z(re, {
|
|
1937
2378
|
value: v,
|
|
1938
2379
|
placeholder: r,
|
|
1939
2380
|
size: b.Standard,
|
|
1940
2381
|
onChange: (e) => y(e ?? "")
|
|
1941
2382
|
})
|
|
1942
|
-
}), /* @__PURE__ */
|
|
1943
|
-
S ? /* @__PURE__ */
|
|
2383
|
+
}), /* @__PURE__ */ z("div", { className: l(Tn.divider, "h-px shrink-0") })] }),
|
|
2384
|
+
S ? /* @__PURE__ */ z(Nt, {}) : C ? /* @__PURE__ */ z("div", {
|
|
1944
2385
|
role: "list",
|
|
1945
|
-
className: l(
|
|
2386
|
+
className: l(Tn.stateLabel, h, "px-4 py-4"),
|
|
1946
2387
|
children: C
|
|
1947
|
-
}) : /* @__PURE__ */
|
|
2388
|
+
}) : /* @__PURE__ */ z(wn, {
|
|
1948
2389
|
role: "list",
|
|
1949
2390
|
className: "overflow-y-auto",
|
|
1950
|
-
style: { height: Math.min(T.length,
|
|
1951
|
-
rowComponent:
|
|
2391
|
+
style: { height: Math.min(T.length, Dn) * En },
|
|
2392
|
+
rowComponent: On,
|
|
1952
2393
|
rowCount: T.length,
|
|
1953
|
-
rowHeight:
|
|
2394
|
+
rowHeight: En,
|
|
1954
2395
|
rowProps: {
|
|
1955
2396
|
items: T,
|
|
1956
2397
|
selectedDeploymentId: o,
|
|
@@ -1966,8 +2407,8 @@ var Z = {
|
|
|
1966
2407
|
]
|
|
1967
2408
|
})
|
|
1968
2409
|
});
|
|
1969
|
-
},
|
|
1970
|
-
let [C, w] =
|
|
2410
|
+
}, An = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, menuStyles: i, nameClassName: a = "dial-small-text", versionClassName: o = "dial-tiny-text", isStreaming: u, isMobile: d, isDisabled: f = !1, style: p, modelPickerOverlay: h, isPickerOpen: g, onPickerToggle: b, onPickerOpenChange: x }) => {
|
|
2411
|
+
let [C, w] = G(!1), { selectorIcon: T, selectorAriaLabel: E, selectedLabel: D, selectedVersion: O, menuItems: k, menuHeader: ee, menuStyle: A, onOpenChange: j } = Rt({
|
|
1971
2412
|
deployments: e,
|
|
1972
2413
|
selectedDeploymentId: t,
|
|
1973
2414
|
onDeploymentChange: n,
|
|
@@ -1975,36 +2416,36 @@ var Z = {
|
|
|
1975
2416
|
styles: i
|
|
1976
2417
|
});
|
|
1977
2418
|
if (!e) return null;
|
|
1978
|
-
let
|
|
2419
|
+
let M = u || f, N = M ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, P = /* @__PURE__ */ z(ge, {
|
|
1979
2420
|
size: _.SM,
|
|
1980
|
-
className: l(
|
|
2421
|
+
className: l(J.modelSelectorCaret, K.modelSelectorCaret),
|
|
1981
2422
|
"aria-hidden": !0,
|
|
1982
2423
|
stroke: v
|
|
1983
|
-
}),
|
|
1984
|
-
className: l("flex shrink-0 items-center",
|
|
2424
|
+
}), te = /* @__PURE__ */ z("span", {
|
|
2425
|
+
className: l("flex shrink-0 items-center", K.modelSelectorIcon),
|
|
1985
2426
|
children: T
|
|
1986
2427
|
});
|
|
1987
|
-
if (d) return /* @__PURE__ */
|
|
2428
|
+
if (d) return /* @__PURE__ */ B(le, { children: [/* @__PURE__ */ z(S, {
|
|
1988
2429
|
tooltipProps: { tooltip: D },
|
|
1989
|
-
icon: /* @__PURE__ */
|
|
2430
|
+
icon: /* @__PURE__ */ B("div", {
|
|
1990
2431
|
className: "flex items-center gap-1",
|
|
1991
|
-
children: [
|
|
2432
|
+
children: [te, P]
|
|
1992
2433
|
}),
|
|
1993
2434
|
"aria-label": E,
|
|
1994
|
-
"aria-disabled":
|
|
2435
|
+
"aria-disabled": M || void 0,
|
|
1995
2436
|
onClick: () => {
|
|
1996
|
-
|
|
2437
|
+
M || w(!0);
|
|
1997
2438
|
},
|
|
1998
|
-
className: l("w-[50px]",
|
|
1999
|
-
}), h ? /* @__PURE__ */
|
|
2439
|
+
className: l("w-[50px]", J.modelSelectorButton, N, K.modelSelectorButton)
|
|
2440
|
+
}), h ? /* @__PURE__ */ z(Fe, {
|
|
2000
2441
|
isOpen: C,
|
|
2001
2442
|
title: r?.ariaLabel ?? "Select model",
|
|
2002
2443
|
closeLabel: r?.closeLabel ?? "Close",
|
|
2003
2444
|
onClose: () => w(!1),
|
|
2004
2445
|
style: p,
|
|
2005
|
-
className: l(i?.className,
|
|
2446
|
+
className: l(i?.className, K.modelMenu),
|
|
2006
2447
|
children: h(() => w(!1))
|
|
2007
|
-
}) : /* @__PURE__ */
|
|
2448
|
+
}) : /* @__PURE__ */ z(kn, {
|
|
2008
2449
|
isOpen: C,
|
|
2009
2450
|
title: r?.ariaLabel ?? "Select model",
|
|
2010
2451
|
closeLabel: r?.closeLabel ?? "Close",
|
|
@@ -2021,7 +2462,7 @@ var Z = {
|
|
|
2021
2462
|
})] });
|
|
2022
2463
|
if (h) {
|
|
2023
2464
|
let e = O ? `${D} · ${O}` : D;
|
|
2024
|
-
return /* @__PURE__ */
|
|
2465
|
+
return /* @__PURE__ */ z(y, {
|
|
2025
2466
|
placement: "top-end",
|
|
2026
2467
|
matchReferenceWidth: !1,
|
|
2027
2468
|
open: g,
|
|
@@ -2029,394 +2470,394 @@ var Z = {
|
|
|
2029
2470
|
trigger: [],
|
|
2030
2471
|
outsideClosable: !0,
|
|
2031
2472
|
renderOverlay: () => h(() => x?.(!1)),
|
|
2032
|
-
listClassName: l("w-[368px]!",
|
|
2473
|
+
listClassName: l("w-[368px]!", J.modelOverlayPanel, i?.className, K.modelMenu),
|
|
2033
2474
|
listStyle: c({ "--ci-model-overlay-bg": i?.colors?.overlayBackground }),
|
|
2034
|
-
children: /* @__PURE__ */
|
|
2475
|
+
children: /* @__PURE__ */ z(m, {
|
|
2035
2476
|
"aria-label": E,
|
|
2036
|
-
"aria-disabled":
|
|
2477
|
+
"aria-disabled": M || void 0,
|
|
2037
2478
|
tooltipProps: { tooltip: e },
|
|
2038
|
-
className: l("h-auto min-w-0 gap-1.5 rounded-full! border-0! px-0 py-1.5 ps-1.5 pe-2",
|
|
2479
|
+
className: l("h-auto min-w-0 gap-1.5 rounded-full! border-0! px-0 py-1.5 ps-1.5 pe-2", J.modelSelectorButton, N, M && J.modelSelectorButtonDisabled, K.modelSelectorButton),
|
|
2039
2480
|
onClick: () => {
|
|
2040
|
-
|
|
2481
|
+
M || b?.();
|
|
2041
2482
|
},
|
|
2042
|
-
iconBefore:
|
|
2043
|
-
iconAfter:
|
|
2483
|
+
iconBefore: te,
|
|
2484
|
+
iconAfter: P,
|
|
2044
2485
|
textClassName: "min-w-0",
|
|
2045
|
-
label: /* @__PURE__ */
|
|
2486
|
+
label: /* @__PURE__ */ B("span", {
|
|
2046
2487
|
className: "flex max-w-[180px] min-w-0 items-baseline gap-1",
|
|
2047
|
-
children: [/* @__PURE__ */
|
|
2048
|
-
className: l("max-w-[180px] shrink-0 truncate", a,
|
|
2488
|
+
children: [/* @__PURE__ */ z("span", {
|
|
2489
|
+
className: l("max-w-[180px] shrink-0 truncate", a, J.modelSelectorName),
|
|
2049
2490
|
children: D
|
|
2050
|
-
}), O && /* @__PURE__ */
|
|
2051
|
-
className: l("min-w-0 truncate", o,
|
|
2491
|
+
}), O && /* @__PURE__ */ z("span", {
|
|
2492
|
+
className: l("min-w-0 truncate", o, J.modelSelectorVersion),
|
|
2052
2493
|
children: O
|
|
2053
2494
|
})]
|
|
2054
2495
|
})
|
|
2055
2496
|
})
|
|
2056
2497
|
});
|
|
2057
2498
|
}
|
|
2058
|
-
return /* @__PURE__ */
|
|
2059
|
-
className: l(
|
|
2060
|
-
"aria-disabled":
|
|
2061
|
-
children: /* @__PURE__ */
|
|
2499
|
+
return /* @__PURE__ */ z("div", {
|
|
2500
|
+
className: l(N),
|
|
2501
|
+
"aria-disabled": M || void 0,
|
|
2502
|
+
children: /* @__PURE__ */ z(y, {
|
|
2062
2503
|
items: k,
|
|
2063
2504
|
menuHeader: ee,
|
|
2064
2505
|
placement: "bottom-end",
|
|
2065
2506
|
matchReferenceWidth: !1,
|
|
2066
2507
|
maxDropdownHeight: s,
|
|
2067
|
-
listClassName: l("w-[240px]!", i?.className,
|
|
2508
|
+
listClassName: l("w-[240px]!", i?.className, K.modelMenu),
|
|
2068
2509
|
listStyle: A,
|
|
2069
|
-
disabled:
|
|
2070
|
-
onOpenChange:
|
|
2071
|
-
children: /* @__PURE__ */
|
|
2510
|
+
disabled: M,
|
|
2511
|
+
onOpenChange: M ? void 0 : j,
|
|
2512
|
+
children: /* @__PURE__ */ z(m, {
|
|
2072
2513
|
"aria-label": E,
|
|
2073
|
-
"aria-disabled":
|
|
2514
|
+
"aria-disabled": M || void 0,
|
|
2074
2515
|
tooltipProps: { tooltip: D },
|
|
2075
|
-
iconBefore:
|
|
2076
|
-
iconAfter:
|
|
2077
|
-
className: l("h-auto gap-1 rounded-full! border-0! p-1.5",
|
|
2516
|
+
iconBefore: te,
|
|
2517
|
+
iconAfter: P,
|
|
2518
|
+
className: l("h-auto gap-1 rounded-full! border-0! p-1.5", J.modelSelectorButton, M && J.modelSelectorButtonDisabled, K.modelSelectorButton)
|
|
2078
2519
|
})
|
|
2079
2520
|
})
|
|
2080
2521
|
});
|
|
2081
|
-
},
|
|
2082
|
-
let
|
|
2083
|
-
"--ci-bg":
|
|
2084
|
-
"--ci-text":
|
|
2085
|
-
"--ci-border":
|
|
2086
|
-
"--ci-border-focus":
|
|
2087
|
-
"--ci-placeholder":
|
|
2088
|
-
"--ci-text-disabled":
|
|
2089
|
-
"--ci-model-selector-caret-color":
|
|
2090
|
-
"--ci-model-selector-hover-bg":
|
|
2091
|
-
"--ci-model-selector-disabled-color":
|
|
2092
|
-
"--ci-model-selector-name-color":
|
|
2093
|
-
"--ci-model-selector-version-color":
|
|
2094
|
-
"--ci-voice-waveform":
|
|
2095
|
-
"--ci-voice-accent":
|
|
2096
|
-
"--ci-mention-highlight-bg":
|
|
2097
|
-
"--ci-mention-highlight-text":
|
|
2098
|
-
"--ci-mention-highlight-unsupported-bg":
|
|
2099
|
-
"--ci-mention-highlight-unsupported-text":
|
|
2100
|
-
"--ci-selection-highlight-bg":
|
|
2101
|
-
}), [
|
|
2522
|
+
}, jn = Oe(({ message: e = "", messageRevision: t, focusRequestId: n, textInsertion: r, onSend: i, onUploadAttachment: a, onStop: o, isStreaming: s = !1, onChange: u, onAttachmentsChange: p, placeholder: m = "Type a message...", ariaLabel: h, attachLabel: g = "Attach file", fileAccept: b, addMenuTitle: C = "Add", menuTitle: D = "Menu", menuCloseLabel: O = "Close", removeLabel: k, retryLabel: ee, uploadingLabel: A, expandLabel: j, clickLabel: M, sendLabel: N, sendTooltip: P, emptyMessageTooltip: te, stopLabel: F, micLabel: ne = "Dictate", recordVoiceLabel: re = "Record voice", stopRecordingLabel: I, discardRecordingLabel: L, colors: R, typography: ie, attachmentTray: ae, modelMenu: oe, className: se, pendingDropFiles: ce = [], onDropFilesConsumed: de, pendingAttachments: fe = [], onPendingAttachmentsConsumed: me, pasteTextThreshold: he = 4e3, maxMessageLength: ge = 5e4, deployments: _e, selectedDeploymentId: be, onDeploymentChange: xe, modelSelectorLabels: Se, initialAttachments: Ce = [], hideAddButton: we = !1, hideAttachFile: Te = !1, hideActionBar: Ee = !1, actionRowLayout: De = lt.Stacked, isInlineActionRowAllowedBelowDesktop: Oe = !1, renderFooterActions: ke, isInputDisabled: Ae = !1, isModelSelectorDisabled: Ne = !1, isSendDisabled: Pe = !1, isAudioMessageSupported: Fe = !1, isVoiceRecordingSupported: Ie = Fe, onTranscribeAudio: Re, transcribingLabel: ze, voiceErrorLabel: Be, sendOnEnter: Ve = ct.Enter, prefixAttachments: We = [], onRemovePrefixAttachment: Ge, chatSettings: Je, toolsMenuItems: Ye, onToolToggle: $e, canRemoveTools: rt = !0, toolsMenuTitle: it, toolsBackLabel: at, toolsChipLabels: ot, menuOverlays: ut, activeMentions: dt, onBackspaceAtCaret: ft, caretPositionOverride: pt, commandMenu: q, autoFocus: mt = !1, messageHistory: ht, onDialFileSystemClick: gt, dialFileSystemLabel: _t, validateAttachment: vt, onAttachmentClick: yt, modelPickerOverlay: xt, maximumAttachmentsAmount: St, onAttachmentsLimitExceeded: wt, isAttachmentsEnabled: Tt = !0, isTextAttachmentsAllowed: Et = !0, usageLimitsSlot: Dt, onMessageTooLong: jt }, Mt) => {
|
|
2523
|
+
let Nt = d(), [Pt, Ft] = G(!1), It = Ke(ht), Lt = dt ?? [], Rt = Lt.length > 0, Y = U(() => c({
|
|
2524
|
+
"--ci-bg": R?.background,
|
|
2525
|
+
"--ci-text": R?.text,
|
|
2526
|
+
"--ci-border": R?.border,
|
|
2527
|
+
"--ci-border-focus": R?.borderFocus,
|
|
2528
|
+
"--ci-placeholder": R?.placeholder,
|
|
2529
|
+
"--ci-text-disabled": R?.textDisabled,
|
|
2530
|
+
"--ci-model-selector-caret-color": R?.modelSelectorCaret,
|
|
2531
|
+
"--ci-model-selector-hover-bg": R?.modelSelectorHoverBg,
|
|
2532
|
+
"--ci-model-selector-disabled-color": R?.modelSelectorDisabled,
|
|
2533
|
+
"--ci-model-selector-name-color": R?.modelSelectorName,
|
|
2534
|
+
"--ci-model-selector-version-color": R?.modelSelectorVersion,
|
|
2535
|
+
"--ci-voice-waveform": R?.voiceWaveform,
|
|
2536
|
+
"--ci-voice-accent": R?.voiceAccent,
|
|
2537
|
+
"--ci-mention-highlight-bg": R?.mentionHighlightBg,
|
|
2538
|
+
"--ci-mention-highlight-text": R?.mentionHighlightText,
|
|
2539
|
+
"--ci-mention-highlight-unsupported-bg": R?.mentionHighlightUnsupportedBg,
|
|
2540
|
+
"--ci-mention-highlight-unsupported-text": R?.mentionHighlightUnsupportedText,
|
|
2541
|
+
"--ci-selection-highlight-bg": R?.selectionHighlightBg
|
|
2542
|
+
}), [R]), zt = U(() => gt ? [{
|
|
2102
2543
|
key: "dial-fs",
|
|
2103
|
-
label:
|
|
2104
|
-
icon: /* @__PURE__ */
|
|
2544
|
+
label: _t ?? "DIAL file system",
|
|
2545
|
+
icon: /* @__PURE__ */ z(ve, {
|
|
2105
2546
|
size: f,
|
|
2106
2547
|
"aria-hidden": !0,
|
|
2107
2548
|
stroke: v
|
|
2108
2549
|
}),
|
|
2109
|
-
onClick:
|
|
2110
|
-
}] : [], [
|
|
2550
|
+
onClick: gt
|
|
2551
|
+
}] : [], [gt, _t]), { message: X, setMessage: Z, textareaRef: Q } = Ze({
|
|
2111
2552
|
messageProp: e,
|
|
2112
2553
|
messageRevision: t
|
|
2113
2554
|
});
|
|
2114
|
-
|
|
2115
|
-
let e =
|
|
2555
|
+
H(() => {
|
|
2556
|
+
let e = Q.current;
|
|
2116
2557
|
e != null && e.value.length !== 0 && document.activeElement === e && e.setSelectionRange(e.value.length, e.value.length);
|
|
2117
|
-
}, [
|
|
2118
|
-
n !== void 0 &&
|
|
2119
|
-
}, [n,
|
|
2120
|
-
let { handleUndoKeyDown:
|
|
2558
|
+
}, [Q]), H(() => {
|
|
2559
|
+
n !== void 0 && Q.current?.focus();
|
|
2560
|
+
}, [n, Q]), je(Mt, () => ({ getCaretPosition: () => Q.current?.selectionStart ?? X.length }), [X, Q]);
|
|
2561
|
+
let { handleUndoKeyDown: Bt, markCaretPlaced: Vt } = et({
|
|
2121
2562
|
insertion: r,
|
|
2122
|
-
textareaRef:
|
|
2123
|
-
}), { isMenuOpen:
|
|
2124
|
-
config:
|
|
2125
|
-
message:
|
|
2126
|
-
}),
|
|
2127
|
-
|
|
2128
|
-
let
|
|
2129
|
-
|
|
2130
|
-
},
|
|
2131
|
-
|
|
2132
|
-
let e =
|
|
2133
|
-
|
|
2563
|
+
textareaRef: Q
|
|
2564
|
+
}), { isMenuOpen: Ht, query: Ut, activeWordStart: $, dismiss: Wt, closeOnOutsidePress: Gt, handleCaretMove: Kt, handleValueChange: qt, listboxId: Jt, overlayRef: Yt, activeOptionId: Xt, moveActiveOption: Zt, getActiveOption: Qt } = Ue({
|
|
2565
|
+
config: q,
|
|
2566
|
+
message: X
|
|
2567
|
+
}), $t = W(Kt);
|
|
2568
|
+
$t.current = Kt;
|
|
2569
|
+
let en = () => {
|
|
2570
|
+
Kt(Q.current?.selectionStart ?? X.length);
|
|
2571
|
+
}, tn = W(!1), nn = () => {
|
|
2572
|
+
tn.current ? tn.current = !1 : requestAnimationFrame(() => {
|
|
2573
|
+
let e = Q.current;
|
|
2574
|
+
$t.current(e?.selectionStart ?? e?.value.length ?? 0);
|
|
2134
2575
|
});
|
|
2135
|
-
},
|
|
2136
|
-
(e.key === "ArrowLeft" || e.key === "ArrowRight" || e.key === "Home" || e.key === "End" || e.key === "PageUp" || e.key === "PageDown") &&
|
|
2137
|
-
},
|
|
2138
|
-
let e =
|
|
2576
|
+
}, rn = (e) => {
|
|
2577
|
+
(e.key === "ArrowLeft" || e.key === "ArrowRight" || e.key === "Home" || e.key === "End" || e.key === "PageUp" || e.key === "PageDown") && Kt(e.currentTarget.selectionStart ?? X.length);
|
|
2578
|
+
}, an = q?.emptyQueryHint != null, on = q != null && $ != null ? $ + q.triggerPrefix.length : null, sn = on != null && X.slice(on).split("\n", 1)[0] !== "", cn = an && Ht && Ut === "" && on != null && !sn, ln = q != null && Ht ? $ ?? 0 : null, un = W(null), dn = W(null), [fn, pn] = G(null), mn = V(() => {
|
|
2579
|
+
let e = un.current, t = dn.current;
|
|
2139
2580
|
if (e == null || t == null) {
|
|
2140
|
-
|
|
2581
|
+
pn(null);
|
|
2141
2582
|
return;
|
|
2142
2583
|
}
|
|
2143
2584
|
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
2144
|
-
|
|
2585
|
+
pn({
|
|
2145
2586
|
left: n.left - r.left,
|
|
2146
2587
|
top: n.top - r.top
|
|
2147
2588
|
});
|
|
2148
2589
|
}, []);
|
|
2149
|
-
|
|
2150
|
-
if (
|
|
2151
|
-
let e =
|
|
2590
|
+
H(() => {
|
|
2591
|
+
if (ln == null) return;
|
|
2592
|
+
let e = Q.current;
|
|
2152
2593
|
if (e == null || typeof ResizeObserver > "u") return;
|
|
2153
|
-
let t = new ResizeObserver(
|
|
2594
|
+
let t = new ResizeObserver(mn);
|
|
2154
2595
|
return t.observe(e), () => t.disconnect();
|
|
2155
2596
|
}, [
|
|
2597
|
+
ln,
|
|
2156
2598
|
Q,
|
|
2157
|
-
|
|
2158
|
-
gn
|
|
2599
|
+
mn
|
|
2159
2600
|
]);
|
|
2160
|
-
let
|
|
2161
|
-
if (
|
|
2162
|
-
let t = `${
|
|
2163
|
-
if (
|
|
2164
|
-
let r =
|
|
2165
|
-
|
|
2601
|
+
let hn = V((e) => {
|
|
2602
|
+
if (q == null || (Wt(), !e?.consumeQuery) || (e.returnFocus !== !1 && Q.current?.focus(), $ == null)) return;
|
|
2603
|
+
let t = `${q.triggerPrefix}${Ut}`, n = $ + t.length;
|
|
2604
|
+
if (X.slice($, n) !== t) return;
|
|
2605
|
+
let r = X.slice(0, $) + X.slice(n);
|
|
2606
|
+
Z(r), It.notifyChange(), u?.(r);
|
|
2166
2607
|
}, [
|
|
2167
|
-
G,
|
|
2168
|
-
qt,
|
|
2169
|
-
Kt,
|
|
2170
2608
|
q,
|
|
2609
|
+
Wt,
|
|
2610
|
+
Ut,
|
|
2171
2611
|
X,
|
|
2172
|
-
|
|
2173
|
-
|
|
2612
|
+
$,
|
|
2613
|
+
Z,
|
|
2614
|
+
It,
|
|
2174
2615
|
u,
|
|
2175
|
-
|
|
2176
|
-
]),
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
}, [
|
|
2180
|
-
let
|
|
2181
|
-
|
|
2182
|
-
let { attachments:
|
|
2183
|
-
initialAttachments:
|
|
2616
|
+
Q
|
|
2617
|
+
]), gn = W(void 0);
|
|
2618
|
+
H(() => {
|
|
2619
|
+
pt != null && gn.current !== t && (gn.current = t, Q.current?.setSelectionRange(pt, pt), Vt(), Kt(pt));
|
|
2620
|
+
}, [X]);
|
|
2621
|
+
let _n = W(X);
|
|
2622
|
+
_n.current = X;
|
|
2623
|
+
let { attachments: vn, buildAttachments: yn, addAttachments: bn, resetAttachments: xn, handleRemove: Sn, handleRetry: Cn, handleExpand: wn, hasBlockedAttachments: Tn } = Le({
|
|
2624
|
+
initialAttachments: Ce,
|
|
2184
2625
|
onUploadAttachment: a,
|
|
2185
2626
|
onAttachmentsChange: p,
|
|
2186
|
-
validateAttachment:
|
|
2187
|
-
pendingDropFiles:
|
|
2188
|
-
onDropFilesConsumed:
|
|
2189
|
-
isDropDisabled:
|
|
2190
|
-
pendingAttachments:
|
|
2191
|
-
onPendingAttachmentsConsumed:
|
|
2192
|
-
onExpandPastedText:
|
|
2193
|
-
let t =
|
|
2194
|
-
|
|
2195
|
-
}, [
|
|
2196
|
-
maximumAttachmentsAmount:
|
|
2197
|
-
baseAttachmentsAmount:
|
|
2198
|
-
onAttachmentsLimitExceeded:
|
|
2199
|
-
}),
|
|
2200
|
-
|
|
2201
|
-
}, [
|
|
2627
|
+
validateAttachment: vt,
|
|
2628
|
+
pendingDropFiles: ce,
|
|
2629
|
+
onDropFilesConsumed: de,
|
|
2630
|
+
isDropDisabled: Ae,
|
|
2631
|
+
pendingAttachments: fe,
|
|
2632
|
+
onPendingAttachmentsConsumed: me,
|
|
2633
|
+
onExpandPastedText: V((e) => {
|
|
2634
|
+
let t = _n.current, n = t ? `${t}\n${e}` : e;
|
|
2635
|
+
_n.current = n, Z(n), u?.(n);
|
|
2636
|
+
}, [Z, u]),
|
|
2637
|
+
maximumAttachmentsAmount: St,
|
|
2638
|
+
baseAttachmentsAmount: We.length,
|
|
2639
|
+
onAttachmentsLimitExceeded: wt
|
|
2640
|
+
}), En = V((e) => {
|
|
2641
|
+
bn(yn([e]));
|
|
2642
|
+
}, [bn, yn]), Dn = W(!1), [On, kn] = G({
|
|
2202
2643
|
text: "",
|
|
2203
2644
|
revision: 0
|
|
2204
|
-
}), { state:
|
|
2205
|
-
onAttachAudio:
|
|
2206
|
-
onTranscribeAudio:
|
|
2207
|
-
onTranscript:
|
|
2645
|
+
}), { state: jn, analyserNodeRef: Mn, errorMessage: Nn, startRecording: Pn, stopRecording: Fn, discardRecording: In } = st({
|
|
2646
|
+
onAttachAudio: En,
|
|
2647
|
+
onTranscribeAudio: Re,
|
|
2648
|
+
onTranscript: V((e) => {
|
|
2208
2649
|
let t = e.trim();
|
|
2209
2650
|
if (t) {
|
|
2210
|
-
let e =
|
|
2211
|
-
|
|
2651
|
+
let e = _n.current, n = `${e}${e && !/\s$/.test(e) ? " " : ""}${t}`;
|
|
2652
|
+
_n.current = n, Z(n), kn((e) => ({
|
|
2212
2653
|
text: t,
|
|
2213
2654
|
revision: e.revision + 1
|
|
2214
|
-
})),
|
|
2655
|
+
})), It.notifyChange(), u?.(n);
|
|
2215
2656
|
}
|
|
2216
|
-
|
|
2657
|
+
Dn.current = !0;
|
|
2217
2658
|
}, [
|
|
2218
|
-
|
|
2219
|
-
|
|
2659
|
+
Z,
|
|
2660
|
+
It,
|
|
2220
2661
|
u
|
|
2221
2662
|
]),
|
|
2222
|
-
errorLabel:
|
|
2223
|
-
}),
|
|
2224
|
-
|
|
2225
|
-
if (
|
|
2226
|
-
|
|
2227
|
-
let e =
|
|
2663
|
+
errorLabel: Be
|
|
2664
|
+
}), Ln = jn === tt.Recording || jn === tt.Processing;
|
|
2665
|
+
H(() => {
|
|
2666
|
+
if (jn === tt.Error || jn === tt.Idle && Dn.current) {
|
|
2667
|
+
Dn.current = !1;
|
|
2668
|
+
let e = Q.current;
|
|
2228
2669
|
if (e != null) {
|
|
2229
|
-
|
|
2670
|
+
tn.current = document.activeElement !== e, e.focus();
|
|
2230
2671
|
let t = e.value.length;
|
|
2231
2672
|
e.setSelectionRange(t, t);
|
|
2232
2673
|
}
|
|
2233
2674
|
}
|
|
2234
|
-
}, [
|
|
2235
|
-
let Rn =
|
|
2675
|
+
}, [jn, Q]);
|
|
2676
|
+
let Rn = W(null), zn = W(null), Bn = Tt && Et, { handlePaste: Vn } = pe(bn, Bn ? he : Infinity), Hn = V((e) => {
|
|
2236
2677
|
if (!Bn) {
|
|
2237
2678
|
let t = e.clipboardData.getData("text/plain");
|
|
2238
|
-
t.length >=
|
|
2679
|
+
t.length >= ge && jt?.(t.length, ge);
|
|
2239
2680
|
}
|
|
2240
2681
|
if (Vn(e), e.defaultPrevented) return;
|
|
2241
2682
|
let t = e.clipboardData.getData("text/plain").replace(/\r\n?/g, "\n");
|
|
2242
|
-
t !== "" &&
|
|
2683
|
+
t !== "" && q?.onTextPaste?.(t);
|
|
2243
2684
|
}, [
|
|
2244
2685
|
Bn,
|
|
2245
|
-
|
|
2246
|
-
|
|
2686
|
+
ge,
|
|
2687
|
+
jt,
|
|
2247
2688
|
Vn,
|
|
2248
|
-
|
|
2249
|
-
]), Un =
|
|
2250
|
-
|
|
2689
|
+
q
|
|
2690
|
+
]), Un = X.trim().length > 0 || vn.length > 0, Wn = Un && !Tn && !Pe && !Ln, [Gn, Kn] = G([]), qn = (Ye ?? []).map((e) => e.id).join("|");
|
|
2691
|
+
H(() => {
|
|
2251
2692
|
Kn([]);
|
|
2252
2693
|
}, [qn]);
|
|
2253
|
-
let Jn =
|
|
2254
|
-
let e =
|
|
2255
|
-
return
|
|
2694
|
+
let Jn = U(() => {
|
|
2695
|
+
let e = Ye ?? [];
|
|
2696
|
+
return rt ? e.filter((e) => e.isSelected || !Gn.includes(e.id)) : e;
|
|
2256
2697
|
}, [
|
|
2257
|
-
|
|
2698
|
+
Ye,
|
|
2258
2699
|
Gn,
|
|
2259
|
-
|
|
2260
|
-
]), Yn =
|
|
2261
|
-
Kn((t) => t.includes(e) ? t : [...t, e]),
|
|
2262
|
-
}, [
|
|
2263
|
-
if (
|
|
2264
|
-
if (
|
|
2265
|
-
|
|
2700
|
+
rt
|
|
2701
|
+
]), Yn = V((e) => {
|
|
2702
|
+
Kn((t) => t.includes(e) ? t : [...t, e]), Ye?.find((t) => t.id === e)?.isSelected && $e?.(e);
|
|
2703
|
+
}, [Ye, $e]), Xn = _e === void 0 || be != null, Zn = Fe && !s, Qn = async () => {
|
|
2704
|
+
if (Pe || Ln) return;
|
|
2705
|
+
if (X.length >= ge) {
|
|
2706
|
+
jt?.(X.length, ge);
|
|
2266
2707
|
return;
|
|
2267
2708
|
}
|
|
2268
|
-
let e =
|
|
2269
|
-
|
|
2709
|
+
let e = X, t = vn;
|
|
2710
|
+
Z(""), It.reset();
|
|
2270
2711
|
try {
|
|
2271
2712
|
await i?.(e, t), t.forEach((e) => {
|
|
2272
2713
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
2273
|
-
}),
|
|
2714
|
+
}), xn([]);
|
|
2274
2715
|
} catch {
|
|
2275
|
-
|
|
2716
|
+
Z(e), xn(t);
|
|
2276
2717
|
}
|
|
2277
|
-
}, $n = (e) =>
|
|
2278
|
-
if (!
|
|
2279
|
-
if (e.key === "Escape") return e.preventDefault(), e.stopPropagation(),
|
|
2280
|
-
if (e.key === "ArrowDown" || e.key === "ArrowUp") return e.preventDefault(),
|
|
2718
|
+
}, $n = (e) => Ve === ct.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey, er = (e) => {
|
|
2719
|
+
if (!Ht || e.nativeEvent.isComposing) return !1;
|
|
2720
|
+
if (e.key === "Escape") return e.preventDefault(), e.stopPropagation(), Wt(), !0;
|
|
2721
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") return e.preventDefault(), Zt(e.key === "ArrowDown" ? He.Next : He.Previous), !0;
|
|
2281
2722
|
if (e.key !== "Enter" || e.shiftKey) return !1;
|
|
2282
|
-
let t =
|
|
2723
|
+
let t = Qt();
|
|
2283
2724
|
return t == null ? $n(e) ? (e.preventDefault(), !0) : !1 : (e.preventDefault(), t.click(), !0);
|
|
2284
2725
|
}, tr = (e) => {
|
|
2285
|
-
if (
|
|
2286
|
-
if (!e.nativeEvent.isComposing && !
|
|
2726
|
+
if (!Ln && !Bt(e) && !er(e)) {
|
|
2727
|
+
if (!e.nativeEvent.isComposing && !Ae && !s) {
|
|
2287
2728
|
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
2288
|
-
let t = e.currentTarget.selectionStart ?? 0, n =
|
|
2729
|
+
let t = e.currentTarget.selectionStart ?? 0, n = It.navigate(e.key === "ArrowUp" ? "up" : "down", X, t);
|
|
2289
2730
|
if (n !== null) {
|
|
2290
|
-
e.preventDefault(),
|
|
2731
|
+
e.preventDefault(), Z(n);
|
|
2291
2732
|
return;
|
|
2292
2733
|
}
|
|
2293
2734
|
}
|
|
2294
|
-
if (e.key === "Backspace" &&
|
|
2295
|
-
let t =
|
|
2735
|
+
if (e.key === "Backspace" && ft != null && e.currentTarget.selectionStart === e.currentTarget.selectionEnd && e.currentTarget.selectionStart != null) {
|
|
2736
|
+
let t = ft(e.currentTarget.selectionStart);
|
|
2296
2737
|
if (t != null) {
|
|
2297
2738
|
e.preventDefault();
|
|
2298
2739
|
let n = e.currentTarget;
|
|
2299
|
-
n.setSelectionRange(t.start, t.start + t.length), typeof document.execCommand == "function" && document.execCommand("delete", !1) || Qe(n,
|
|
2740
|
+
n.setSelectionRange(t.start, t.start + t.length), typeof document.execCommand == "function" && document.execCommand("delete", !1) || Qe(n, X.slice(0, t.start) + X.slice(t.start + t.length), t.start);
|
|
2300
2741
|
return;
|
|
2301
2742
|
}
|
|
2302
2743
|
}
|
|
2303
2744
|
}
|
|
2304
|
-
e.key === "Enter" && $n(e) && (e.preventDefault(), !s && Wn && Xn && !
|
|
2745
|
+
e.key === "Enter" && $n(e) && (e.preventDefault(), !s && Wn && Xn && !Ae && Qn());
|
|
2305
2746
|
}
|
|
2306
2747
|
}, nr = (e) => {
|
|
2307
2748
|
let t = Array.from(e.target.files ?? []);
|
|
2308
2749
|
if (t.length === 0) return;
|
|
2309
|
-
let n =
|
|
2310
|
-
e.target.value = "",
|
|
2311
|
-
}, rr =
|
|
2750
|
+
let n = yn(t);
|
|
2751
|
+
e.target.value = "", bn(n);
|
|
2752
|
+
}, rr = U(() => {
|
|
2312
2753
|
let e = [];
|
|
2313
|
-
return
|
|
2314
|
-
offset:
|
|
2315
|
-
node: /* @__PURE__ */
|
|
2316
|
-
ref:
|
|
2754
|
+
return ln != null && e.push({
|
|
2755
|
+
offset: ln,
|
|
2756
|
+
node: /* @__PURE__ */ z("span", {
|
|
2757
|
+
ref: un,
|
|
2317
2758
|
"aria-hidden": !0,
|
|
2318
2759
|
className: "inline-block h-lh w-0 align-text-top"
|
|
2319
2760
|
}, "caret-marker")
|
|
2320
|
-
}),
|
|
2321
|
-
offset:
|
|
2322
|
-
node: /* @__PURE__ */
|
|
2323
|
-
className:
|
|
2761
|
+
}), cn && q != null && on != null && e.push({
|
|
2762
|
+
offset: on,
|
|
2763
|
+
node: /* @__PURE__ */ z("span", {
|
|
2764
|
+
className: J.commandHint,
|
|
2324
2765
|
"aria-hidden": !0,
|
|
2325
2766
|
"data-mirror-synthetic": !0,
|
|
2326
|
-
children:
|
|
2767
|
+
children: q.emptyQueryHint
|
|
2327
2768
|
}, "command-hint")
|
|
2328
2769
|
}), e;
|
|
2329
2770
|
}, [
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
]), ir =
|
|
2335
|
-
textareaRef:
|
|
2336
|
-
message:
|
|
2771
|
+
ln,
|
|
2772
|
+
cn,
|
|
2773
|
+
q,
|
|
2774
|
+
on
|
|
2775
|
+
]), ir = Rt || rr.length > 0, { mirrorRef: ar, selectionRects: or, updateSelectionRects: sr, syncMirrorToTextarea: cr } = Xe({
|
|
2776
|
+
textareaRef: Q,
|
|
2777
|
+
message: X,
|
|
2337
2778
|
isMirrorActive: ir
|
|
2338
2779
|
});
|
|
2339
|
-
|
|
2340
|
-
|
|
2780
|
+
Me(() => {
|
|
2781
|
+
mn();
|
|
2341
2782
|
}, [
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2783
|
+
mn,
|
|
2784
|
+
ln,
|
|
2785
|
+
X
|
|
2345
2786
|
]);
|
|
2346
|
-
let lr = /* @__PURE__ */
|
|
2347
|
-
className: l(
|
|
2348
|
-
ref:
|
|
2349
|
-
autoFocus:
|
|
2350
|
-
value:
|
|
2787
|
+
let lr = /* @__PURE__ */ z("textarea", {
|
|
2788
|
+
className: l(J.textarea, ir && J.textareaMentionMode, ie?.fontClassName || "dial-body-paragraph-text", "relative z-0 field-sizing-content max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent ps-1 pe-1 outline-hidden", "disabled:cursor-not-allowed"),
|
|
2789
|
+
ref: Q,
|
|
2790
|
+
autoFocus: mt,
|
|
2791
|
+
value: X,
|
|
2351
2792
|
onChange: (e) => {
|
|
2352
|
-
|
|
2793
|
+
Z(e.target.value), It.notifyChange();
|
|
2353
2794
|
let t = e.nativeEvent instanceof InputEvent ? e.nativeEvent : void 0;
|
|
2354
|
-
|
|
2795
|
+
qt(e.target.value, e.target.selectionStart ?? e.target.value.length, t?.isComposing ?? !1), u?.(e.target.value);
|
|
2355
2796
|
},
|
|
2356
2797
|
onSelect: sr,
|
|
2357
2798
|
onScroll: () => {
|
|
2358
|
-
cr(),
|
|
2799
|
+
cr(), ln != null && mn();
|
|
2359
2800
|
},
|
|
2360
|
-
onFocus:
|
|
2361
|
-
onClick:
|
|
2801
|
+
onFocus: nn,
|
|
2802
|
+
onClick: en,
|
|
2362
2803
|
onKeyDown: tr,
|
|
2363
|
-
onKeyUp:
|
|
2804
|
+
onKeyUp: rn,
|
|
2364
2805
|
onPaste: Hn,
|
|
2365
2806
|
placeholder: m,
|
|
2366
2807
|
"aria-label": h,
|
|
2367
|
-
"aria-autocomplete":
|
|
2368
|
-
"aria-controls":
|
|
2369
|
-
"aria-activedescendant":
|
|
2370
|
-
"aria-hidden":
|
|
2371
|
-
disabled:
|
|
2372
|
-
readOnly:
|
|
2808
|
+
"aria-autocomplete": q == null ? void 0 : "list",
|
|
2809
|
+
"aria-controls": Ht ? Jt : void 0,
|
|
2810
|
+
"aria-activedescendant": Xt ?? void 0,
|
|
2811
|
+
"aria-hidden": Rt ? !0 : void 0,
|
|
2812
|
+
disabled: Ae,
|
|
2813
|
+
readOnly: Ln,
|
|
2373
2814
|
rows: 1
|
|
2374
|
-
}), ur = /* @__PURE__ */
|
|
2815
|
+
}), ur = /* @__PURE__ */ B(le, { children: [lr, q != null && /* @__PURE__ */ z("div", {
|
|
2375
2816
|
"aria-hidden": !0,
|
|
2376
|
-
className: l("pointer-events-none absolute",
|
|
2817
|
+
className: l("pointer-events-none absolute", ie?.fontClassName || "dial-body-paragraph-text"),
|
|
2377
2818
|
style: {
|
|
2378
|
-
left:
|
|
2379
|
-
top:
|
|
2819
|
+
left: fn?.left ?? 0,
|
|
2820
|
+
top: fn?.top ?? 0
|
|
2380
2821
|
},
|
|
2381
|
-
children: /* @__PURE__ */
|
|
2382
|
-
open:
|
|
2822
|
+
children: /* @__PURE__ */ z(y, {
|
|
2823
|
+
open: Ht,
|
|
2383
2824
|
onOpenChange: (e) => {
|
|
2384
|
-
e ||
|
|
2825
|
+
e || Gt();
|
|
2385
2826
|
},
|
|
2386
2827
|
placement: "top-start",
|
|
2387
2828
|
trigger: [],
|
|
2388
2829
|
initialFocus: -1,
|
|
2389
2830
|
matchReferenceWidth: !1,
|
|
2390
|
-
outsidePressIgnoreRef:
|
|
2831
|
+
outsidePressIgnoreRef: Q,
|
|
2391
2832
|
renderOverlay: () => {
|
|
2392
|
-
let e =
|
|
2393
|
-
return /* @__PURE__ */
|
|
2394
|
-
ref:
|
|
2833
|
+
let e = q.menuLabel != null;
|
|
2834
|
+
return /* @__PURE__ */ z("div", {
|
|
2835
|
+
ref: Yt,
|
|
2395
2836
|
role: e ? "group" : void 0,
|
|
2396
|
-
"aria-label":
|
|
2397
|
-
children:
|
|
2398
|
-
query:
|
|
2399
|
-
caretPosition:
|
|
2400
|
-
close:
|
|
2401
|
-
listboxId:
|
|
2402
|
-
activeOptionId:
|
|
2837
|
+
"aria-label": q.menuLabel,
|
|
2838
|
+
children: q.renderMenu({
|
|
2839
|
+
query: Ut,
|
|
2840
|
+
caretPosition: $ ?? 0,
|
|
2841
|
+
close: hn,
|
|
2842
|
+
listboxId: Jt,
|
|
2843
|
+
activeOptionId: Xt
|
|
2403
2844
|
})
|
|
2404
2845
|
});
|
|
2405
2846
|
},
|
|
2406
|
-
children: /* @__PURE__ */
|
|
2847
|
+
children: /* @__PURE__ */ z("span", {
|
|
2407
2848
|
"aria-hidden": !0,
|
|
2408
2849
|
className: "inline-block h-lh w-0"
|
|
2409
2850
|
})
|
|
2410
2851
|
})
|
|
2411
|
-
})] }), dr = /* @__PURE__ */
|
|
2412
|
-
ref:
|
|
2852
|
+
})] }), dr = /* @__PURE__ */ B("div", {
|
|
2853
|
+
ref: dn,
|
|
2413
2854
|
className: "relative -ms-1 -me-1 w-[calc(100%+8px)]",
|
|
2414
|
-
children: [ir && /* @__PURE__ */
|
|
2855
|
+
children: [ir && /* @__PURE__ */ B("div", {
|
|
2415
2856
|
ref: ar,
|
|
2416
|
-
className: l(
|
|
2417
|
-
children: [qe(
|
|
2857
|
+
className: l(J.textarea, ie?.fontClassName || "dial-body-paragraph-text", "pointer-events-none absolute inset-0 z-10 max-h-[272px] w-full overflow-hidden ps-1 pe-1 wrap-anywhere whitespace-pre-wrap"),
|
|
2858
|
+
children: [qe(X, Lt, rr, J.mentionHighlight, J.mentionHighlightUnsupported), or.map((e, t) => /* @__PURE__ */ z("div", {
|
|
2418
2859
|
"aria-hidden": !0,
|
|
2419
|
-
className: l("pointer-events-none absolute rounded-sm",
|
|
2860
|
+
className: l("pointer-events-none absolute rounded-sm", J.selectionHighlight),
|
|
2420
2861
|
style: {
|
|
2421
2862
|
left: e.left,
|
|
2422
2863
|
top: e.top,
|
|
@@ -2425,68 +2866,68 @@ var Z = {
|
|
|
2425
2866
|
}
|
|
2426
2867
|
}, `selection-${t}`))]
|
|
2427
2868
|
}), ur]
|
|
2428
|
-
}), fr =
|
|
2429
|
-
onAttachClick:
|
|
2869
|
+
}), fr = we ? void 0 : /* @__PURE__ */ z(bt, {
|
|
2870
|
+
onAttachClick: Te ? void 0 : () => Rn.current?.click(),
|
|
2430
2871
|
attachLabel: g,
|
|
2431
2872
|
addMenuTitle: C,
|
|
2432
2873
|
menuTitle: D,
|
|
2433
2874
|
menuCloseLabel: O,
|
|
2434
|
-
style:
|
|
2435
|
-
isDisabled:
|
|
2436
|
-
chatSettings:
|
|
2437
|
-
extraMenuItems:
|
|
2438
|
-
onRecordVoice:
|
|
2439
|
-
recordVoiceLabel:
|
|
2440
|
-
toolsMenuItems:
|
|
2441
|
-
onToolToggle:
|
|
2442
|
-
toolsMenuTitle:
|
|
2443
|
-
toolsBackLabel:
|
|
2444
|
-
menuOverlays:
|
|
2445
|
-
getCaretPosition: () =>
|
|
2446
|
-
}), pr =
|
|
2447
|
-
className: l("flex",
|
|
2875
|
+
style: Y,
|
|
2876
|
+
isDisabled: Ae || Ln,
|
|
2877
|
+
chatSettings: Je,
|
|
2878
|
+
extraMenuItems: zt,
|
|
2879
|
+
onRecordVoice: Ie && Tt && !s && !Ln ? () => Pn(nt.Attachment) : void 0,
|
|
2880
|
+
recordVoiceLabel: re,
|
|
2881
|
+
toolsMenuItems: rt ? Ye : void 0,
|
|
2882
|
+
onToolToggle: $e,
|
|
2883
|
+
toolsMenuTitle: it,
|
|
2884
|
+
toolsBackLabel: at,
|
|
2885
|
+
menuOverlays: ut,
|
|
2886
|
+
getCaretPosition: () => Q.current?.selectionStart ?? X.length
|
|
2887
|
+
}), pr = De === lt.Inline && (!Nt || Oe), mr = fr && /* @__PURE__ */ z("div", {
|
|
2888
|
+
className: l("flex", K.addCluster),
|
|
2448
2889
|
children: fr
|
|
2449
|
-
}), hr = Jn.length > 0 &&
|
|
2450
|
-
className: l("min-w-0", pr ? "flex-1" : "max-w-full flex-[1_0_auto]",
|
|
2451
|
-
children: /* @__PURE__ */
|
|
2890
|
+
}), hr = Jn.length > 0 && $e != null && /* @__PURE__ */ z("div", {
|
|
2891
|
+
className: l("min-w-0", pr ? "flex-1" : "max-w-full flex-[1_0_auto]", K.toolsChips),
|
|
2892
|
+
children: /* @__PURE__ */ z(Ct, {
|
|
2452
2893
|
items: Jn,
|
|
2453
|
-
onToolToggle:
|
|
2894
|
+
onToolToggle: $e,
|
|
2454
2895
|
onToolDismiss: Yn,
|
|
2455
|
-
canRemove:
|
|
2456
|
-
removeLabel:
|
|
2457
|
-
stateOnLabel:
|
|
2458
|
-
stateOffLabel:
|
|
2896
|
+
canRemove: rt,
|
|
2897
|
+
removeLabel: ot?.removeLabel,
|
|
2898
|
+
stateOnLabel: ot?.stateOnLabel,
|
|
2899
|
+
stateOffLabel: ot?.stateOffLabel
|
|
2459
2900
|
})
|
|
2460
2901
|
});
|
|
2461
|
-
return /* @__PURE__ */
|
|
2902
|
+
return /* @__PURE__ */ B("div", {
|
|
2462
2903
|
ref: zn,
|
|
2463
|
-
style:
|
|
2464
|
-
className: l(
|
|
2904
|
+
style: Y,
|
|
2905
|
+
className: l(J.wrapper, Ae && J.wrapperDisabled, Ae && "cursor-not-allowed", "flex w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border", "p-4 focus-within:outline focus-within:-outline-offset-1 active:outline active:-outline-offset-1", se, K.wrapper),
|
|
2465
2906
|
children: [
|
|
2466
|
-
(
|
|
2467
|
-
attachments: [...
|
|
2907
|
+
(We.length > 0 || vn.length > 0) && /* @__PURE__ */ z(ue, {
|
|
2908
|
+
attachments: [...We, ...vn],
|
|
2468
2909
|
onRemove: (e) => {
|
|
2469
|
-
|
|
2910
|
+
We.some((t) => t.id === e) ? Ge?.(e) : Sn(e);
|
|
2470
2911
|
},
|
|
2471
|
-
onRetry:
|
|
2472
|
-
onExpand:
|
|
2912
|
+
onRetry: Cn,
|
|
2913
|
+
onExpand: wn,
|
|
2473
2914
|
labels: {
|
|
2474
2915
|
removeLabel: k,
|
|
2475
2916
|
retryLabel: ee,
|
|
2476
2917
|
uploadingLabel: A,
|
|
2477
|
-
expandLabel:
|
|
2478
|
-
clickLabel:
|
|
2918
|
+
expandLabel: j,
|
|
2919
|
+
clickLabel: M
|
|
2479
2920
|
},
|
|
2480
2921
|
styles: {
|
|
2481
|
-
...
|
|
2482
|
-
className: l(
|
|
2922
|
+
...ae,
|
|
2923
|
+
className: l(vn.length > 6 && "-me-4", ae?.className)
|
|
2483
2924
|
},
|
|
2484
|
-
onAttachmentClick:
|
|
2485
|
-
let t = [...
|
|
2486
|
-
t != null &&
|
|
2925
|
+
onAttachmentClick: yt == null ? void 0 : (e) => {
|
|
2926
|
+
let t = [...We, ...vn].find((t) => t.id === e);
|
|
2927
|
+
t != null && yt(t);
|
|
2487
2928
|
}
|
|
2488
2929
|
}),
|
|
2489
|
-
!
|
|
2930
|
+
!we && /* @__PURE__ */ z("input", {
|
|
2490
2931
|
ref: Rn,
|
|
2491
2932
|
type: "file",
|
|
2492
2933
|
multiple: !0,
|
|
@@ -2496,128 +2937,128 @@ var Z = {
|
|
|
2496
2937
|
tabIndex: -1,
|
|
2497
2938
|
onChange: nr
|
|
2498
2939
|
}),
|
|
2499
|
-
/* @__PURE__ */
|
|
2940
|
+
/* @__PURE__ */ z(w, {
|
|
2500
2941
|
politeness: E.Assertive,
|
|
2501
2942
|
className: "min-w-0 px-1 wrap-break-word",
|
|
2502
|
-
children:
|
|
2943
|
+
children: Nn && /* @__PURE__ */ z(x, { text: Nn })
|
|
2503
2944
|
}),
|
|
2504
|
-
|
|
2945
|
+
Ln && /* @__PURE__ */ z(Ot, {
|
|
2505
2946
|
embedded: !0,
|
|
2506
|
-
state:
|
|
2507
|
-
analyserNodeRef:
|
|
2508
|
-
onStop:
|
|
2509
|
-
onDiscard:
|
|
2947
|
+
state: jn,
|
|
2948
|
+
analyserNodeRef: Mn,
|
|
2949
|
+
onStop: Fn,
|
|
2950
|
+
onDiscard: In,
|
|
2510
2951
|
attachButton: fr,
|
|
2511
|
-
stopLabel:
|
|
2512
|
-
discardLabel:
|
|
2513
|
-
processingLabel:
|
|
2952
|
+
stopLabel: I,
|
|
2953
|
+
discardLabel: L,
|
|
2954
|
+
processingLabel: ze
|
|
2514
2955
|
}),
|
|
2515
|
-
|
|
2516
|
-
|
|
2956
|
+
!Ln && Ee && dr,
|
|
2957
|
+
!Ln && !Ee && pr && hr && /* @__PURE__ */ z("div", {
|
|
2517
2958
|
className: "flex",
|
|
2518
2959
|
children: hr
|
|
2519
2960
|
}),
|
|
2520
|
-
|
|
2521
|
-
className: l("flex items-center gap-2", pr ? "flex-nowrap" : "flex-wrap",
|
|
2961
|
+
!Ln && !Ee && /* @__PURE__ */ B("div", {
|
|
2962
|
+
className: l("flex items-center gap-2", pr ? "flex-nowrap" : "flex-wrap", K.actionRow),
|
|
2522
2963
|
children: [
|
|
2523
2964
|
pr && mr,
|
|
2524
|
-
/* @__PURE__ */
|
|
2525
|
-
className: l("flex min-w-0 items-center self-stretch", pr ? "flex-1" : "w-full",
|
|
2965
|
+
/* @__PURE__ */ z("div", {
|
|
2966
|
+
className: l("flex min-w-0 items-center self-stretch", pr ? "flex-1" : "w-full", K.textareaWrap),
|
|
2526
2967
|
children: dr
|
|
2527
2968
|
}),
|
|
2528
2969
|
!pr && mr,
|
|
2529
2970
|
!pr && hr,
|
|
2530
|
-
/* @__PURE__ */
|
|
2531
|
-
className: l("ms-auto flex shrink-0 items-center gap-2",
|
|
2532
|
-
children:
|
|
2971
|
+
/* @__PURE__ */ z("div", {
|
|
2972
|
+
className: l("ms-auto flex shrink-0 items-center gap-2", K.footerActions),
|
|
2973
|
+
children: ke ? ke({
|
|
2533
2974
|
canSend: Wn,
|
|
2534
2975
|
onSend: Qn
|
|
2535
|
-
}) : /* @__PURE__ */
|
|
2536
|
-
|
|
2537
|
-
/* @__PURE__ */
|
|
2538
|
-
deployments:
|
|
2539
|
-
selectedDeploymentId:
|
|
2540
|
-
onDeploymentChange:
|
|
2541
|
-
modelSelectorLabels:
|
|
2542
|
-
menuStyles:
|
|
2543
|
-
nameClassName:
|
|
2544
|
-
versionClassName:
|
|
2976
|
+
}) : /* @__PURE__ */ B(le, { children: [
|
|
2977
|
+
Dt,
|
|
2978
|
+
/* @__PURE__ */ z(An, {
|
|
2979
|
+
deployments: _e,
|
|
2980
|
+
selectedDeploymentId: be,
|
|
2981
|
+
onDeploymentChange: xe,
|
|
2982
|
+
modelSelectorLabels: Se,
|
|
2983
|
+
menuStyles: oe,
|
|
2984
|
+
nameClassName: ie?.modelSelectorNameClassName,
|
|
2985
|
+
versionClassName: ie?.modelSelectorVersionClassName,
|
|
2545
2986
|
isStreaming: s,
|
|
2546
|
-
isMobile:
|
|
2547
|
-
isDisabled:
|
|
2548
|
-
style:
|
|
2549
|
-
modelPickerOverlay:
|
|
2550
|
-
isPickerOpen:
|
|
2551
|
-
onPickerToggle: () =>
|
|
2552
|
-
onPickerOpenChange:
|
|
2987
|
+
isMobile: Nt,
|
|
2988
|
+
isDisabled: Ne,
|
|
2989
|
+
style: Y,
|
|
2990
|
+
modelPickerOverlay: xt,
|
|
2991
|
+
isPickerOpen: Pt,
|
|
2992
|
+
onPickerToggle: () => Ft((e) => !e),
|
|
2993
|
+
onPickerOpenChange: Ft
|
|
2553
2994
|
}),
|
|
2554
|
-
Zn && /* @__PURE__ */
|
|
2555
|
-
icon: /* @__PURE__ */
|
|
2995
|
+
Zn && /* @__PURE__ */ z(S, {
|
|
2996
|
+
icon: /* @__PURE__ */ z(ye, {
|
|
2556
2997
|
size: _.LG,
|
|
2557
2998
|
stroke: v,
|
|
2558
2999
|
"aria-hidden": !0
|
|
2559
3000
|
}),
|
|
2560
|
-
"aria-label":
|
|
2561
|
-
tooltipProps: { tooltip:
|
|
3001
|
+
"aria-label": ne,
|
|
3002
|
+
tooltipProps: { tooltip: ne },
|
|
2562
3003
|
className: "shrink-0",
|
|
2563
|
-
onClick: () =>
|
|
2564
|
-
disabled:
|
|
3004
|
+
onClick: () => Pn(nt.Dictation),
|
|
3005
|
+
disabled: Ae || s
|
|
2565
3006
|
}),
|
|
2566
|
-
s && o ? /* @__PURE__ */
|
|
3007
|
+
s && o ? /* @__PURE__ */ z(At, {
|
|
2567
3008
|
onStop: o,
|
|
2568
|
-
ariaLabel:
|
|
2569
|
-
}) : !s && /* @__PURE__ */
|
|
3009
|
+
ariaLabel: F
|
|
3010
|
+
}) : !s && /* @__PURE__ */ z(kt, {
|
|
2570
3011
|
onSend: Qn,
|
|
2571
3012
|
isDisabled: !Xn || !Wn,
|
|
2572
|
-
ariaLabel:
|
|
2573
|
-
sendTooltip: Un ?
|
|
3013
|
+
ariaLabel: N,
|
|
3014
|
+
sendTooltip: Un ? P : te ?? P
|
|
2574
3015
|
})
|
|
2575
3016
|
] })
|
|
2576
3017
|
})
|
|
2577
3018
|
]
|
|
2578
3019
|
}),
|
|
2579
|
-
/* @__PURE__ */
|
|
3020
|
+
/* @__PURE__ */ z(w, {
|
|
2580
3021
|
visuallyHidden: !0,
|
|
2581
3022
|
atomic: !0,
|
|
2582
3023
|
as: T.Span,
|
|
2583
|
-
children: /* @__PURE__ */
|
|
3024
|
+
children: /* @__PURE__ */ z("span", { children: On.text }, On.revision)
|
|
2584
3025
|
})
|
|
2585
3026
|
]
|
|
2586
3027
|
});
|
|
2587
3028
|
});
|
|
2588
|
-
|
|
2589
|
-
var
|
|
3029
|
+
jn.displayName = "Input";
|
|
3030
|
+
var Mn = {
|
|
2590
3031
|
welcome: "_welcome_1icyo_1",
|
|
2591
3032
|
description: "_description_1icyo_5"
|
|
2592
|
-
},
|
|
3033
|
+
}, Nn = ({ isStreaming: e = !1, placeholder: t = "Type a prompt or use \"/\" to select one", welcomeText: n, descriptionText: r, belowWelcomeSlot: i, aboveInputSlot: a, styles: o, className: s, inputClassName: u, isInputDisabled: d = !1, ...f }) => {
|
|
2593
3034
|
let { colors: p, typography: m, attachmentTray: h, modelMenu: g } = o ?? {}, _ = c({
|
|
2594
3035
|
"--ci-welcome-color": p?.welcomeText,
|
|
2595
3036
|
"--ci-description-color": p?.descriptionText
|
|
2596
3037
|
});
|
|
2597
|
-
return /* @__PURE__ */
|
|
3038
|
+
return /* @__PURE__ */ B("div", {
|
|
2598
3039
|
style: _,
|
|
2599
3040
|
className: l("relative flex w-full flex-col items-center gap-9 px-4 py-5 desktop:p-5", s),
|
|
2600
3041
|
children: [
|
|
2601
|
-
n && /* @__PURE__ */
|
|
3042
|
+
n && /* @__PURE__ */ B("div", {
|
|
2602
3043
|
className: "flex max-w-full flex-col items-center gap-4 text-center",
|
|
2603
|
-
children: [/* @__PURE__ */
|
|
2604
|
-
className: l(
|
|
3044
|
+
children: [/* @__PURE__ */ z("h1", {
|
|
3045
|
+
className: l(Mn.welcome, "m-0 max-w-full wrap-anywhere", m?.welcomeClassName || "dial-display2-text"),
|
|
2605
3046
|
children: n
|
|
2606
|
-
}), r && /* @__PURE__ */
|
|
2607
|
-
className: l(
|
|
3047
|
+
}), r && /* @__PURE__ */ z("p", {
|
|
3048
|
+
className: l(Mn.description, "m-0 max-w-[540px]", m?.descriptionClassName || "dial-body-paragraph-text"),
|
|
2608
3049
|
children: r
|
|
2609
3050
|
})]
|
|
2610
3051
|
}),
|
|
2611
|
-
i != null && /* @__PURE__ */
|
|
3052
|
+
i != null && /* @__PURE__ */ z("div", {
|
|
2612
3053
|
className: "flex w-full max-w-[700px] flex-col items-center empty:hidden",
|
|
2613
3054
|
children: i
|
|
2614
3055
|
}),
|
|
2615
|
-
/* @__PURE__ */
|
|
3056
|
+
/* @__PURE__ */ B("div", {
|
|
2616
3057
|
className: l("relative w-full", n ? "max-w-[700px]" : "max-w-[748px]"),
|
|
2617
|
-
children: [a != null && /* @__PURE__ */
|
|
3058
|
+
children: [a != null && /* @__PURE__ */ z("div", {
|
|
2618
3059
|
className: "mb-2",
|
|
2619
3060
|
children: a
|
|
2620
|
-
}), /* @__PURE__ */
|
|
3061
|
+
}), /* @__PURE__ */ z(jn, {
|
|
2621
3062
|
placeholder: t,
|
|
2622
3063
|
isStreaming: e,
|
|
2623
3064
|
isInputDisabled: d,
|
|
@@ -2631,36 +3072,36 @@ var ln = {
|
|
|
2631
3072
|
})
|
|
2632
3073
|
]
|
|
2633
3074
|
});
|
|
2634
|
-
},
|
|
2635
|
-
let
|
|
2636
|
-
|
|
2637
|
-
A?.length && (
|
|
2638
|
-
}, [A,
|
|
2639
|
-
let [
|
|
2640
|
-
|
|
2641
|
-
},
|
|
2642
|
-
m(e,
|
|
2643
|
-
}, [
|
|
2644
|
-
|
|
2645
|
-
},
|
|
2646
|
-
|
|
2647
|
-
}, [n]),
|
|
3075
|
+
}, Pn = ({ message: e, messageRevision: t, onChange: n, activeMentions: r, onBackspaceAtCaret: i, caretPositionOverride: o, commandMenu: s, menuOverlays: c, sendOnEnter: u, initialAttachments: d = [], onCancel: p, onSave: m, onUploadAttachment: h, cancelLabel: g = "Cancel", saveLabel: _ = "Save & Submit", ariaLabel: y, removeLabel: b, retryLabel: x, uploadingLabel: S, expandLabel: C, clickLabel: w, addMenuTitle: T = "Add", attachLabel: E = "Attach file", menuTitle: D = "Menu", menuCloseLabel: k = "Close", className: ee, pendingDropFiles: A, onDropFilesConsumed: j, validateAttachment: M, isAttachmentsEnabled: N, isTextAttachmentsAllowed: te, hideAttachFile: F = !1, fileAccept: ne, maximumAttachmentsAmount: re, onAttachmentsLimitExceeded: I, onDialFileSystemClick: L, dialFileSystemLabel: R, pendingAttachments: ie, onPendingAttachmentsConsumed: ae, onAttachmentClick: oe, pasteTextThreshold: se, maxMessageLength: ce = 5e4, onMessageTooLong: le }) => {
|
|
3076
|
+
let ue = W(null), de = W(null), [fe, pe] = G([]);
|
|
3077
|
+
H(() => {
|
|
3078
|
+
A?.length && (pe(A), j?.());
|
|
3079
|
+
}, [A, j]);
|
|
3080
|
+
let [me, he] = G(e ?? ""), [ge, _e] = G([]), [ye, be] = G(d), xe = ge.some((e) => e.status === a.Loading || e.status === a.Error), Se = (me.trim().length > 0 || ge.length > 0 || ye.length > 0) && !xe, Ce = (e) => {
|
|
3081
|
+
be((t) => t.filter((t) => t.id !== e));
|
|
3082
|
+
}, we = V((e, t) => {
|
|
3083
|
+
m(e, ye, t);
|
|
3084
|
+
}, [ye, m]), Te = () => {
|
|
3085
|
+
Se && (me.length >= ce ? le?.(me.length, ce) : we(me, ge));
|
|
3086
|
+
}, Ee = V(() => pe([]), []), De = V((e) => {
|
|
3087
|
+
he(e), n?.(e);
|
|
3088
|
+
}, [n]), Oe = V((e) => {
|
|
2648
3089
|
let t = Array.from(e.target.files ?? []);
|
|
2649
|
-
t.length !== 0 && (e.target.value = "",
|
|
2650
|
-
}, []),
|
|
3090
|
+
t.length !== 0 && (e.target.value = "", pe(t));
|
|
3091
|
+
}, []), ke = U(() => L ? [{
|
|
2651
3092
|
key: "dial-fs",
|
|
2652
|
-
label:
|
|
2653
|
-
icon: /* @__PURE__ */
|
|
3093
|
+
label: R ?? "DIAL file system",
|
|
3094
|
+
icon: /* @__PURE__ */ z(ve, {
|
|
2654
3095
|
size: f,
|
|
2655
3096
|
"aria-hidden": !0,
|
|
2656
3097
|
stroke: v
|
|
2657
3098
|
}),
|
|
2658
|
-
onClick:
|
|
2659
|
-
}] : [], [
|
|
2660
|
-
return /* @__PURE__ */
|
|
3099
|
+
onClick: L
|
|
3100
|
+
}] : [], [L, R]);
|
|
3101
|
+
return /* @__PURE__ */ B("div", {
|
|
2661
3102
|
className: l("flex w-full flex-col gap-2", ee),
|
|
2662
|
-
children: [/* @__PURE__ */
|
|
2663
|
-
ref:
|
|
3103
|
+
children: [/* @__PURE__ */ z(jn, {
|
|
3104
|
+
ref: de,
|
|
2664
3105
|
message: e,
|
|
2665
3106
|
messageRevision: t,
|
|
2666
3107
|
activeMentions: r,
|
|
@@ -2670,108 +3111,108 @@ var ln = {
|
|
|
2670
3111
|
ariaLabel: y,
|
|
2671
3112
|
hideActionBar: !0,
|
|
2672
3113
|
sendOnEnter: u,
|
|
2673
|
-
pendingDropFiles:
|
|
2674
|
-
onDropFilesConsumed:
|
|
2675
|
-
onSend:
|
|
3114
|
+
pendingDropFiles: fe,
|
|
3115
|
+
onDropFilesConsumed: Ee,
|
|
3116
|
+
onSend: we,
|
|
2676
3117
|
onUploadAttachment: h,
|
|
2677
|
-
onChange:
|
|
2678
|
-
onAttachmentsChange:
|
|
3118
|
+
onChange: De,
|
|
3119
|
+
onAttachmentsChange: _e,
|
|
2679
3120
|
removeLabel: b,
|
|
2680
3121
|
retryLabel: x,
|
|
2681
3122
|
uploadingLabel: S,
|
|
2682
3123
|
expandLabel: C,
|
|
2683
3124
|
clickLabel: w,
|
|
2684
3125
|
className: "max-w-full",
|
|
2685
|
-
prefixAttachments:
|
|
2686
|
-
onRemovePrefixAttachment:
|
|
2687
|
-
validateAttachment:
|
|
2688
|
-
isAttachmentsEnabled:
|
|
2689
|
-
isTextAttachmentsAllowed:
|
|
2690
|
-
maximumAttachmentsAmount:
|
|
2691
|
-
onAttachmentsLimitExceeded:
|
|
2692
|
-
pendingAttachments:
|
|
2693
|
-
onPendingAttachmentsConsumed:
|
|
2694
|
-
onAttachmentClick:
|
|
2695
|
-
pasteTextThreshold:
|
|
2696
|
-
maxMessageLength:
|
|
2697
|
-
onMessageTooLong:
|
|
2698
|
-
}), /* @__PURE__ */
|
|
3126
|
+
prefixAttachments: ye,
|
|
3127
|
+
onRemovePrefixAttachment: Ce,
|
|
3128
|
+
validateAttachment: M,
|
|
3129
|
+
isAttachmentsEnabled: N,
|
|
3130
|
+
isTextAttachmentsAllowed: te,
|
|
3131
|
+
maximumAttachmentsAmount: re,
|
|
3132
|
+
onAttachmentsLimitExceeded: I,
|
|
3133
|
+
pendingAttachments: ie,
|
|
3134
|
+
onPendingAttachmentsConsumed: ae,
|
|
3135
|
+
onAttachmentClick: oe,
|
|
3136
|
+
pasteTextThreshold: se,
|
|
3137
|
+
maxMessageLength: ce,
|
|
3138
|
+
onMessageTooLong: le
|
|
3139
|
+
}), /* @__PURE__ */ B("div", {
|
|
2699
3140
|
className: "flex items-center justify-between",
|
|
2700
|
-
children: [/* @__PURE__ */
|
|
3141
|
+
children: [/* @__PURE__ */ B("div", {
|
|
2701
3142
|
className: "flex",
|
|
2702
|
-
children: [!
|
|
2703
|
-
ref:
|
|
3143
|
+
children: [!F && /* @__PURE__ */ z("input", {
|
|
3144
|
+
ref: ue,
|
|
2704
3145
|
type: "file",
|
|
2705
3146
|
multiple: !0,
|
|
2706
|
-
accept:
|
|
3147
|
+
accept: ne,
|
|
2707
3148
|
className: "sr-only",
|
|
2708
3149
|
"aria-hidden": !0,
|
|
2709
3150
|
tabIndex: -1,
|
|
2710
|
-
onChange:
|
|
2711
|
-
}), (!
|
|
2712
|
-
onAttachClick:
|
|
3151
|
+
onChange: Oe
|
|
3152
|
+
}), (!F || (c?.length ?? 0) > 0) && /* @__PURE__ */ z(bt, {
|
|
3153
|
+
onAttachClick: F ? void 0 : () => ue.current?.click(),
|
|
2713
3154
|
attachLabel: E,
|
|
2714
3155
|
addMenuTitle: T,
|
|
2715
3156
|
menuTitle: D,
|
|
2716
3157
|
menuCloseLabel: k,
|
|
2717
|
-
extraMenuItems:
|
|
3158
|
+
extraMenuItems: ke,
|
|
2718
3159
|
menuOverlays: c,
|
|
2719
|
-
getCaretPosition: () =>
|
|
3160
|
+
getCaretPosition: () => de.current?.getCaretPosition() ?? 0
|
|
2720
3161
|
})]
|
|
2721
|
-
}), /* @__PURE__ */
|
|
3162
|
+
}), /* @__PURE__ */ B("div", {
|
|
2722
3163
|
className: "flex gap-2",
|
|
2723
|
-
children: [/* @__PURE__ */
|
|
3164
|
+
children: [/* @__PURE__ */ z(O, {
|
|
2724
3165
|
label: g,
|
|
2725
3166
|
onClick: p
|
|
2726
|
-
}), /* @__PURE__ */
|
|
3167
|
+
}), /* @__PURE__ */ z(P, {
|
|
2727
3168
|
label: _,
|
|
2728
|
-
onClick:
|
|
2729
|
-
disabled: !
|
|
3169
|
+
onClick: Te,
|
|
3170
|
+
disabled: !Se
|
|
2730
3171
|
})]
|
|
2731
3172
|
})]
|
|
2732
3173
|
})]
|
|
2733
3174
|
});
|
|
2734
|
-
},
|
|
3175
|
+
}, Fn = /* @__PURE__ */ function(e) {
|
|
2735
3176
|
return e.Warning = "warning", e.Reached = "reached", e;
|
|
2736
|
-
}({}),
|
|
2737
|
-
[
|
|
2738
|
-
[
|
|
2739
|
-
},
|
|
2740
|
-
let d = /* @__PURE__ */
|
|
3177
|
+
}({}), In = { banner: "_banner_180n6_2" }, Ln = {
|
|
3178
|
+
[Fn.Warning]: j.Warning,
|
|
3179
|
+
[Fn.Reached]: j.Error
|
|
3180
|
+
}, Rn = ({ severity: e, limitText: t, reset: n, onClose: r, closeAriaLabel: i = "Close notification", limitTextClassName: a = "dial-small-paragraph-semi-text", resetTextClassName: o = "dial-small-paragraph-text", className: s, colors: u }) => {
|
|
3181
|
+
let d = /* @__PURE__ */ z("span", {
|
|
2741
3182
|
className: a,
|
|
2742
3183
|
children: t
|
|
2743
|
-
}), f = n != null && /* @__PURE__ */
|
|
3184
|
+
}), f = n != null && /* @__PURE__ */ B(le, { children: [
|
|
2744
3185
|
" ",
|
|
2745
|
-
/* @__PURE__ */
|
|
3186
|
+
/* @__PURE__ */ z("time", {
|
|
2746
3187
|
dateTime: n.isoValue,
|
|
2747
3188
|
"aria-hidden": n.ariaLabel != null || void 0,
|
|
2748
3189
|
className: o,
|
|
2749
3190
|
children: n.label
|
|
2750
3191
|
}),
|
|
2751
|
-
n.ariaLabel != null && /* @__PURE__ */
|
|
3192
|
+
n.ariaLabel != null && /* @__PURE__ */ z("span", {
|
|
2752
3193
|
className: "sr-only",
|
|
2753
3194
|
children: n.ariaLabel
|
|
2754
3195
|
})
|
|
2755
3196
|
] });
|
|
2756
|
-
return /* @__PURE__ */
|
|
3197
|
+
return /* @__PURE__ */ z(ee, {
|
|
2757
3198
|
role: "status",
|
|
2758
|
-
variant:
|
|
3199
|
+
variant: Ln[e],
|
|
2759
3200
|
type: A.SectionMessage,
|
|
2760
3201
|
title: f ? d : void 0,
|
|
2761
3202
|
message: f || d,
|
|
2762
|
-
className: l(
|
|
3203
|
+
className: l(In.banner, K.usageBanner, s),
|
|
2763
3204
|
style: c({ "--ci-usage-banner-bg": u?.background }),
|
|
2764
|
-
children: r != null && /* @__PURE__ */
|
|
3205
|
+
children: r != null && /* @__PURE__ */ z(g, {
|
|
2765
3206
|
className: "shrink-0 self-start",
|
|
2766
3207
|
ariaLabel: i,
|
|
2767
3208
|
onClose: () => r()
|
|
2768
3209
|
})
|
|
2769
3210
|
});
|
|
2770
|
-
},
|
|
2771
|
-
let [t, n] =
|
|
3211
|
+
}, zn = (e) => {
|
|
3212
|
+
let [t, n] = G({
|
|
2772
3213
|
text: e?.text,
|
|
2773
3214
|
revision: e?.revision ?? 0
|
|
2774
|
-
}), r =
|
|
3215
|
+
}), r = V((e) => {
|
|
2775
3216
|
n((t) => ({
|
|
2776
3217
|
text: e,
|
|
2777
3218
|
revision: t.revision + 1
|
|
@@ -2782,11 +3223,11 @@ var ln = {
|
|
|
2782
3223
|
messageRevision: t.revision,
|
|
2783
3224
|
seedMessage: r
|
|
2784
3225
|
};
|
|
2785
|
-
},
|
|
2786
|
-
let n =
|
|
2787
|
-
r.current = t,
|
|
3226
|
+
}, Bn = (e, t) => {
|
|
3227
|
+
let n = W(e), r = W(t);
|
|
3228
|
+
r.current = t, H(() => {
|
|
2788
3229
|
e !== n.current && (n.current = e, r.current());
|
|
2789
3230
|
}, [e]);
|
|
2790
3231
|
};
|
|
2791
3232
|
//#endregion
|
|
2792
|
-
export { lt as ActionRowLayout, Fe as BottomSheetShell,
|
|
3233
|
+
export { lt as ActionRowLayout, Fe as BottomSheetShell, K as CONVERSATION_INPUT_CLASS, gt as ChatSettingsModal, Nn as ConversationInput, Pn as EditMessageInput, jn as Input, ct as SendOnEnter, Fn as UsageLimitBannerSeverity, Rn as UsageLimitBannerView, zn as useComposerSeed, Bn as useComposerSeedSource };
|