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