@epam/ai-dial-conversation-input 1.2.0-dev.253 → 1.2.0-dev.256
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { AttachmentErrorReason as e, AttachmentType as t, DeploymentIcon as n, MIME_TYPE_EXT_MAP as r, RESIZABLE_TEXTAREA_CLASS_NAME as i, RequestStatus as a, ResponseFormat as o, SELECT_LIST_MAX_HEIGHT_PX as s, buildCssVars as c, mergeClasses as l, normalizeMimeType as u, useIsMobile as d } from "@epam/ai-dial-chat-shared";
|
|
2
|
-
import { BASE_ICON_SIZE as f,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { AttachmentTray as Ee, MAX_UPLOADS_PER_MINUTE as De, generateAttachmentId as Oe, useClipboardPaste as ke } from "@epam/ai-dial-attachment-input";
|
|
2
|
+
import { BASE_ICON_SIZE as f, BottomSheet as p, Button as m, ButtonVariant as h, DIAL_ICON_SIZE as g, DIAL_KIT_ICON_STROKE as _, Dropdown as v, ElementSize as y, ErrorText as b, GhostIconButton as x, Highlight as S, MenuItemMark as C, NeutralButton as w, NeutralIconButton as T, Popup as E, PopupSize as D, PrimaryButton as ee, PrimaryIconButton as O, RadioGroup as k, RadioGroupOrientation as te, Search as A, Skeleton as ne, SkeletonVariant as j, Slider as re, Spinner as ie, Textarea as M, TextareaResize as N, Tooltip as ae } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { Fragment as oe, jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
4
|
+
import { AttachmentTray as se, MAX_UPLOADS_PER_MINUTE as I, generateAttachmentId as ce, useClipboardPaste as le } from "@epam/ai-dial-attachment-input";
|
|
5
|
+
import { IconArrowNarrowRight as ue, IconCheck as L, IconChevronDown as de, IconChevronRight as fe, IconFile as pe, IconMicrophone as me, IconPaperclip as he, IconPlayerStop as ge, IconPlus as _e, IconSettings as ve, IconTool as ye, IconX as be } from "@tabler/icons-react";
|
|
6
|
+
import { createElement as xe, forwardRef as Se, memo as Ce, useCallback as R, useEffect as z, useId as we, useImperativeHandle as Te, useLayoutEffect as Ee, useMemo as B, useRef as V, useState as H } from "react";
|
|
8
7
|
//#region src/constants/public-class-names.ts
|
|
9
|
-
var
|
|
8
|
+
var U = {
|
|
10
9
|
wrapper: "dial-ci-wrapper",
|
|
11
10
|
actionRow: "dial-ci-action-row",
|
|
12
11
|
textareaWrap: "dial-ci-textarea-wrap",
|
|
@@ -20,116 +19,54 @@ var H = {
|
|
|
20
19
|
modelMenuSearch: "dial-ci-model-menu-search",
|
|
21
20
|
modelMenuItem: "dial-ci-model-menu-item",
|
|
22
21
|
modelMenuItemSelected: "dial-ci-model-menu-item-selected"
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}, [e, t]), F(() => {
|
|
31
|
-
if (e) return document.body.style.overflow = "hidden", () => {
|
|
32
|
-
document.body.style.overflow = "";
|
|
33
|
-
};
|
|
34
|
-
}, [e]), F(() => {
|
|
35
|
-
if (!e || n?.current == null) return;
|
|
36
|
-
let t = n.current, r = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
37
|
-
(t.querySelector(Ae) ?? t).focus();
|
|
38
|
-
let i = (e) => {
|
|
39
|
-
if (e.key !== "Tab") return;
|
|
40
|
-
let n = Array.from(t.querySelectorAll(Ae));
|
|
41
|
-
if (n.length === 0) {
|
|
42
|
-
e.preventDefault(), t.focus();
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
let r = n[0], i = n[n.length - 1], a = document.activeElement, o = a === t || a === null || !t.contains(a);
|
|
46
|
-
e.shiftKey ? (a === r || o) && (e.preventDefault(), i.focus()) : (a === i || o) && (e.preventDefault(), r.focus());
|
|
47
|
-
};
|
|
48
|
-
return document.addEventListener("keydown", i), () => {
|
|
49
|
-
document.removeEventListener("keydown", i), r?.focus();
|
|
50
|
-
};
|
|
51
|
-
}, [e, n]);
|
|
52
|
-
}, Me = {
|
|
53
|
-
backdrop: "_backdrop_1d50f_9",
|
|
54
|
-
sheet: "_sheet_1d50f_13",
|
|
55
|
-
"slide-up": "_slide-up_1d50f_1",
|
|
56
|
-
title: "_title_1d50f_18",
|
|
57
|
-
divider: "_divider_1d50f_22"
|
|
58
|
-
}, U = ({ 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, children: p }) => {
|
|
59
|
-
let m = L(null);
|
|
60
|
-
if (je(e, r, m), !e || typeof document > "u") return null;
|
|
61
|
-
let v = c({
|
|
22
|
+
}, De = {
|
|
23
|
+
backdrop: "_backdrop_1ym62_8",
|
|
24
|
+
sheet: "_sheet_1ym62_12",
|
|
25
|
+
title: "_title_1ym62_16",
|
|
26
|
+
divider: "_divider_1ym62_20"
|
|
27
|
+
}, W = ({ 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, children: m }) => {
|
|
28
|
+
let h = c({
|
|
62
29
|
"--ci-backdrop": f?.backdrop,
|
|
63
30
|
"--ci-sheet-bg": f?.sheetBg,
|
|
64
31
|
"--ci-sheet-text": f?.sheetText,
|
|
65
32
|
"--ci-sheet-divider": f?.divider
|
|
66
33
|
});
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"aria-modal": !0,
|
|
76
|
-
"aria-label": t ?? o,
|
|
77
|
-
tabIndex: -1,
|
|
34
|
+
return /* @__PURE__ */ P(p, {
|
|
35
|
+
open: e,
|
|
36
|
+
onClose: r,
|
|
37
|
+
title: t,
|
|
38
|
+
ariaLabel: o,
|
|
39
|
+
onBack: i,
|
|
40
|
+
backAriaLabel: a,
|
|
41
|
+
closeAriaLabel: n,
|
|
78
42
|
style: {
|
|
79
|
-
...
|
|
43
|
+
...h,
|
|
80
44
|
...s
|
|
81
45
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
size: g.LG,
|
|
91
|
-
stroke: _,
|
|
92
|
-
className: "rtl:scale-x-[-1]"
|
|
93
|
-
}),
|
|
94
|
-
"aria-label": a,
|
|
95
|
-
onClick: i
|
|
96
|
-
})
|
|
97
|
-
}),
|
|
98
|
-
/* @__PURE__ */ B("span", {
|
|
99
|
-
className: l(Me.title, u),
|
|
100
|
-
children: t
|
|
101
|
-
}),
|
|
102
|
-
/* @__PURE__ */ B("div", {
|
|
103
|
-
className: "absolute end-4 m-2",
|
|
104
|
-
children: /* @__PURE__ */ B(h, {
|
|
105
|
-
ariaLabel: n,
|
|
106
|
-
onClose: r,
|
|
107
|
-
size: y.Standard
|
|
108
|
-
})
|
|
109
|
-
})
|
|
110
|
-
]
|
|
111
|
-
}), /* @__PURE__ */ B("div", { className: l(Me.divider, "h-px flex-shrink-0") })] }), /* @__PURE__ */ B("div", {
|
|
112
|
-
className: "overflow-y-auto",
|
|
113
|
-
children: p
|
|
114
|
-
})]
|
|
115
|
-
})] }), document.body);
|
|
116
|
-
}, Ne = async (e, t, n) => {
|
|
46
|
+
overlayStyle: h,
|
|
47
|
+
className: l(De.sheet, d),
|
|
48
|
+
overlayClassName: De.backdrop,
|
|
49
|
+
headerClassName: De.divider,
|
|
50
|
+
titleClassName: l(De.title, u),
|
|
51
|
+
children: m
|
|
52
|
+
});
|
|
53
|
+
}, Oe = async (e, t, n) => {
|
|
117
54
|
let r = 6e4 / t, i = [];
|
|
118
55
|
for (let t = 0; t < e.length; t++) t > 0 && await new Promise((e) => setTimeout(e, r)), i.push(n(e[t]));
|
|
119
56
|
await Promise.allSettled(i);
|
|
120
|
-
},
|
|
121
|
-
let [h, g] =
|
|
122
|
-
|
|
57
|
+
}, ke = ({ initialAttachments: n, onUploadAttachment: r, onAttachmentsChange: i, validateAttachment: o, pendingDropFiles: s, onDropFilesConsumed: c, pendingAttachments: l, onPendingAttachmentsConsumed: u, onExpandPastedText: d, maximumAttachmentsAmount: f, baseAttachmentsAmount: p = 0, onAttachmentsLimitExceeded: m }) => {
|
|
58
|
+
let [h, g] = H(n), _ = V(h);
|
|
59
|
+
z(() => {
|
|
123
60
|
_.current = h;
|
|
124
|
-
}, [h]),
|
|
61
|
+
}, [h]), z(() => () => {
|
|
125
62
|
_.current.forEach((e) => {
|
|
126
63
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
127
64
|
});
|
|
128
65
|
}, []);
|
|
129
|
-
let v =
|
|
66
|
+
let v = R((e) => e.map((e) => {
|
|
130
67
|
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;
|
|
131
68
|
return {
|
|
132
|
-
id:
|
|
69
|
+
id: ce(),
|
|
133
70
|
name: e.name,
|
|
134
71
|
contentType: e.type,
|
|
135
72
|
file: e,
|
|
@@ -138,26 +75,26 @@ var H = {
|
|
|
138
75
|
previewUrl: i,
|
|
139
76
|
playUrl: o
|
|
140
77
|
};
|
|
141
|
-
}), []), y =
|
|
142
|
-
|
|
78
|
+
}), []), y = V(i);
|
|
79
|
+
z(() => {
|
|
143
80
|
y.current = i;
|
|
144
81
|
}, [i]);
|
|
145
|
-
let b =
|
|
82
|
+
let b = V(!0), x = R((e) => {
|
|
146
83
|
g((t) => {
|
|
147
84
|
let n = e(t);
|
|
148
85
|
return n === t ? t : n;
|
|
149
86
|
});
|
|
150
87
|
}, []);
|
|
151
|
-
|
|
88
|
+
z(() => {
|
|
152
89
|
if (b.current) {
|
|
153
90
|
b.current = !1;
|
|
154
91
|
return;
|
|
155
92
|
}
|
|
156
93
|
y.current?.(h);
|
|
157
94
|
}, [h]);
|
|
158
|
-
let S =
|
|
95
|
+
let S = R((e) => {
|
|
159
96
|
g(e);
|
|
160
|
-
}, []), C =
|
|
97
|
+
}, []), C = R(async (t) => {
|
|
161
98
|
if (r) {
|
|
162
99
|
x((e) => e.map((e) => e.id === t.id ? {
|
|
163
100
|
...e,
|
|
@@ -180,7 +117,7 @@ var H = {
|
|
|
180
117
|
} : e));
|
|
181
118
|
}
|
|
182
119
|
}
|
|
183
|
-
}, [r, x]), w =
|
|
120
|
+
}, [r, x]), w = R((e, t = !0) => {
|
|
184
121
|
let n = new Set(_.current.map((e) => e.id)), r = e.filter((e) => !n.has(e.id));
|
|
185
122
|
if (r.length !== 0) {
|
|
186
123
|
if (f != null && f > 0 && Number.isFinite(f)) {
|
|
@@ -201,7 +138,7 @@ var H = {
|
|
|
201
138
|
status: a.Error,
|
|
202
139
|
errorReason: n
|
|
203
140
|
} : e));
|
|
204
|
-
}),
|
|
141
|
+
}), Oe(e, I, C);
|
|
205
142
|
}
|
|
206
143
|
}
|
|
207
144
|
}, [
|
|
@@ -211,8 +148,8 @@ var H = {
|
|
|
211
148
|
x,
|
|
212
149
|
C,
|
|
213
150
|
o
|
|
214
|
-
]), T =
|
|
215
|
-
|
|
151
|
+
]), T = V(/* @__PURE__ */ new WeakSet());
|
|
152
|
+
z(() => {
|
|
216
153
|
if (s.length === 0) {
|
|
217
154
|
T.current = /* @__PURE__ */ new WeakSet();
|
|
218
155
|
return;
|
|
@@ -224,13 +161,13 @@ var H = {
|
|
|
224
161
|
v,
|
|
225
162
|
c,
|
|
226
163
|
s
|
|
227
|
-
]),
|
|
164
|
+
]), z(() => {
|
|
228
165
|
l.length !== 0 && (w(l, !1), u?.());
|
|
229
166
|
}, [
|
|
230
167
|
w,
|
|
231
168
|
u,
|
|
232
169
|
l
|
|
233
|
-
]),
|
|
170
|
+
]), z(() => {
|
|
234
171
|
if (!o) return;
|
|
235
172
|
let t = !1, n = [], r = _.current.map((r) => {
|
|
236
173
|
if (r.status === a.Loading) return r;
|
|
@@ -257,7 +194,7 @@ var H = {
|
|
|
257
194
|
x,
|
|
258
195
|
C
|
|
259
196
|
]);
|
|
260
|
-
let E =
|
|
197
|
+
let E = R((e) => {
|
|
261
198
|
x((t) => {
|
|
262
199
|
let n = t.find((t) => t.id === e);
|
|
263
200
|
return n?.previewUrl && URL.revokeObjectURL(n.previewUrl), n?.playUrl && URL.revokeObjectURL(n.playUrl), t.filter((t) => t.id !== e);
|
|
@@ -269,11 +206,11 @@ var H = {
|
|
|
269
206
|
addAttachments: w,
|
|
270
207
|
resetAttachments: S,
|
|
271
208
|
handleRemove: E,
|
|
272
|
-
handleRetry:
|
|
209
|
+
handleRetry: R((e) => {
|
|
273
210
|
let t = h.find((t) => t.id === e);
|
|
274
211
|
t && C(t);
|
|
275
212
|
}, [h, C]),
|
|
276
|
-
handleExpand:
|
|
213
|
+
handleExpand: R(async (e) => {
|
|
277
214
|
let n = h.find((t) => t.id === e);
|
|
278
215
|
if (!n || n.type !== t.Pasted) return;
|
|
279
216
|
let r = await n.file.text();
|
|
@@ -285,29 +222,29 @@ var H = {
|
|
|
285
222
|
]),
|
|
286
223
|
hasBlockedAttachments: h.some((e) => e.status === a.Loading || e.status === a.Error)
|
|
287
224
|
};
|
|
288
|
-
},
|
|
225
|
+
}, G = (e, t) => {
|
|
289
226
|
let n = t;
|
|
290
227
|
for (; n < e.length && !/\s/.test(e[n]);) n++;
|
|
291
228
|
return n;
|
|
292
|
-
},
|
|
229
|
+
}, Ae = (e, t) => {
|
|
293
230
|
let n = t;
|
|
294
231
|
for (; n > 0 && !/\s/.test(e[n - 1]);) n--;
|
|
295
232
|
return {
|
|
296
233
|
start: n,
|
|
297
|
-
end:
|
|
234
|
+
end: G(e, n)
|
|
298
235
|
};
|
|
299
|
-
},
|
|
236
|
+
}, je = (e, t) => e.startsWith(t) && !e.slice(t.length).includes(t), Me = "[role=\"option\"]:not([aria-disabled=\"true\"])", Ne = /* @__PURE__ */ function(e) {
|
|
300
237
|
return e.Next = "next", e.Previous = "previous", e;
|
|
301
|
-
}({}),
|
|
302
|
-
let [n, r] =
|
|
238
|
+
}({}), Pe = ({ config: e, message: t }) => {
|
|
239
|
+
let [n, r] = H(!1), [i, a] = H(null), [o, s] = H(null), c = V(null);
|
|
303
240
|
c.current = i;
|
|
304
241
|
let l = e != null && i != null && i <= t.length ? (() => {
|
|
305
|
-
let n = t.slice(i,
|
|
306
|
-
return
|
|
307
|
-
})() : "", u =
|
|
242
|
+
let n = t.slice(i, G(t, i));
|
|
243
|
+
return je(n, e.triggerPrefix) ? n.slice(e.triggerPrefix.length) : "";
|
|
244
|
+
})() : "", u = R((t, n, i) => {
|
|
308
245
|
if (e == null || i) return;
|
|
309
|
-
let { start: c, end: l } =
|
|
310
|
-
if (!
|
|
246
|
+
let { start: c, end: l } = Ae(t, n), u = t.slice(c, l);
|
|
247
|
+
if (!je(u, e.triggerPrefix)) {
|
|
311
248
|
r(!1), s(null), a(null);
|
|
312
249
|
return;
|
|
313
250
|
}
|
|
@@ -317,7 +254,7 @@ var H = {
|
|
|
317
254
|
}
|
|
318
255
|
r(!1);
|
|
319
256
|
}, [e, o]);
|
|
320
|
-
|
|
257
|
+
z(() => {
|
|
321
258
|
if (e == null) {
|
|
322
259
|
r(!1), s(null), a(null);
|
|
323
260
|
return;
|
|
@@ -325,16 +262,16 @@ var H = {
|
|
|
325
262
|
let n = c.current;
|
|
326
263
|
if (n == null) return;
|
|
327
264
|
let i = Math.min(n, t.length);
|
|
328
|
-
|
|
265
|
+
je(t.slice(i, G(t, i)), e.triggerPrefix) || (r(!1), s(null), a(null));
|
|
329
266
|
}, [e, t]);
|
|
330
|
-
let d =
|
|
267
|
+
let d = R(() => {
|
|
331
268
|
r(!1), s(i);
|
|
332
|
-
}, [i]), f =
|
|
269
|
+
}, [i]), f = R(() => {
|
|
333
270
|
r(!1);
|
|
334
|
-
}, []), p =
|
|
271
|
+
}, []), p = R((n) => {
|
|
335
272
|
if (e == null) return;
|
|
336
|
-
let { start: i, end: s } =
|
|
337
|
-
if (!
|
|
273
|
+
let { start: i, end: s } = Ae(t, n);
|
|
274
|
+
if (!je(t.slice(i, s), e.triggerPrefix)) {
|
|
338
275
|
a(null), r(!1);
|
|
339
276
|
return;
|
|
340
277
|
}
|
|
@@ -343,11 +280,11 @@ var H = {
|
|
|
343
280
|
e,
|
|
344
281
|
t,
|
|
345
282
|
o
|
|
346
|
-
]), m =
|
|
347
|
-
|
|
283
|
+
]), m = we(), h = V(null), [g, _] = H(null);
|
|
284
|
+
z(() => {
|
|
348
285
|
_(null);
|
|
349
286
|
}, [n, l]);
|
|
350
|
-
let v =
|
|
287
|
+
let v = R(() => Array.from(h.current?.querySelectorAll(Me) ?? []), []), y = R((e) => {
|
|
351
288
|
let t = v();
|
|
352
289
|
if (t.length === 0) {
|
|
353
290
|
_(null);
|
|
@@ -355,7 +292,7 @@ var H = {
|
|
|
355
292
|
}
|
|
356
293
|
let n = t.findIndex((e) => e.id === g), r = t[e === "next" ? (n + 1) % t.length : (n <= 0 ? t.length : n) - 1];
|
|
357
294
|
_(r.id), r.scrollIntoView?.({ block: "nearest" });
|
|
358
|
-
}, [v, g]), b =
|
|
295
|
+
}, [v, g]), b = R(() => v().find((e) => e.id === g) ?? null, [v, g]);
|
|
359
296
|
return {
|
|
360
297
|
isMenuOpen: n,
|
|
361
298
|
query: l,
|
|
@@ -370,18 +307,18 @@ var H = {
|
|
|
370
307
|
moveActiveOption: y,
|
|
371
308
|
getActiveOption: b
|
|
372
309
|
};
|
|
373
|
-
},
|
|
374
|
-
let t =
|
|
310
|
+
}, Fe = (e, t) => !e.slice(0, t).includes("\n"), Ie = (e, t) => !e.slice(t).includes("\n"), Le = (e) => {
|
|
311
|
+
let t = V(e);
|
|
375
312
|
t.current = e;
|
|
376
|
-
let n =
|
|
313
|
+
let n = V(-1), r = V(""), i = R((e, i, a) => {
|
|
377
314
|
let o = t.current;
|
|
378
|
-
return !o || o.length === 0 ? null : e === "up" ? !
|
|
379
|
-
}, []), a =
|
|
315
|
+
return !o || o.length === 0 ? null : e === "up" ? !Fe(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 || !Ie(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
|
|
316
|
+
}, []), a = R(() => {
|
|
380
317
|
n.current = -1, r.current = "";
|
|
381
|
-
}, []), o =
|
|
318
|
+
}, []), o = R(() => {
|
|
382
319
|
n.current = -1, r.current = "";
|
|
383
320
|
}, []);
|
|
384
|
-
return
|
|
321
|
+
return B(() => ({
|
|
385
322
|
navigate: i,
|
|
386
323
|
notifyChange: a,
|
|
387
324
|
reset: o
|
|
@@ -390,16 +327,16 @@ var H = {
|
|
|
390
327
|
a,
|
|
391
328
|
o
|
|
392
329
|
]);
|
|
393
|
-
},
|
|
330
|
+
}, Re = (e, t, n, r, i) => {
|
|
394
331
|
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) => {
|
|
395
332
|
if (n <= t) return;
|
|
396
333
|
let r = t;
|
|
397
334
|
o.filter((e) => e.offset >= t && e.offset <= n).forEach((t) => {
|
|
398
|
-
t.offset > r && s.push(/* @__PURE__ */
|
|
335
|
+
t.offset > r && s.push(/* @__PURE__ */ P("span", {
|
|
399
336
|
"aria-hidden": !0,
|
|
400
337
|
children: e.slice(r, t.offset)
|
|
401
338
|
}, `text-${l++}`)), s.push(t.node), r = t.offset;
|
|
402
|
-
}), r < n && s.push(/* @__PURE__ */
|
|
339
|
+
}), r < n && s.push(/* @__PURE__ */ P("span", {
|
|
403
340
|
"aria-hidden": !0,
|
|
404
341
|
children: e.slice(r, n)
|
|
405
342
|
}, `text-${l++}`));
|
|
@@ -407,16 +344,16 @@ var H = {
|
|
|
407
344
|
return a.forEach((t, n) => {
|
|
408
345
|
if (u(c, t.start), t.start + t.length <= c) return;
|
|
409
346
|
let a = e.slice(t.start, t.start + t.length);
|
|
410
|
-
s.push(t.render ? /* @__PURE__ */
|
|
347
|
+
s.push(t.render ? /* @__PURE__ */ P("span", {
|
|
411
348
|
className: "pointer-events-auto",
|
|
412
349
|
children: t.render()
|
|
413
|
-
}, `range-${n}`) : /* @__PURE__ */
|
|
350
|
+
}, `range-${n}`) : /* @__PURE__ */ P("span", {
|
|
414
351
|
"aria-hidden": !0,
|
|
415
352
|
className: t.isUnsupported ? i : r,
|
|
416
353
|
children: a
|
|
417
354
|
}, `range-${n}`)), c = Math.max(c, t.start + t.length);
|
|
418
355
|
}), u(c, e.length), s;
|
|
419
|
-
},
|
|
356
|
+
}, ze = (e, t) => {
|
|
420
357
|
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;
|
|
421
358
|
for (let e = n.nextNode(); e != null; e = n.nextNode()) {
|
|
422
359
|
let n = e.textContent?.length ?? 0;
|
|
@@ -427,19 +364,19 @@ var H = {
|
|
|
427
364
|
r += n;
|
|
428
365
|
}
|
|
429
366
|
return null;
|
|
430
|
-
},
|
|
431
|
-
let r =
|
|
367
|
+
}, Be = (e, t, n) => {
|
|
368
|
+
let r = ze(e, t), i = ze(e, n);
|
|
432
369
|
if (r == null || i == null) return null;
|
|
433
370
|
let a = document.createRange();
|
|
434
371
|
return a.setStart(r.node, r.offset), a.setEnd(i.node, i.offset), a;
|
|
435
|
-
},
|
|
436
|
-
let r =
|
|
372
|
+
}, Ve = ({ textareaRef: e, message: t, hasActiveMentions: n }) => {
|
|
373
|
+
let r = V(null), [i, a] = H([]), o = R(() => {
|
|
437
374
|
let t = e.current, i = r.current, o = t?.selectionStart, s = t?.selectionEnd;
|
|
438
375
|
if (!n || t == null || i == null || o == null || s == null || o === s) {
|
|
439
376
|
a((e) => e.length === 0 ? e : []);
|
|
440
377
|
return;
|
|
441
378
|
}
|
|
442
|
-
let c =
|
|
379
|
+
let c = Be(i, o, s);
|
|
443
380
|
if (c == null) {
|
|
444
381
|
a((e) => e.length === 0 ? e : []);
|
|
445
382
|
return;
|
|
@@ -447,9 +384,9 @@ var H = {
|
|
|
447
384
|
let l = i.getBoundingClientRect();
|
|
448
385
|
a(Array.from(c.getClientRects()).map((e) => new DOMRect(e.left - l.left, e.top - l.top, e.width, e.height)));
|
|
449
386
|
}, [n, e]);
|
|
450
|
-
return
|
|
387
|
+
return Ee(() => {
|
|
451
388
|
o();
|
|
452
|
-
}, [o, t]),
|
|
389
|
+
}, [o, t]), z(() => {
|
|
453
390
|
if (!n) return;
|
|
454
391
|
let t = e.current;
|
|
455
392
|
if (t == null || typeof ResizeObserver > "u") return;
|
|
@@ -464,23 +401,23 @@ var H = {
|
|
|
464
401
|
selectionRects: i,
|
|
465
402
|
updateSelectionRects: o
|
|
466
403
|
};
|
|
467
|
-
},
|
|
468
|
-
let [n, r] =
|
|
469
|
-
return
|
|
404
|
+
}, He = ({ messageProp: e, messageRevision: t }) => {
|
|
405
|
+
let [n, r] = H(e), i = V(null);
|
|
406
|
+
return z(() => {
|
|
470
407
|
r(e);
|
|
471
408
|
}, [e, t]), {
|
|
472
409
|
message: n,
|
|
473
410
|
setMessage: r,
|
|
474
411
|
textareaRef: i
|
|
475
412
|
};
|
|
476
|
-
},
|
|
413
|
+
}, Ue = (e, t, n, r = n) => {
|
|
477
414
|
let i = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value")?.set;
|
|
478
415
|
i ? i.call(e, t) : e.value = t, e.setSelectionRange(n, r), e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
479
|
-
},
|
|
480
|
-
let n = e?.revision, r =
|
|
416
|
+
}, We = (e) => e.key.toLowerCase() === "z" && (e.ctrlKey || e.metaKey) && !e.shiftKey && !e.altKey, Ge = ({ insertion: e, textareaRef: t }) => {
|
|
417
|
+
let n = e?.revision, r = V(e?.text);
|
|
481
418
|
r.current = e?.text;
|
|
482
|
-
let i =
|
|
483
|
-
return
|
|
419
|
+
let i = V(n), a = V(null);
|
|
420
|
+
return z(() => {
|
|
484
421
|
if (n === i.current) return;
|
|
485
422
|
i.current = n;
|
|
486
423
|
let e = r.current;
|
|
@@ -490,7 +427,7 @@ var H = {
|
|
|
490
427
|
let { value: r, selectionStart: i, selectionEnd: o } = n, s = i ?? r.length, c = o ?? s;
|
|
491
428
|
if (n.focus(), a.current = null, typeof document.execCommand == "function" && document.execCommand("insertText", !1, e)) return;
|
|
492
429
|
let l = `${r.slice(0, s)}${e}${r.slice(c)}`;
|
|
493
|
-
|
|
430
|
+
Ue(n, l, s + e.length), a.current = {
|
|
494
431
|
insertedValue: l,
|
|
495
432
|
previousValue: r,
|
|
496
433
|
previousSelectionStart: s,
|
|
@@ -499,18 +436,18 @@ var H = {
|
|
|
499
436
|
});
|
|
500
437
|
}, [n, t]), { handleUndoKeyDown: (e) => {
|
|
501
438
|
let n = a.current, r = t.current;
|
|
502
|
-
return n == null || r == null || !
|
|
439
|
+
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);
|
|
503
440
|
} };
|
|
504
|
-
},
|
|
441
|
+
}, Ke = /* @__PURE__ */ function(e) {
|
|
505
442
|
return e.Idle = "idle", e.Recording = "recording", e.Processing = "processing", e.Error = "error", e;
|
|
506
|
-
}({}),
|
|
443
|
+
}({}), qe = /* @__PURE__ */ function(e) {
|
|
507
444
|
return e.Dictation = "dictation", e.Attachment = "attachment", e;
|
|
508
|
-
}({}),
|
|
445
|
+
}({}), Je = [
|
|
509
446
|
"audio/webm;codecs=opus",
|
|
510
447
|
"audio/ogg;codecs=opus",
|
|
511
448
|
"audio/webm"
|
|
512
|
-
],
|
|
513
|
-
let [a, o] =
|
|
449
|
+
], Ye = 100, Xe = 100, Ze = .01, Qe = ({ onAttachAudio: e, onTranscribeAudio: t, onTranscript: n, errorLabel: i = "Voice input failed" }) => {
|
|
450
|
+
let [a, o] = H("idle"), [s, c] = H(null), l = V(null), d = V(null), f = V({
|
|
514
451
|
onAttachAudio: e,
|
|
515
452
|
onTranscribeAudio: t,
|
|
516
453
|
onTranscript: n,
|
|
@@ -522,7 +459,7 @@ var H = {
|
|
|
522
459
|
onTranscript: n,
|
|
523
460
|
errorLabel: i
|
|
524
461
|
};
|
|
525
|
-
let p =
|
|
462
|
+
let p = R((e = "dictation") => {
|
|
526
463
|
if (d.current) return;
|
|
527
464
|
let t = { controller: new AbortController() };
|
|
528
465
|
d.current = t, c(null), o("recording");
|
|
@@ -540,7 +477,7 @@ var H = {
|
|
|
540
477
|
n.aborted || (t.controller.abort(), d.current = null, c(e instanceof Error ? e.message : f.current.errorLabel), o("error"));
|
|
541
478
|
}, S = () => {
|
|
542
479
|
if (!a || n.aborted) return;
|
|
543
|
-
let e =
|
|
480
|
+
let e = Je.find((e) => MediaRecorder.isTypeSupported(e)), t = new MediaRecorder(a, e ? { mimeType: e } : void 0);
|
|
544
481
|
p = t;
|
|
545
482
|
let s = Date.now(), c = !1, d = !1, S = new Uint8Array(l.current?.fftSize ?? 256), C = async () => {
|
|
546
483
|
if (!(g || n.aborted)) {
|
|
@@ -548,7 +485,7 @@ var H = {
|
|
|
548
485
|
try {
|
|
549
486
|
let a = t.mimeType || e || "audio/webm", l = new Blob(_, { type: a });
|
|
550
487
|
_.length = 0, y();
|
|
551
|
-
let p = Date.now() - s >=
|
|
488
|
+
let p = Date.now() - s >= Xe;
|
|
552
489
|
if (l.size && (!i || p && (!c || d))) {
|
|
553
490
|
let e = u(a), t = r[e] ?? e.split("/")[1] ?? "webm", s = new File([l], "voice-" + crypto.randomUUID() + "." + t, { type: a });
|
|
554
491
|
if (i) {
|
|
@@ -574,8 +511,8 @@ var H = {
|
|
|
574
511
|
e.getByteTimeDomainData(S), c = !0;
|
|
575
512
|
let t = 0;
|
|
576
513
|
for (let e of S) t += ((e - 128) / 128) ** 2;
|
|
577
|
-
Math.sqrt(t / S.length) >=
|
|
578
|
-
},
|
|
514
|
+
Math.sqrt(t / S.length) >= Ze && (d = !0, v());
|
|
515
|
+
}, Ye));
|
|
579
516
|
};
|
|
580
517
|
t.stop = () => {
|
|
581
518
|
h || n.aborted || (h = !0, v(), o("processing"), p?.state === "recording" && p.stop());
|
|
@@ -593,10 +530,10 @@ var H = {
|
|
|
593
530
|
x(e);
|
|
594
531
|
}
|
|
595
532
|
})();
|
|
596
|
-
}, []), m =
|
|
533
|
+
}, []), m = R(() => d.current?.stop?.(), []), h = R(() => {
|
|
597
534
|
d.current?.controller.abort(), d.current = null, c(null), o("idle");
|
|
598
535
|
}, []);
|
|
599
|
-
return
|
|
536
|
+
return z(() => () => {
|
|
600
537
|
d.current?.controller.abort(), d.current = null;
|
|
601
538
|
}, []), {
|
|
602
539
|
state: a,
|
|
@@ -606,15 +543,15 @@ var H = {
|
|
|
606
543
|
stopRecording: m,
|
|
607
544
|
discardRecording: h
|
|
608
545
|
};
|
|
609
|
-
},
|
|
546
|
+
}, $e = /* @__PURE__ */ function(e) {
|
|
610
547
|
return e.Enter = "enter", e.MetaEnter = "meta-enter", e;
|
|
611
|
-
}({}),
|
|
548
|
+
}({}), et = /* @__PURE__ */ function(e) {
|
|
612
549
|
return e.Stacked = "stacked", e.Inline = "inline", e;
|
|
613
|
-
}({}),
|
|
550
|
+
}({}), tt = {
|
|
614
551
|
item: "_item_1sr2n_1",
|
|
615
552
|
itemIcon: "_itemIcon_1sr2n_11"
|
|
616
|
-
},
|
|
617
|
-
let
|
|
553
|
+
}, nt = ({ 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 }) => {
|
|
554
|
+
let p = (e) => {
|
|
618
555
|
e(), r();
|
|
619
556
|
}, h = c({
|
|
620
557
|
"--ci-sheet-text": f?.itemText,
|
|
@@ -622,7 +559,7 @@ var H = {
|
|
|
622
559
|
"--ci-sheet-item-active": f?.itemActiveBg,
|
|
623
560
|
"--ci-sheet-icon": f?.itemIcon
|
|
624
561
|
});
|
|
625
|
-
return /* @__PURE__ */
|
|
562
|
+
return /* @__PURE__ */ P(W, {
|
|
626
563
|
isOpen: e,
|
|
627
564
|
title: t,
|
|
628
565
|
closeLabel: n,
|
|
@@ -631,33 +568,33 @@ var H = {
|
|
|
631
568
|
className: o,
|
|
632
569
|
titleClassName: s,
|
|
633
570
|
colors: f?.shell,
|
|
634
|
-
children: /* @__PURE__ */
|
|
571
|
+
children: /* @__PURE__ */ P("ul", {
|
|
635
572
|
role: "list",
|
|
636
573
|
className: "flex flex-col",
|
|
637
574
|
style: h,
|
|
638
|
-
children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */
|
|
575
|
+
children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ P("li", { children: /* @__PURE__ */ P(m, {
|
|
639
576
|
type: "button",
|
|
640
|
-
className: l(
|
|
641
|
-
iconBefore: /* @__PURE__ */
|
|
642
|
-
className:
|
|
577
|
+
className: l(tt.item, "w-full gap-3 px-4 py-[10px] text-start"),
|
|
578
|
+
iconBefore: /* @__PURE__ */ P("span", {
|
|
579
|
+
className: tt.itemIcon,
|
|
643
580
|
children: n
|
|
644
581
|
}),
|
|
645
|
-
iconAfter: r ? /* @__PURE__ */
|
|
582
|
+
iconAfter: r ? /* @__PURE__ */ P("span", {
|
|
646
583
|
className: "ms-auto",
|
|
647
584
|
children: r
|
|
648
585
|
}) : null,
|
|
649
586
|
textClassName: d,
|
|
650
|
-
label: /* @__PURE__ */
|
|
587
|
+
label: /* @__PURE__ */ P("span", {
|
|
651
588
|
className: u,
|
|
652
589
|
children: t
|
|
653
590
|
}),
|
|
654
|
-
onClick: () =>
|
|
591
|
+
onClick: () => p(i)
|
|
655
592
|
}) }, e))
|
|
656
593
|
})
|
|
657
594
|
});
|
|
658
|
-
},
|
|
659
|
-
let [s, c] =
|
|
660
|
-
|
|
595
|
+
}, rt = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
596
|
+
let [s, c] = H(t), [l, u] = H(n), [d, f] = H(r), p = V(o);
|
|
597
|
+
z(() => {
|
|
661
598
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
662
599
|
}, [
|
|
663
600
|
o,
|
|
@@ -674,7 +611,7 @@ var H = {
|
|
|
674
611
|
setResponseFormat: c,
|
|
675
612
|
setSystemPrompt: u,
|
|
676
613
|
setTemperature: f,
|
|
677
|
-
handleSubmit:
|
|
614
|
+
handleSubmit: R(() => {
|
|
678
615
|
if (!m) return;
|
|
679
616
|
let t = {};
|
|
680
617
|
e.responseFormat && s != null && (t.responseFormat = s), e.systemPrompt && (t.systemPrompt = l), e.temperature && (t.temperature = d), i(t), a();
|
|
@@ -688,17 +625,17 @@ var H = {
|
|
|
688
625
|
a
|
|
689
626
|
])
|
|
690
627
|
};
|
|
691
|
-
},
|
|
628
|
+
}, it = { label: "_label_14i7c_1" }, at = ({ 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 = [
|
|
692
629
|
"Precise",
|
|
693
630
|
"Neutral",
|
|
694
631
|
"Creative"
|
|
695
632
|
], temperatureHint: y, labelClassName: b = "!dial-small-semi-text", colors: x }) => {
|
|
696
|
-
let S = c({ "--csf-label-text": x?.labelText }), C = l(b,
|
|
697
|
-
return /* @__PURE__ */
|
|
633
|
+
let S = c({ "--csf-label-text": x?.labelText }), C = l(b, it.label, "gap-1");
|
|
634
|
+
return /* @__PURE__ */ F("div", {
|
|
698
635
|
className: "flex flex-col gap-4 px-6 pb-3",
|
|
699
636
|
style: S,
|
|
700
637
|
children: [
|
|
701
|
-
e.responseFormat && /* @__PURE__ */
|
|
638
|
+
e.responseFormat && /* @__PURE__ */ P(k, {
|
|
702
639
|
id: "response-format",
|
|
703
640
|
labelProps: {
|
|
704
641
|
label: d,
|
|
@@ -717,7 +654,7 @@ var H = {
|
|
|
717
654
|
}],
|
|
718
655
|
onChange: (e) => a(e)
|
|
719
656
|
}),
|
|
720
|
-
e.systemPrompt && /* @__PURE__ */
|
|
657
|
+
e.systemPrompt && /* @__PURE__ */ P(M, {
|
|
721
658
|
value: n,
|
|
722
659
|
placeholder: g,
|
|
723
660
|
className: i,
|
|
@@ -728,7 +665,7 @@ var H = {
|
|
|
728
665
|
},
|
|
729
666
|
onChange: (e) => s(e ?? "")
|
|
730
667
|
}),
|
|
731
|
-
e.temperature && /* @__PURE__ */
|
|
668
|
+
e.temperature && /* @__PURE__ */ P(re, {
|
|
732
669
|
labelProps: {
|
|
733
670
|
label: _,
|
|
734
671
|
className: C,
|
|
@@ -744,8 +681,8 @@ var H = {
|
|
|
744
681
|
})
|
|
745
682
|
]
|
|
746
683
|
});
|
|
747
|
-
},
|
|
748
|
-
let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: D, setResponseFormat: O, setSystemPrompt: k, setTemperature: te, handleSubmit: A } =
|
|
684
|
+
}, ot = ({ 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 }) => {
|
|
685
|
+
let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: D, setResponseFormat: O, setSystemPrompt: k, setTemperature: te, handleSubmit: A } = rt({
|
|
749
686
|
isOpen: e,
|
|
750
687
|
features: o,
|
|
751
688
|
initialResponseFormat: s,
|
|
@@ -754,7 +691,7 @@ var H = {
|
|
|
754
691
|
onSave: d,
|
|
755
692
|
onClose: r
|
|
756
693
|
});
|
|
757
|
-
return /* @__PURE__ */
|
|
694
|
+
return /* @__PURE__ */ F(W, {
|
|
758
695
|
isOpen: e,
|
|
759
696
|
title: f,
|
|
760
697
|
closeLabel: i,
|
|
@@ -762,7 +699,7 @@ var H = {
|
|
|
762
699
|
onBack: t,
|
|
763
700
|
backLabel: n,
|
|
764
701
|
style: a,
|
|
765
|
-
children: [/* @__PURE__ */
|
|
702
|
+
children: [/* @__PURE__ */ P(at, {
|
|
766
703
|
features: o,
|
|
767
704
|
responseFormat: w,
|
|
768
705
|
systemPrompt: T,
|
|
@@ -779,13 +716,13 @@ var H = {
|
|
|
779
716
|
temperatureLabel: y,
|
|
780
717
|
temperatureLabels: b,
|
|
781
718
|
temperatureHint: x
|
|
782
|
-
}), /* @__PURE__ */
|
|
719
|
+
}), /* @__PURE__ */ P("div", {
|
|
783
720
|
className: l("px-6 py-4 mobile:pb-8"),
|
|
784
|
-
children: /* @__PURE__ */
|
|
721
|
+
children: /* @__PURE__ */ P(ae, {
|
|
785
722
|
tooltip: C,
|
|
786
723
|
hideTooltip: D || !C,
|
|
787
724
|
triggerClassName: "w-full",
|
|
788
|
-
children: /* @__PURE__ */
|
|
725
|
+
children: /* @__PURE__ */ P(ee, {
|
|
789
726
|
label: S,
|
|
790
727
|
onClick: A,
|
|
791
728
|
disabled: !D,
|
|
@@ -794,8 +731,8 @@ var H = {
|
|
|
794
731
|
})
|
|
795
732
|
})]
|
|
796
733
|
});
|
|
797
|
-
},
|
|
798
|
-
let { responseFormat: x, systemPrompt: S, temperature: C, canSubmit: w, setResponseFormat: T, setSystemPrompt: ee, setTemperature: O, handleSubmit: k } =
|
|
734
|
+
}, st = { modal: "_modal_kl0h0_1" }, ct = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", titleClassName: s = "dial-h1-text", responseFormatLabel: c, responseFormatHint: l, responseFormatMarkdownLabel: u, responseFormatPlainTextLabel: d, systemPromptLabel: f, systemPromptTooltip: p, temperatureLabel: m, temperatureLabels: g, temperatureHint: _, saveLabel: v = "Apply changes", saveDisabledTooltip: y, backgroundClassName: b = st.modal }) => {
|
|
735
|
+
let { responseFormat: x, systemPrompt: S, temperature: C, canSubmit: w, setResponseFormat: T, setSystemPrompt: ee, setTemperature: O, handleSubmit: k } = rt({
|
|
799
736
|
features: e,
|
|
800
737
|
initialResponseFormat: t,
|
|
801
738
|
initialSystemPrompt: n,
|
|
@@ -803,7 +740,7 @@ var H = {
|
|
|
803
740
|
onSave: i,
|
|
804
741
|
onClose: a
|
|
805
742
|
});
|
|
806
|
-
return /* @__PURE__ */
|
|
743
|
+
return /* @__PURE__ */ P(E, {
|
|
807
744
|
open: !0,
|
|
808
745
|
header: o,
|
|
809
746
|
titleClassName: s,
|
|
@@ -812,7 +749,7 @@ var H = {
|
|
|
812
749
|
className: b,
|
|
813
750
|
mainButtons: [{
|
|
814
751
|
label: v,
|
|
815
|
-
variant:
|
|
752
|
+
variant: h.Primary,
|
|
816
753
|
onClick: k,
|
|
817
754
|
disabled: !w,
|
|
818
755
|
tooltipProps: y ? {
|
|
@@ -820,7 +757,7 @@ var H = {
|
|
|
820
757
|
hideTooltip: w
|
|
821
758
|
} : void 0
|
|
822
759
|
}],
|
|
823
|
-
children: /* @__PURE__ */
|
|
760
|
+
children: /* @__PURE__ */ P(at, {
|
|
824
761
|
features: e,
|
|
825
762
|
responseFormat: x,
|
|
826
763
|
systemPrompt: S,
|
|
@@ -834,15 +771,15 @@ var H = {
|
|
|
834
771
|
responseFormatPlainTextLabel: d,
|
|
835
772
|
systemPromptLabel: f,
|
|
836
773
|
systemPromptTooltip: p,
|
|
837
|
-
temperatureLabel:
|
|
774
|
+
temperatureLabel: m,
|
|
838
775
|
temperatureLabels: g,
|
|
839
776
|
temperatureHint: _
|
|
840
777
|
})
|
|
841
778
|
});
|
|
842
|
-
},
|
|
779
|
+
}, lt = {
|
|
843
780
|
icon: "_icon_1fv6z_1",
|
|
844
781
|
selectedIcon: "_selectedIcon_1fv6z_5"
|
|
845
|
-
},
|
|
782
|
+
}, K = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel: i = "Close", style: a, title: o = "Tools", items: s, onToolToggle: u, itemLabelClassName: d = "dial-small-text", colors: p }) => /* @__PURE__ */ P(W, {
|
|
846
783
|
isOpen: e,
|
|
847
784
|
title: o,
|
|
848
785
|
closeLabel: i,
|
|
@@ -850,33 +787,33 @@ var H = {
|
|
|
850
787
|
onBack: t,
|
|
851
788
|
backLabel: n,
|
|
852
789
|
style: a,
|
|
853
|
-
children: /* @__PURE__ */
|
|
790
|
+
children: /* @__PURE__ */ P("ul", {
|
|
854
791
|
role: "menu",
|
|
855
792
|
className: "flex flex-col pb-4",
|
|
856
793
|
style: c({
|
|
857
|
-
"--tbs-icon-text":
|
|
858
|
-
"--tbs-selected-icon-text":
|
|
794
|
+
"--tbs-icon-text": p?.iconText,
|
|
795
|
+
"--tbs-selected-icon-text": p?.selectedIconText
|
|
859
796
|
}),
|
|
860
|
-
children: s.map((e) => /* @__PURE__ */
|
|
797
|
+
children: s.map((e) => /* @__PURE__ */ P("li", {
|
|
861
798
|
role: "none",
|
|
862
|
-
children: /* @__PURE__ */
|
|
799
|
+
children: /* @__PURE__ */ P(m, {
|
|
863
800
|
type: "button",
|
|
864
801
|
role: "menuitemcheckbox",
|
|
865
802
|
"aria-checked": e.isSelected,
|
|
866
803
|
className: "w-full gap-3 px-4 py-[10px] text-start",
|
|
867
|
-
iconBefore: /* @__PURE__ */
|
|
868
|
-
className: l("flex items-center",
|
|
804
|
+
iconBefore: /* @__PURE__ */ P("span", {
|
|
805
|
+
className: l("flex items-center", lt.icon),
|
|
869
806
|
children: e.icon
|
|
870
807
|
}),
|
|
871
|
-
iconAfter: e.isSelected ? /* @__PURE__ */
|
|
872
|
-
className: l("ms-auto",
|
|
873
|
-
children: /* @__PURE__ */
|
|
808
|
+
iconAfter: e.isSelected ? /* @__PURE__ */ P("span", {
|
|
809
|
+
className: l("ms-auto", lt.selectedIcon),
|
|
810
|
+
children: /* @__PURE__ */ P(L, {
|
|
874
811
|
size: f,
|
|
875
812
|
"aria-hidden": !0,
|
|
876
813
|
stroke: _
|
|
877
814
|
})
|
|
878
815
|
}) : null,
|
|
879
|
-
label: /* @__PURE__ */
|
|
816
|
+
label: /* @__PURE__ */ P("span", {
|
|
880
817
|
className: d,
|
|
881
818
|
children: e.label
|
|
882
819
|
}),
|
|
@@ -884,19 +821,19 @@ var H = {
|
|
|
884
821
|
})
|
|
885
822
|
}, e.id))
|
|
886
823
|
})
|
|
887
|
-
}),
|
|
824
|
+
}), ut = {
|
|
888
825
|
toolIcon: "_toolIcon_ma5s5_1",
|
|
889
826
|
chevronIcon: "_chevronIcon_ma5s5_5"
|
|
890
|
-
},
|
|
891
|
-
let k = d(), [te, A] =
|
|
827
|
+
}, dt = ({ onAttachClick: e, onRecordVoice: t, recordVoiceLabel: n = "Record voice", attachLabel: r, addMenuTitle: i, menuTitle: a, menuCloseLabel: s, style: u, listClassName: p = "w-[240px]", isDisabled: m = !1, chatSettings: h, extraMenuItems: b, toolsMenuItems: S = [], onToolToggle: w, toolsMenuTitle: T = "Tools", toolsBackLabel: E = "Back", menuOverlays: D, getCaretPosition: ee, colors: O }) => {
|
|
828
|
+
let k = d(), [te, A] = H(!1), [ne, j] = H(!1), [re, ie] = H(!1), [M, N] = H(null), [ae, se] = H(!1), I = B(() => c({
|
|
892
829
|
"--aab-tool-icon": O?.toolIcon,
|
|
893
830
|
"--aab-chevron-icon": O?.chevronIcon
|
|
894
|
-
}), [O?.toolIcon, O?.chevronIcon]), ce = S.length > 0 && w != null, le = D != null && D.length > 0,
|
|
831
|
+
}), [O?.toolIcon, O?.chevronIcon]), ce = S.length > 0 && w != null, le = D != null && D.length > 0, ue = B(() => S.map((e) => ({
|
|
895
832
|
key: e.id,
|
|
896
833
|
label: e.label,
|
|
897
|
-
icon: /* @__PURE__ */
|
|
898
|
-
style:
|
|
899
|
-
className: l("flex items-center",
|
|
834
|
+
icon: /* @__PURE__ */ P("span", {
|
|
835
|
+
style: I,
|
|
836
|
+
className: l("flex items-center", ut.toolIcon),
|
|
900
837
|
children: e.icon
|
|
901
838
|
}),
|
|
902
839
|
selectable: !0,
|
|
@@ -906,12 +843,12 @@ var H = {
|
|
|
906
843
|
})), [
|
|
907
844
|
S,
|
|
908
845
|
w,
|
|
909
|
-
|
|
910
|
-
]),
|
|
846
|
+
I
|
|
847
|
+
]), L = B(() => [
|
|
911
848
|
...e == null ? [] : [{
|
|
912
849
|
key: "attach",
|
|
913
850
|
label: r,
|
|
914
|
-
icon: /* @__PURE__ */
|
|
851
|
+
icon: /* @__PURE__ */ P(he, {
|
|
915
852
|
size: f,
|
|
916
853
|
"aria-hidden": !0,
|
|
917
854
|
stroke: _
|
|
@@ -922,7 +859,7 @@ var H = {
|
|
|
922
859
|
...ce ? [{
|
|
923
860
|
key: "tools",
|
|
924
861
|
label: T,
|
|
925
|
-
icon: /* @__PURE__ */
|
|
862
|
+
icon: /* @__PURE__ */ P(ye, {
|
|
926
863
|
size: f,
|
|
927
864
|
"aria-hidden": !0,
|
|
928
865
|
stroke: _
|
|
@@ -930,13 +867,13 @@ var H = {
|
|
|
930
867
|
onClick: k ? () => {
|
|
931
868
|
ie(!0), A(!1);
|
|
932
869
|
} : () => void 0,
|
|
933
|
-
...k ? { iconAfter: /* @__PURE__ */
|
|
870
|
+
...k ? { iconAfter: /* @__PURE__ */ P(fe, {
|
|
934
871
|
size: f,
|
|
935
872
|
stroke: _,
|
|
936
|
-
style:
|
|
937
|
-
className: l("rtl:scale-x-[-1]",
|
|
873
|
+
style: I,
|
|
874
|
+
className: l("rtl:scale-x-[-1]", ut.chevronIcon),
|
|
938
875
|
"aria-hidden": !0
|
|
939
|
-
}) } : { children:
|
|
876
|
+
}) } : { children: ue }
|
|
940
877
|
}] : [],
|
|
941
878
|
...(D ?? []).map((e) => ({
|
|
942
879
|
key: e.key,
|
|
@@ -945,45 +882,45 @@ var H = {
|
|
|
945
882
|
onClick: k ? () => {
|
|
946
883
|
N(e.key), A(!1);
|
|
947
884
|
} : () => void 0,
|
|
948
|
-
...k ? { iconAfter: /* @__PURE__ */
|
|
885
|
+
...k ? { iconAfter: /* @__PURE__ */ P(fe, {
|
|
949
886
|
size: f,
|
|
950
887
|
stroke: _,
|
|
951
|
-
style:
|
|
952
|
-
className: l("rtl:scale-x-[-1]",
|
|
888
|
+
style: I,
|
|
889
|
+
className: l("rtl:scale-x-[-1]", ut.chevronIcon),
|
|
953
890
|
"aria-hidden": !0
|
|
954
891
|
}) } : {
|
|
955
892
|
children: [{
|
|
956
893
|
key: `${e.key}-panel`,
|
|
957
894
|
label: ""
|
|
958
895
|
}],
|
|
959
|
-
renderSubMenu: () => e.renderOverlay(() =>
|
|
896
|
+
renderSubMenu: () => e.renderOverlay(() => se(!1), ee?.() ?? 0)
|
|
960
897
|
}
|
|
961
898
|
})),
|
|
962
899
|
...t == null ? [] : [{
|
|
963
900
|
key: "record-voice",
|
|
964
901
|
label: n,
|
|
965
|
-
icon: /* @__PURE__ */
|
|
902
|
+
icon: /* @__PURE__ */ P(me, {
|
|
966
903
|
size: f,
|
|
967
904
|
"aria-hidden": !0,
|
|
968
905
|
stroke: _
|
|
969
906
|
}),
|
|
970
907
|
onClick: () => {
|
|
971
|
-
A(!1),
|
|
908
|
+
A(!1), se(!1), t();
|
|
972
909
|
}
|
|
973
910
|
}],
|
|
974
911
|
...h == null ? [] : [{
|
|
975
912
|
key: "chat-settings",
|
|
976
913
|
label: h.menuItemLabel ?? "Chat settings",
|
|
977
|
-
icon: /* @__PURE__ */
|
|
914
|
+
icon: /* @__PURE__ */ P(ve, {
|
|
978
915
|
size: f,
|
|
979
916
|
"aria-hidden": !0,
|
|
980
917
|
stroke: _
|
|
981
918
|
}),
|
|
982
|
-
iconAfter: k ? /* @__PURE__ */
|
|
919
|
+
iconAfter: k ? /* @__PURE__ */ P(fe, {
|
|
983
920
|
size: f,
|
|
984
921
|
stroke: _,
|
|
985
|
-
style:
|
|
986
|
-
className: l("rtl:scale-x-[-1]",
|
|
922
|
+
style: I,
|
|
923
|
+
className: l("rtl:scale-x-[-1]", ut.chevronIcon),
|
|
987
924
|
"aria-hidden": !0
|
|
988
925
|
}) : null,
|
|
989
926
|
onClick: () => j(!0)
|
|
@@ -998,22 +935,22 @@ var H = {
|
|
|
998
935
|
k,
|
|
999
936
|
ce,
|
|
1000
937
|
T,
|
|
1001
|
-
|
|
938
|
+
ue,
|
|
1002
939
|
D,
|
|
1003
940
|
ee,
|
|
1004
|
-
|
|
941
|
+
I
|
|
1005
942
|
]);
|
|
1006
|
-
if (
|
|
1007
|
-
let
|
|
943
|
+
if (L.length === 0) return null;
|
|
944
|
+
let de = /* @__PURE__ */ P(v, {
|
|
1008
945
|
matchReferenceWidth: !1,
|
|
1009
946
|
placement: "bottom-start",
|
|
1010
947
|
listClassName: p,
|
|
1011
948
|
overlayContentClassName: "flex flex-col gap-1",
|
|
1012
|
-
items:
|
|
949
|
+
items: L,
|
|
1013
950
|
open: le ? ae : void 0,
|
|
1014
|
-
onOpenChange: le ?
|
|
1015
|
-
children: /* @__PURE__ */
|
|
1016
|
-
icon: /* @__PURE__ */
|
|
951
|
+
onOpenChange: le ? se : void 0,
|
|
952
|
+
children: /* @__PURE__ */ P(x, {
|
|
953
|
+
icon: /* @__PURE__ */ P(_e, {
|
|
1017
954
|
size: g.LG,
|
|
1018
955
|
"aria-hidden": !0,
|
|
1019
956
|
stroke: _
|
|
@@ -1023,9 +960,9 @@ var H = {
|
|
|
1023
960
|
disabled: m
|
|
1024
961
|
})
|
|
1025
962
|
});
|
|
1026
|
-
return /* @__PURE__ */
|
|
1027
|
-
/* @__PURE__ */
|
|
1028
|
-
icon: /* @__PURE__ */
|
|
963
|
+
return /* @__PURE__ */ P(oe, { children: k ? /* @__PURE__ */ F(oe, { children: [
|
|
964
|
+
/* @__PURE__ */ P(x, {
|
|
965
|
+
icon: /* @__PURE__ */ P(_e, {
|
|
1029
966
|
size: g.LG,
|
|
1030
967
|
"aria-hidden": !0,
|
|
1031
968
|
stroke: _
|
|
@@ -1036,17 +973,17 @@ var H = {
|
|
|
1036
973
|
disabled: m,
|
|
1037
974
|
onClick: () => A(!0)
|
|
1038
975
|
}),
|
|
1039
|
-
/* @__PURE__ */
|
|
976
|
+
/* @__PURE__ */ P(nt, {
|
|
1040
977
|
isOpen: te,
|
|
1041
978
|
title: a,
|
|
1042
979
|
closeLabel: s,
|
|
1043
980
|
onClose: () => A(!1),
|
|
1044
981
|
style: u,
|
|
1045
|
-
items:
|
|
982
|
+
items: L,
|
|
1046
983
|
className: "pb-4",
|
|
1047
984
|
btnTextClassName: "flex-1"
|
|
1048
985
|
}),
|
|
1049
|
-
ce && /* @__PURE__ */
|
|
986
|
+
ce && /* @__PURE__ */ P(K, {
|
|
1050
987
|
isOpen: re,
|
|
1051
988
|
onBack: () => {
|
|
1052
989
|
ie(!1), A(!0);
|
|
@@ -1059,7 +996,7 @@ var H = {
|
|
|
1059
996
|
items: S,
|
|
1060
997
|
onToolToggle: w
|
|
1061
998
|
}),
|
|
1062
|
-
D?.map((e) => /* @__PURE__ */
|
|
999
|
+
D?.map((e) => /* @__PURE__ */ P(W, {
|
|
1063
1000
|
isOpen: M === e.key,
|
|
1064
1001
|
title: e.title,
|
|
1065
1002
|
closeLabel: s,
|
|
@@ -1069,13 +1006,13 @@ var H = {
|
|
|
1069
1006
|
backLabel: e.backLabel ?? "Back",
|
|
1070
1007
|
onClose: () => N(null),
|
|
1071
1008
|
style: u,
|
|
1072
|
-
children: /* @__PURE__ */
|
|
1009
|
+
children: /* @__PURE__ */ P("div", {
|
|
1073
1010
|
role: "menu",
|
|
1074
1011
|
"aria-label": e.title,
|
|
1075
1012
|
children: e.renderOverlay(() => N(null), ee?.() ?? 0)
|
|
1076
1013
|
})
|
|
1077
1014
|
}, e.key)),
|
|
1078
|
-
h != null && /* @__PURE__ */
|
|
1015
|
+
h != null && /* @__PURE__ */ P(ot, {
|
|
1079
1016
|
isOpen: ne,
|
|
1080
1017
|
onBack: () => {
|
|
1081
1018
|
j(!1), A(!0);
|
|
@@ -1102,7 +1039,7 @@ var H = {
|
|
|
1102
1039
|
saveLabel: h.saveLabel,
|
|
1103
1040
|
saveDisabledTooltip: h.saveDisabledTooltip
|
|
1104
1041
|
})
|
|
1105
|
-
] }) : /* @__PURE__ */
|
|
1042
|
+
] }) : /* @__PURE__ */ F(oe, { children: [de, h != null && ne && /* @__PURE__ */ P(ct, {
|
|
1106
1043
|
features: h.features,
|
|
1107
1044
|
initialResponseFormat: h.responseFormat ?? o.Markdown,
|
|
1108
1045
|
initialSystemPrompt: h.systemPrompt,
|
|
@@ -1122,17 +1059,17 @@ var H = {
|
|
|
1122
1059
|
saveLabel: h.saveLabel,
|
|
1123
1060
|
saveDisabledTooltip: h.saveDisabledTooltip
|
|
1124
1061
|
})] }) });
|
|
1125
|
-
},
|
|
1062
|
+
}, ft = {
|
|
1126
1063
|
chip: "_chip_1lvv5_1",
|
|
1127
1064
|
chipSelected: "_chipSelected_1lvv5_9",
|
|
1128
1065
|
chipIcon: "_chipIcon_1lvv5_16",
|
|
1129
1066
|
chipText: "_chipText_1lvv5_19",
|
|
1130
1067
|
chipState: "_chipState_1lvv5_22",
|
|
1131
1068
|
chipClose: "_chipClose_1lvv5_25"
|
|
1132
|
-
},
|
|
1069
|
+
}, pt = (e) => `Remove ${e}`, mt = ({ items: e, onToolToggle: t, onToolDismiss: n, canRemove: r = !0, removeLabel: i = pt, stateOnLabel: a, stateOffLabel: o, typography: s, colors: u }) => {
|
|
1133
1070
|
if (e.length === 0) return null;
|
|
1134
1071
|
let d = !!(a && o);
|
|
1135
|
-
return /* @__PURE__ */
|
|
1072
|
+
return /* @__PURE__ */ P("div", {
|
|
1136
1073
|
className: "flex flex-wrap items-center gap-2",
|
|
1137
1074
|
style: c({
|
|
1138
1075
|
"--ci-chip-bg": u?.chipBg,
|
|
@@ -1148,38 +1085,38 @@ var H = {
|
|
|
1148
1085
|
"--ci-chip-close": u?.chipClose,
|
|
1149
1086
|
"--ci-chip-close-hover": u?.chipCloseHover
|
|
1150
1087
|
}),
|
|
1151
|
-
children: e.map((e) => /* @__PURE__ */
|
|
1152
|
-
className: l(
|
|
1153
|
-
children: [/* @__PURE__ */
|
|
1088
|
+
children: e.map((e) => /* @__PURE__ */ F("div", {
|
|
1089
|
+
className: l(ft.chip, e.isSelected && ft.chipSelected, "flex min-w-0 items-center gap-1.5 rounded-full border py-1 transition-colors", r ? "pe-1 ps-2" : "px-2"),
|
|
1090
|
+
children: [/* @__PURE__ */ F("button", {
|
|
1154
1091
|
type: "button",
|
|
1155
1092
|
onClick: () => t(e.id),
|
|
1156
1093
|
"aria-pressed": e.isSelected,
|
|
1157
1094
|
className: "flex min-w-0 items-center gap-1.5",
|
|
1158
1095
|
children: [
|
|
1159
|
-
/* @__PURE__ */
|
|
1160
|
-
className: l(
|
|
1096
|
+
/* @__PURE__ */ P("span", {
|
|
1097
|
+
className: l(ft.chipIcon, "shrink-0"),
|
|
1161
1098
|
"aria-hidden": !0,
|
|
1162
1099
|
children: e.icon
|
|
1163
1100
|
}),
|
|
1164
|
-
/* @__PURE__ */
|
|
1165
|
-
className: l(
|
|
1166
|
-
children: [e.label, d && /* @__PURE__ */
|
|
1101
|
+
/* @__PURE__ */ F("span", {
|
|
1102
|
+
className: l(ft.chipText, s?.fontClassName || "dial-small-paragraph-text", "truncate"),
|
|
1103
|
+
children: [e.label, d && /* @__PURE__ */ P("span", {
|
|
1167
1104
|
"aria-hidden": !0,
|
|
1168
1105
|
children: ":"
|
|
1169
1106
|
})]
|
|
1170
1107
|
}),
|
|
1171
|
-
d && /* @__PURE__ */
|
|
1172
|
-
className: l(
|
|
1108
|
+
d && /* @__PURE__ */ P("span", {
|
|
1109
|
+
className: l(ft.chipState, s?.fontClassName || "dial-small-paragraph-text", "ms-1 shrink-0 uppercase tracking-wider"),
|
|
1173
1110
|
"aria-hidden": !0,
|
|
1174
1111
|
children: e.isSelected ? a : o
|
|
1175
1112
|
})
|
|
1176
1113
|
]
|
|
1177
|
-
}), r && /* @__PURE__ */
|
|
1114
|
+
}), r && /* @__PURE__ */ P("button", {
|
|
1178
1115
|
type: "button",
|
|
1179
1116
|
onClick: () => n(e.id),
|
|
1180
1117
|
"aria-label": i(e.label),
|
|
1181
|
-
className: l(
|
|
1182
|
-
children: /* @__PURE__ */
|
|
1118
|
+
className: l(ft.chipClose, "flex shrink-0 items-center rounded p-0.5 transition-colors"),
|
|
1119
|
+
children: /* @__PURE__ */ P(be, {
|
|
1183
1120
|
size: 12,
|
|
1184
1121
|
"aria-hidden": !0,
|
|
1185
1122
|
stroke: _
|
|
@@ -1187,7 +1124,7 @@ var H = {
|
|
|
1187
1124
|
})]
|
|
1188
1125
|
}, e.id))
|
|
1189
1126
|
});
|
|
1190
|
-
},
|
|
1127
|
+
}, q = {
|
|
1191
1128
|
wrapper: "_wrapper_19a9k_2",
|
|
1192
1129
|
wrapperDisabled: "_wrapperDisabled_19a9k_9",
|
|
1193
1130
|
textarea: "_textarea_19a9k_13",
|
|
@@ -1200,33 +1137,33 @@ var H = {
|
|
|
1200
1137
|
modelSelectorName: "_modelSelectorName_19a9k_72",
|
|
1201
1138
|
modelSelectorVersion: "_modelSelectorVersion_19a9k_75",
|
|
1202
1139
|
modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_19a9k_84"
|
|
1203
|
-
},
|
|
1140
|
+
}, ht = {
|
|
1204
1141
|
waveformCanvas: "_waveformCanvas_18zb5_1",
|
|
1205
1142
|
recordingDot: "_recordingDot_18zb5_15",
|
|
1206
1143
|
"recording-pulse": "_recording-pulse_18zb5_1"
|
|
1207
|
-
},
|
|
1208
|
-
let f =
|
|
1144
|
+
}, gt = 3, _t = 4, vt = 200, yt = ({ 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 }) => {
|
|
1145
|
+
let f = V(null), p = V(new Float32Array(vt)), m = V(0), h = V(0), v = e === Ke.Recording, y = e === Ke.Processing, b = R((e) => {
|
|
1209
1146
|
let t = e.getContext("2d");
|
|
1210
1147
|
if (!t) return;
|
|
1211
1148
|
e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
|
|
1212
1149
|
let { width: n, height: r } = e;
|
|
1213
1150
|
t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
|
|
1214
|
-
let i = Math.min(Math.max(1, Math.floor(n /
|
|
1151
|
+
let i = Math.min(Math.max(1, Math.floor(n / _t)), vt - 1), a = m.current, o = h.current;
|
|
1215
1152
|
t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
|
|
1216
1153
|
for (let e = 0; e <= i; e++) {
|
|
1217
|
-
let n = ((a - i + e) %
|
|
1218
|
-
t.fillRect(e *
|
|
1154
|
+
let n = ((a - i + e) % vt + vt) % vt, o = p.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
|
|
1155
|
+
t.fillRect(e * _t, (r - c) / 2, gt, c);
|
|
1219
1156
|
}
|
|
1220
1157
|
t.restore();
|
|
1221
1158
|
}, []);
|
|
1222
|
-
|
|
1159
|
+
z(() => {
|
|
1223
1160
|
if (!v) return;
|
|
1224
1161
|
let e = f.current;
|
|
1225
1162
|
if (!e) return;
|
|
1226
1163
|
p.current.fill(0), m.current = 0, h.current = 0;
|
|
1227
1164
|
let n, r = () => {
|
|
1228
|
-
if (h.current += 1, h.current >=
|
|
1229
|
-
h.current -=
|
|
1165
|
+
if (h.current += 1, h.current >= _t) {
|
|
1166
|
+
h.current -= _t;
|
|
1230
1167
|
let e = t.current;
|
|
1231
1168
|
if (e) {
|
|
1232
1169
|
let t = new Uint8Array(e.frequencyBinCount);
|
|
@@ -1236,7 +1173,7 @@ var H = {
|
|
|
1236
1173
|
let r = (t[e] - 128) / 128;
|
|
1237
1174
|
n += r * r;
|
|
1238
1175
|
}
|
|
1239
|
-
p.current[m.current %
|
|
1176
|
+
p.current[m.current % vt] = Math.sqrt(n / t.length), m.current++;
|
|
1240
1177
|
}
|
|
1241
1178
|
}
|
|
1242
1179
|
b(e), n = requestAnimationFrame(r);
|
|
@@ -1248,7 +1185,7 @@ var H = {
|
|
|
1248
1185
|
v,
|
|
1249
1186
|
t,
|
|
1250
1187
|
b
|
|
1251
|
-
]),
|
|
1188
|
+
]), z(() => {
|
|
1252
1189
|
let e = f.current;
|
|
1253
1190
|
if (!e) return;
|
|
1254
1191
|
let t = new ResizeObserver(() => {
|
|
@@ -1256,11 +1193,11 @@ var H = {
|
|
|
1256
1193
|
});
|
|
1257
1194
|
return t.observe(e), () => t.disconnect();
|
|
1258
1195
|
}, [b]);
|
|
1259
|
-
let x = /* @__PURE__ */
|
|
1196
|
+
let x = /* @__PURE__ */ F("div", {
|
|
1260
1197
|
className: "flex flex-shrink-0 items-center justify-end gap-1",
|
|
1261
1198
|
children: [
|
|
1262
|
-
/* @__PURE__ */
|
|
1263
|
-
icon: /* @__PURE__ */
|
|
1199
|
+
/* @__PURE__ */ P(T, {
|
|
1200
|
+
icon: /* @__PURE__ */ P(be, {
|
|
1264
1201
|
size: g.LG,
|
|
1265
1202
|
"aria-hidden": !0,
|
|
1266
1203
|
stroke: _
|
|
@@ -1269,8 +1206,8 @@ var H = {
|
|
|
1269
1206
|
className: "mobile:min-h-11 mobile:min-w-11",
|
|
1270
1207
|
onClick: r
|
|
1271
1208
|
}),
|
|
1272
|
-
v && /* @__PURE__ */
|
|
1273
|
-
icon: /* @__PURE__ */
|
|
1209
|
+
v && /* @__PURE__ */ P(O, {
|
|
1210
|
+
icon: /* @__PURE__ */ P(L, {
|
|
1274
1211
|
size: g.LG,
|
|
1275
1212
|
"aria-hidden": !0,
|
|
1276
1213
|
stroke: _
|
|
@@ -1280,104 +1217,104 @@ var H = {
|
|
|
1280
1217
|
"aria-label": a,
|
|
1281
1218
|
className: "mobile:min-h-11 mobile:min-w-11"
|
|
1282
1219
|
}),
|
|
1283
|
-
y && /* @__PURE__ */
|
|
1220
|
+
y && /* @__PURE__ */ P("span", {
|
|
1284
1221
|
className: "flex size-[40px] flex-shrink-0 items-center justify-center mobile:min-h-11 mobile:min-w-11",
|
|
1285
|
-
children: /* @__PURE__ */
|
|
1222
|
+
children: /* @__PURE__ */ P(ie, {
|
|
1286
1223
|
size: 20,
|
|
1287
1224
|
ariaLabel: s
|
|
1288
1225
|
})
|
|
1289
1226
|
})
|
|
1290
1227
|
]
|
|
1291
1228
|
});
|
|
1292
|
-
return /* @__PURE__ */
|
|
1229
|
+
return /* @__PURE__ */ P("div", {
|
|
1293
1230
|
className: u,
|
|
1294
|
-
children: /* @__PURE__ */
|
|
1231
|
+
children: /* @__PURE__ */ F("div", {
|
|
1295
1232
|
style: c,
|
|
1296
|
-
className: l("flex w-full min-w-0 flex-col justify-center gap-2", !d &&
|
|
1297
|
-
children: [/* @__PURE__ */
|
|
1233
|
+
className: l("flex w-full min-w-0 flex-col justify-center gap-2", !d && q.wrapper, !d && "min-h-[64px] max-w-[748px] rounded-xl border px-3 shadow-md"),
|
|
1234
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1298
1235
|
className: "flex min-w-0 flex-1 items-center gap-3",
|
|
1299
|
-
children: [v && /* @__PURE__ */
|
|
1300
|
-
className: l(
|
|
1236
|
+
children: [v && /* @__PURE__ */ P("span", {
|
|
1237
|
+
className: l(ht.recordingDot, "pointer-events-none block size-[8px] rounded-3xl"),
|
|
1301
1238
|
"aria-hidden": !0
|
|
1302
|
-
}), /* @__PURE__ */
|
|
1239
|
+
}), /* @__PURE__ */ P("canvas", {
|
|
1303
1240
|
ref: f,
|
|
1304
1241
|
height: 26,
|
|
1305
1242
|
"aria-hidden": !0,
|
|
1306
|
-
className: l(
|
|
1243
|
+
className: l(ht.waveformCanvas, "h-[26px] min-w-0 flex-1")
|
|
1307
1244
|
})]
|
|
1308
|
-
}), /* @__PURE__ */
|
|
1245
|
+
}), /* @__PURE__ */ F("div", {
|
|
1309
1246
|
className: "flex items-center justify-between gap-2",
|
|
1310
|
-
children: [i ?? /* @__PURE__ */
|
|
1247
|
+
children: [i ?? /* @__PURE__ */ P("span", { "aria-hidden": !0 }), x]
|
|
1311
1248
|
})]
|
|
1312
1249
|
})
|
|
1313
1250
|
});
|
|
1314
|
-
},
|
|
1251
|
+
}, bt = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", sendTooltip: r }) => /* @__PURE__ */ P(O, {
|
|
1315
1252
|
"aria-label": n,
|
|
1316
1253
|
onClick: () => e?.(),
|
|
1317
1254
|
disabled: t,
|
|
1318
1255
|
tooltipProps: r ? { tooltip: r } : void 0,
|
|
1319
|
-
icon: /* @__PURE__ */
|
|
1256
|
+
icon: /* @__PURE__ */ P(ue, {
|
|
1320
1257
|
size: g.LG,
|
|
1321
1258
|
className: "rtl:scale-x-[-1]",
|
|
1322
1259
|
stroke: _
|
|
1323
1260
|
})
|
|
1324
|
-
}),
|
|
1325
|
-
icon: /* @__PURE__ */
|
|
1261
|
+
}), xt = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ P(T, {
|
|
1262
|
+
icon: /* @__PURE__ */ P(ge, {
|
|
1326
1263
|
size: g.LG,
|
|
1327
1264
|
stroke: _
|
|
1328
1265
|
}),
|
|
1329
1266
|
onClick: () => e?.(),
|
|
1330
1267
|
"aria-label": t
|
|
1331
|
-
}),
|
|
1268
|
+
}), St = ({ size: e = 20 }) => /* @__PURE__ */ P(ne, {
|
|
1332
1269
|
variant: j.Circular,
|
|
1333
1270
|
width: e,
|
|
1334
1271
|
height: e,
|
|
1335
1272
|
active: !0
|
|
1336
|
-
}),
|
|
1273
|
+
}), Ct = ({ loadingLabel: e }) => /* @__PURE__ */ F("span", {
|
|
1337
1274
|
className: "flex min-w-0 flex-1 items-center",
|
|
1338
|
-
children: [/* @__PURE__ */
|
|
1275
|
+
children: [/* @__PURE__ */ P(ne, {
|
|
1339
1276
|
variant: j.Text,
|
|
1340
1277
|
width: "100%",
|
|
1341
1278
|
height: 16,
|
|
1342
1279
|
active: !0
|
|
1343
|
-
}), e && /* @__PURE__ */
|
|
1280
|
+
}), e && /* @__PURE__ */ P("span", {
|
|
1344
1281
|
className: "sr-only",
|
|
1345
1282
|
children: e
|
|
1346
1283
|
})]
|
|
1347
|
-
}),
|
|
1284
|
+
}), wt = ({ loadingLabel: e }) => /* @__PURE__ */ P("div", {
|
|
1348
1285
|
role: "status",
|
|
1349
1286
|
"aria-label": e,
|
|
1350
|
-
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */
|
|
1287
|
+
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ F("div", {
|
|
1351
1288
|
className: "flex h-11 items-center gap-3 px-4",
|
|
1352
1289
|
"aria-hidden": "true",
|
|
1353
|
-
children: [/* @__PURE__ */
|
|
1290
|
+
children: [/* @__PURE__ */ P(St, {}), /* @__PURE__ */ P(Ct, {})]
|
|
1354
1291
|
}, t))
|
|
1355
|
-
}),
|
|
1292
|
+
}), Tt = (e) => e.displayName ?? e.id, Et = (e, t) => {
|
|
1356
1293
|
let n = t.trim().toLowerCase();
|
|
1357
|
-
return n ? e.filter((e) =>
|
|
1358
|
-
},
|
|
1294
|
+
return n ? e.filter((e) => Tt(e).toLowerCase().includes(n)) : e;
|
|
1295
|
+
}, Dt = (e, t, r, i = 18, a) => /* @__PURE__ */ P(n, {
|
|
1359
1296
|
src: e,
|
|
1360
1297
|
size: i,
|
|
1361
1298
|
labels: { tooltip: a },
|
|
1362
1299
|
initialsName: r
|
|
1363
|
-
}),
|
|
1300
|
+
}), Ot = {
|
|
1364
1301
|
searchHeader: "_searchHeader_1u7db_1",
|
|
1365
1302
|
itemText: "_itemText_1u7db_13",
|
|
1366
1303
|
itemHover: "_itemHover_1u7db_17",
|
|
1367
1304
|
selectedItemBackground: "_selectedItemBackground_1u7db_22",
|
|
1368
1305
|
selectedItemText: "_selectedItemText_1u7db_26",
|
|
1369
1306
|
checkIcon: "_checkIcon_1u7db_30"
|
|
1370
|
-
},
|
|
1371
|
-
let [a, o] =
|
|
1307
|
+
}, kt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, styles: i }) => {
|
|
1308
|
+
let [a, o] = H(""), s = B(() => e?.find((e) => e.id === t), [e, t]), u = r?.loading !== void 0, d = !u && !s && !!t, f = B(() => u ? /* @__PURE__ */ P(St, { size: g.LG }) : Dt(s?.iconUrl, s?.type, s?.displayName ?? s?.id ?? "", g.LG, d ? r?.unavailableTooltip ?? "This deployment is no longer available" : void 0), [
|
|
1372
1309
|
u,
|
|
1373
1310
|
s,
|
|
1374
1311
|
d,
|
|
1375
1312
|
r?.unavailableTooltip
|
|
1376
|
-
]), p = s?.displayName ?? s?.id, m = s?.displayVersion, h = p ? `${r?.ariaLabel ?? "Select model"}: ${p}` : r?.ariaLabel ?? "Select model", _ =
|
|
1313
|
+
]), p = s?.displayName ?? s?.id, m = s?.displayVersion, h = p ? `${r?.ariaLabel ?? "Select model"}: ${p}` : r?.ariaLabel ?? "Select model", _ = B(() => {
|
|
1377
1314
|
if (u) return Array.from({ length: 7 }, (e, t) => ({
|
|
1378
1315
|
key: `__loading-${t}`,
|
|
1379
|
-
icon: /* @__PURE__ */
|
|
1380
|
-
label: /* @__PURE__ */
|
|
1316
|
+
icon: /* @__PURE__ */ P(St, {}),
|
|
1317
|
+
label: /* @__PURE__ */ P(Ct, { loadingLabel: t === 0 ? r?.loading : void 0 }),
|
|
1381
1318
|
disabled: !0
|
|
1382
1319
|
}));
|
|
1383
1320
|
if (!e || e.length === 0) {
|
|
@@ -1389,19 +1326,19 @@ var H = {
|
|
|
1389
1326
|
}] : [];
|
|
1390
1327
|
}
|
|
1391
1328
|
let o = i?.colors;
|
|
1392
|
-
return
|
|
1329
|
+
return Et(e, a).map((e) => {
|
|
1393
1330
|
let r = e.id === t;
|
|
1394
1331
|
return {
|
|
1395
1332
|
key: e.id,
|
|
1396
|
-
label: /* @__PURE__ */
|
|
1397
|
-
text:
|
|
1333
|
+
label: /* @__PURE__ */ P(S, {
|
|
1334
|
+
text: Tt(e),
|
|
1398
1335
|
query: a,
|
|
1399
1336
|
maxLines: 1
|
|
1400
1337
|
}),
|
|
1401
|
-
icon:
|
|
1338
|
+
icon: Dt(e.iconUrl, e.type, e.displayName ?? e.id),
|
|
1402
1339
|
mark: C.Check,
|
|
1403
1340
|
checked: r,
|
|
1404
|
-
className: l(o?.itemText &&
|
|
1341
|
+
className: l(o?.itemText && Ot.itemText, o?.itemHoverBackground && Ot.itemHover, r && o?.selectedItemBackground && Ot.selectedItemBackground, r && o?.selectedItemText && Ot.selectedItemText, r && o?.checkIcon && Ot.checkIcon, i?.itemClassName, r && i?.selectedItemClassName, U.modelMenuItem, r && U.modelMenuItemSelected),
|
|
1405
1342
|
onClick: () => n?.(e.id)
|
|
1406
1343
|
};
|
|
1407
1344
|
});
|
|
@@ -1415,7 +1352,7 @@ var H = {
|
|
|
1415
1352
|
i?.itemClassName,
|
|
1416
1353
|
i?.selectedItemClassName,
|
|
1417
1354
|
i?.colors
|
|
1418
|
-
]), v =
|
|
1355
|
+
]), v = B(() => c({
|
|
1419
1356
|
"--ms-item-text": i?.colors?.itemText,
|
|
1420
1357
|
"--ms-item-hover-bg": i?.colors?.itemHoverBackground,
|
|
1421
1358
|
"--ms-selected-item-bg": i?.colors?.selectedItemBackground,
|
|
@@ -1428,10 +1365,10 @@ var H = {
|
|
|
1428
1365
|
selectedLabel: p,
|
|
1429
1366
|
selectedVersion: m,
|
|
1430
1367
|
menuItems: _,
|
|
1431
|
-
menuHeader:
|
|
1368
|
+
menuHeader: B(() => !u && e && e.length > 0 ? /* @__PURE__ */ P("div", {
|
|
1432
1369
|
style: c({ "--ms-search-header-bg": i?.colors?.searchHeaderBackground }),
|
|
1433
|
-
className: l("sticky top-0 z-10 pb-1 pe-2 pt-2",
|
|
1434
|
-
children: /* @__PURE__ */
|
|
1370
|
+
className: l("sticky top-0 z-10 pb-1 pe-2 pt-2", Ot.searchHeader, i?.searchHeaderClassName, U.modelMenuSearch),
|
|
1371
|
+
children: /* @__PURE__ */ P(A, {
|
|
1435
1372
|
value: a,
|
|
1436
1373
|
placeholder: r?.searchPlaceholder ?? "Search",
|
|
1437
1374
|
size: y.Small,
|
|
@@ -1451,8 +1388,8 @@ var H = {
|
|
|
1451
1388
|
e || o("");
|
|
1452
1389
|
}
|
|
1453
1390
|
};
|
|
1454
|
-
},
|
|
1455
|
-
function
|
|
1391
|
+
}, At = typeof window < "u" ? Ee : z;
|
|
1392
|
+
function jt(e) {
|
|
1456
1393
|
if (e !== void 0) switch (typeof e) {
|
|
1457
1394
|
case "number": return e;
|
|
1458
1395
|
case "string":
|
|
@@ -1460,15 +1397,15 @@ function It(e) {
|
|
|
1460
1397
|
break;
|
|
1461
1398
|
}
|
|
1462
1399
|
}
|
|
1463
|
-
function
|
|
1464
|
-
let { styleHeight: s, styleWidth: c } =
|
|
1465
|
-
styleHeight:
|
|
1466
|
-
styleWidth:
|
|
1467
|
-
}), [o?.height, o?.width]), [l, u] =
|
|
1400
|
+
function Mt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
|
|
1401
|
+
let { styleHeight: s, styleWidth: c } = B(() => ({
|
|
1402
|
+
styleHeight: jt(o?.height),
|
|
1403
|
+
styleWidth: jt(o?.width)
|
|
1404
|
+
}), [o?.height, o?.width]), [l, u] = H({
|
|
1468
1405
|
height: t,
|
|
1469
1406
|
width: n
|
|
1470
1407
|
}), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
|
|
1471
|
-
return
|
|
1408
|
+
return At(() => {
|
|
1472
1409
|
if (i === null || d) return;
|
|
1473
1410
|
let t = new ResizeObserver((e) => {
|
|
1474
1411
|
for (let t of e) {
|
|
@@ -1488,7 +1425,7 @@ function Lt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1488
1425
|
i,
|
|
1489
1426
|
s,
|
|
1490
1427
|
c
|
|
1491
|
-
]),
|
|
1428
|
+
]), B(() => ({
|
|
1492
1429
|
height: s ?? l.height,
|
|
1493
1430
|
width: c ?? l.width
|
|
1494
1431
|
}), [
|
|
@@ -1497,16 +1434,16 @@ function Lt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1497
1434
|
c
|
|
1498
1435
|
]);
|
|
1499
1436
|
}
|
|
1500
|
-
function
|
|
1501
|
-
let t =
|
|
1437
|
+
function Nt(e) {
|
|
1438
|
+
let t = V(() => {
|
|
1502
1439
|
throw Error("Cannot call during render.");
|
|
1503
1440
|
});
|
|
1504
|
-
return
|
|
1441
|
+
return At(() => {
|
|
1505
1442
|
t.current = e;
|
|
1506
|
-
}, [e]),
|
|
1443
|
+
}, [e]), R((e) => t.current?.(e), [t]);
|
|
1507
1444
|
}
|
|
1508
1445
|
var J = null;
|
|
1509
|
-
function
|
|
1446
|
+
function Pt(e = !1) {
|
|
1510
1447
|
if (J === null || e) {
|
|
1511
1448
|
let e = document.createElement("div"), t = e.style;
|
|
1512
1449
|
t.width = "50px", t.height = "50px", t.overflow = "scroll", t.direction = "rtl";
|
|
@@ -1515,8 +1452,8 @@ function Y(e = !1) {
|
|
|
1515
1452
|
}
|
|
1516
1453
|
return J;
|
|
1517
1454
|
}
|
|
1518
|
-
function
|
|
1519
|
-
if (t === "horizontal" && n) switch (
|
|
1455
|
+
function Ft({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
1456
|
+
if (t === "horizontal" && n) switch (Pt()) {
|
|
1520
1457
|
case "negative": return -r;
|
|
1521
1458
|
case "positive-descending":
|
|
1522
1459
|
if (e) {
|
|
@@ -1527,12 +1464,12 @@ function Rt({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
|
1527
1464
|
}
|
|
1528
1465
|
return r;
|
|
1529
1466
|
}
|
|
1530
|
-
function
|
|
1467
|
+
function Y(e, t = "Assertion error") {
|
|
1531
1468
|
if (!e) throw console.error(t), Error(t);
|
|
1532
1469
|
}
|
|
1533
|
-
function
|
|
1470
|
+
function X(e, t) {
|
|
1534
1471
|
if (e === t) return !0;
|
|
1535
|
-
if (!!e != !!t || (
|
|
1472
|
+
if (!!e != !!t || (Y(e !== void 0), Y(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
|
|
1536
1473
|
for (let n in e) if (!Object.is(t[n], e[n])) return !1;
|
|
1537
1474
|
return !0;
|
|
1538
1475
|
}
|
|
@@ -1541,10 +1478,10 @@ function Z({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
|
1541
1478
|
if (typeof n == "number") return t * n;
|
|
1542
1479
|
{
|
|
1543
1480
|
let n = e.get(e.size === 0 ? 0 : e.size - 1);
|
|
1544
|
-
return
|
|
1481
|
+
return Y(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
|
|
1545
1482
|
}
|
|
1546
1483
|
}
|
|
1547
|
-
function
|
|
1484
|
+
function It({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
|
|
1548
1485
|
if (n < 0 || n >= r) throw RangeError(`Invalid index specified: ${n}`, { cause: `Index ${n} is not within the range of 0 - ${r - 1}` });
|
|
1549
1486
|
let s = Z({
|
|
1550
1487
|
cachedBounds: t,
|
|
@@ -1558,7 +1495,7 @@ function Bt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, co
|
|
|
1558
1495
|
default: return a >= u && a <= l ? a : a < u ? u : l;
|
|
1559
1496
|
}
|
|
1560
1497
|
}
|
|
1561
|
-
function
|
|
1498
|
+
function Lt({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
|
|
1562
1499
|
let a = r - 1, o = 0, s = -1, c = 0, l = -1, u = 0;
|
|
1563
1500
|
for (; u < a;) {
|
|
1564
1501
|
let n = e.get(u);
|
|
@@ -1577,11 +1514,11 @@ function Vt({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemC
|
|
|
1577
1514
|
stopIndexOverscan: l
|
|
1578
1515
|
};
|
|
1579
1516
|
}
|
|
1580
|
-
function
|
|
1517
|
+
function Rt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1581
1518
|
let r = /* @__PURE__ */ new Map();
|
|
1582
1519
|
return {
|
|
1583
1520
|
get(i) {
|
|
1584
|
-
for (
|
|
1521
|
+
for (Y(i < e, `Invalid index ${i}`); r.size - 1 < i;) {
|
|
1585
1522
|
let e = r.size, a;
|
|
1586
1523
|
switch (typeof n) {
|
|
1587
1524
|
case "function":
|
|
@@ -1597,14 +1534,14 @@ function Ht({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1597
1534
|
});
|
|
1598
1535
|
else {
|
|
1599
1536
|
let t = r.get(e - 1);
|
|
1600
|
-
|
|
1537
|
+
Y(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
|
|
1601
1538
|
scrollOffset: t.scrollOffset + t.size,
|
|
1602
1539
|
size: a
|
|
1603
1540
|
});
|
|
1604
1541
|
}
|
|
1605
1542
|
}
|
|
1606
1543
|
let a = r.get(i);
|
|
1607
|
-
return
|
|
1544
|
+
return Y(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
|
|
1608
1545
|
},
|
|
1609
1546
|
set(e, t) {
|
|
1610
1547
|
r.set(e, t);
|
|
@@ -1614,8 +1551,8 @@ function Ht({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1614
1551
|
}
|
|
1615
1552
|
};
|
|
1616
1553
|
}
|
|
1617
|
-
function
|
|
1618
|
-
return
|
|
1554
|
+
function Q({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1555
|
+
return B(() => Rt({
|
|
1619
1556
|
itemCount: e,
|
|
1620
1557
|
itemProps: t,
|
|
1621
1558
|
itemSize: n
|
|
@@ -1625,11 +1562,11 @@ function Ut({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1625
1562
|
n
|
|
1626
1563
|
]);
|
|
1627
1564
|
}
|
|
1628
|
-
function
|
|
1565
|
+
function zt({ containerSize: e, itemSize: t }) {
|
|
1629
1566
|
let n;
|
|
1630
1567
|
switch (typeof t) {
|
|
1631
1568
|
case "string":
|
|
1632
|
-
|
|
1569
|
+
Y(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), Y(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseInt(t) / 100;
|
|
1633
1570
|
break;
|
|
1634
1571
|
default:
|
|
1635
1572
|
n = t;
|
|
@@ -1637,21 +1574,21 @@ function Wt({ containerSize: e, itemSize: t }) {
|
|
|
1637
1574
|
}
|
|
1638
1575
|
return n;
|
|
1639
1576
|
}
|
|
1640
|
-
function
|
|
1641
|
-
let { height: u = n, width: d = n } =
|
|
1577
|
+
function Bt({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
|
|
1578
|
+
let { height: u = n, width: d = n } = Mt({
|
|
1642
1579
|
defaultHeight: r === "vertical" ? n : void 0,
|
|
1643
1580
|
defaultWidth: r === "horizontal" ? n : void 0,
|
|
1644
1581
|
element: e,
|
|
1645
1582
|
mode: r === "vertical" ? "only-height" : "only-width",
|
|
1646
1583
|
style: t
|
|
1647
|
-
}), f =
|
|
1584
|
+
}), f = V({
|
|
1648
1585
|
height: 0,
|
|
1649
1586
|
width: 0
|
|
1650
|
-
}), p = r === "vertical" ? u : d, m =
|
|
1587
|
+
}), p = r === "vertical" ? u : d, m = zt({
|
|
1651
1588
|
containerSize: p,
|
|
1652
1589
|
itemSize: s
|
|
1653
1590
|
});
|
|
1654
|
-
|
|
1591
|
+
Ee(() => {
|
|
1655
1592
|
if (typeof c == "function") {
|
|
1656
1593
|
let e = f.current;
|
|
1657
1594
|
(e.height !== u || e.width !== d) && (c({
|
|
@@ -1664,11 +1601,11 @@ function Gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1664
1601
|
c,
|
|
1665
1602
|
d
|
|
1666
1603
|
]);
|
|
1667
|
-
let h =
|
|
1604
|
+
let h = Q({
|
|
1668
1605
|
itemCount: a,
|
|
1669
1606
|
itemProps: o,
|
|
1670
1607
|
itemSize: m
|
|
1671
|
-
}), g =
|
|
1608
|
+
}), g = R((e) => h.get(e), [h]), [_, v] = H(() => Lt({
|
|
1672
1609
|
cachedBounds: h,
|
|
1673
1610
|
containerScrollOffset: 0,
|
|
1674
1611
|
containerSize: p,
|
|
@@ -1679,7 +1616,7 @@ function Gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1679
1616
|
startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
|
|
1680
1617
|
stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
|
|
1681
1618
|
stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
|
|
1682
|
-
}, C =
|
|
1619
|
+
}, C = R(() => Z({
|
|
1683
1620
|
cachedBounds: h,
|
|
1684
1621
|
itemCount: a,
|
|
1685
1622
|
itemSize: m
|
|
@@ -1687,9 +1624,9 @@ function Gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1687
1624
|
h,
|
|
1688
1625
|
a,
|
|
1689
1626
|
m
|
|
1690
|
-
]), w =
|
|
1627
|
+
]), w = R((t) => Lt({
|
|
1691
1628
|
cachedBounds: h,
|
|
1692
|
-
containerScrollOffset:
|
|
1629
|
+
containerScrollOffset: Ft({
|
|
1693
1630
|
containerElement: e,
|
|
1694
1631
|
direction: r,
|
|
1695
1632
|
isRtl: i,
|
|
@@ -1707,19 +1644,19 @@ function Gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1707
1644
|
a,
|
|
1708
1645
|
l
|
|
1709
1646
|
]);
|
|
1710
|
-
return
|
|
1647
|
+
return At(() => {
|
|
1711
1648
|
v(w((r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0));
|
|
1712
1649
|
}, [
|
|
1713
1650
|
e,
|
|
1714
1651
|
r,
|
|
1715
1652
|
w
|
|
1716
|
-
]),
|
|
1653
|
+
]), At(() => {
|
|
1717
1654
|
if (!e) return;
|
|
1718
1655
|
let t = () => {
|
|
1719
1656
|
v((t) => {
|
|
1720
|
-
let { scrollLeft: n, scrollTop: o } = e, s =
|
|
1657
|
+
let { scrollLeft: n, scrollTop: o } = e, s = Lt({
|
|
1721
1658
|
cachedBounds: h,
|
|
1722
|
-
containerScrollOffset:
|
|
1659
|
+
containerScrollOffset: Ft({
|
|
1723
1660
|
containerElement: e,
|
|
1724
1661
|
direction: r,
|
|
1725
1662
|
isRtl: i,
|
|
@@ -1729,7 +1666,7 @@ function Gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1729
1666
|
itemCount: a,
|
|
1730
1667
|
overscanCount: l
|
|
1731
1668
|
});
|
|
1732
|
-
return
|
|
1669
|
+
return X(s, t) ? t : s;
|
|
1733
1670
|
});
|
|
1734
1671
|
};
|
|
1735
1672
|
return e.addEventListener("scroll", t), () => {
|
|
@@ -1745,8 +1682,8 @@ function Gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1745
1682
|
]), {
|
|
1746
1683
|
getCellBounds: g,
|
|
1747
1684
|
getEstimatedSize: C,
|
|
1748
|
-
scrollToIndex:
|
|
1749
|
-
let s =
|
|
1685
|
+
scrollToIndex: Nt(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
|
|
1686
|
+
let s = It({
|
|
1750
1687
|
align: t,
|
|
1751
1688
|
cachedBounds: h,
|
|
1752
1689
|
containerScrollOffset: n,
|
|
@@ -1756,14 +1693,14 @@ function Gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1756
1693
|
itemSize: m
|
|
1757
1694
|
});
|
|
1758
1695
|
if (e) {
|
|
1759
|
-
if (s =
|
|
1696
|
+
if (s = Ft({
|
|
1760
1697
|
containerElement: e,
|
|
1761
1698
|
direction: r,
|
|
1762
1699
|
isRtl: i,
|
|
1763
1700
|
scrollOffset: s
|
|
1764
1701
|
}), typeof e.scrollTo != "function") {
|
|
1765
1702
|
let e = w(s);
|
|
1766
|
-
|
|
1703
|
+
X(_, e) || v(e);
|
|
1767
1704
|
}
|
|
1768
1705
|
return s;
|
|
1769
1706
|
}
|
|
@@ -1774,30 +1711,30 @@ function Gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1774
1711
|
stopIndexVisible: x
|
|
1775
1712
|
};
|
|
1776
1713
|
}
|
|
1777
|
-
function
|
|
1778
|
-
return
|
|
1714
|
+
function Vt(e) {
|
|
1715
|
+
return B(() => e, Object.values(e));
|
|
1779
1716
|
}
|
|
1780
|
-
function
|
|
1717
|
+
function Ht(e, t) {
|
|
1781
1718
|
let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
|
|
1782
|
-
return
|
|
1719
|
+
return X(n, a) && X(r, o) && X(i, s);
|
|
1783
1720
|
}
|
|
1784
|
-
function
|
|
1721
|
+
function Ut(e) {
|
|
1785
1722
|
return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
|
|
1786
1723
|
}
|
|
1787
|
-
var
|
|
1788
|
-
function
|
|
1789
|
-
let m =
|
|
1724
|
+
var Wt = "data-react-window-index";
|
|
1725
|
+
function Gt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onResize: i, onRowsRendered: a, overscanCount: o = 3, rowComponent: s, rowCount: c, rowHeight: l, rowProps: u, tagName: d = "div", style: f, ...p }) {
|
|
1726
|
+
let m = Vt(u), h = B(() => Ce(s, Ht), [s]), [g, _] = H(null), v = Ut(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = Bt({
|
|
1790
1727
|
containerElement: g,
|
|
1791
1728
|
containerStyle: f,
|
|
1792
1729
|
defaultContainerSize: n,
|
|
1793
1730
|
direction: "vertical",
|
|
1794
1731
|
itemCount: c,
|
|
1795
1732
|
itemProps: m,
|
|
1796
|
-
itemSize:
|
|
1733
|
+
itemSize: B(() => v ? (e) => l.getRowHeight(e) ?? l.getAverageRowHeight() : l, [v, l]),
|
|
1797
1734
|
onResize: i,
|
|
1798
1735
|
overscanCount: o
|
|
1799
1736
|
});
|
|
1800
|
-
|
|
1737
|
+
Te(r, () => ({
|
|
1801
1738
|
get element() {
|
|
1802
1739
|
return g;
|
|
1803
1740
|
},
|
|
@@ -1812,12 +1749,12 @@ function Xt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1812
1749
|
top: r
|
|
1813
1750
|
});
|
|
1814
1751
|
}
|
|
1815
|
-
}), [g, x]),
|
|
1752
|
+
}), [g, x]), At(() => {
|
|
1816
1753
|
if (!g) return;
|
|
1817
1754
|
let e = Array.from(g.children).filter((e, t) => {
|
|
1818
1755
|
if (e.hasAttribute("aria-hidden")) return !1;
|
|
1819
1756
|
let n = `${S + t}`;
|
|
1820
|
-
return e.setAttribute(
|
|
1757
|
+
return e.setAttribute(Wt, n), !0;
|
|
1821
1758
|
});
|
|
1822
1759
|
if (v) return l.observeRowElements(e);
|
|
1823
1760
|
}, [
|
|
@@ -1826,7 +1763,7 @@ function Xt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1826
1763
|
l,
|
|
1827
1764
|
S,
|
|
1828
1765
|
w
|
|
1829
|
-
]),
|
|
1766
|
+
]), z(() => {
|
|
1830
1767
|
S >= 0 && w >= 0 && a && a({
|
|
1831
1768
|
startIndex: C,
|
|
1832
1769
|
stopIndex: T
|
|
@@ -1841,11 +1778,11 @@ function Xt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1841
1778
|
w,
|
|
1842
1779
|
T
|
|
1843
1780
|
]);
|
|
1844
|
-
let E =
|
|
1781
|
+
let E = B(() => {
|
|
1845
1782
|
let e = [];
|
|
1846
1783
|
if (c > 0) for (let t = S; t <= w; t++) {
|
|
1847
1784
|
let n = y(t);
|
|
1848
|
-
e.push(/* @__PURE__ */
|
|
1785
|
+
e.push(/* @__PURE__ */ xe(h, {
|
|
1849
1786
|
...m,
|
|
1850
1787
|
ariaAttributes: {
|
|
1851
1788
|
"aria-posinset": t + 1,
|
|
@@ -1872,7 +1809,7 @@ function Xt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1872
1809
|
m,
|
|
1873
1810
|
S,
|
|
1874
1811
|
w
|
|
1875
|
-
]), D = /* @__PURE__ */
|
|
1812
|
+
]), D = /* @__PURE__ */ P("div", {
|
|
1876
1813
|
"aria-hidden": !0,
|
|
1877
1814
|
style: {
|
|
1878
1815
|
height: b(),
|
|
@@ -1880,7 +1817,7 @@ function Xt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1880
1817
|
zIndex: -1
|
|
1881
1818
|
}
|
|
1882
1819
|
});
|
|
1883
|
-
return
|
|
1820
|
+
return xe(d, {
|
|
1884
1821
|
role: "list",
|
|
1885
1822
|
...p,
|
|
1886
1823
|
className: t,
|
|
@@ -1894,7 +1831,7 @@ function Xt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1894
1831
|
}
|
|
1895
1832
|
}, E, e, D);
|
|
1896
1833
|
}
|
|
1897
|
-
var
|
|
1834
|
+
var Kt = {
|
|
1898
1835
|
search: "_search_5skzl_1",
|
|
1899
1836
|
divider: "_divider_5skzl_5",
|
|
1900
1837
|
item: "_item_5skzl_9",
|
|
@@ -1903,42 +1840,42 @@ var Zt = {
|
|
|
1903
1840
|
stateLabel: "_stateLabel_5skzl_27",
|
|
1904
1841
|
itemSelectedBackground: "_itemSelectedBackground_5skzl_37",
|
|
1905
1842
|
itemSelectedText: "_itemSelectedText_5skzl_41"
|
|
1906
|
-
},
|
|
1907
|
-
let
|
|
1908
|
-
return /* @__PURE__ */
|
|
1843
|
+
}, qt = 44, Jt = 8, Yt = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: o, itemClassName: s, selectedItemClassName: c, hasSelectedBackground: u, hasSelectedText: d, onSelect: f }) => {
|
|
1844
|
+
let p = r[e], h = Dt(p.iconUrl, p.type, p.displayName ?? p.id, g.SM), v = p.id === i;
|
|
1845
|
+
return /* @__PURE__ */ P("div", {
|
|
1909
1846
|
style: t,
|
|
1910
1847
|
...n,
|
|
1911
|
-
children: /* @__PURE__ */
|
|
1848
|
+
children: /* @__PURE__ */ P(m, {
|
|
1912
1849
|
type: "button",
|
|
1913
1850
|
"aria-current": v ? "true" : void 0,
|
|
1914
|
-
className: l(
|
|
1915
|
-
iconBefore: /* @__PURE__ */
|
|
1916
|
-
className:
|
|
1851
|
+
className: l(Kt.item, "h-full w-full gap-3 px-4", v && u && Kt.itemSelectedBackground, v && d && Kt.itemSelectedText, s, v && c, U.modelMenuItem, v && U.modelMenuItemSelected),
|
|
1852
|
+
iconBefore: /* @__PURE__ */ P("span", {
|
|
1853
|
+
className: Kt.itemIcon,
|
|
1917
1854
|
children: h
|
|
1918
1855
|
}),
|
|
1919
|
-
label: /* @__PURE__ */
|
|
1856
|
+
label: /* @__PURE__ */ F("span", {
|
|
1920
1857
|
className: "flex flex-1 items-center justify-between gap-2",
|
|
1921
|
-
children: [/* @__PURE__ */
|
|
1922
|
-
text:
|
|
1858
|
+
children: [/* @__PURE__ */ P(S, {
|
|
1859
|
+
text: p.displayName ?? p.id,
|
|
1923
1860
|
query: o,
|
|
1924
1861
|
maxLines: 1,
|
|
1925
1862
|
className: l(a, "min-w-0 flex-1 text-start")
|
|
1926
|
-
}), v && /* @__PURE__ */
|
|
1863
|
+
}), v && /* @__PURE__ */ P(L, {
|
|
1927
1864
|
size: g.SM,
|
|
1928
|
-
className:
|
|
1865
|
+
className: Kt.checkIcon,
|
|
1929
1866
|
"aria-hidden": !0,
|
|
1930
1867
|
stroke: _
|
|
1931
1868
|
})]
|
|
1932
1869
|
}),
|
|
1933
|
-
onClick: () => f(
|
|
1870
|
+
onClick: () => f(p.id)
|
|
1934
1871
|
})
|
|
1935
1872
|
});
|
|
1936
|
-
},
|
|
1937
|
-
let [v, b] =
|
|
1938
|
-
|
|
1873
|
+
}, Xt = ({ 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: _ }) => {
|
|
1874
|
+
let [v, b] = H("");
|
|
1875
|
+
z(() => {
|
|
1939
1876
|
e || b("");
|
|
1940
1877
|
}, [e]);
|
|
1941
|
-
let x = a && a.length > 0, S = u !== void 0, C = !x && !S ? d ?? f : void 0, w = x ?
|
|
1878
|
+
let x = a && a.length > 0, S = u !== void 0, C = !x && !S ? d ?? f : void 0, w = x ? Et(a, v) : [], T = (e) => {
|
|
1942
1879
|
s(e), i();
|
|
1943
1880
|
}, E = _?.colors, D = c({
|
|
1944
1881
|
"--ci-sheet-divider": g?.divider,
|
|
@@ -1950,38 +1887,38 @@ var Zt = {
|
|
|
1950
1887
|
"--ci-sheet-selected-bg": E?.selectedItemBackground,
|
|
1951
1888
|
"--ci-sheet-selected-text": E?.selectedItemText
|
|
1952
1889
|
});
|
|
1953
|
-
return /* @__PURE__ */
|
|
1890
|
+
return /* @__PURE__ */ P(W, {
|
|
1954
1891
|
isOpen: e,
|
|
1955
1892
|
title: t,
|
|
1956
1893
|
closeLabel: n,
|
|
1957
1894
|
onClose: i,
|
|
1958
1895
|
style: p,
|
|
1959
1896
|
titleClassName: m,
|
|
1960
|
-
className: l("max-h-[80dvh]", _?.className,
|
|
1897
|
+
className: l("max-h-[80dvh]", _?.className, U.modelMenu),
|
|
1961
1898
|
colors: g?.shell,
|
|
1962
|
-
children: /* @__PURE__ */
|
|
1899
|
+
children: /* @__PURE__ */ F("div", {
|
|
1963
1900
|
className: "contents",
|
|
1964
1901
|
style: D,
|
|
1965
|
-
children: [x && !S && /* @__PURE__ */
|
|
1902
|
+
children: [x && !S && /* @__PURE__ */ F(oe, { children: [/* @__PURE__ */ P("div", {
|
|
1966
1903
|
style: c({ "--ci-sheet-search-bg": _?.colors?.searchHeaderBackground }),
|
|
1967
|
-
className: l("flex-shrink-0 px-4 py-[10px]",
|
|
1968
|
-
children: /* @__PURE__ */
|
|
1904
|
+
className: l("flex-shrink-0 px-4 py-[10px]", Kt.search, _?.searchHeaderClassName, U.modelMenuSearch),
|
|
1905
|
+
children: /* @__PURE__ */ P(A, {
|
|
1969
1906
|
value: v,
|
|
1970
1907
|
placeholder: r,
|
|
1971
1908
|
size: y.Standard,
|
|
1972
1909
|
onChange: (e) => b(e ?? "")
|
|
1973
1910
|
})
|
|
1974
|
-
}), /* @__PURE__ */
|
|
1911
|
+
}), /* @__PURE__ */ P("div", { className: l(Kt.divider, "h-px flex-shrink-0") })] }), S ? /* @__PURE__ */ P(wt, { loadingLabel: u }) : C ? /* @__PURE__ */ P("div", {
|
|
1975
1912
|
role: "list",
|
|
1976
|
-
className: l(
|
|
1913
|
+
className: l(Kt.stateLabel, h, "px-4 py-4"),
|
|
1977
1914
|
children: C
|
|
1978
|
-
}) : /* @__PURE__ */
|
|
1915
|
+
}) : /* @__PURE__ */ P(Gt, {
|
|
1979
1916
|
role: "list",
|
|
1980
1917
|
className: "overflow-y-auto",
|
|
1981
|
-
style: { height: Math.min(w.length,
|
|
1982
|
-
rowComponent:
|
|
1918
|
+
style: { height: Math.min(w.length, Jt) * qt },
|
|
1919
|
+
rowComponent: Yt,
|
|
1983
1920
|
rowCount: w.length,
|
|
1984
|
-
rowHeight:
|
|
1921
|
+
rowHeight: qt,
|
|
1985
1922
|
rowProps: {
|
|
1986
1923
|
items: w,
|
|
1987
1924
|
selectedDeploymentId: o,
|
|
@@ -1996,8 +1933,8 @@ var Zt = {
|
|
|
1996
1933
|
})]
|
|
1997
1934
|
})
|
|
1998
1935
|
});
|
|
1999
|
-
},
|
|
2000
|
-
let [y, b] =
|
|
1936
|
+
}, Zt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, menuStyles: i, isStreaming: a, isMobile: o, isDisabled: c = !1, style: u, modelPickerOverlay: d, isPickerOpen: f, onPickerToggle: p, onPickerOpenChange: h }) => {
|
|
1937
|
+
let [y, b] = H(!1), { selectorIcon: S, selectorAriaLabel: C, selectedLabel: w, selectedVersion: T, menuItems: E, menuHeader: D, menuStyle: ee, onOpenChange: O } = kt({
|
|
2001
1938
|
deployments: e,
|
|
2002
1939
|
selectedDeploymentId: t,
|
|
2003
1940
|
onDeploymentChange: n,
|
|
@@ -2005,18 +1942,18 @@ var Zt = {
|
|
|
2005
1942
|
styles: i
|
|
2006
1943
|
});
|
|
2007
1944
|
if (!e) return null;
|
|
2008
|
-
let k = a || c ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, te = /* @__PURE__ */
|
|
1945
|
+
let k = a || c ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, te = /* @__PURE__ */ P(de, {
|
|
2009
1946
|
size: g.SM,
|
|
2010
|
-
className: l(
|
|
1947
|
+
className: l(q.modelSelectorCaret, U.modelSelectorCaret),
|
|
2011
1948
|
"aria-hidden": !0,
|
|
2012
1949
|
stroke: _
|
|
2013
|
-
}), A = /* @__PURE__ */
|
|
2014
|
-
className: l("flex shrink-0 items-center",
|
|
1950
|
+
}), A = /* @__PURE__ */ P("span", {
|
|
1951
|
+
className: l("flex shrink-0 items-center", U.modelSelectorIcon),
|
|
2015
1952
|
children: S
|
|
2016
1953
|
});
|
|
2017
|
-
if (o) return /* @__PURE__ */
|
|
1954
|
+
if (o) return /* @__PURE__ */ F(oe, { children: [/* @__PURE__ */ P(x, {
|
|
2018
1955
|
tooltipProps: { tooltip: w },
|
|
2019
|
-
icon: /* @__PURE__ */
|
|
1956
|
+
icon: /* @__PURE__ */ F("div", {
|
|
2020
1957
|
className: "flex items-center gap-1",
|
|
2021
1958
|
children: [A, te]
|
|
2022
1959
|
}),
|
|
@@ -2024,16 +1961,16 @@ var Zt = {
|
|
|
2024
1961
|
onClick: () => {
|
|
2025
1962
|
c || b(!0);
|
|
2026
1963
|
},
|
|
2027
|
-
className: l("w-[50px]",
|
|
2028
|
-
}), d ? /* @__PURE__ */
|
|
1964
|
+
className: l("w-[50px]", q.modelSelectorButton, k, U.modelSelectorButton)
|
|
1965
|
+
}), d ? /* @__PURE__ */ P(W, {
|
|
2029
1966
|
isOpen: y,
|
|
2030
1967
|
title: r?.ariaLabel ?? "Select model",
|
|
2031
1968
|
closeLabel: r?.closeLabel ?? "Close",
|
|
2032
1969
|
onClose: () => b(!1),
|
|
2033
1970
|
style: u,
|
|
2034
|
-
className: l(i?.className,
|
|
1971
|
+
className: l(i?.className, U.modelMenu),
|
|
2035
1972
|
children: d(() => b(!1))
|
|
2036
|
-
}) : /* @__PURE__ */
|
|
1973
|
+
}) : /* @__PURE__ */ P(Xt, {
|
|
2037
1974
|
isOpen: y,
|
|
2038
1975
|
title: r?.ariaLabel ?? "Select model",
|
|
2039
1976
|
closeLabel: r?.closeLabel ?? "Close",
|
|
@@ -2050,7 +1987,7 @@ var Zt = {
|
|
|
2050
1987
|
})] });
|
|
2051
1988
|
if (d) {
|
|
2052
1989
|
let e = T ? `${w} · ${T}` : w;
|
|
2053
|
-
return /* @__PURE__ */
|
|
1990
|
+
return /* @__PURE__ */ P(v, {
|
|
2054
1991
|
placement: "top-end",
|
|
2055
1992
|
matchReferenceWidth: !1,
|
|
2056
1993
|
open: f,
|
|
@@ -2058,56 +1995,56 @@ var Zt = {
|
|
|
2058
1995
|
trigger: [],
|
|
2059
1996
|
outsideClosable: !0,
|
|
2060
1997
|
renderOverlay: () => d(() => h?.(!1)),
|
|
2061
|
-
listClassName: l("!w-[368px] !bg-layer-raised", i?.className,
|
|
2062
|
-
children: /* @__PURE__ */
|
|
1998
|
+
listClassName: l("!w-[368px] !bg-layer-raised", i?.className, U.modelMenu),
|
|
1999
|
+
children: /* @__PURE__ */ P(m, {
|
|
2063
2000
|
"aria-label": C,
|
|
2064
2001
|
"aria-disabled": c || void 0,
|
|
2065
2002
|
tooltipProps: { tooltip: e },
|
|
2066
|
-
className: l("h-auto min-w-0 gap-1.5 !rounded-full !border-0 px-0 py-1.5 pe-2 ps-1.5",
|
|
2003
|
+
className: l("h-auto min-w-0 gap-1.5 !rounded-full !border-0 px-0 py-1.5 pe-2 ps-1.5", q.modelSelectorButton, k, c && q.modelSelectorButtonDisabled, U.modelSelectorButton),
|
|
2067
2004
|
onClick: () => {
|
|
2068
|
-
!a && !c &&
|
|
2005
|
+
!a && !c && p?.();
|
|
2069
2006
|
},
|
|
2070
2007
|
iconBefore: A,
|
|
2071
2008
|
iconAfter: te,
|
|
2072
2009
|
textClassName: "min-w-0",
|
|
2073
|
-
label: /* @__PURE__ */
|
|
2010
|
+
label: /* @__PURE__ */ F("span", {
|
|
2074
2011
|
className: "flex min-w-0 max-w-[180px] items-baseline gap-1",
|
|
2075
|
-
children: [/* @__PURE__ */
|
|
2076
|
-
className: l("dial-small-text max-w-[180px] shrink-0 truncate",
|
|
2012
|
+
children: [/* @__PURE__ */ P("span", {
|
|
2013
|
+
className: l("dial-small-text max-w-[180px] shrink-0 truncate", q.modelSelectorName),
|
|
2077
2014
|
children: w
|
|
2078
|
-
}), T && /* @__PURE__ */
|
|
2079
|
-
className: l("dial-tiny-text min-w-0 truncate",
|
|
2015
|
+
}), T && /* @__PURE__ */ P("span", {
|
|
2016
|
+
className: l("dial-tiny-text min-w-0 truncate", q.modelSelectorVersion),
|
|
2080
2017
|
children: T
|
|
2081
2018
|
})]
|
|
2082
2019
|
})
|
|
2083
2020
|
})
|
|
2084
2021
|
});
|
|
2085
2022
|
}
|
|
2086
|
-
return /* @__PURE__ */
|
|
2023
|
+
return /* @__PURE__ */ P("div", {
|
|
2087
2024
|
className: l(c && k),
|
|
2088
2025
|
"aria-disabled": c || void 0,
|
|
2089
|
-
children: /* @__PURE__ */
|
|
2026
|
+
children: /* @__PURE__ */ P(v, {
|
|
2090
2027
|
items: E,
|
|
2091
2028
|
menuHeader: D,
|
|
2092
2029
|
placement: "bottom-end",
|
|
2093
2030
|
matchReferenceWidth: !1,
|
|
2094
2031
|
maxDropdownHeight: s,
|
|
2095
|
-
listClassName: l("!w-[240px]", i?.className,
|
|
2032
|
+
listClassName: l("!w-[240px]", i?.className, U.modelMenu),
|
|
2096
2033
|
listStyle: ee,
|
|
2097
2034
|
disabled: c,
|
|
2098
2035
|
onOpenChange: c ? void 0 : O,
|
|
2099
|
-
children: /* @__PURE__ */
|
|
2036
|
+
children: /* @__PURE__ */ P(m, {
|
|
2100
2037
|
"aria-label": C,
|
|
2101
2038
|
"aria-disabled": c || void 0,
|
|
2102
2039
|
tooltipProps: { tooltip: w },
|
|
2103
2040
|
iconBefore: A,
|
|
2104
2041
|
iconAfter: te,
|
|
2105
|
-
className: l("h-auto gap-1 !rounded-full !border-0 p-1.5",
|
|
2042
|
+
className: l("h-auto gap-1 !rounded-full !border-0 p-1.5", q.modelSelectorButton, c && q.modelSelectorButtonDisabled, U.modelSelectorButton)
|
|
2106
2043
|
})
|
|
2107
2044
|
})
|
|
2108
2045
|
});
|
|
2109
|
-
},
|
|
2110
|
-
let
|
|
2046
|
+
}, Qt = Se(({ message: e = "", messageRevision: t, focusRequestId: n, textInsertion: r, onSend: i, onUploadAttachment: a, onStop: o, isStreaming: s = !1, onChange: u, onAttachmentsChange: p, placeholder: m = "Type a message...", ariaLabel: h, attachLabel: y = "Attach file", fileAccept: S, addMenuTitle: C = "Add", menuTitle: w = "Menu", menuCloseLabel: T = "Close", removeLabel: E, retryLabel: D, uploadingLabel: ee, sendLabel: O, sendTooltip: k, emptyMessageTooltip: te, stopLabel: A, micLabel: ne = "Dictate", recordVoiceLabel: j = "Record voice", stopRecordingLabel: re, discardRecordingLabel: ie, colors: M, typography: N, attachmentTray: ae, modelMenu: I, className: ce, pendingDropFiles: ue = [], onDropFilesConsumed: L, pendingAttachments: de = [], onPendingAttachmentsConsumed: fe, pasteTextThreshold: he = 4e3, maxMessageLength: ge = 5e4, deployments: _e, selectedDeploymentId: ve, onDeploymentChange: ye, modelSelectorLabels: be, initialAttachments: xe = [], hideAddButton: Se = !1, hideAttachFile: Ce = !1, hideActionBar: we = !1, actionRowLayout: De = et.Stacked, isInlineActionRowAllowedBelowDesktop: W = !1, renderFooterActions: Oe, isInputDisabled: G = !1, isModelSelectorDisabled: Ae = !1, isSendDisabled: je = !1, isAudioMessageSupported: Me = !1, isVoiceRecordingSupported: Fe = Me, onTranscribeAudio: Ie, transcribingLabel: ze, voiceErrorLabel: Be, sendOnEnter: We = $e.Enter, prefixAttachments: Je = [], onRemovePrefixAttachment: Ye, chatSettings: Xe, toolsMenuItems: Ze, onToolToggle: tt, canRemoveTools: nt = !0, toolsMenuTitle: rt, toolsBackLabel: it, toolsChipLabels: at, menuOverlays: ot, activeMentions: st, onBackspaceAtCaret: ct, caretPositionOverride: lt, commandMenu: K, autoFocus: ut = !1, messageHistory: ft, onDialFileSystemClick: pt, dialFileSystemLabel: ht, validateAttachment: gt, onAttachmentClick: _t, modelPickerOverlay: vt, maximumAttachmentsAmount: St, onAttachmentsLimitExceeded: Ct, isAttachmentsEnabled: wt = !0, isTextAttachmentsAllowed: Tt = !0, usageLimitsSlot: Et, onMessageTooLong: Dt }, Ot) => {
|
|
2047
|
+
let kt = d(), [At, jt] = H(!1), Mt = Le(ft), Nt = st ?? [], J = Nt.length > 0, Pt = B(() => c({
|
|
2111
2048
|
"--ci-bg": M?.background,
|
|
2112
2049
|
"--ci-text": M?.text,
|
|
2113
2050
|
"--ci-border": M?.border,
|
|
@@ -2125,37 +2062,37 @@ var Zt = {
|
|
|
2125
2062
|
"--ci-mention-highlight-text": M?.mentionHighlightText,
|
|
2126
2063
|
"--ci-mention-highlight-unsupported-bg": M?.mentionHighlightUnsupportedBg,
|
|
2127
2064
|
"--ci-mention-highlight-unsupported-text": M?.mentionHighlightUnsupportedText
|
|
2128
|
-
}), [M]),
|
|
2065
|
+
}), [M]), Ft = B(() => pt ? [{
|
|
2129
2066
|
key: "dial-fs",
|
|
2130
2067
|
label: ht ?? "DIAL file system",
|
|
2131
|
-
icon: /* @__PURE__ */
|
|
2068
|
+
icon: /* @__PURE__ */ P(pe, {
|
|
2132
2069
|
size: f,
|
|
2133
2070
|
"aria-hidden": !0,
|
|
2134
2071
|
stroke: _
|
|
2135
2072
|
}),
|
|
2136
|
-
onClick:
|
|
2137
|
-
}] : [], [
|
|
2073
|
+
onClick: pt
|
|
2074
|
+
}] : [], [pt, ht]), { message: Y, setMessage: X, textareaRef: Z } = He({
|
|
2138
2075
|
messageProp: e,
|
|
2139
2076
|
messageRevision: t
|
|
2140
2077
|
});
|
|
2141
|
-
|
|
2142
|
-
n !== void 0 &&
|
|
2143
|
-
}, [n,
|
|
2144
|
-
let { handleUndoKeyDown:
|
|
2078
|
+
z(() => {
|
|
2079
|
+
n !== void 0 && Z.current?.focus();
|
|
2080
|
+
}, [n, Z]), Te(Ot, () => ({ getCaretPosition: () => Z.current?.selectionStart ?? Y.length }), [Y, Z]);
|
|
2081
|
+
let { handleUndoKeyDown: It } = Ge({
|
|
2145
2082
|
insertion: r,
|
|
2146
|
-
textareaRef:
|
|
2147
|
-
}), { isMenuOpen:
|
|
2148
|
-
config:
|
|
2149
|
-
message:
|
|
2150
|
-
}),
|
|
2151
|
-
|
|
2152
|
-
},
|
|
2083
|
+
textareaRef: Z
|
|
2084
|
+
}), { isMenuOpen: Lt, query: Rt, activeWordStart: Q, dismiss: zt, closeOnOutsidePress: Bt, handleCaretMove: Vt, handleValueChange: Ht, listboxId: Ut, overlayRef: Wt, activeOptionId: Gt, moveActiveOption: Kt, getActiveOption: qt } = Pe({
|
|
2085
|
+
config: K,
|
|
2086
|
+
message: Y
|
|
2087
|
+
}), Jt = () => {
|
|
2088
|
+
Vt(Z.current?.selectionStart ?? Y.length);
|
|
2089
|
+
}, Yt = () => {
|
|
2153
2090
|
requestAnimationFrame(() => {
|
|
2154
|
-
|
|
2091
|
+
Vt(Z.current?.selectionStart ?? Y.length);
|
|
2155
2092
|
});
|
|
2156
|
-
},
|
|
2157
|
-
e.key !== "ArrowLeft" && e.key !== "ArrowRight" && e.key !== "Home" && e.key !== "End" && e.key !== "PageUp" && e.key !== "PageDown" ||
|
|
2158
|
-
}, Qt =
|
|
2093
|
+
}, Xt = (e) => {
|
|
2094
|
+
e.key !== "ArrowLeft" && e.key !== "ArrowRight" && e.key !== "Home" && e.key !== "End" && e.key !== "PageUp" && e.key !== "PageDown" || Vt(e.currentTarget.selectionStart ?? Y.length);
|
|
2095
|
+
}, Qt = K?.emptyQueryHint != null, $t = K != null && Q != null ? Q + K.triggerPrefix.length : null, en = $t != null && Y.slice($t).split("\n", 1)[0] !== "", tn = Qt && Lt && Rt === "" && $t != null && !en, nn = K != null && Lt ? Q ?? 0 : null, rn = V(null), an = V(null), [on, sn] = H(null), cn = R(() => {
|
|
2159
2096
|
let e = rn.current, t = an.current;
|
|
2160
2097
|
if (e == null || t == null) {
|
|
2161
2098
|
sn(null);
|
|
@@ -2167,254 +2104,254 @@ var Zt = {
|
|
|
2167
2104
|
top: n.top - r.top
|
|
2168
2105
|
});
|
|
2169
2106
|
}, []);
|
|
2170
|
-
|
|
2107
|
+
Ee(() => {
|
|
2171
2108
|
cn();
|
|
2172
2109
|
}, [
|
|
2173
2110
|
cn,
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
]),
|
|
2177
|
-
if (
|
|
2178
|
-
let e =
|
|
2111
|
+
nn,
|
|
2112
|
+
Y
|
|
2113
|
+
]), z(() => {
|
|
2114
|
+
if (nn == null) return;
|
|
2115
|
+
let e = Z.current;
|
|
2179
2116
|
if (e == null || typeof ResizeObserver > "u") return;
|
|
2180
2117
|
let t = new ResizeObserver(cn);
|
|
2181
2118
|
return t.observe(e), () => t.disconnect();
|
|
2182
2119
|
}, [
|
|
2183
|
-
|
|
2184
|
-
|
|
2120
|
+
nn,
|
|
2121
|
+
Z,
|
|
2185
2122
|
cn
|
|
2186
2123
|
]);
|
|
2187
|
-
let { mirrorRef: ln, selectionRects: un, updateSelectionRects: dn } =
|
|
2188
|
-
textareaRef:
|
|
2189
|
-
message:
|
|
2190
|
-
hasActiveMentions:
|
|
2191
|
-
}), fn =
|
|
2192
|
-
if (
|
|
2193
|
-
let t = `${
|
|
2194
|
-
if (
|
|
2195
|
-
let r =
|
|
2196
|
-
|
|
2124
|
+
let { mirrorRef: ln, selectionRects: un, updateSelectionRects: dn } = Ve({
|
|
2125
|
+
textareaRef: Z,
|
|
2126
|
+
message: Y,
|
|
2127
|
+
hasActiveMentions: J
|
|
2128
|
+
}), fn = R((e) => {
|
|
2129
|
+
if (K == null || (zt(), !e?.consumeQuery) || (e.returnFocus !== !1 && Z.current?.focus(), Q == null)) return;
|
|
2130
|
+
let t = `${K.triggerPrefix}${Rt}`, n = Q + t.length;
|
|
2131
|
+
if (Y.slice(Q, n) !== t) return;
|
|
2132
|
+
let r = Y.slice(0, Q) + Y.slice(n);
|
|
2133
|
+
X(r), Mt.notifyChange(), u?.(r);
|
|
2197
2134
|
}, [
|
|
2198
|
-
W,
|
|
2199
|
-
Bt,
|
|
2200
|
-
zt,
|
|
2201
|
-
q,
|
|
2202
|
-
Z,
|
|
2203
|
-
J,
|
|
2204
2135
|
K,
|
|
2136
|
+
zt,
|
|
2137
|
+
Rt,
|
|
2138
|
+
Y,
|
|
2139
|
+
Q,
|
|
2140
|
+
X,
|
|
2141
|
+
Mt,
|
|
2205
2142
|
u,
|
|
2206
|
-
|
|
2207
|
-
]), pn =
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
}, [
|
|
2211
|
-
let { attachments: mn, buildAttachments: hn, addAttachments: gn, resetAttachments: _n, handleRemove: vn, handleRetry: yn, handleExpand: bn, hasBlockedAttachments: xn } =
|
|
2212
|
-
initialAttachments:
|
|
2143
|
+
Z
|
|
2144
|
+
]), pn = V(void 0);
|
|
2145
|
+
z(() => {
|
|
2146
|
+
lt == null || pn.current === t || (pn.current = t, Z.current?.setSelectionRange(lt, lt), Vt(lt));
|
|
2147
|
+
}, [Y]);
|
|
2148
|
+
let { attachments: mn, buildAttachments: hn, addAttachments: gn, resetAttachments: _n, handleRemove: vn, handleRetry: yn, handleExpand: bn, hasBlockedAttachments: xn } = ke({
|
|
2149
|
+
initialAttachments: xe,
|
|
2213
2150
|
onUploadAttachment: a,
|
|
2214
2151
|
onAttachmentsChange: p,
|
|
2215
2152
|
validateAttachment: gt,
|
|
2216
|
-
pendingDropFiles:
|
|
2217
|
-
onDropFilesConsumed:
|
|
2218
|
-
pendingAttachments:
|
|
2219
|
-
onPendingAttachmentsConsumed:
|
|
2220
|
-
onExpandPastedText:
|
|
2221
|
-
|
|
2222
|
-
}, [
|
|
2223
|
-
maximumAttachmentsAmount:
|
|
2224
|
-
baseAttachmentsAmount:
|
|
2225
|
-
onAttachmentsLimitExceeded:
|
|
2226
|
-
}), Sn =
|
|
2153
|
+
pendingDropFiles: ue,
|
|
2154
|
+
onDropFilesConsumed: L,
|
|
2155
|
+
pendingAttachments: de,
|
|
2156
|
+
onPendingAttachmentsConsumed: fe,
|
|
2157
|
+
onExpandPastedText: R((e) => {
|
|
2158
|
+
X((t) => t ? `${t}\n${e}` : e);
|
|
2159
|
+
}, [X]),
|
|
2160
|
+
maximumAttachmentsAmount: St,
|
|
2161
|
+
baseAttachmentsAmount: Je.length,
|
|
2162
|
+
onAttachmentsLimitExceeded: Ct
|
|
2163
|
+
}), Sn = R((e) => {
|
|
2227
2164
|
gn(hn([e]));
|
|
2228
|
-
}, [gn, hn]), Cn =
|
|
2229
|
-
wn.current =
|
|
2230
|
-
let [Tn, En] =
|
|
2165
|
+
}, [gn, hn]), Cn = V(!1), wn = V(Y);
|
|
2166
|
+
wn.current = Y;
|
|
2167
|
+
let [Tn, En] = H({
|
|
2231
2168
|
text: "",
|
|
2232
2169
|
revision: 0
|
|
2233
|
-
}), { state: Dn, analyserNodeRef: On, errorMessage: kn, startRecording: An, stopRecording: jn, discardRecording: Mn } =
|
|
2170
|
+
}), { state: Dn, analyserNodeRef: On, errorMessage: kn, startRecording: An, stopRecording: jn, discardRecording: Mn } = Qe({
|
|
2234
2171
|
onAttachAudio: Sn,
|
|
2235
2172
|
onTranscribeAudio: Ie,
|
|
2236
|
-
onTranscript:
|
|
2173
|
+
onTranscript: R((e) => {
|
|
2237
2174
|
let t = e.trim();
|
|
2238
2175
|
if (t) {
|
|
2239
2176
|
let e = wn.current, n = `${e}${e && !/\s$/.test(e) ? " " : ""}${t}`;
|
|
2240
|
-
wn.current = n,
|
|
2177
|
+
wn.current = n, X(n), En((e) => ({
|
|
2241
2178
|
text: t,
|
|
2242
2179
|
revision: e.revision + 1
|
|
2243
|
-
})),
|
|
2180
|
+
})), Mt.notifyChange(), u?.(n);
|
|
2244
2181
|
}
|
|
2245
2182
|
Cn.current = !0;
|
|
2246
2183
|
}, [
|
|
2247
|
-
|
|
2248
|
-
|
|
2184
|
+
X,
|
|
2185
|
+
Mt,
|
|
2249
2186
|
u
|
|
2250
2187
|
]),
|
|
2251
|
-
errorLabel:
|
|
2252
|
-
}), $ = Dn ===
|
|
2253
|
-
|
|
2254
|
-
(Dn ===
|
|
2255
|
-
}, [Dn,
|
|
2256
|
-
let Nn =
|
|
2188
|
+
errorLabel: Be
|
|
2189
|
+
}), $ = Dn === Ke.Recording || Dn === Ke.Processing;
|
|
2190
|
+
z(() => {
|
|
2191
|
+
(Dn === Ke.Error || Dn === Ke.Idle && Cn.current) && (Cn.current = !1, Z.current?.focus());
|
|
2192
|
+
}, [Dn, Z]);
|
|
2193
|
+
let Nn = V(null), Pn = V(null), Fn = wt && Tt, { handlePaste: In } = le(gn, Fn ? he : Infinity), Ln = R((e) => {
|
|
2257
2194
|
if (!Fn) {
|
|
2258
2195
|
let t = e.clipboardData.getData("text/plain");
|
|
2259
|
-
t.length >=
|
|
2196
|
+
t.length >= ge && Dt?.(t.length, ge);
|
|
2260
2197
|
}
|
|
2261
2198
|
In(e);
|
|
2262
2199
|
}, [
|
|
2263
2200
|
Fn,
|
|
2264
|
-
|
|
2265
|
-
|
|
2201
|
+
ge,
|
|
2202
|
+
Dt,
|
|
2266
2203
|
In
|
|
2267
|
-
]), Rn =
|
|
2268
|
-
|
|
2204
|
+
]), Rn = Y.trim().length > 0 || mn.length > 0, zn = Rn && !xn && !je && !$, [Bn, Vn] = H([]);
|
|
2205
|
+
z(() => {
|
|
2269
2206
|
Vn([]);
|
|
2270
|
-
}, [(
|
|
2271
|
-
let Hn =
|
|
2272
|
-
let e =
|
|
2273
|
-
return
|
|
2207
|
+
}, [(Ze ?? []).map((e) => e.id).join("|")]);
|
|
2208
|
+
let Hn = B(() => {
|
|
2209
|
+
let e = Ze ?? [];
|
|
2210
|
+
return nt ? e.filter((e) => e.isSelected || !Bn.includes(e.id)) : e;
|
|
2274
2211
|
}, [
|
|
2275
|
-
|
|
2212
|
+
Ze,
|
|
2276
2213
|
Bn,
|
|
2277
|
-
|
|
2278
|
-
]), Un =
|
|
2279
|
-
Vn((t) => t.includes(e) ? t : [...t, e]),
|
|
2280
|
-
}, [
|
|
2281
|
-
if (
|
|
2282
|
-
if (
|
|
2283
|
-
|
|
2214
|
+
nt
|
|
2215
|
+
]), Un = R((e) => {
|
|
2216
|
+
Vn((t) => t.includes(e) ? t : [...t, e]), Ze?.find((t) => t.id === e)?.isSelected && tt?.(e);
|
|
2217
|
+
}, [Ze, tt]), Wn = _e === void 0 || ve != null, Gn = Me && !s, Kn = async () => {
|
|
2218
|
+
if (je || $) return;
|
|
2219
|
+
if (Y.length >= ge) {
|
|
2220
|
+
Dt?.(Y.length, ge);
|
|
2284
2221
|
return;
|
|
2285
2222
|
}
|
|
2286
|
-
let e =
|
|
2287
|
-
|
|
2223
|
+
let e = Y, t = mn;
|
|
2224
|
+
X(""), Mt.reset();
|
|
2288
2225
|
try {
|
|
2289
2226
|
await i?.(e, t), t.forEach((e) => {
|
|
2290
2227
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
2291
2228
|
}), _n([]);
|
|
2292
2229
|
} catch {
|
|
2293
|
-
|
|
2230
|
+
X(e), _n(t);
|
|
2294
2231
|
}
|
|
2295
|
-
}, qn = (e) =>
|
|
2296
|
-
if (!
|
|
2297
|
-
if (e.key === "Escape") return e.preventDefault(), e.stopPropagation(),
|
|
2298
|
-
if (e.key === "ArrowDown" || e.key === "ArrowUp") return e.preventDefault(),
|
|
2232
|
+
}, qn = (e) => We === $e.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey, Jn = (e) => {
|
|
2233
|
+
if (!Lt || e.nativeEvent.isComposing) return !1;
|
|
2234
|
+
if (e.key === "Escape") return e.preventDefault(), e.stopPropagation(), zt(), !0;
|
|
2235
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") return e.preventDefault(), Kt(e.key === "ArrowDown" ? Ne.Next : Ne.Previous), !0;
|
|
2299
2236
|
if (e.key !== "Enter" || e.shiftKey) return !1;
|
|
2300
|
-
let t =
|
|
2237
|
+
let t = qt();
|
|
2301
2238
|
return t == null ? qn(e) ? (e.preventDefault(), !0) : !1 : (e.preventDefault(), t.click(), !0);
|
|
2302
2239
|
}, Yn = (e) => {
|
|
2303
|
-
if (!$ && !
|
|
2304
|
-
if (!e.nativeEvent.isComposing && !
|
|
2240
|
+
if (!$ && !It(e) && !Jn(e)) {
|
|
2241
|
+
if (!e.nativeEvent.isComposing && !G && !s) {
|
|
2305
2242
|
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
2306
|
-
let t = e.currentTarget.selectionStart ?? 0, n =
|
|
2243
|
+
let t = e.currentTarget.selectionStart ?? 0, n = Mt.navigate(e.key === "ArrowUp" ? "up" : "down", Y, t);
|
|
2307
2244
|
if (n !== null) {
|
|
2308
|
-
e.preventDefault(),
|
|
2245
|
+
e.preventDefault(), X(n);
|
|
2309
2246
|
return;
|
|
2310
2247
|
}
|
|
2311
2248
|
}
|
|
2312
|
-
if (e.key === "Backspace" &&
|
|
2313
|
-
let t =
|
|
2249
|
+
if (e.key === "Backspace" && ct != null && e.currentTarget.selectionStart === e.currentTarget.selectionEnd && e.currentTarget.selectionStart != null) {
|
|
2250
|
+
let t = ct(e.currentTarget.selectionStart);
|
|
2314
2251
|
if (t != null) {
|
|
2315
2252
|
e.preventDefault();
|
|
2316
2253
|
let n = e.currentTarget;
|
|
2317
|
-
n.setSelectionRange(t.start, t.start + t.length), typeof document.execCommand == "function" && document.execCommand("delete", !1) ||
|
|
2254
|
+
n.setSelectionRange(t.start, t.start + t.length), typeof document.execCommand == "function" && document.execCommand("delete", !1) || Ue(n, Y.slice(0, t.start) + Y.slice(t.start + t.length), t.start);
|
|
2318
2255
|
return;
|
|
2319
2256
|
}
|
|
2320
2257
|
}
|
|
2321
2258
|
}
|
|
2322
|
-
e.key === "Enter" && qn(e) && (e.preventDefault(), !s && zn && Wn && !
|
|
2259
|
+
e.key === "Enter" && qn(e) && (e.preventDefault(), !s && zn && Wn && !G && Kn());
|
|
2323
2260
|
}
|
|
2324
2261
|
}, Xn = (e) => {
|
|
2325
2262
|
let t = Array.from(e.target.files ?? []);
|
|
2326
2263
|
if (t.length === 0) return;
|
|
2327
2264
|
let n = hn(t);
|
|
2328
2265
|
e.target.value = "", gn(n);
|
|
2329
|
-
}, Zn =
|
|
2266
|
+
}, Zn = B(() => {
|
|
2330
2267
|
let e = [];
|
|
2331
|
-
return
|
|
2332
|
-
offset:
|
|
2333
|
-
node: /* @__PURE__ */
|
|
2268
|
+
return nn != null && e.push({
|
|
2269
|
+
offset: nn,
|
|
2270
|
+
node: /* @__PURE__ */ P("span", {
|
|
2334
2271
|
ref: rn,
|
|
2335
2272
|
"aria-hidden": !0,
|
|
2336
2273
|
className: "inline-block h-[1lh] w-0 align-text-top"
|
|
2337
2274
|
}, "caret-marker")
|
|
2338
|
-
}), tn &&
|
|
2275
|
+
}), tn && K != null && $t != null && e.push({
|
|
2339
2276
|
offset: $t,
|
|
2340
|
-
node: /* @__PURE__ */
|
|
2341
|
-
className:
|
|
2277
|
+
node: /* @__PURE__ */ P("span", {
|
|
2278
|
+
className: q.commandHint,
|
|
2342
2279
|
"aria-hidden": !0,
|
|
2343
2280
|
"data-mirror-synthetic": !0,
|
|
2344
|
-
children:
|
|
2281
|
+
children: K.emptyQueryHint
|
|
2345
2282
|
}, "command-hint")
|
|
2346
2283
|
}), e;
|
|
2347
2284
|
}, [
|
|
2348
|
-
|
|
2285
|
+
nn,
|
|
2349
2286
|
tn,
|
|
2350
|
-
|
|
2287
|
+
K,
|
|
2351
2288
|
$t
|
|
2352
|
-
]), Qn = /* @__PURE__ */
|
|
2353
|
-
className: l(
|
|
2354
|
-
ref:
|
|
2355
|
-
autoFocus:
|
|
2356
|
-
value:
|
|
2289
|
+
]), Qn = /* @__PURE__ */ P("textarea", {
|
|
2290
|
+
className: l(q.textarea, (J || Zn.length > 0) && q.textareaMentionMode, N?.fontClassName || "dial-body-paragraph-text", "relative z-0 max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent pe-1 ps-1 outline-none [field-sizing:content]", "disabled:cursor-not-allowed"),
|
|
2291
|
+
ref: Z,
|
|
2292
|
+
autoFocus: ut,
|
|
2293
|
+
value: Y,
|
|
2357
2294
|
onChange: (e) => {
|
|
2358
|
-
|
|
2295
|
+
X(e.target.value), Mt.notifyChange();
|
|
2359
2296
|
let t = e.nativeEvent instanceof InputEvent ? e.nativeEvent : void 0;
|
|
2360
|
-
|
|
2297
|
+
Ht(e.target.value, e.target.selectionStart ?? e.target.value.length, t?.isComposing ?? !1), u?.(e.target.value);
|
|
2361
2298
|
},
|
|
2362
2299
|
onSelect: dn,
|
|
2363
|
-
onFocus:
|
|
2364
|
-
onClick:
|
|
2300
|
+
onFocus: Yt,
|
|
2301
|
+
onClick: Jt,
|
|
2365
2302
|
onKeyDown: Yn,
|
|
2366
|
-
onKeyUp:
|
|
2303
|
+
onKeyUp: Xt,
|
|
2367
2304
|
onPaste: Ln,
|
|
2368
2305
|
placeholder: m,
|
|
2369
2306
|
"aria-label": h,
|
|
2370
|
-
"aria-autocomplete":
|
|
2371
|
-
"aria-controls":
|
|
2372
|
-
"aria-activedescendant":
|
|
2373
|
-
"aria-hidden":
|
|
2374
|
-
disabled:
|
|
2307
|
+
"aria-autocomplete": K == null ? void 0 : "list",
|
|
2308
|
+
"aria-controls": Lt ? Ut : void 0,
|
|
2309
|
+
"aria-activedescendant": Gt ?? void 0,
|
|
2310
|
+
"aria-hidden": J ? !0 : void 0,
|
|
2311
|
+
disabled: G,
|
|
2375
2312
|
readOnly: $,
|
|
2376
2313
|
rows: 1
|
|
2377
|
-
}), $n =
|
|
2314
|
+
}), $n = K == null ? Qn : /* @__PURE__ */ F(oe, { children: [Qn, /* @__PURE__ */ P("div", {
|
|
2378
2315
|
"aria-hidden": !0,
|
|
2379
2316
|
className: l("pointer-events-none absolute", N?.fontClassName || "dial-body-paragraph-text"),
|
|
2380
2317
|
style: {
|
|
2381
2318
|
left: on?.left ?? 0,
|
|
2382
2319
|
top: on?.top ?? 0
|
|
2383
2320
|
},
|
|
2384
|
-
children: /* @__PURE__ */
|
|
2385
|
-
open:
|
|
2321
|
+
children: /* @__PURE__ */ P(v, {
|
|
2322
|
+
open: Lt,
|
|
2386
2323
|
onOpenChange: (e) => {
|
|
2387
|
-
e ||
|
|
2324
|
+
e || Bt();
|
|
2388
2325
|
},
|
|
2389
2326
|
placement: "top-start",
|
|
2390
2327
|
trigger: [],
|
|
2391
2328
|
initialFocus: -1,
|
|
2392
2329
|
matchReferenceWidth: !1,
|
|
2393
|
-
outsidePressIgnoreRef:
|
|
2394
|
-
renderOverlay: () => /* @__PURE__ */
|
|
2395
|
-
ref:
|
|
2396
|
-
role:
|
|
2397
|
-
"aria-label":
|
|
2398
|
-
children:
|
|
2399
|
-
query:
|
|
2400
|
-
caretPosition:
|
|
2330
|
+
outsidePressIgnoreRef: Z,
|
|
2331
|
+
renderOverlay: () => /* @__PURE__ */ P("div", {
|
|
2332
|
+
ref: Wt,
|
|
2333
|
+
role: K.menuLabel == null ? void 0 : "group",
|
|
2334
|
+
"aria-label": K.menuLabel,
|
|
2335
|
+
children: K.renderMenu({
|
|
2336
|
+
query: Rt,
|
|
2337
|
+
caretPosition: Q ?? 0,
|
|
2401
2338
|
close: fn,
|
|
2402
|
-
listboxId:
|
|
2403
|
-
activeOptionId:
|
|
2339
|
+
listboxId: Ut,
|
|
2340
|
+
activeOptionId: Gt
|
|
2404
2341
|
})
|
|
2405
2342
|
}),
|
|
2406
|
-
children: /* @__PURE__ */
|
|
2343
|
+
children: /* @__PURE__ */ P("span", {
|
|
2407
2344
|
"aria-hidden": !0,
|
|
2408
2345
|
className: "inline-block h-[1lh] w-0"
|
|
2409
2346
|
})
|
|
2410
2347
|
})
|
|
2411
|
-
})] }), er = /* @__PURE__ */
|
|
2348
|
+
})] }), er = /* @__PURE__ */ F("div", {
|
|
2412
2349
|
ref: an,
|
|
2413
2350
|
className: "relative -me-1 -ms-1 w-[calc(100%+8px)]",
|
|
2414
|
-
children: [(
|
|
2351
|
+
children: [(J || Zn.length > 0) && /* @__PURE__ */ F("div", {
|
|
2415
2352
|
ref: ln,
|
|
2416
|
-
className: l(
|
|
2417
|
-
children: [
|
|
2353
|
+
className: l(q.textarea, N?.fontClassName || "dial-body-paragraph-text", "pointer-events-none absolute inset-0 z-10 max-h-[272px] w-full overflow-hidden whitespace-pre-wrap pe-1 ps-1 [overflow-wrap:anywhere]"),
|
|
2354
|
+
children: [Re(Y, Nt, Zn, q.mentionHighlight, q.mentionHighlightUnsupported), un.map((e, t) => /* @__PURE__ */ P("div", {
|
|
2418
2355
|
"aria-hidden": !0,
|
|
2419
2356
|
className: "pointer-events-none absolute rounded-sm bg-control-accent-alpha-active",
|
|
2420
2357
|
style: {
|
|
@@ -2425,48 +2362,48 @@ var Zt = {
|
|
|
2425
2362
|
}
|
|
2426
2363
|
}, `selection-${t}`))]
|
|
2427
2364
|
}), $n]
|
|
2428
|
-
}), tr =
|
|
2429
|
-
onAttachClick:
|
|
2365
|
+
}), tr = Se ? void 0 : /* @__PURE__ */ P(dt, {
|
|
2366
|
+
onAttachClick: Ce ? void 0 : () => Nn.current?.click(),
|
|
2430
2367
|
attachLabel: y,
|
|
2431
2368
|
addMenuTitle: C,
|
|
2432
2369
|
menuTitle: w,
|
|
2433
2370
|
menuCloseLabel: T,
|
|
2434
|
-
style:
|
|
2435
|
-
isDisabled:
|
|
2436
|
-
chatSettings:
|
|
2437
|
-
extraMenuItems:
|
|
2438
|
-
onRecordVoice: Fe &&
|
|
2371
|
+
style: Pt,
|
|
2372
|
+
isDisabled: G || $,
|
|
2373
|
+
chatSettings: Xe,
|
|
2374
|
+
extraMenuItems: Ft,
|
|
2375
|
+
onRecordVoice: Fe && wt && !s && !$ ? () => An(qe.Attachment) : void 0,
|
|
2439
2376
|
recordVoiceLabel: j,
|
|
2440
|
-
toolsMenuItems:
|
|
2441
|
-
onToolToggle:
|
|
2442
|
-
toolsMenuTitle:
|
|
2443
|
-
toolsBackLabel:
|
|
2444
|
-
menuOverlays:
|
|
2445
|
-
getCaretPosition: () =>
|
|
2446
|
-
}), nr = De ===
|
|
2447
|
-
className: l("flex",
|
|
2377
|
+
toolsMenuItems: nt ? Ze : void 0,
|
|
2378
|
+
onToolToggle: tt,
|
|
2379
|
+
toolsMenuTitle: rt,
|
|
2380
|
+
toolsBackLabel: it,
|
|
2381
|
+
menuOverlays: ot,
|
|
2382
|
+
getCaretPosition: () => Z.current?.selectionStart ?? Y.length
|
|
2383
|
+
}), nr = De === et.Inline && (!kt || W), rr = tr && /* @__PURE__ */ P("div", {
|
|
2384
|
+
className: l("flex", U.addCluster),
|
|
2448
2385
|
children: tr
|
|
2449
|
-
}), ir = Hn.length > 0 &&
|
|
2450
|
-
className: l("min-w-0 flex-1",
|
|
2451
|
-
children: /* @__PURE__ */
|
|
2386
|
+
}), ir = Hn.length > 0 && tt != null && /* @__PURE__ */ P("div", {
|
|
2387
|
+
className: l("min-w-0 flex-1", U.toolsChips),
|
|
2388
|
+
children: /* @__PURE__ */ P(mt, {
|
|
2452
2389
|
items: Hn,
|
|
2453
|
-
onToolToggle:
|
|
2390
|
+
onToolToggle: tt,
|
|
2454
2391
|
onToolDismiss: Un,
|
|
2455
|
-
canRemove:
|
|
2456
|
-
removeLabel:
|
|
2457
|
-
stateOnLabel:
|
|
2458
|
-
stateOffLabel:
|
|
2392
|
+
canRemove: nt,
|
|
2393
|
+
removeLabel: at?.removeLabel,
|
|
2394
|
+
stateOnLabel: at?.stateOnLabel,
|
|
2395
|
+
stateOffLabel: at?.stateOffLabel
|
|
2459
2396
|
})
|
|
2460
2397
|
});
|
|
2461
|
-
return /* @__PURE__ */
|
|
2398
|
+
return /* @__PURE__ */ F("div", {
|
|
2462
2399
|
ref: Pn,
|
|
2463
|
-
style:
|
|
2464
|
-
className: l(
|
|
2400
|
+
style: Pt,
|
|
2401
|
+
className: l(q.wrapper, G && q.wrapperDisabled, G && "cursor-not-allowed", "flex w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border", "focus-within:outline focus-within:-outline-offset-1 active:outline active:-outline-offset-1", mn.length > 6 ? "py-4 ps-4" : "p-4", ce, U.wrapper),
|
|
2465
2402
|
children: [
|
|
2466
|
-
(
|
|
2467
|
-
attachments: [...
|
|
2403
|
+
(Je.length > 0 || mn.length > 0) && /* @__PURE__ */ P(se, {
|
|
2404
|
+
attachments: [...Je, ...mn],
|
|
2468
2405
|
onRemove: (e) => {
|
|
2469
|
-
|
|
2406
|
+
Je.some((t) => t.id === e) ? Ye?.(e) : vn(e);
|
|
2470
2407
|
},
|
|
2471
2408
|
onRetry: yn,
|
|
2472
2409
|
onExpand: bn,
|
|
@@ -2476,12 +2413,12 @@ var Zt = {
|
|
|
2476
2413
|
uploadingLabel: ee
|
|
2477
2414
|
},
|
|
2478
2415
|
styles: ae,
|
|
2479
|
-
onAttachmentClick:
|
|
2480
|
-
let t = [...
|
|
2481
|
-
t != null &&
|
|
2416
|
+
onAttachmentClick: _t == null ? void 0 : (e) => {
|
|
2417
|
+
let t = [...Je, ...mn].find((t) => t.id === e);
|
|
2418
|
+
t != null && _t(t);
|
|
2482
2419
|
}
|
|
2483
2420
|
}),
|
|
2484
|
-
!
|
|
2421
|
+
!Se && /* @__PURE__ */ P("input", {
|
|
2485
2422
|
ref: Nn,
|
|
2486
2423
|
type: "file",
|
|
2487
2424
|
multiple: !0,
|
|
@@ -2491,11 +2428,11 @@ var Zt = {
|
|
|
2491
2428
|
tabIndex: -1,
|
|
2492
2429
|
onChange: Xn
|
|
2493
2430
|
}),
|
|
2494
|
-
kn && /* @__PURE__ */
|
|
2431
|
+
kn && /* @__PURE__ */ P(b, {
|
|
2495
2432
|
text: kn,
|
|
2496
2433
|
className: "min-w-0 break-words px-1"
|
|
2497
2434
|
}),
|
|
2498
|
-
$ && /* @__PURE__ */
|
|
2435
|
+
$ && /* @__PURE__ */ P(yt, {
|
|
2499
2436
|
embedded: !0,
|
|
2500
2437
|
state: Dn,
|
|
2501
2438
|
analyserNodeRef: On,
|
|
@@ -2504,47 +2441,47 @@ var Zt = {
|
|
|
2504
2441
|
attachButton: tr,
|
|
2505
2442
|
stopLabel: re,
|
|
2506
2443
|
discardLabel: ie,
|
|
2507
|
-
processingLabel:
|
|
2444
|
+
processingLabel: ze
|
|
2508
2445
|
}),
|
|
2509
|
-
!$ &&
|
|
2510
|
-
!$ && !
|
|
2446
|
+
!$ && we && er,
|
|
2447
|
+
!$ && !we && nr && ir && /* @__PURE__ */ P("div", {
|
|
2511
2448
|
className: "flex",
|
|
2512
2449
|
children: ir
|
|
2513
2450
|
}),
|
|
2514
|
-
!$ && !
|
|
2515
|
-
className: l("flex items-center gap-2", nr ? "flex-nowrap" : "flex-wrap",
|
|
2451
|
+
!$ && !we && /* @__PURE__ */ F("div", {
|
|
2452
|
+
className: l("flex items-center gap-2", nr ? "flex-nowrap" : "flex-wrap", U.actionRow),
|
|
2516
2453
|
children: [
|
|
2517
2454
|
nr && rr,
|
|
2518
|
-
/* @__PURE__ */
|
|
2519
|
-
className: l("flex min-w-0 items-center self-stretch", nr ? "flex-1" : "w-full",
|
|
2455
|
+
/* @__PURE__ */ P("div", {
|
|
2456
|
+
className: l("flex min-w-0 items-center self-stretch", nr ? "flex-1" : "w-full", U.textareaWrap),
|
|
2520
2457
|
children: er
|
|
2521
2458
|
}),
|
|
2522
2459
|
!nr && rr,
|
|
2523
2460
|
!nr && ir,
|
|
2524
|
-
/* @__PURE__ */
|
|
2525
|
-
className: l("ms-auto flex flex-shrink-0 items-center gap-2",
|
|
2526
|
-
children:
|
|
2461
|
+
/* @__PURE__ */ P("div", {
|
|
2462
|
+
className: l("ms-auto flex flex-shrink-0 items-center gap-2", U.footerActions),
|
|
2463
|
+
children: Oe ? Oe({
|
|
2527
2464
|
canSend: zn,
|
|
2528
2465
|
onSend: Kn
|
|
2529
|
-
}) : /* @__PURE__ */
|
|
2530
|
-
|
|
2531
|
-
/* @__PURE__ */
|
|
2532
|
-
deployments:
|
|
2533
|
-
selectedDeploymentId:
|
|
2534
|
-
onDeploymentChange:
|
|
2535
|
-
modelSelectorLabels:
|
|
2536
|
-
menuStyles:
|
|
2466
|
+
}) : /* @__PURE__ */ F(oe, { children: [
|
|
2467
|
+
Et,
|
|
2468
|
+
/* @__PURE__ */ P(Zt, {
|
|
2469
|
+
deployments: _e,
|
|
2470
|
+
selectedDeploymentId: ve,
|
|
2471
|
+
onDeploymentChange: ye,
|
|
2472
|
+
modelSelectorLabels: be,
|
|
2473
|
+
menuStyles: I,
|
|
2537
2474
|
isStreaming: s,
|
|
2538
|
-
isMobile:
|
|
2539
|
-
isDisabled:
|
|
2540
|
-
style:
|
|
2541
|
-
modelPickerOverlay:
|
|
2542
|
-
isPickerOpen:
|
|
2543
|
-
onPickerToggle: () =>
|
|
2544
|
-
onPickerOpenChange:
|
|
2475
|
+
isMobile: kt,
|
|
2476
|
+
isDisabled: Ae,
|
|
2477
|
+
style: Pt,
|
|
2478
|
+
modelPickerOverlay: vt,
|
|
2479
|
+
isPickerOpen: At,
|
|
2480
|
+
onPickerToggle: () => jt((e) => !e),
|
|
2481
|
+
onPickerOpenChange: jt
|
|
2545
2482
|
}),
|
|
2546
|
-
Gn && /* @__PURE__ */
|
|
2547
|
-
icon: /* @__PURE__ */
|
|
2483
|
+
Gn && /* @__PURE__ */ P(x, {
|
|
2484
|
+
icon: /* @__PURE__ */ P(me, {
|
|
2548
2485
|
size: g.LG,
|
|
2549
2486
|
stroke: _,
|
|
2550
2487
|
"aria-hidden": !0
|
|
@@ -2552,13 +2489,13 @@ var Zt = {
|
|
|
2552
2489
|
"aria-label": ne,
|
|
2553
2490
|
tooltipProps: { tooltip: ne },
|
|
2554
2491
|
className: "size-[40px] flex-shrink-0 mobile:min-h-11 mobile:min-w-11",
|
|
2555
|
-
onClick: () => An(
|
|
2556
|
-
disabled:
|
|
2492
|
+
onClick: () => An(qe.Dictation),
|
|
2493
|
+
disabled: G || s
|
|
2557
2494
|
}),
|
|
2558
|
-
s && o ? /* @__PURE__ */
|
|
2495
|
+
s && o ? /* @__PURE__ */ P(xt, {
|
|
2559
2496
|
onStop: o,
|
|
2560
2497
|
ariaLabel: A
|
|
2561
|
-
}) : !s && /* @__PURE__ */
|
|
2498
|
+
}) : !s && /* @__PURE__ */ P(bt, {
|
|
2562
2499
|
onSend: Kn,
|
|
2563
2500
|
isDisabled: !Wn || !zn,
|
|
2564
2501
|
ariaLabel: O,
|
|
@@ -2568,46 +2505,46 @@ var Zt = {
|
|
|
2568
2505
|
})
|
|
2569
2506
|
]
|
|
2570
2507
|
}),
|
|
2571
|
-
/* @__PURE__ */
|
|
2508
|
+
/* @__PURE__ */ P("span", {
|
|
2572
2509
|
className: "sr-only",
|
|
2573
2510
|
role: "status",
|
|
2574
2511
|
"aria-live": "polite",
|
|
2575
2512
|
"aria-atomic": "true",
|
|
2576
|
-
children: /* @__PURE__ */
|
|
2513
|
+
children: /* @__PURE__ */ P("span", { children: Tn.text }, Tn.revision)
|
|
2577
2514
|
})
|
|
2578
2515
|
]
|
|
2579
2516
|
});
|
|
2580
2517
|
});
|
|
2581
|
-
|
|
2582
|
-
var
|
|
2518
|
+
Qt.displayName = "Input";
|
|
2519
|
+
var $t = {
|
|
2583
2520
|
welcome: "_welcome_1icyo_1",
|
|
2584
2521
|
description: "_description_1icyo_5"
|
|
2585
|
-
},
|
|
2522
|
+
}, en = ({ isStreaming: e = !1, placeholder: t = "Type a prompt or use \"/\" to select one", welcomeText: n, descriptionText: r, belowWelcomeSlot: i, styles: a, className: o, inputClassName: s, isInputDisabled: u = !1, ...d }) => {
|
|
2586
2523
|
let { colors: f, typography: p, attachmentTray: m, modelMenu: h } = a ?? {};
|
|
2587
|
-
return /* @__PURE__ */
|
|
2524
|
+
return /* @__PURE__ */ F("div", {
|
|
2588
2525
|
style: c({
|
|
2589
2526
|
"--ci-welcome-color": f?.welcomeText,
|
|
2590
2527
|
"--ci-description-color": f?.descriptionText
|
|
2591
2528
|
}),
|
|
2592
2529
|
className: l("relative flex w-full flex-col items-center gap-9 px-4 py-5 desktop:p-5", o),
|
|
2593
2530
|
children: [
|
|
2594
|
-
n && /* @__PURE__ */
|
|
2531
|
+
n && /* @__PURE__ */ F("div", {
|
|
2595
2532
|
className: "flex flex-col items-center gap-4 text-center",
|
|
2596
|
-
children: [/* @__PURE__ */
|
|
2597
|
-
className: l(
|
|
2533
|
+
children: [/* @__PURE__ */ P("h1", {
|
|
2534
|
+
className: l($t.welcome, "m-0", p?.welcomeClassName || "dial-display2-text"),
|
|
2598
2535
|
children: n
|
|
2599
|
-
}), r && /* @__PURE__ */
|
|
2600
|
-
className: l(
|
|
2536
|
+
}), r && /* @__PURE__ */ P("p", {
|
|
2537
|
+
className: l($t.description, "m-0 max-w-[540px]", p?.descriptionClassName || "dial-body-paragraph-text"),
|
|
2601
2538
|
children: r
|
|
2602
2539
|
})]
|
|
2603
2540
|
}),
|
|
2604
|
-
i != null && /* @__PURE__ */
|
|
2541
|
+
i != null && /* @__PURE__ */ P("div", {
|
|
2605
2542
|
className: "flex w-full max-w-[700px] flex-col items-center empty:hidden",
|
|
2606
2543
|
children: i
|
|
2607
2544
|
}),
|
|
2608
|
-
/* @__PURE__ */
|
|
2545
|
+
/* @__PURE__ */ P("div", {
|
|
2609
2546
|
className: l("relative w-full", n ? "max-w-[700px]" : "max-w-[748px]"),
|
|
2610
|
-
children: /* @__PURE__ */
|
|
2547
|
+
children: /* @__PURE__ */ P(Qt, {
|
|
2611
2548
|
placeholder: t,
|
|
2612
2549
|
isStreaming: e,
|
|
2613
2550
|
isInputDisabled: u,
|
|
@@ -2621,42 +2558,42 @@ var rn = {
|
|
|
2621
2558
|
})
|
|
2622
2559
|
]
|
|
2623
2560
|
});
|
|
2624
|
-
},
|
|
2625
|
-
let
|
|
2626
|
-
|
|
2627
|
-
O?.length && (
|
|
2561
|
+
}, tn = ({ message: e, messageRevision: t, onChange: n, activeMentions: r, onBackspaceAtCaret: i, caretPositionOverride: o, commandMenu: s, menuOverlays: c, initialAttachments: u = [], onCancel: d, onSave: p, onUploadAttachment: m, cancelLabel: h = "Cancel", saveLabel: g = "Save & Submit", ariaLabel: v, removeLabel: y, retryLabel: b, uploadingLabel: x, addMenuTitle: S = "Add", attachLabel: C = "Attach file", menuTitle: T = "Menu", menuCloseLabel: E = "Close", className: D, pendingDropFiles: O, onDropFilesConsumed: k, validateAttachment: te, isAttachmentsEnabled: A, isTextAttachmentsAllowed: ne, hideAttachFile: j = !1, fileAccept: re, maximumAttachmentsAmount: ie, onAttachmentsLimitExceeded: M, onDialFileSystemClick: N, dialFileSystemLabel: ae, pendingAttachments: oe, onPendingAttachmentsConsumed: se, onAttachmentClick: I, pasteTextThreshold: ce, maxMessageLength: le = 5e4, onMessageTooLong: ue }) => {
|
|
2562
|
+
let L = V(null), de = V(null), [fe, me] = H([]);
|
|
2563
|
+
z(() => {
|
|
2564
|
+
O?.length && (me(O), k?.());
|
|
2628
2565
|
}, [O, k]);
|
|
2629
|
-
let [
|
|
2630
|
-
|
|
2631
|
-
},
|
|
2632
|
-
p(e,
|
|
2633
|
-
}, [
|
|
2634
|
-
if (
|
|
2635
|
-
if (
|
|
2636
|
-
|
|
2566
|
+
let [he, ge] = H(e ?? ""), [_e, ve] = H([]), [ye, be] = H(u), xe = _e.some((e) => e.status === a.Loading || e.status === a.Error), Se = (he.trim().length > 0 || _e.length > 0 || ye.length > 0) && !xe, Ce = (e) => {
|
|
2567
|
+
be((t) => t.filter((t) => t.id !== e));
|
|
2568
|
+
}, we = R((e, t) => {
|
|
2569
|
+
p(e, ye, t);
|
|
2570
|
+
}, [ye, p]), Te = () => {
|
|
2571
|
+
if (Se) {
|
|
2572
|
+
if (he.length >= le) {
|
|
2573
|
+
ue?.(he.length, le);
|
|
2637
2574
|
return;
|
|
2638
2575
|
}
|
|
2639
|
-
|
|
2576
|
+
we(he, _e);
|
|
2640
2577
|
}
|
|
2641
|
-
},
|
|
2642
|
-
|
|
2643
|
-
}, [n]),
|
|
2578
|
+
}, Ee = R(() => me([]), []), U = R((e) => {
|
|
2579
|
+
ge(e), n?.(e);
|
|
2580
|
+
}, [n]), De = R((e) => {
|
|
2644
2581
|
let t = Array.from(e.target.files ?? []);
|
|
2645
|
-
t.length !== 0 && (e.target.value = "",
|
|
2646
|
-
}, []),
|
|
2582
|
+
t.length !== 0 && (e.target.value = "", me(t));
|
|
2583
|
+
}, []), W = B(() => N ? [{
|
|
2647
2584
|
key: "dial-fs",
|
|
2648
2585
|
label: ae ?? "DIAL file system",
|
|
2649
|
-
icon: /* @__PURE__ */
|
|
2586
|
+
icon: /* @__PURE__ */ P(pe, {
|
|
2650
2587
|
size: f,
|
|
2651
2588
|
"aria-hidden": !0,
|
|
2652
2589
|
stroke: _
|
|
2653
2590
|
}),
|
|
2654
2591
|
onClick: N
|
|
2655
2592
|
}] : [], [N, ae]);
|
|
2656
|
-
return /* @__PURE__ */
|
|
2593
|
+
return /* @__PURE__ */ F("div", {
|
|
2657
2594
|
className: l("flex w-full flex-col gap-2", D),
|
|
2658
|
-
children: [/* @__PURE__ */
|
|
2659
|
-
ref:
|
|
2595
|
+
children: [/* @__PURE__ */ P(Qt, {
|
|
2596
|
+
ref: de,
|
|
2660
2597
|
message: e,
|
|
2661
2598
|
messageRevision: t,
|
|
2662
2599
|
activeMentions: r,
|
|
@@ -2665,18 +2602,18 @@ var rn = {
|
|
|
2665
2602
|
commandMenu: s,
|
|
2666
2603
|
ariaLabel: v,
|
|
2667
2604
|
hideActionBar: !0,
|
|
2668
|
-
pendingDropFiles:
|
|
2669
|
-
onDropFilesConsumed:
|
|
2670
|
-
onSend:
|
|
2605
|
+
pendingDropFiles: fe,
|
|
2606
|
+
onDropFilesConsumed: Ee,
|
|
2607
|
+
onSend: we,
|
|
2671
2608
|
onUploadAttachment: m,
|
|
2672
|
-
onChange:
|
|
2673
|
-
onAttachmentsChange:
|
|
2609
|
+
onChange: U,
|
|
2610
|
+
onAttachmentsChange: ve,
|
|
2674
2611
|
removeLabel: y,
|
|
2675
2612
|
retryLabel: b,
|
|
2676
2613
|
uploadingLabel: x,
|
|
2677
2614
|
className: "max-w-full",
|
|
2678
|
-
prefixAttachments:
|
|
2679
|
-
onRemovePrefixAttachment:
|
|
2615
|
+
prefixAttachments: ye,
|
|
2616
|
+
onRemovePrefixAttachment: Ce,
|
|
2680
2617
|
validateAttachment: te,
|
|
2681
2618
|
isAttachmentsEnabled: A,
|
|
2682
2619
|
isTextAttachmentsAllowed: ne,
|
|
@@ -2684,51 +2621,51 @@ var rn = {
|
|
|
2684
2621
|
onAttachmentsLimitExceeded: M,
|
|
2685
2622
|
pendingAttachments: oe,
|
|
2686
2623
|
onPendingAttachmentsConsumed: se,
|
|
2687
|
-
onAttachmentClick:
|
|
2688
|
-
pasteTextThreshold:
|
|
2689
|
-
maxMessageLength:
|
|
2690
|
-
onMessageTooLong:
|
|
2691
|
-
}), /* @__PURE__ */
|
|
2624
|
+
onAttachmentClick: I,
|
|
2625
|
+
pasteTextThreshold: ce,
|
|
2626
|
+
maxMessageLength: le,
|
|
2627
|
+
onMessageTooLong: ue
|
|
2628
|
+
}), /* @__PURE__ */ F("div", {
|
|
2692
2629
|
className: "flex items-center justify-between",
|
|
2693
|
-
children: [/* @__PURE__ */
|
|
2630
|
+
children: [/* @__PURE__ */ F("div", {
|
|
2694
2631
|
className: "flex",
|
|
2695
|
-
children: [!j && /* @__PURE__ */
|
|
2696
|
-
ref:
|
|
2632
|
+
children: [!j && /* @__PURE__ */ P("input", {
|
|
2633
|
+
ref: L,
|
|
2697
2634
|
type: "file",
|
|
2698
2635
|
multiple: !0,
|
|
2699
2636
|
accept: re,
|
|
2700
2637
|
className: "sr-only",
|
|
2701
2638
|
"aria-hidden": !0,
|
|
2702
2639
|
tabIndex: -1,
|
|
2703
|
-
onChange:
|
|
2704
|
-
}), (!j || (c?.length ?? 0) > 0) && /* @__PURE__ */
|
|
2705
|
-
onAttachClick: j ? void 0 : () =>
|
|
2640
|
+
onChange: De
|
|
2641
|
+
}), (!j || (c?.length ?? 0) > 0) && /* @__PURE__ */ P(dt, {
|
|
2642
|
+
onAttachClick: j ? void 0 : () => L.current?.click(),
|
|
2706
2643
|
attachLabel: C,
|
|
2707
2644
|
addMenuTitle: S,
|
|
2708
2645
|
menuTitle: T,
|
|
2709
2646
|
menuCloseLabel: E,
|
|
2710
|
-
extraMenuItems:
|
|
2647
|
+
extraMenuItems: W,
|
|
2711
2648
|
menuOverlays: c,
|
|
2712
|
-
getCaretPosition: () =>
|
|
2649
|
+
getCaretPosition: () => de.current?.getCaretPosition() ?? 0
|
|
2713
2650
|
})]
|
|
2714
|
-
}), /* @__PURE__ */
|
|
2651
|
+
}), /* @__PURE__ */ F("div", {
|
|
2715
2652
|
className: "flex gap-2",
|
|
2716
|
-
children: [/* @__PURE__ */
|
|
2653
|
+
children: [/* @__PURE__ */ P(w, {
|
|
2717
2654
|
label: h,
|
|
2718
2655
|
onClick: d
|
|
2719
|
-
}), /* @__PURE__ */
|
|
2656
|
+
}), /* @__PURE__ */ P(ee, {
|
|
2720
2657
|
label: g,
|
|
2721
|
-
onClick:
|
|
2722
|
-
disabled: !
|
|
2658
|
+
onClick: Te,
|
|
2659
|
+
disabled: !Se
|
|
2723
2660
|
})]
|
|
2724
2661
|
})]
|
|
2725
2662
|
})]
|
|
2726
2663
|
});
|
|
2727
|
-
},
|
|
2728
|
-
let [t, n] =
|
|
2664
|
+
}, nn = (e) => {
|
|
2665
|
+
let [t, n] = H({
|
|
2729
2666
|
text: e?.text,
|
|
2730
2667
|
revision: e?.revision ?? 0
|
|
2731
|
-
}), r =
|
|
2668
|
+
}), r = R((e) => {
|
|
2732
2669
|
n((t) => ({
|
|
2733
2670
|
text: e,
|
|
2734
2671
|
revision: t.revision + 1
|
|
@@ -2739,11 +2676,11 @@ var rn = {
|
|
|
2739
2676
|
messageRevision: t.revision,
|
|
2740
2677
|
seedMessage: r
|
|
2741
2678
|
};
|
|
2742
|
-
},
|
|
2743
|
-
let n =
|
|
2744
|
-
r.current = t,
|
|
2679
|
+
}, rn = (e, t) => {
|
|
2680
|
+
let n = V(e), r = V(t);
|
|
2681
|
+
r.current = t, z(() => {
|
|
2745
2682
|
e !== n.current && (n.current = e, r.current());
|
|
2746
2683
|
}, [e]);
|
|
2747
2684
|
};
|
|
2748
2685
|
//#endregion
|
|
2749
|
-
export {
|
|
2686
|
+
export { et as ActionRowLayout, W as BottomSheetShell, U as CONVERSATION_INPUT_CLASS, ct as ChatSettingsModal, en as ConversationInput, tn as EditMessageInput, Qt as Input, $e as SendOnEnter, nn as useComposerSeed, rn as useComposerSeedSource };
|