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