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