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