@epam/ai-dial-conversation-input 1.1.0-dev.43 → 1.1.0-dev.45
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/ConversationInput/ConversationInput.d.ts.map +1 -1
- package/components/Input/Input.d.ts.map +1 -1
- package/index.js +398 -391
- package/models/ConversationInput.d.ts +11 -0
- package/models/ConversationInput.d.ts.map +1 -1
- package/models/Input.d.ts +6 -0
- package/models/Input.d.ts.map +1 -1
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
import { AttachmentErrorReason as e, AttachmentType as t, DeploymentIcon as n, Highlight as r, RequestStatus as i, ResponseFormat as a, buildCssVars as o, mergeClasses as s, useIsMobile as c } from "@epam/ai-dial-chat-shared";
|
|
2
|
-
import { BASE_ICON_SIZE as l, ButtonAppearance as u, ButtonVariant as d, DIAL_ICON_SIZE as f, DialButton as p, DialCloseButton as m, DialDropdown as h, DialDropdownIcon as g, DialErrorText as _, DialGhostIconButton as v, DialInput as y, DialPopup as b, DialPrimaryButton as x, DialRadioGroup as S, DialSearch as C, DialSkeleton as w, DialSkeletonVariant as T, DialSlider as E, DialTag as D, DialTooltip as O, ElementSize as k, PopupSize as
|
|
3
|
-
import { IconArrowLeft as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { createElement as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { AttachmentCard as
|
|
2
|
+
import { BASE_ICON_SIZE as l, ButtonAppearance as u, ButtonVariant as d, DIAL_ICON_SIZE as f, DialButton as p, DialCloseButton as m, DialDropdown as h, DialDropdownIcon as g, DialErrorText as _, DialGhostIconButton as v, DialInput as y, DialPopup as b, DialPrimaryButton as x, DialRadioGroup as S, DialSearch as C, DialSkeleton as w, DialSkeletonVariant as T, DialSlider as E, DialTag as D, DialTooltip as O, ElementSize as k, PopupSize as ee, RadioGroupOrientation as te } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { IconArrowLeft as A, IconArrowNarrowRight as ne, IconCheck as re, IconChevronDown as ie, IconChevronRight as ae, IconFile as oe, IconMicrophone as se, IconPaperclip as ce, IconPlayerStopFilled as le, IconPlaystationSquare as ue, IconPlus as de, IconSettings as fe, IconX as pe } from "@tabler/icons-react";
|
|
4
|
+
import { createPortal as me } from "react-dom";
|
|
5
|
+
import { createElement as he, memo as ge, useCallback as j, useEffect as M, useImperativeHandle as N, useLayoutEffect as _e, useMemo as P, useRef as F, useState as I } from "react";
|
|
6
|
+
import { Fragment as L, jsx as R, jsxs as z } from "react/jsx-runtime";
|
|
7
|
+
import { AttachmentCard as ve, AttachmentGroup as ye, AttachmentTray as be, AttachmentTray as xe, FileDndOverlay as B, MAX_UPLOADS_PER_MINUTE as Se, generateAttachmentId as Ce, getAttachmentIcon as we, useClipboardPaste as Te } from "@epam/ai-dial-attachment-input";
|
|
8
8
|
//#region src/hooks/useBottomSheet.ts
|
|
9
|
-
var
|
|
10
|
-
|
|
9
|
+
var Ee = (e, t) => {
|
|
10
|
+
M(() => {
|
|
11
11
|
if (!e) return;
|
|
12
12
|
let n = (e) => {
|
|
13
13
|
e.key === "Escape" && t();
|
|
14
14
|
};
|
|
15
15
|
return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
|
|
16
|
-
}, [e, t]),
|
|
16
|
+
}, [e, t]), M(() => {
|
|
17
17
|
if (e) return document.body.style.overflow = "hidden", () => {
|
|
18
18
|
document.body.style.overflow = "";
|
|
19
19
|
};
|
|
20
20
|
}, [e]);
|
|
21
|
-
},
|
|
21
|
+
}, V = {
|
|
22
22
|
backdrop: "_backdrop_3xrn0_9",
|
|
23
23
|
sheet: "_sheet_3xrn0_13",
|
|
24
24
|
"slide-up": "_slide-up_3xrn0_1",
|
|
25
25
|
title: "_title_3xrn0_18",
|
|
26
26
|
divider: "_divider_3xrn0_22"
|
|
27
|
-
}, H = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: a, "aria-label": o, style: c, titleClassName: l = "dial-body-semi-text", className: u, children: d }) => (
|
|
28
|
-
className: s(
|
|
27
|
+
}, H = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: a, "aria-label": o, style: c, titleClassName: l = "dial-body-semi-text", className: u, children: d }) => (Ee(e, r), !e || typeof document > "u" ? null : me(/* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("div", {
|
|
28
|
+
className: s(V.backdrop, "fixed inset-0 z-[55]"),
|
|
29
29
|
onPointerDown: r,
|
|
30
30
|
"aria-hidden": !0
|
|
31
|
-
}), /* @__PURE__ */
|
|
31
|
+
}), /* @__PURE__ */ z("div", {
|
|
32
32
|
role: "dialog",
|
|
33
33
|
"aria-modal": !0,
|
|
34
34
|
"aria-label": t ?? o,
|
|
35
35
|
style: c,
|
|
36
|
-
className: s(
|
|
37
|
-
children: [t != null && /* @__PURE__ */
|
|
36
|
+
className: s(V.sheet, "fixed inset-x-0 bottom-0 z-[60] flex max-h-[85dvh] flex-col", u),
|
|
37
|
+
children: [t != null && /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ z("div", {
|
|
38
38
|
className: "relative flex h-[60px] flex-shrink-0 items-center justify-center px-4",
|
|
39
39
|
children: [
|
|
40
|
-
i && /* @__PURE__ */
|
|
40
|
+
i && /* @__PURE__ */ R("div", {
|
|
41
41
|
className: "absolute start-4",
|
|
42
|
-
children: /* @__PURE__ */
|
|
43
|
-
icon: /* @__PURE__ */
|
|
42
|
+
children: /* @__PURE__ */ R(v, {
|
|
43
|
+
icon: /* @__PURE__ */ R(A, {
|
|
44
44
|
size: f.LG,
|
|
45
45
|
stroke: 1.5,
|
|
46
46
|
className: "rtl:scale-x-[-1]"
|
|
@@ -49,20 +49,20 @@ var Te = (e, t) => {
|
|
|
49
49
|
onClick: i
|
|
50
50
|
})
|
|
51
51
|
}),
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
className: s(
|
|
52
|
+
/* @__PURE__ */ R("span", {
|
|
53
|
+
className: s(V.title, l),
|
|
54
54
|
children: t
|
|
55
55
|
}),
|
|
56
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ R("div", {
|
|
57
57
|
className: "absolute end-4 m-2",
|
|
58
|
-
children: /* @__PURE__ */
|
|
58
|
+
children: /* @__PURE__ */ R(m, {
|
|
59
59
|
ariaLabel: n,
|
|
60
60
|
size: f.LG,
|
|
61
61
|
onClose: r
|
|
62
62
|
})
|
|
63
63
|
})
|
|
64
64
|
]
|
|
65
|
-
}), /* @__PURE__ */
|
|
65
|
+
}), /* @__PURE__ */ R("div", { className: "h-px flex-shrink-0" })] }), /* @__PURE__ */ R("div", {
|
|
66
66
|
className: "overflow-y-auto",
|
|
67
67
|
children: d
|
|
68
68
|
})]
|
|
@@ -71,18 +71,18 @@ var Te = (e, t) => {
|
|
|
71
71
|
for (let t = 0; t < e.length; t++) t > 0 && await new Promise((e) => setTimeout(e, r)), i.push(n(e[t]));
|
|
72
72
|
await Promise.allSettled(i);
|
|
73
73
|
}, Oe = ({ initialAttachments: n, onUploadAttachment: r, onAttachmentsChange: a, validateAttachment: o, pendingDropFiles: s, onDropFilesConsumed: c, pendingAttachments: l, onPendingAttachmentsConsumed: u, onExpandPastedText: d, maximumAttachmentsAmount: f, baseAttachmentsAmount: p = 0, onAttachmentsLimitExceeded: m }) => {
|
|
74
|
-
let [h, g] =
|
|
75
|
-
|
|
74
|
+
let [h, g] = I(n), _ = F(h);
|
|
75
|
+
M(() => {
|
|
76
76
|
_.current = h;
|
|
77
|
-
}, [h]),
|
|
77
|
+
}, [h]), M(() => () => {
|
|
78
78
|
_.current.forEach((e) => {
|
|
79
79
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
80
80
|
});
|
|
81
81
|
}, []);
|
|
82
|
-
let v =
|
|
82
|
+
let v = j((e) => e.map((e) => {
|
|
83
83
|
let n = e.type.startsWith("image/"), r = e.type.startsWith("audio/"), a = n ? URL.createObjectURL(e) : void 0, o = r ? URL.createObjectURL(e) : void 0;
|
|
84
84
|
return {
|
|
85
|
-
id:
|
|
85
|
+
id: Ce(),
|
|
86
86
|
name: e.name,
|
|
87
87
|
contentType: e.type,
|
|
88
88
|
file: e,
|
|
@@ -91,14 +91,14 @@ var Te = (e, t) => {
|
|
|
91
91
|
previewUrl: a,
|
|
92
92
|
playUrl: o
|
|
93
93
|
};
|
|
94
|
-
}), []), y =
|
|
94
|
+
}), []), y = j((e) => {
|
|
95
95
|
g((t) => {
|
|
96
96
|
let n = e(t);
|
|
97
97
|
return n !== t && a?.(n), n;
|
|
98
98
|
});
|
|
99
|
-
}, [a]), b =
|
|
99
|
+
}, [a]), b = j((e) => {
|
|
100
100
|
g(e), a?.(e);
|
|
101
|
-
}, [a]), x =
|
|
101
|
+
}, [a]), x = j(async (t) => {
|
|
102
102
|
if (r) {
|
|
103
103
|
y((e) => e.map((e) => e.id === t.id ? {
|
|
104
104
|
...e,
|
|
@@ -120,7 +120,7 @@ var Te = (e, t) => {
|
|
|
120
120
|
} : e));
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
}, [r, y]), S =
|
|
123
|
+
}, [r, y]), S = j((e, t = !0) => {
|
|
124
124
|
let n = new Set(_.current.map((e) => e.id)), r = e.filter((e) => !n.has(e.id));
|
|
125
125
|
if (r.length !== 0) {
|
|
126
126
|
if (f != null && f > 0 && Number.isFinite(f)) {
|
|
@@ -141,7 +141,7 @@ var Te = (e, t) => {
|
|
|
141
141
|
status: i.Error,
|
|
142
142
|
errorReason: n
|
|
143
143
|
} : e));
|
|
144
|
-
}), De(e,
|
|
144
|
+
}), De(e, Se, x);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
}, [
|
|
@@ -152,20 +152,20 @@ var Te = (e, t) => {
|
|
|
152
152
|
x,
|
|
153
153
|
o
|
|
154
154
|
]);
|
|
155
|
-
|
|
155
|
+
M(() => {
|
|
156
156
|
s.length !== 0 && (S(v(s)), c?.());
|
|
157
157
|
}, [
|
|
158
158
|
S,
|
|
159
159
|
v,
|
|
160
160
|
c,
|
|
161
161
|
s
|
|
162
|
-
]),
|
|
162
|
+
]), M(() => {
|
|
163
163
|
l.length !== 0 && (S(l, !1), u?.());
|
|
164
164
|
}, [
|
|
165
165
|
S,
|
|
166
166
|
u,
|
|
167
167
|
l
|
|
168
|
-
]),
|
|
168
|
+
]), M(() => {
|
|
169
169
|
if (!o) return;
|
|
170
170
|
let t = !1, n = [], r = _.current.map((r) => {
|
|
171
171
|
if (r.status === i.Loading) return r;
|
|
@@ -192,7 +192,7 @@ var Te = (e, t) => {
|
|
|
192
192
|
y,
|
|
193
193
|
x
|
|
194
194
|
]);
|
|
195
|
-
let C =
|
|
195
|
+
let C = j((e) => {
|
|
196
196
|
y((t) => {
|
|
197
197
|
let n = t.find((t) => t.id === e);
|
|
198
198
|
return n?.previewUrl && URL.revokeObjectURL(n.previewUrl), n?.playUrl && URL.revokeObjectURL(n.playUrl), t.filter((t) => t.id !== e);
|
|
@@ -204,11 +204,11 @@ var Te = (e, t) => {
|
|
|
204
204
|
addAttachments: S,
|
|
205
205
|
resetAttachments: b,
|
|
206
206
|
handleRemove: C,
|
|
207
|
-
handleRetry:
|
|
207
|
+
handleRetry: j((e) => {
|
|
208
208
|
let t = h.find((t) => t.id === e);
|
|
209
209
|
t && x(t);
|
|
210
210
|
}, [h, x]),
|
|
211
|
-
handleExpand:
|
|
211
|
+
handleExpand: j(async (e) => {
|
|
212
212
|
let n = h.find((t) => t.id === e);
|
|
213
213
|
if (!n || n.type !== t.Pasted) return;
|
|
214
214
|
let r = await n.file.text();
|
|
@@ -221,8 +221,8 @@ var Te = (e, t) => {
|
|
|
221
221
|
hasBlockedAttachments: h.some((e) => e.status === i.Loading || e.status === i.Error)
|
|
222
222
|
};
|
|
223
223
|
}, ke = (e, t) => {
|
|
224
|
-
let [n, r] =
|
|
225
|
-
return
|
|
224
|
+
let [n, r] = I(e), [i, a] = I(!1), [o, s] = I(0);
|
|
225
|
+
return M(() => {
|
|
226
226
|
if (e) {
|
|
227
227
|
r(!0), a(!1), s((e) => e + 1);
|
|
228
228
|
return;
|
|
@@ -239,17 +239,17 @@ var Te = (e, t) => {
|
|
|
239
239
|
instanceKey: o
|
|
240
240
|
};
|
|
241
241
|
}, Ae = (e, t) => !e.slice(0, t).includes("\n"), je = (e, t) => !e.slice(t).includes("\n"), Me = (e) => {
|
|
242
|
-
let t =
|
|
242
|
+
let t = F(e);
|
|
243
243
|
t.current = e;
|
|
244
|
-
let n =
|
|
244
|
+
let n = F(-1), r = F(""), i = j((e, i, a) => {
|
|
245
245
|
let o = t.current;
|
|
246
246
|
return !o || o.length === 0 ? null : e === "up" ? !Ae(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 || !je(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
|
|
247
|
-
}, []), a =
|
|
247
|
+
}, []), a = j(() => {
|
|
248
248
|
n.current = -1, r.current = "";
|
|
249
|
-
}, []), o =
|
|
249
|
+
}, []), o = j(() => {
|
|
250
250
|
n.current = -1, r.current = "";
|
|
251
251
|
}, []);
|
|
252
|
-
return
|
|
252
|
+
return P(() => ({
|
|
253
253
|
navigate: i,
|
|
254
254
|
notifyChange: a,
|
|
255
255
|
reset: o
|
|
@@ -259,12 +259,12 @@ var Te = (e, t) => {
|
|
|
259
259
|
o
|
|
260
260
|
]);
|
|
261
261
|
}, Ne = ({ messageProp: e, messageRevision: t }) => {
|
|
262
|
-
let [n, r] =
|
|
263
|
-
return
|
|
262
|
+
let [n, r] = I(e), i = F(null), a = F(0), [o, s] = I(!1);
|
|
263
|
+
return M(() => {
|
|
264
264
|
r(e);
|
|
265
|
-
}, [e, t]),
|
|
265
|
+
}, [e, t]), M(() => {
|
|
266
266
|
i.current && (a.current = i.current.offsetHeight);
|
|
267
|
-
}, []),
|
|
267
|
+
}, []), _e(() => {
|
|
268
268
|
if (!i.current || a.current === 0) return;
|
|
269
269
|
let e = i.current.offsetHeight > a.current;
|
|
270
270
|
s((t) => e ? !0 : n === "" ? !1 : t);
|
|
@@ -281,13 +281,13 @@ var Te = (e, t) => {
|
|
|
281
281
|
"audio/ogg;codecs=opus",
|
|
282
282
|
"audio/webm"
|
|
283
283
|
], Ie = () => Fe.find((e) => MediaRecorder.isTypeSupported(e)) ?? "", Le = ({ onAttachAudio: e }) => {
|
|
284
|
-
let [t, n] =
|
|
284
|
+
let [t, n] = I("idle"), [r, i] = I(null), [a, o] = I(0), s = F(null), c = F(null), l = F(null), u = F(null), d = F([]), f = F(""), p = F(null), m = F(e);
|
|
285
285
|
m.current = e;
|
|
286
|
-
let h =
|
|
286
|
+
let h = j(() => {
|
|
287
287
|
p.current != null && (clearInterval(p.current), p.current = null);
|
|
288
|
-
}, []), g =
|
|
288
|
+
}, []), g = j(() => {
|
|
289
289
|
h(), s.current &&= (s.current.getTracks().forEach((e) => e.stop()), null), c.current &&= (c.current.close(), null), l.current = null, u.current = null;
|
|
290
|
-
}, [h]), _ =
|
|
290
|
+
}, [h]), _ = j(() => {
|
|
291
291
|
(async () => {
|
|
292
292
|
try {
|
|
293
293
|
let e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
@@ -308,17 +308,17 @@ var Te = (e, t) => {
|
|
|
308
308
|
i(e instanceof Error ? e.message : "Microphone access denied"), n("error");
|
|
309
309
|
}
|
|
310
310
|
})();
|
|
311
|
-
}, []), v =
|
|
311
|
+
}, []), v = j(() => {
|
|
312
312
|
let e = u.current;
|
|
313
313
|
!e || e.state !== "recording" || (h(), e.onstop = () => {
|
|
314
314
|
let e = f.current || "audio/webm", t = new Blob(d.current, { type: e }), r = e.split(";")[0], a = r.split("/")[1] ?? "webm", s = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, -1), c = new File([t], `voice-${s}.${a}`, { type: r });
|
|
315
315
|
m.current(c), g(), o(0), i(null), n("idle");
|
|
316
316
|
}, e.stop());
|
|
317
|
-
}, [h, g]), y =
|
|
317
|
+
}, [h, g]), y = j(() => {
|
|
318
318
|
let e = u.current;
|
|
319
319
|
e && e.state === "recording" && (e.ondataavailable = null, e.onstop = null, e.stop()), g(), o(0), i(null), n("idle");
|
|
320
320
|
}, [g]);
|
|
321
|
-
return
|
|
321
|
+
return M(() => () => {
|
|
322
322
|
g();
|
|
323
323
|
}, [g]), {
|
|
324
324
|
state: t,
|
|
@@ -338,7 +338,7 @@ var Te = (e, t) => {
|
|
|
338
338
|
let d = (e) => {
|
|
339
339
|
e(), r();
|
|
340
340
|
};
|
|
341
|
-
return /* @__PURE__ */
|
|
341
|
+
return /* @__PURE__ */ R(H, {
|
|
342
342
|
isOpen: e,
|
|
343
343
|
title: t,
|
|
344
344
|
closeLabel: n,
|
|
@@ -346,22 +346,22 @@ var Te = (e, t) => {
|
|
|
346
346
|
style: i,
|
|
347
347
|
className: o,
|
|
348
348
|
titleClassName: c,
|
|
349
|
-
children: /* @__PURE__ */
|
|
349
|
+
children: /* @__PURE__ */ R("ul", {
|
|
350
350
|
role: "list",
|
|
351
351
|
className: "flex flex-col",
|
|
352
|
-
children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */
|
|
352
|
+
children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ R("li", { children: /* @__PURE__ */ R(p, {
|
|
353
353
|
type: "button",
|
|
354
354
|
className: s(ze.item, "flex w-full items-center gap-3 px-4 py-[10px] text-start"),
|
|
355
|
-
iconBefore: /* @__PURE__ */
|
|
355
|
+
iconBefore: /* @__PURE__ */ R("span", {
|
|
356
356
|
className: ze.itemIcon,
|
|
357
357
|
children: n
|
|
358
358
|
}),
|
|
359
|
-
iconAfter: r ? /* @__PURE__ */
|
|
359
|
+
iconAfter: r ? /* @__PURE__ */ R("span", {
|
|
360
360
|
className: "ms-auto",
|
|
361
361
|
children: r
|
|
362
362
|
}) : null,
|
|
363
363
|
textClassName: u,
|
|
364
|
-
label: /* @__PURE__ */
|
|
364
|
+
label: /* @__PURE__ */ R("span", {
|
|
365
365
|
className: l,
|
|
366
366
|
children: t
|
|
367
367
|
}),
|
|
@@ -369,62 +369,67 @@ var Te = (e, t) => {
|
|
|
369
369
|
}) }, e))
|
|
370
370
|
})
|
|
371
371
|
});
|
|
372
|
-
}, Ve = ({ gradientId: e = "gradient-check-icon" }) => /* @__PURE__ */
|
|
372
|
+
}, Ve = ({ gradientId: e = "gradient-check-icon" }) => /* @__PURE__ */ z("svg", {
|
|
373
373
|
width: f.SM,
|
|
374
374
|
height: f.SM,
|
|
375
375
|
viewBox: "0 0 24 24",
|
|
376
376
|
fill: "none",
|
|
377
377
|
"aria-hidden": !0,
|
|
378
|
-
children: [/* @__PURE__ */
|
|
378
|
+
children: [/* @__PURE__ */ R("defs", { children: /* @__PURE__ */ z("linearGradient", {
|
|
379
379
|
id: e,
|
|
380
380
|
x1: "0",
|
|
381
381
|
y1: "0",
|
|
382
382
|
x2: "24",
|
|
383
383
|
y2: "24",
|
|
384
384
|
gradientUnits: "userSpaceOnUse",
|
|
385
|
-
children: [/* @__PURE__ */
|
|
385
|
+
children: [/* @__PURE__ */ R("stop", {
|
|
386
386
|
offset: "0%",
|
|
387
387
|
stopColor: "#4b7be6"
|
|
388
|
-
}), /* @__PURE__ */
|
|
388
|
+
}), /* @__PURE__ */ R("stop", {
|
|
389
389
|
offset: "100%",
|
|
390
390
|
stopColor: "#9355f4"
|
|
391
391
|
})]
|
|
392
|
-
}) }), /* @__PURE__ */
|
|
392
|
+
}) }), /* @__PURE__ */ R("path", {
|
|
393
393
|
d: "M5 12l5 5L20 7",
|
|
394
394
|
stroke: `url(#${e})`,
|
|
395
395
|
strokeWidth: "2",
|
|
396
396
|
strokeLinecap: "round",
|
|
397
397
|
strokeLinejoin: "round"
|
|
398
398
|
})]
|
|
399
|
-
}),
|
|
399
|
+
}), U = {
|
|
400
400
|
tabContainer: "_tabContainer_rzv03_1",
|
|
401
401
|
tabActive: "_tabActive_rzv03_13"
|
|
402
402
|
};
|
|
403
|
-
|
|
403
|
+
ge(({ tabs: e, activeTabId: t, onTabChange: n, styles: r }) => {
|
|
404
404
|
let { tabClassName: i = "dial-tiny-semi-text" } = r?.typography ?? {};
|
|
405
|
-
return /* @__PURE__ */
|
|
405
|
+
return /* @__PURE__ */ R("div", {
|
|
406
406
|
className: "flex flex-nowrap gap-1",
|
|
407
|
+
role: "tablist",
|
|
407
408
|
children: e.map((e) => {
|
|
408
409
|
let r = t === e.id;
|
|
409
|
-
return /* @__PURE__ */
|
|
410
|
-
|
|
411
|
-
selected: r,
|
|
412
|
-
onClick: () => n(e.id),
|
|
410
|
+
return /* @__PURE__ */ R("div", {
|
|
411
|
+
role: "tab",
|
|
413
412
|
"aria-selected": r,
|
|
414
|
-
className:
|
|
413
|
+
className: "contents",
|
|
414
|
+
children: /* @__PURE__ */ R(D, {
|
|
415
|
+
label: e.label,
|
|
416
|
+
selected: r,
|
|
417
|
+
onClick: () => n(e.id),
|
|
418
|
+
className: s("box-border h-auto shrink-0 justify-center rounded-full p-2 text-center", i, U.tabContainer, r && U.tabActive)
|
|
419
|
+
})
|
|
415
420
|
}, e.id);
|
|
416
421
|
})
|
|
417
422
|
});
|
|
418
423
|
});
|
|
419
424
|
//#endregion
|
|
420
425
|
//#region ../ai-dial-kit/src/components/Button/Buttons.tsx
|
|
421
|
-
var
|
|
426
|
+
var He = (e) => /* @__PURE__ */ R(x, { ...e }), W = (e) => /* @__PURE__ */ R(p, {
|
|
422
427
|
...e,
|
|
423
428
|
variant: d.Neutral,
|
|
424
429
|
appearance: u.Outlined
|
|
425
|
-
}),
|
|
426
|
-
let [s, c] =
|
|
427
|
-
|
|
430
|
+
}), G = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
431
|
+
let [s, c] = I(t), [l, u] = I(n), [d, f] = I(r), p = F(o);
|
|
432
|
+
M(() => {
|
|
428
433
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
429
434
|
}, [
|
|
430
435
|
o,
|
|
@@ -441,7 +446,7 @@ var U = (e) => /* @__PURE__ */ z(x, { ...e }), W = (e) => /* @__PURE__ */ z(p, {
|
|
|
441
446
|
setResponseFormat: c,
|
|
442
447
|
setSystemPrompt: u,
|
|
443
448
|
setTemperature: f,
|
|
444
|
-
handleSubmit:
|
|
449
|
+
handleSubmit: j(() => {
|
|
445
450
|
if (!m) return;
|
|
446
451
|
let t = {};
|
|
447
452
|
e.responseFormat && s != null && (t.responseFormat = s), e.systemPrompt && (t.systemPrompt = l), e.temperature && (t.temperature = d), i(t), a();
|
|
@@ -455,18 +460,18 @@ var U = (e) => /* @__PURE__ */ z(x, { ...e }), W = (e) => /* @__PURE__ */ z(p, {
|
|
|
455
460
|
a
|
|
456
461
|
])
|
|
457
462
|
};
|
|
458
|
-
},
|
|
463
|
+
}, Ue = "!dial-small-semi-text !text-primary gap-1", We = ({ features: e, responseFormat: t, systemPrompt: n, temperature: r, onResponseFormatChange: i, onSystemPromptChange: o, onTemperatureChange: s, responseFormatLabel: c = "Response format", responseFormatHint: l = "Applies to new and existing messages", responseFormatMarkdownLabel: u = "Markdown", responseFormatPlainTextLabel: d = "Plain text", systemPromptLabel: f = "System prompt", systemPromptTooltip: p = "Enter a prompt", temperatureLabel: m = "Temperature", temperatureLabels: h = [
|
|
459
464
|
"Precise",
|
|
460
465
|
"Neutral",
|
|
461
466
|
"Creative"
|
|
462
|
-
], temperatureHint: g }) => /* @__PURE__ */
|
|
467
|
+
], temperatureHint: g }) => /* @__PURE__ */ z("div", {
|
|
463
468
|
className: "flex flex-col gap-4 px-6 py-3",
|
|
464
469
|
children: [
|
|
465
|
-
e.responseFormat && /* @__PURE__ */
|
|
470
|
+
e.responseFormat && /* @__PURE__ */ R(S, {
|
|
466
471
|
fieldTitle: c,
|
|
467
|
-
labelClassName:
|
|
472
|
+
labelClassName: Ue,
|
|
468
473
|
elementId: "response-format",
|
|
469
|
-
orientation:
|
|
474
|
+
orientation: te.Column,
|
|
470
475
|
activeRadioButton: t ?? a.Markdown,
|
|
471
476
|
labelDescription: l,
|
|
472
477
|
radioButtons: [{
|
|
@@ -478,19 +483,19 @@ var U = (e) => /* @__PURE__ */ z(x, { ...e }), W = (e) => /* @__PURE__ */ z(p, {
|
|
|
478
483
|
}],
|
|
479
484
|
onChange: (e) => i(e)
|
|
480
485
|
}),
|
|
481
|
-
e.systemPrompt && /* @__PURE__ */
|
|
486
|
+
e.systemPrompt && /* @__PURE__ */ R(y, {
|
|
482
487
|
value: n,
|
|
483
488
|
placeholder: p,
|
|
484
489
|
labelProps: {
|
|
485
|
-
className:
|
|
490
|
+
className: Ue,
|
|
486
491
|
label: f
|
|
487
492
|
},
|
|
488
493
|
onChange: (e) => o(e ?? "")
|
|
489
494
|
}),
|
|
490
|
-
e.temperature && /* @__PURE__ */
|
|
495
|
+
e.temperature && /* @__PURE__ */ R(E, {
|
|
491
496
|
labelProps: {
|
|
492
497
|
label: m,
|
|
493
|
-
className:
|
|
498
|
+
className: Ue,
|
|
494
499
|
caption: g
|
|
495
500
|
},
|
|
496
501
|
value: r,
|
|
@@ -501,8 +506,8 @@ var U = (e) => /* @__PURE__ */ z(x, { ...e }), W = (e) => /* @__PURE__ */ z(p, {
|
|
|
501
506
|
onChange: s
|
|
502
507
|
})
|
|
503
508
|
]
|
|
504
|
-
}),
|
|
505
|
-
let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: D, setResponseFormat: k, setSystemPrompt:
|
|
509
|
+
}), K = ({ isOpen: e, onBack: t, backLabel: n, onClose: r, closeLabel: i, style: a, features: o, initialResponseFormat: c, initialSystemPrompt: l, 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 }) => {
|
|
510
|
+
let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: D, setResponseFormat: k, setSystemPrompt: ee, setTemperature: te, handleSubmit: A } = G({
|
|
506
511
|
isOpen: e,
|
|
507
512
|
features: o,
|
|
508
513
|
initialResponseFormat: c,
|
|
@@ -511,7 +516,7 @@ var U = (e) => /* @__PURE__ */ z(x, { ...e }), W = (e) => /* @__PURE__ */ z(p, {
|
|
|
511
516
|
onSave: d,
|
|
512
517
|
onClose: r
|
|
513
518
|
});
|
|
514
|
-
return /* @__PURE__ */
|
|
519
|
+
return /* @__PURE__ */ z(H, {
|
|
515
520
|
isOpen: e,
|
|
516
521
|
title: f,
|
|
517
522
|
closeLabel: i,
|
|
@@ -519,14 +524,14 @@ var U = (e) => /* @__PURE__ */ z(x, { ...e }), W = (e) => /* @__PURE__ */ z(p, {
|
|
|
519
524
|
onBack: t,
|
|
520
525
|
backLabel: n,
|
|
521
526
|
style: a,
|
|
522
|
-
children: [/* @__PURE__ */
|
|
527
|
+
children: [/* @__PURE__ */ R(We, {
|
|
523
528
|
features: o,
|
|
524
529
|
responseFormat: w,
|
|
525
530
|
systemPrompt: T,
|
|
526
531
|
temperature: E,
|
|
527
532
|
onResponseFormatChange: k,
|
|
528
|
-
onSystemPromptChange:
|
|
529
|
-
onTemperatureChange:
|
|
533
|
+
onSystemPromptChange: ee,
|
|
534
|
+
onTemperatureChange: te,
|
|
530
535
|
responseFormatLabel: p,
|
|
531
536
|
responseFormatHint: m,
|
|
532
537
|
responseFormatMarkdownLabel: h,
|
|
@@ -536,23 +541,23 @@ var U = (e) => /* @__PURE__ */ z(x, { ...e }), W = (e) => /* @__PURE__ */ z(p, {
|
|
|
536
541
|
temperatureLabel: y,
|
|
537
542
|
temperatureLabels: b,
|
|
538
543
|
temperatureHint: x
|
|
539
|
-
}), /* @__PURE__ */
|
|
544
|
+
}), /* @__PURE__ */ R("div", {
|
|
540
545
|
className: s("px-6 py-4 mobile:pb-8"),
|
|
541
|
-
children: /* @__PURE__ */
|
|
546
|
+
children: /* @__PURE__ */ R(O, {
|
|
542
547
|
tooltip: C,
|
|
543
548
|
hideTooltip: D || !C,
|
|
544
549
|
triggerClassName: "w-full",
|
|
545
|
-
children: /* @__PURE__ */
|
|
550
|
+
children: /* @__PURE__ */ R(He, {
|
|
546
551
|
label: S,
|
|
547
|
-
onClick:
|
|
552
|
+
onClick: A,
|
|
548
553
|
disabled: !D,
|
|
549
554
|
className: "w-full"
|
|
550
555
|
})
|
|
551
556
|
})
|
|
552
557
|
})]
|
|
553
558
|
});
|
|
554
|
-
},
|
|
555
|
-
let { responseFormat: v, systemPrompt: y, temperature: x, canSubmit: S, setResponseFormat: C, setSystemPrompt: w, setTemperature: T, handleSubmit: E } =
|
|
559
|
+
}, q = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", responseFormatLabel: s, responseFormatHint: c, responseFormatMarkdownLabel: l, responseFormatPlainTextLabel: u, systemPromptLabel: d, systemPromptTooltip: f, temperatureLabel: p, temperatureLabels: m, temperatureHint: h, saveLabel: g = "Apply changes", saveDisabledTooltip: _ }) => {
|
|
560
|
+
let { responseFormat: v, systemPrompt: y, temperature: x, canSubmit: S, setResponseFormat: C, setSystemPrompt: w, setTemperature: T, handleSubmit: E } = G({
|
|
556
561
|
features: e,
|
|
557
562
|
initialResponseFormat: t,
|
|
558
563
|
initialSystemPrompt: n,
|
|
@@ -560,25 +565,25 @@ var U = (e) => /* @__PURE__ */ z(x, { ...e }), W = (e) => /* @__PURE__ */ z(p, {
|
|
|
560
565
|
onSave: i,
|
|
561
566
|
onClose: a
|
|
562
567
|
});
|
|
563
|
-
return /* @__PURE__ */
|
|
568
|
+
return /* @__PURE__ */ R(b, {
|
|
564
569
|
open: !0,
|
|
565
570
|
header: o,
|
|
566
|
-
size:
|
|
571
|
+
size: ee.Sm,
|
|
567
572
|
onClose: a,
|
|
568
573
|
className: "!bg-layer-2",
|
|
569
|
-
footer: /* @__PURE__ */
|
|
574
|
+
footer: /* @__PURE__ */ R("div", {
|
|
570
575
|
className: "flex justify-end px-6 py-4",
|
|
571
|
-
children: /* @__PURE__ */
|
|
576
|
+
children: /* @__PURE__ */ R(O, {
|
|
572
577
|
tooltip: _,
|
|
573
578
|
hideTooltip: S || !_,
|
|
574
|
-
children: /* @__PURE__ */
|
|
579
|
+
children: /* @__PURE__ */ R(He, {
|
|
575
580
|
label: g,
|
|
576
581
|
onClick: E,
|
|
577
582
|
disabled: !S
|
|
578
583
|
})
|
|
579
584
|
})
|
|
580
585
|
}),
|
|
581
|
-
children: /* @__PURE__ */
|
|
586
|
+
children: /* @__PURE__ */ R(We, {
|
|
582
587
|
features: e,
|
|
583
588
|
responseFormat: v,
|
|
584
589
|
systemPrompt: y,
|
|
@@ -598,15 +603,15 @@ var U = (e) => /* @__PURE__ */ z(x, { ...e }), W = (e) => /* @__PURE__ */ z(p, {
|
|
|
598
603
|
})
|
|
599
604
|
});
|
|
600
605
|
};
|
|
601
|
-
|
|
606
|
+
ge(q);
|
|
602
607
|
//#endregion
|
|
603
608
|
//#region src/components/AddAttachmentButton/AddAttachmentButton.tsx
|
|
604
|
-
var
|
|
605
|
-
let g = c(), [_, y] =
|
|
609
|
+
var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, menuCloseLabel: i, style: o, listClassName: u = "cp-dropdown-overlay !w-[240px]", isDisabled: d = !1, chatSettings: p, extraMenuItems: m }) => {
|
|
610
|
+
let g = c(), [_, y] = I(!1), [b, x] = I(!1), S = P(() => [
|
|
606
611
|
...e == null ? [] : [{
|
|
607
612
|
key: "attach",
|
|
608
613
|
label: t,
|
|
609
|
-
icon: /* @__PURE__ */
|
|
614
|
+
icon: /* @__PURE__ */ R(ce, {
|
|
610
615
|
size: l,
|
|
611
616
|
"aria-hidden": !0
|
|
612
617
|
}),
|
|
@@ -616,11 +621,11 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
616
621
|
...p == null ? [] : [{
|
|
617
622
|
key: "chat-settings",
|
|
618
623
|
label: p.menuItemLabel ?? "Chat settings",
|
|
619
|
-
icon: /* @__PURE__ */
|
|
624
|
+
icon: /* @__PURE__ */ R(fe, {
|
|
620
625
|
size: l,
|
|
621
626
|
"aria-hidden": !0
|
|
622
627
|
}),
|
|
623
|
-
iconAfter: g ? /* @__PURE__ */
|
|
628
|
+
iconAfter: g ? /* @__PURE__ */ R(ae, {
|
|
624
629
|
size: l,
|
|
625
630
|
stroke: 1.5,
|
|
626
631
|
className: "text-secondary rtl:scale-x-[-1]",
|
|
@@ -635,9 +640,9 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
635
640
|
m,
|
|
636
641
|
g
|
|
637
642
|
]);
|
|
638
|
-
return S.length === 0 ? null : /* @__PURE__ */
|
|
639
|
-
/* @__PURE__ */
|
|
640
|
-
icon: /* @__PURE__ */
|
|
643
|
+
return S.length === 0 ? null : /* @__PURE__ */ R(L, { children: g ? /* @__PURE__ */ z(L, { children: [
|
|
644
|
+
/* @__PURE__ */ R(v, {
|
|
645
|
+
icon: /* @__PURE__ */ R(de, {
|
|
641
646
|
size: f.LG,
|
|
642
647
|
"aria-hidden": !0
|
|
643
648
|
}),
|
|
@@ -646,7 +651,7 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
646
651
|
className: s("size-10 flex-shrink-0", d && "pointer-events-none opacity-50"),
|
|
647
652
|
onClick: () => y(!0)
|
|
648
653
|
}),
|
|
649
|
-
/* @__PURE__ */
|
|
654
|
+
/* @__PURE__ */ R(Be, {
|
|
650
655
|
isOpen: _,
|
|
651
656
|
title: r,
|
|
652
657
|
closeLabel: i,
|
|
@@ -656,7 +661,7 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
656
661
|
className: "pb-4",
|
|
657
662
|
btnTextClassName: "flex-1"
|
|
658
663
|
}),
|
|
659
|
-
p != null && /* @__PURE__ */
|
|
664
|
+
p != null && /* @__PURE__ */ R(K, {
|
|
660
665
|
isOpen: b,
|
|
661
666
|
onBack: () => {
|
|
662
667
|
x(!1), y(!0);
|
|
@@ -683,13 +688,13 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
683
688
|
saveLabel: p.saveLabel,
|
|
684
689
|
saveDisabledTooltip: p.saveDisabledTooltip
|
|
685
690
|
})
|
|
686
|
-
] }) : /* @__PURE__ */
|
|
691
|
+
] }) : /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R(h, {
|
|
687
692
|
matchReferenceWidth: !1,
|
|
688
693
|
placement: "bottom-start",
|
|
689
694
|
listClassName: u,
|
|
690
695
|
items: S,
|
|
691
|
-
children: /* @__PURE__ */
|
|
692
|
-
icon: /* @__PURE__ */
|
|
696
|
+
children: /* @__PURE__ */ R(v, {
|
|
697
|
+
icon: /* @__PURE__ */ R(de, {
|
|
693
698
|
size: f.LG,
|
|
694
699
|
"aria-hidden": !0
|
|
695
700
|
}),
|
|
@@ -698,7 +703,7 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
698
703
|
className: "size-10 flex-shrink-0",
|
|
699
704
|
disabled: d
|
|
700
705
|
})
|
|
701
|
-
}), p != null && b && /* @__PURE__ */
|
|
706
|
+
}), p != null && b && /* @__PURE__ */ R(q, {
|
|
702
707
|
features: p.features,
|
|
703
708
|
initialResponseFormat: p.responseFormat ?? a.Markdown,
|
|
704
709
|
initialSystemPrompt: p.systemPrompt,
|
|
@@ -718,7 +723,7 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
718
723
|
saveLabel: p.saveLabel,
|
|
719
724
|
saveDisabledTooltip: p.saveDisabledTooltip
|
|
720
725
|
})] }) });
|
|
721
|
-
},
|
|
726
|
+
}, J = {
|
|
722
727
|
container: "_container_8j81i_1",
|
|
723
728
|
containerError: "_containerError_8j81i_14",
|
|
724
729
|
waveformCanvas: "_waveformCanvas_8j81i_18",
|
|
@@ -726,29 +731,29 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
726
731
|
stopRecordingIcon: "_stopRecordingIcon_8j81i_28",
|
|
727
732
|
recordingDot: "_recordingDot_8j81i_42",
|
|
728
733
|
"recording-pulse": "_recording-pulse_8j81i_1"
|
|
729
|
-
},
|
|
730
|
-
let p =
|
|
734
|
+
}, Ke = 3, qe = 4, Y = 200, Je = (e) => `${String(Math.floor(e / 60)).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`, Ye = ({ state: e, analyserNodeRef: t, elapsedSeconds: n, errorMessage: r, onStop: i, onDiscard: a, stopLabel: o = "Stop recording", discardLabel: c = "Discard recording", timerLabel: l = "Recording time", style: u, className: d }) => {
|
|
735
|
+
let p = F(null), m = F(new Float32Array(Y)), h = F(0), g = F(0), y = e === Pe.Recording, b = e === Pe.Error, x = j((e) => {
|
|
731
736
|
let t = e.getContext("2d");
|
|
732
737
|
if (!t) return;
|
|
733
738
|
e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
|
|
734
739
|
let { width: n, height: r } = e;
|
|
735
740
|
t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
|
|
736
|
-
let i = Math.min(Math.max(1, Math.floor(n /
|
|
741
|
+
let i = Math.min(Math.max(1, Math.floor(n / qe)), Y - 1), a = h.current, o = g.current;
|
|
737
742
|
t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
|
|
738
743
|
for (let e = 0; e <= i; e++) {
|
|
739
|
-
let n = ((a - i + e) %
|
|
740
|
-
t.fillRect(e *
|
|
744
|
+
let n = ((a - i + e) % Y + Y) % Y, o = m.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
|
|
745
|
+
t.fillRect(e * qe, (r - c) / 2, Ke, c);
|
|
741
746
|
}
|
|
742
747
|
t.restore();
|
|
743
748
|
}, []);
|
|
744
|
-
|
|
749
|
+
M(() => {
|
|
745
750
|
if (!y) return;
|
|
746
751
|
let e = p.current;
|
|
747
752
|
if (!e) return;
|
|
748
753
|
m.current.fill(0), h.current = 0, g.current = 0;
|
|
749
754
|
let n, r = () => {
|
|
750
|
-
if (g.current += 1, g.current >=
|
|
751
|
-
g.current -=
|
|
755
|
+
if (g.current += 1, g.current >= qe) {
|
|
756
|
+
g.current -= qe;
|
|
752
757
|
let e = t.current;
|
|
753
758
|
if (e) {
|
|
754
759
|
let t = new Uint8Array(e.frequencyBinCount);
|
|
@@ -758,7 +763,7 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
758
763
|
let r = (t[e] - 128) / 128;
|
|
759
764
|
n += r * r;
|
|
760
765
|
}
|
|
761
|
-
m.current[h.current %
|
|
766
|
+
m.current[h.current % Y] = Math.sqrt(n / t.length), h.current++;
|
|
762
767
|
}
|
|
763
768
|
}
|
|
764
769
|
x(e), n = requestAnimationFrame(r);
|
|
@@ -770,7 +775,7 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
770
775
|
y,
|
|
771
776
|
t,
|
|
772
777
|
x
|
|
773
|
-
]),
|
|
778
|
+
]), M(() => {
|
|
774
779
|
let e = p.current;
|
|
775
780
|
if (!e) return;
|
|
776
781
|
let t = new ResizeObserver(() => {
|
|
@@ -778,20 +783,20 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
778
783
|
});
|
|
779
784
|
return t.observe(e), () => t.disconnect();
|
|
780
785
|
}, [x]);
|
|
781
|
-
let S = /* @__PURE__ */
|
|
786
|
+
let S = /* @__PURE__ */ z("div", {
|
|
782
787
|
className: "flex flex-shrink-0 items-center justify-end gap-1",
|
|
783
|
-
children: [/* @__PURE__ */
|
|
784
|
-
icon: /* @__PURE__ */
|
|
788
|
+
children: [/* @__PURE__ */ R(v, {
|
|
789
|
+
icon: /* @__PURE__ */ R(pe, {
|
|
785
790
|
size: f.LG,
|
|
786
791
|
"aria-hidden": !0
|
|
787
792
|
}),
|
|
788
793
|
"aria-label": c,
|
|
789
794
|
className: "size-10 flex-shrink-0",
|
|
790
795
|
onClick: a
|
|
791
|
-
}), y && /* @__PURE__ */
|
|
792
|
-
icon: /* @__PURE__ */
|
|
796
|
+
}), y && /* @__PURE__ */ R(v, {
|
|
797
|
+
icon: /* @__PURE__ */ R(le, {
|
|
793
798
|
size: f.LG,
|
|
794
|
-
className:
|
|
799
|
+
className: J.stopRecordingIcon,
|
|
795
800
|
"aria-hidden": !0
|
|
796
801
|
}),
|
|
797
802
|
"aria-label": o,
|
|
@@ -799,32 +804,32 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
799
804
|
onClick: i
|
|
800
805
|
})]
|
|
801
806
|
});
|
|
802
|
-
return /* @__PURE__ */
|
|
807
|
+
return /* @__PURE__ */ z("div", {
|
|
803
808
|
className: d,
|
|
804
|
-
children: [/* @__PURE__ */
|
|
809
|
+
children: [/* @__PURE__ */ z("div", {
|
|
805
810
|
style: u,
|
|
806
|
-
className: s(
|
|
807
|
-
children: [/* @__PURE__ */
|
|
811
|
+
className: s(J.container, "flex min-h-[56px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border px-3 desktop:flex-row desktop:items-center desktop:gap-2 desktop:py-2", b && J.containerError),
|
|
812
|
+
children: [/* @__PURE__ */ z("div", {
|
|
808
813
|
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
809
|
-
children: [y && /* @__PURE__ */
|
|
810
|
-
className:
|
|
814
|
+
children: [y && /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("span", {
|
|
815
|
+
className: J.recordingDot,
|
|
811
816
|
"aria-hidden": !0
|
|
812
|
-
}), /* @__PURE__ */
|
|
813
|
-
className: s(
|
|
817
|
+
}), /* @__PURE__ */ R("span", {
|
|
818
|
+
className: s(J.timer, "flex-shrink-0"),
|
|
814
819
|
"aria-label": l,
|
|
815
|
-
children:
|
|
816
|
-
})] }), /* @__PURE__ */
|
|
820
|
+
children: Je(n)
|
|
821
|
+
})] }), /* @__PURE__ */ R("canvas", {
|
|
817
822
|
ref: p,
|
|
818
823
|
height: 32,
|
|
819
|
-
className: s(
|
|
824
|
+
className: s(J.waveformCanvas, "h-8 min-w-0 flex-1 desktop:h-6")
|
|
820
825
|
})]
|
|
821
826
|
}), S]
|
|
822
|
-
}), b && r && /* @__PURE__ */
|
|
827
|
+
}), b && r && /* @__PURE__ */ R(_, {
|
|
823
828
|
text: r,
|
|
824
829
|
className: "mt-1 px-1"
|
|
825
830
|
})]
|
|
826
831
|
});
|
|
827
|
-
},
|
|
832
|
+
}, X = {
|
|
828
833
|
wrapper: "_wrapper_1q2nu_2",
|
|
829
834
|
wrapperDisabled: "_wrapperDisabled_1q2nu_15",
|
|
830
835
|
textarea: "_textarea_1q2nu_20",
|
|
@@ -836,73 +841,73 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
836
841
|
sendButtonEnter: "_sendButtonEnter_1q2nu_1",
|
|
837
842
|
sendButtonExiting: "_sendButtonExiting_1q2nu_55",
|
|
838
843
|
sendButtonExit: "_sendButtonExit_1q2nu_55"
|
|
839
|
-
},
|
|
844
|
+
}, Xe = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", title: r, isExiting: i = !1 }) => /* @__PURE__ */ R(O, {
|
|
840
845
|
tooltip: r,
|
|
841
846
|
hideTooltip: !r,
|
|
842
|
-
children: /* @__PURE__ */
|
|
843
|
-
className: s("flex size-[32px] cursor-pointer items-center justify-center rounded-full disabled:cursor-not-allowed",
|
|
847
|
+
children: /* @__PURE__ */ R("button", {
|
|
848
|
+
className: s("flex size-[32px] cursor-pointer items-center justify-center rounded-full disabled:cursor-not-allowed", X.sendButton, i && X.sendButtonExiting),
|
|
844
849
|
"aria-label": n,
|
|
845
850
|
onClick: () => e?.(),
|
|
846
851
|
type: "button",
|
|
847
852
|
disabled: t,
|
|
848
853
|
"aria-hidden": i,
|
|
849
|
-
children: /* @__PURE__ */
|
|
854
|
+
children: /* @__PURE__ */ R(ne, {
|
|
850
855
|
size: f.LG,
|
|
851
856
|
className: "rtl:scale-x-[-1]"
|
|
852
857
|
})
|
|
853
858
|
})
|
|
854
|
-
}),
|
|
859
|
+
}), Ze = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ R("button", {
|
|
855
860
|
className: s("flex cursor-pointer items-center justify-center disabled:cursor-not-allowed"),
|
|
856
861
|
"aria-label": t,
|
|
857
862
|
onClick: () => e?.(),
|
|
858
863
|
type: "button",
|
|
859
|
-
children: /* @__PURE__ */
|
|
864
|
+
children: /* @__PURE__ */ R(ue, {
|
|
860
865
|
size: f.LG,
|
|
861
|
-
className:
|
|
866
|
+
className: X.stopIcon
|
|
862
867
|
})
|
|
863
|
-
}),
|
|
868
|
+
}), Qe = ({ size: e = 20 }) => /* @__PURE__ */ R(w, {
|
|
864
869
|
variant: T.Circular,
|
|
865
870
|
width: e,
|
|
866
871
|
height: e,
|
|
867
872
|
active: !0
|
|
868
|
-
}),
|
|
873
|
+
}), $e = ({ loadingLabel: e }) => /* @__PURE__ */ z("span", {
|
|
869
874
|
className: "flex min-w-0 flex-1 items-center",
|
|
870
|
-
children: [/* @__PURE__ */
|
|
875
|
+
children: [/* @__PURE__ */ R(w, {
|
|
871
876
|
variant: T.Text,
|
|
872
877
|
width: "100%",
|
|
873
878
|
height: 16,
|
|
874
879
|
active: !0
|
|
875
|
-
}), e && /* @__PURE__ */
|
|
880
|
+
}), e && /* @__PURE__ */ R("span", {
|
|
876
881
|
className: "sr-only",
|
|
877
882
|
children: e
|
|
878
883
|
})]
|
|
879
|
-
}),
|
|
884
|
+
}), et = ({ loadingLabel: e }) => /* @__PURE__ */ R("div", {
|
|
880
885
|
role: "status",
|
|
881
886
|
"aria-label": e,
|
|
882
|
-
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */
|
|
887
|
+
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ z("div", {
|
|
883
888
|
className: "flex h-11 items-center gap-3 px-4",
|
|
884
889
|
"aria-hidden": "true",
|
|
885
|
-
children: [/* @__PURE__ */
|
|
890
|
+
children: [/* @__PURE__ */ R(Qe, {}), /* @__PURE__ */ R($e, {})]
|
|
886
891
|
}, t))
|
|
887
|
-
}),
|
|
892
|
+
}), tt = (e) => e.displayName ?? e.id, nt = (e, t) => {
|
|
888
893
|
let n = t.trim().toLowerCase();
|
|
889
|
-
return n ? e.filter((e) =>
|
|
890
|
-
},
|
|
894
|
+
return n ? e.filter((e) => tt(e).toLowerCase().includes(n)) : e;
|
|
895
|
+
}, rt = (e, t, r, i = 18, a) => /* @__PURE__ */ R(n, {
|
|
891
896
|
src: e,
|
|
892
897
|
size: i,
|
|
893
898
|
labels: { tooltip: a },
|
|
894
899
|
initialsName: r
|
|
895
|
-
}),
|
|
896
|
-
let [o, c] =
|
|
900
|
+
}), it = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: i, searchHeaderClassName: a = "bg-layer-0" }) => {
|
|
901
|
+
let [o, c] = I(""), l = P(() => e?.find((e) => e.id === t), [e, t]), u = i?.loading !== void 0, d = P(() => u ? /* @__PURE__ */ R(Qe, { size: f.LG }) : rt(l?.iconUrl, l?.type, l?.displayName ?? l?.id ?? "", f.LG), [u, l]), p = l?.displayName ?? l?.id;
|
|
897
902
|
return {
|
|
898
903
|
selectorIcon: d,
|
|
899
904
|
selectorAriaLabel: p ? `${i?.ariaLabel ?? "Select model"}: ${p}` : i?.ariaLabel ?? "Select model",
|
|
900
905
|
selectedLabel: p,
|
|
901
|
-
menuItems:
|
|
906
|
+
menuItems: P(() => {
|
|
902
907
|
if (u) return Array.from({ length: 7 }, (e, t) => ({
|
|
903
908
|
key: `__loading-${t}`,
|
|
904
|
-
icon: /* @__PURE__ */
|
|
905
|
-
label: /* @__PURE__ */
|
|
909
|
+
icon: /* @__PURE__ */ R(Qe, {}),
|
|
910
|
+
label: /* @__PURE__ */ R($e, { loadingLabel: t === 0 ? i?.loading : void 0 }),
|
|
906
911
|
disabled: !0
|
|
907
912
|
}));
|
|
908
913
|
if (!e || e.length === 0) {
|
|
@@ -913,19 +918,19 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
913
918
|
disabled: !0
|
|
914
919
|
}] : [];
|
|
915
920
|
}
|
|
916
|
-
return
|
|
921
|
+
return nt(e, o).map((e) => {
|
|
917
922
|
let i = e.id === t;
|
|
918
923
|
return {
|
|
919
924
|
key: e.id,
|
|
920
|
-
label: /* @__PURE__ */
|
|
925
|
+
label: /* @__PURE__ */ z("span", {
|
|
921
926
|
className: "flex w-full items-center justify-between gap-2",
|
|
922
|
-
children: [/* @__PURE__ */
|
|
923
|
-
text:
|
|
927
|
+
children: [/* @__PURE__ */ R(r, {
|
|
928
|
+
text: tt(e),
|
|
924
929
|
query: o,
|
|
925
930
|
maxLines: 1
|
|
926
|
-
}), i && /* @__PURE__ */
|
|
931
|
+
}), i && /* @__PURE__ */ R(Ve, { gradientId: "ms-check-grad" })]
|
|
927
932
|
}),
|
|
928
|
-
icon:
|
|
933
|
+
icon: rt(e.iconUrl, e.type, e.displayName ?? e.id),
|
|
929
934
|
onClick: () => n?.(e.id),
|
|
930
935
|
className: i ? "bg-accent-primary-alpha" : void 0
|
|
931
936
|
};
|
|
@@ -938,9 +943,9 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
938
943
|
i,
|
|
939
944
|
n
|
|
940
945
|
]),
|
|
941
|
-
menuHeader:
|
|
946
|
+
menuHeader: P(() => !u && e && e.length > 0 ? /* @__PURE__ */ R("div", {
|
|
942
947
|
className: s("sticky top-0 z-10 pb-1 pe-2 pt-2", a),
|
|
943
|
-
children: /* @__PURE__ */
|
|
948
|
+
children: /* @__PURE__ */ R(C, {
|
|
944
949
|
value: o,
|
|
945
950
|
placeholder: i?.searchPlaceholder ?? "Search",
|
|
946
951
|
size: k.Small,
|
|
@@ -958,7 +963,7 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
958
963
|
e || c("");
|
|
959
964
|
}
|
|
960
965
|
};
|
|
961
|
-
},
|
|
966
|
+
}, at = typeof window < "u" ? _e : M;
|
|
962
967
|
function ot(e) {
|
|
963
968
|
if (e !== void 0) switch (typeof e) {
|
|
964
969
|
case "number": return e;
|
|
@@ -968,14 +973,14 @@ function ot(e) {
|
|
|
968
973
|
}
|
|
969
974
|
}
|
|
970
975
|
function st({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
|
|
971
|
-
let { styleHeight: s, styleWidth: c } =
|
|
976
|
+
let { styleHeight: s, styleWidth: c } = P(() => ({
|
|
972
977
|
styleHeight: ot(o?.height),
|
|
973
978
|
styleWidth: ot(o?.width)
|
|
974
|
-
}), [o?.height, o?.width]), [l, u] =
|
|
979
|
+
}), [o?.height, o?.width]), [l, u] = I({
|
|
975
980
|
height: t,
|
|
976
981
|
width: n
|
|
977
982
|
}), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
|
|
978
|
-
return
|
|
983
|
+
return at(() => {
|
|
979
984
|
if (i === null || d) return;
|
|
980
985
|
let t = new ResizeObserver((e) => {
|
|
981
986
|
for (let t of e) {
|
|
@@ -995,7 +1000,7 @@ function st({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
995
1000
|
i,
|
|
996
1001
|
s,
|
|
997
1002
|
c
|
|
998
|
-
]),
|
|
1003
|
+
]), P(() => ({
|
|
999
1004
|
height: s ?? l.height,
|
|
1000
1005
|
width: c ?? l.width
|
|
1001
1006
|
}), [
|
|
@@ -1005,12 +1010,12 @@ function st({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1005
1010
|
]);
|
|
1006
1011
|
}
|
|
1007
1012
|
function ct(e) {
|
|
1008
|
-
let t =
|
|
1013
|
+
let t = F(() => {
|
|
1009
1014
|
throw Error("Cannot call during render.");
|
|
1010
1015
|
});
|
|
1011
|
-
return
|
|
1016
|
+
return at(() => {
|
|
1012
1017
|
t.current = e;
|
|
1013
|
-
}, [e]),
|
|
1018
|
+
}, [e]), j((e) => t.current?.(e), [t]);
|
|
1014
1019
|
}
|
|
1015
1020
|
var Z = null;
|
|
1016
1021
|
function lt(e = !1) {
|
|
@@ -1037,13 +1042,13 @@ function ut({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
|
1037
1042
|
function Q(e, t = "Assertion error") {
|
|
1038
1043
|
if (!e) throw console.error(t), Error(t);
|
|
1039
1044
|
}
|
|
1040
|
-
function
|
|
1045
|
+
function dt(e, t) {
|
|
1041
1046
|
if (e === t) return !0;
|
|
1042
1047
|
if (!!e != !!t || (Q(e !== void 0), Q(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
|
|
1043
1048
|
for (let n in e) if (!Object.is(t[n], e[n])) return !1;
|
|
1044
1049
|
return !0;
|
|
1045
1050
|
}
|
|
1046
|
-
function
|
|
1051
|
+
function $({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
1047
1052
|
if (t === 0) return 0;
|
|
1048
1053
|
if (typeof n == "number") return t * n;
|
|
1049
1054
|
{
|
|
@@ -1053,7 +1058,7 @@ function dt({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
|
1053
1058
|
}
|
|
1054
1059
|
function ft({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
|
|
1055
1060
|
if (n < 0 || n >= r) throw RangeError(`Invalid index specified: ${n}`, { cause: `Index ${n} is not within the range of 0 - ${r - 1}` });
|
|
1056
|
-
let s =
|
|
1061
|
+
let s = $({
|
|
1057
1062
|
cachedBounds: t,
|
|
1058
1063
|
itemCount: r,
|
|
1059
1064
|
itemSize: i
|
|
@@ -1122,7 +1127,7 @@ function mt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1122
1127
|
};
|
|
1123
1128
|
}
|
|
1124
1129
|
function ht({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1125
|
-
return
|
|
1130
|
+
return P(() => mt({
|
|
1126
1131
|
itemCount: e,
|
|
1127
1132
|
itemProps: t,
|
|
1128
1133
|
itemSize: n
|
|
@@ -1151,14 +1156,14 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1151
1156
|
element: e,
|
|
1152
1157
|
mode: r === "vertical" ? "only-height" : "only-width",
|
|
1153
1158
|
style: t
|
|
1154
|
-
}), f =
|
|
1159
|
+
}), f = F({
|
|
1155
1160
|
height: 0,
|
|
1156
1161
|
width: 0
|
|
1157
1162
|
}), p = r === "vertical" ? u : d, m = gt({
|
|
1158
1163
|
containerSize: p,
|
|
1159
1164
|
itemSize: s
|
|
1160
1165
|
});
|
|
1161
|
-
|
|
1166
|
+
_e(() => {
|
|
1162
1167
|
if (typeof c == "function") {
|
|
1163
1168
|
let e = f.current;
|
|
1164
1169
|
(e.height !== u || e.width !== d) && (c({
|
|
@@ -1175,7 +1180,7 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1175
1180
|
itemCount: a,
|
|
1176
1181
|
itemProps: o,
|
|
1177
1182
|
itemSize: m
|
|
1178
|
-
}), g =
|
|
1183
|
+
}), g = j((e) => h.get(e), [h]), [_, v] = I(() => pt({
|
|
1179
1184
|
cachedBounds: h,
|
|
1180
1185
|
containerScrollOffset: 0,
|
|
1181
1186
|
containerSize: p,
|
|
@@ -1186,7 +1191,7 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1186
1191
|
startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
|
|
1187
1192
|
stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
|
|
1188
1193
|
stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
|
|
1189
|
-
}, C =
|
|
1194
|
+
}, C = j(() => $({
|
|
1190
1195
|
cachedBounds: h,
|
|
1191
1196
|
itemCount: a,
|
|
1192
1197
|
itemSize: m
|
|
@@ -1194,7 +1199,7 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1194
1199
|
h,
|
|
1195
1200
|
a,
|
|
1196
1201
|
m
|
|
1197
|
-
]), w =
|
|
1202
|
+
]), w = j((t) => pt({
|
|
1198
1203
|
cachedBounds: h,
|
|
1199
1204
|
containerScrollOffset: ut({
|
|
1200
1205
|
containerElement: e,
|
|
@@ -1214,13 +1219,13 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1214
1219
|
a,
|
|
1215
1220
|
l
|
|
1216
1221
|
]);
|
|
1217
|
-
return
|
|
1222
|
+
return at(() => {
|
|
1218
1223
|
v(w((r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0));
|
|
1219
1224
|
}, [
|
|
1220
1225
|
e,
|
|
1221
1226
|
r,
|
|
1222
1227
|
w
|
|
1223
|
-
]),
|
|
1228
|
+
]), at(() => {
|
|
1224
1229
|
if (!e) return;
|
|
1225
1230
|
let t = () => {
|
|
1226
1231
|
v((t) => {
|
|
@@ -1236,7 +1241,7 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1236
1241
|
itemCount: a,
|
|
1237
1242
|
overscanCount: l
|
|
1238
1243
|
});
|
|
1239
|
-
return
|
|
1244
|
+
return dt(s, t) ? t : s;
|
|
1240
1245
|
});
|
|
1241
1246
|
};
|
|
1242
1247
|
return e.addEventListener("scroll", t), () => {
|
|
@@ -1270,7 +1275,7 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1270
1275
|
scrollOffset: s
|
|
1271
1276
|
}), typeof e.scrollTo != "function") {
|
|
1272
1277
|
let e = w(s);
|
|
1273
|
-
|
|
1278
|
+
dt(_, e) || v(e);
|
|
1274
1279
|
}
|
|
1275
1280
|
return s;
|
|
1276
1281
|
}
|
|
@@ -1282,29 +1287,29 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1282
1287
|
};
|
|
1283
1288
|
}
|
|
1284
1289
|
function vt(e) {
|
|
1285
|
-
return
|
|
1290
|
+
return P(() => e, Object.values(e));
|
|
1286
1291
|
}
|
|
1287
1292
|
function yt(e, t) {
|
|
1288
1293
|
let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
|
|
1289
|
-
return
|
|
1294
|
+
return dt(n, a) && dt(r, o) && dt(i, s);
|
|
1290
1295
|
}
|
|
1291
1296
|
function bt(e) {
|
|
1292
1297
|
return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
|
|
1293
1298
|
}
|
|
1294
1299
|
var xt = "data-react-window-index";
|
|
1295
1300
|
function St({ 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 }) {
|
|
1296
|
-
let m = vt(u), h =
|
|
1301
|
+
let m = vt(u), h = P(() => ge(s, yt), [s]), [g, _] = I(null), v = bt(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = _t({
|
|
1297
1302
|
containerElement: g,
|
|
1298
1303
|
containerStyle: f,
|
|
1299
1304
|
defaultContainerSize: n,
|
|
1300
1305
|
direction: "vertical",
|
|
1301
1306
|
itemCount: c,
|
|
1302
1307
|
itemProps: m,
|
|
1303
|
-
itemSize:
|
|
1308
|
+
itemSize: P(() => v ? (e) => l.getRowHeight(e) ?? l.getAverageRowHeight() : l, [v, l]),
|
|
1304
1309
|
onResize: i,
|
|
1305
1310
|
overscanCount: o
|
|
1306
1311
|
});
|
|
1307
|
-
|
|
1312
|
+
N(r, () => ({
|
|
1308
1313
|
get element() {
|
|
1309
1314
|
return g;
|
|
1310
1315
|
},
|
|
@@ -1319,7 +1324,7 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1319
1324
|
top: r
|
|
1320
1325
|
});
|
|
1321
1326
|
}
|
|
1322
|
-
}), [g, x]),
|
|
1327
|
+
}), [g, x]), at(() => {
|
|
1323
1328
|
if (!g) return;
|
|
1324
1329
|
let e = Array.from(g.children).filter((e, t) => {
|
|
1325
1330
|
if (e.hasAttribute("aria-hidden")) return !1;
|
|
@@ -1333,7 +1338,7 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1333
1338
|
l,
|
|
1334
1339
|
S,
|
|
1335
1340
|
w
|
|
1336
|
-
]),
|
|
1341
|
+
]), M(() => {
|
|
1337
1342
|
S >= 0 && w >= 0 && a && a({
|
|
1338
1343
|
startIndex: C,
|
|
1339
1344
|
stopIndex: T
|
|
@@ -1348,11 +1353,11 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1348
1353
|
w,
|
|
1349
1354
|
T
|
|
1350
1355
|
]);
|
|
1351
|
-
let E =
|
|
1356
|
+
let E = P(() => {
|
|
1352
1357
|
let e = [];
|
|
1353
1358
|
if (c > 0) for (let t = S; t <= w; t++) {
|
|
1354
1359
|
let n = y(t);
|
|
1355
|
-
e.push(/* @__PURE__ */
|
|
1360
|
+
e.push(/* @__PURE__ */ he(h, {
|
|
1356
1361
|
...m,
|
|
1357
1362
|
ariaAttributes: {
|
|
1358
1363
|
"aria-posinset": t + 1,
|
|
@@ -1379,7 +1384,7 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1379
1384
|
m,
|
|
1380
1385
|
S,
|
|
1381
1386
|
w
|
|
1382
|
-
]), D = /* @__PURE__ */
|
|
1387
|
+
]), D = /* @__PURE__ */ R("div", {
|
|
1383
1388
|
"aria-hidden": !0,
|
|
1384
1389
|
style: {
|
|
1385
1390
|
height: b(),
|
|
@@ -1387,7 +1392,7 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1387
1392
|
zIndex: -1
|
|
1388
1393
|
}
|
|
1389
1394
|
});
|
|
1390
|
-
return
|
|
1395
|
+
return he(d, {
|
|
1391
1396
|
role: "list",
|
|
1392
1397
|
...p,
|
|
1393
1398
|
className: t,
|
|
@@ -1408,25 +1413,25 @@ var Ct = {
|
|
|
1408
1413
|
checkIcon: "_checkIcon_3wv6u_19",
|
|
1409
1414
|
stateLabel: "_stateLabel_3wv6u_23"
|
|
1410
1415
|
}, wt = 44, Tt = 8, Et = ({ index: e, style: t, ariaAttributes: n, items: i, selectedDeploymentId: a, labelClassName: o, query: c, onSelect: l }) => {
|
|
1411
|
-
let u = i[e], d =
|
|
1412
|
-
return /* @__PURE__ */
|
|
1416
|
+
let u = i[e], d = rt(u.iconUrl, u.type, u.displayName ?? u.id, f.SM), m = u.id === a;
|
|
1417
|
+
return /* @__PURE__ */ R("div", {
|
|
1413
1418
|
style: t,
|
|
1414
1419
|
...n,
|
|
1415
|
-
children: /* @__PURE__ */
|
|
1420
|
+
children: /* @__PURE__ */ R(p, {
|
|
1416
1421
|
type: "button",
|
|
1417
1422
|
className: s(Ct.item, "flex h-full w-full items-center gap-3 px-4"),
|
|
1418
|
-
iconBefore: /* @__PURE__ */
|
|
1423
|
+
iconBefore: /* @__PURE__ */ R("span", {
|
|
1419
1424
|
className: Ct.itemIcon,
|
|
1420
1425
|
children: d
|
|
1421
1426
|
}),
|
|
1422
|
-
label: /* @__PURE__ */
|
|
1427
|
+
label: /* @__PURE__ */ z("span", {
|
|
1423
1428
|
className: "flex flex-1 items-center justify-between gap-2",
|
|
1424
|
-
children: [/* @__PURE__ */
|
|
1429
|
+
children: [/* @__PURE__ */ R(r, {
|
|
1425
1430
|
text: u.displayName ?? u.id,
|
|
1426
1431
|
query: c,
|
|
1427
1432
|
maxLines: 1,
|
|
1428
1433
|
className: s(o, "min-w-0 flex-1 text-start")
|
|
1429
|
-
}), m && /* @__PURE__ */
|
|
1434
|
+
}), m && /* @__PURE__ */ R(re, {
|
|
1430
1435
|
size: f.SM,
|
|
1431
1436
|
className: Ct.checkIcon,
|
|
1432
1437
|
"aria-hidden": !0
|
|
@@ -1436,12 +1441,12 @@ var Ct = {
|
|
|
1436
1441
|
})
|
|
1437
1442
|
});
|
|
1438
1443
|
}, Dt = ({ isOpen: e, title: t, closeLabel: n, searchPlaceholder: r = "Search", onClose: i, deployments: a, selectedDeploymentId: o, onSelect: c, loadingLabel: l, errorLabel: u, emptyLabel: d, style: f, titleClassName: p = "dial-body-semi-text", labelClassName: m = "dial-small-text" }) => {
|
|
1439
|
-
let [h, g] =
|
|
1440
|
-
|
|
1444
|
+
let [h, g] = I("");
|
|
1445
|
+
M(() => {
|
|
1441
1446
|
e || g("");
|
|
1442
1447
|
}, [e]);
|
|
1443
|
-
let _ = a && a.length > 0, v = l !== void 0, y = !_ && !v ? u ?? d : void 0, b = _ ?
|
|
1444
|
-
return /* @__PURE__ */
|
|
1448
|
+
let _ = a && a.length > 0, v = l !== void 0, y = !_ && !v ? u ?? d : void 0, b = _ ? nt(a, h) : [];
|
|
1449
|
+
return /* @__PURE__ */ z(H, {
|
|
1445
1450
|
isOpen: e,
|
|
1446
1451
|
title: t,
|
|
1447
1452
|
closeLabel: n,
|
|
@@ -1449,19 +1454,19 @@ var Ct = {
|
|
|
1449
1454
|
style: f,
|
|
1450
1455
|
titleClassName: p,
|
|
1451
1456
|
className: "max-h-[80dvh]",
|
|
1452
|
-
children: [_ && !v && /* @__PURE__ */
|
|
1457
|
+
children: [_ && !v && /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("div", {
|
|
1453
1458
|
className: "flex-shrink-0 px-4 py-[10px]",
|
|
1454
|
-
children: /* @__PURE__ */
|
|
1459
|
+
children: /* @__PURE__ */ R(C, {
|
|
1455
1460
|
value: h,
|
|
1456
1461
|
placeholder: r,
|
|
1457
1462
|
size: k.Standard,
|
|
1458
1463
|
onChange: g
|
|
1459
1464
|
})
|
|
1460
|
-
}), /* @__PURE__ */
|
|
1465
|
+
}), /* @__PURE__ */ R("div", { className: s(Ct.divider, "h-px flex-shrink-0") })] }), v ? /* @__PURE__ */ R(et, { loadingLabel: l }) : y ? /* @__PURE__ */ R("div", {
|
|
1461
1466
|
role: "list",
|
|
1462
1467
|
className: s(Ct.stateLabel, m, "px-4 py-4"),
|
|
1463
1468
|
children: y
|
|
1464
|
-
}) : /* @__PURE__ */
|
|
1469
|
+
}) : /* @__PURE__ */ R(St, {
|
|
1465
1470
|
role: "list",
|
|
1466
1471
|
className: "overflow-y-auto",
|
|
1467
1472
|
style: { height: Math.min(b.length, Tt) * wt },
|
|
@@ -1480,22 +1485,22 @@ var Ct = {
|
|
|
1480
1485
|
})]
|
|
1481
1486
|
});
|
|
1482
1487
|
}, Ot = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, isStreaming: i, isMobile: a, isInputDisabled: o = !1, isDisabled: c = !1, style: l, modelPickerOverlay: u, isPickerOpen: d, onPickerToggle: p, onPickerOpenChange: m }) => {
|
|
1483
|
-
let [_, y] =
|
|
1488
|
+
let [_, y] = I(!1), { selectorIcon: b, selectorAriaLabel: x, selectedLabel: S, menuItems: C, menuHeader: w, onOpenChange: T } = it({
|
|
1484
1489
|
deployments: e,
|
|
1485
1490
|
selectedDeploymentId: t,
|
|
1486
1491
|
onDeploymentChange: n,
|
|
1487
1492
|
modelSelectorLabels: r
|
|
1488
1493
|
});
|
|
1489
1494
|
if (!e) return null;
|
|
1490
|
-
let E = i || c ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, D = /* @__PURE__ */
|
|
1495
|
+
let E = i || c ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, D = /* @__PURE__ */ R(ie, {
|
|
1491
1496
|
size: f.SM,
|
|
1492
|
-
className:
|
|
1497
|
+
className: X.modelSelectorCaret,
|
|
1493
1498
|
"aria-hidden": !0
|
|
1494
1499
|
});
|
|
1495
|
-
return a ? /* @__PURE__ */
|
|
1500
|
+
return a ? /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R(O, {
|
|
1496
1501
|
tooltip: S,
|
|
1497
|
-
children: /* @__PURE__ */
|
|
1498
|
-
icon: /* @__PURE__ */
|
|
1502
|
+
children: /* @__PURE__ */ R(v, {
|
|
1503
|
+
icon: /* @__PURE__ */ z("div", {
|
|
1499
1504
|
className: "flex items-center gap-1",
|
|
1500
1505
|
children: [b, D]
|
|
1501
1506
|
}),
|
|
@@ -1503,16 +1508,16 @@ var Ct = {
|
|
|
1503
1508
|
onClick: () => {
|
|
1504
1509
|
c || y(!0);
|
|
1505
1510
|
},
|
|
1506
|
-
className: s(
|
|
1511
|
+
className: s(X.modelSelectorButton, E)
|
|
1507
1512
|
})
|
|
1508
|
-
}), u ? /* @__PURE__ */
|
|
1513
|
+
}), u ? /* @__PURE__ */ R(H, {
|
|
1509
1514
|
isOpen: _,
|
|
1510
1515
|
title: r?.ariaLabel ?? "Select model",
|
|
1511
1516
|
closeLabel: r?.closeLabel ?? "Close",
|
|
1512
1517
|
onClose: () => y(!1),
|
|
1513
1518
|
style: l,
|
|
1514
1519
|
children: u(() => y(!1))
|
|
1515
|
-
}) : /* @__PURE__ */
|
|
1520
|
+
}) : /* @__PURE__ */ R(Dt, {
|
|
1516
1521
|
isOpen: _,
|
|
1517
1522
|
title: r?.ariaLabel ?? "Select model",
|
|
1518
1523
|
closeLabel: r?.closeLabel ?? "Close",
|
|
@@ -1525,7 +1530,7 @@ var Ct = {
|
|
|
1525
1530
|
errorLabel: r?.error,
|
|
1526
1531
|
emptyLabel: r?.empty,
|
|
1527
1532
|
style: l
|
|
1528
|
-
})] }) : u ? /* @__PURE__ */
|
|
1533
|
+
})] }) : u ? /* @__PURE__ */ R(h, {
|
|
1529
1534
|
placement: "top-end",
|
|
1530
1535
|
matchReferenceWidth: !1,
|
|
1531
1536
|
open: d,
|
|
@@ -1534,24 +1539,24 @@ var Ct = {
|
|
|
1534
1539
|
outsideClosable: !0,
|
|
1535
1540
|
renderOverlay: () => u(() => m?.(!1)),
|
|
1536
1541
|
listClassName: "cp-dropdown-overlay !w-[320px]",
|
|
1537
|
-
children: /* @__PURE__ */
|
|
1542
|
+
children: /* @__PURE__ */ R(O, {
|
|
1538
1543
|
tooltip: S,
|
|
1539
|
-
children: /* @__PURE__ */
|
|
1544
|
+
children: /* @__PURE__ */ z("button", {
|
|
1540
1545
|
type: "button",
|
|
1541
1546
|
"aria-label": x,
|
|
1542
|
-
className: s("flex items-center justify-center gap-1 rounded-md p-2",
|
|
1547
|
+
className: s("flex items-center justify-center gap-1 rounded-md p-2", X.modelSelectorButton, o || i || c ? E : void 0, (o || c) && X.modelSelectorButtonDisabled),
|
|
1543
1548
|
onClick: () => {
|
|
1544
1549
|
!o && !i && !c && p?.();
|
|
1545
1550
|
},
|
|
1546
1551
|
children: [b, D]
|
|
1547
1552
|
})
|
|
1548
1553
|
})
|
|
1549
|
-
}) : /* @__PURE__ */
|
|
1554
|
+
}) : /* @__PURE__ */ R("div", {
|
|
1550
1555
|
className: s(c && E),
|
|
1551
1556
|
"aria-disabled": c || void 0,
|
|
1552
|
-
children: /* @__PURE__ */
|
|
1557
|
+
children: /* @__PURE__ */ R(O, {
|
|
1553
1558
|
tooltip: S,
|
|
1554
|
-
children: /* @__PURE__ */
|
|
1559
|
+
children: /* @__PURE__ */ R(g, {
|
|
1555
1560
|
icon: b,
|
|
1556
1561
|
ariaLabel: x,
|
|
1557
1562
|
items: C,
|
|
@@ -1563,12 +1568,12 @@ var Ct = {
|
|
|
1563
1568
|
size: k.Standard,
|
|
1564
1569
|
caretIcon: D,
|
|
1565
1570
|
iconClassName: o || c ? E : void 0,
|
|
1566
|
-
buttonClassName: s("bg-transparent",
|
|
1571
|
+
buttonClassName: s("bg-transparent", X.modelSelectorButton, (o || c) && E && X.modelSelectorButtonDisabled)
|
|
1567
1572
|
})
|
|
1568
1573
|
})
|
|
1569
1574
|
});
|
|
1570
|
-
}, kt = 160, At = ({ message: e = "", messageRevision: t, onSend: n, onUploadAttachment: r, onStop: i, isStreaming: a = !1, onChange: u, onAttachmentsChange: d, placeholder: p = "Type a message...", ariaLabel: m, attachLabel: h = "Attach file", fileAccept: g, addMenuTitle: _ = "Add", menuTitle: y = "Menu", menuCloseLabel: b = "Close", removeLabel: x, retryLabel: S, sendLabel: C, stopLabel: w, micLabel: T = "Record voice message", stopRecordingLabel: E, discardRecordingLabel: D, timerAriaLabel: O, colors: k, typography:
|
|
1571
|
-
let
|
|
1575
|
+
}, kt = 160, At = ({ message: e = "", messageRevision: t, onSend: n, onUploadAttachment: r, onStop: i, isStreaming: a = !1, onChange: u, onAttachmentsChange: d, placeholder: p = "Type a message...", ariaLabel: m, attachLabel: h = "Attach file", fileAccept: g, addMenuTitle: _ = "Add", menuTitle: y = "Menu", menuCloseLabel: b = "Close", removeLabel: x, retryLabel: S, sendLabel: C, stopLabel: w, micLabel: T = "Record voice message", stopRecordingLabel: E, discardRecordingLabel: D, timerAriaLabel: O, colors: k, typography: ee, className: te, pendingDropFiles: A = [], onDropFilesConsumed: ne, pendingAttachments: re = [], onPendingAttachmentsConsumed: ie, pasteTextThreshold: ae = 4e3, deployments: ce, selectedDeploymentId: le, onDeploymentChange: ue, modelSelectorLabels: de, initialAttachments: fe = [], isStacked: pe = !1, hideAddButton: me = !1, hideAttachFile: he = !1, hideActionBar: ge = !1, renderFooterActions: M, isInputDisabled: N = !1, isModelSelectorDisabled: _e = !1, isSendDisabled: ve = !1, isAudioMessageSupported: ye = !1, sendOnEnter: be = Re.Enter, prefixAttachments: B = [], onRemovePrefixAttachment: Se, chatSettings: Ce, autoFocus: we = !1, messageHistory: Ee, onDialFileSystemClick: V, dialFileSystemLabel: H, validateAttachment: De, onAttachmentClick: Ae, modelPickerOverlay: je, maximumAttachmentsAmount: Pe, onAttachmentsLimitExceeded: Fe }) => {
|
|
1576
|
+
let Ie = c(), [ze, Be] = I(!1), Ve = Me(Ee), U = P(() => o({
|
|
1572
1577
|
"--ci-bg": k?.background,
|
|
1573
1578
|
"--ci-text": k?.text,
|
|
1574
1579
|
"--ci-border": k?.border,
|
|
@@ -1580,60 +1585,61 @@ var Ct = {
|
|
|
1580
1585
|
"--ci-send-bg": k?.sendBackground,
|
|
1581
1586
|
"--ci-send-text": k?.sendText,
|
|
1582
1587
|
"--ci-stop-color": k?.stopColor
|
|
1583
|
-
}), [k]), He =
|
|
1588
|
+
}), [k]), He = P(() => V ? [{
|
|
1584
1589
|
key: "dial-fs",
|
|
1585
|
-
label:
|
|
1586
|
-
icon: /* @__PURE__ */
|
|
1590
|
+
label: H ?? "DIAL file system",
|
|
1591
|
+
icon: /* @__PURE__ */ R(oe, {
|
|
1587
1592
|
size: l,
|
|
1588
1593
|
"aria-hidden": !0
|
|
1589
1594
|
}),
|
|
1590
|
-
onClick:
|
|
1591
|
-
}] : [], [
|
|
1595
|
+
onClick: V
|
|
1596
|
+
}] : [], [V, H]), { message: W, setMessage: G, textareaRef: Ue, isMultiLine: We } = Ne({
|
|
1592
1597
|
messageProp: e,
|
|
1593
1598
|
messageRevision: t
|
|
1594
|
-
}), { attachments:
|
|
1595
|
-
initialAttachments:
|
|
1599
|
+
}), { attachments: K, buildAttachments: q, addAttachments: J, resetAttachments: Ke, handleRemove: qe, handleRetry: Y, handleExpand: Je, hasBlockedAttachments: Qe } = Oe({
|
|
1600
|
+
initialAttachments: fe,
|
|
1596
1601
|
onUploadAttachment: r,
|
|
1597
1602
|
onAttachmentsChange: d,
|
|
1598
|
-
validateAttachment:
|
|
1599
|
-
pendingDropFiles:
|
|
1600
|
-
onDropFilesConsumed:
|
|
1601
|
-
pendingAttachments:
|
|
1602
|
-
onPendingAttachmentsConsumed:
|
|
1603
|
-
onExpandPastedText:
|
|
1604
|
-
|
|
1605
|
-
}, [
|
|
1606
|
-
maximumAttachmentsAmount:
|
|
1607
|
-
baseAttachmentsAmount:
|
|
1608
|
-
onAttachmentsLimitExceeded:
|
|
1609
|
-
}), { state: $e, analyserNodeRef: et, elapsedSeconds: tt, errorMessage: nt, startRecording: rt, stopRecording: it, discardRecording: at } = Le({ onAttachAudio:
|
|
1610
|
-
|
|
1611
|
-
}, [
|
|
1612
|
-
|
|
1613
|
-
W
|
|
1603
|
+
validateAttachment: De,
|
|
1604
|
+
pendingDropFiles: A,
|
|
1605
|
+
onDropFilesConsumed: ne,
|
|
1606
|
+
pendingAttachments: re,
|
|
1607
|
+
onPendingAttachmentsConsumed: ie,
|
|
1608
|
+
onExpandPastedText: j((e) => {
|
|
1609
|
+
G((t) => t ? `${t}\n${e}` : e);
|
|
1610
|
+
}, [G]),
|
|
1611
|
+
maximumAttachmentsAmount: Pe,
|
|
1612
|
+
baseAttachmentsAmount: B.length,
|
|
1613
|
+
onAttachmentsLimitExceeded: Fe
|
|
1614
|
+
}), { state: $e, analyserNodeRef: et, elapsedSeconds: tt, errorMessage: nt, startRecording: rt, stopRecording: it, discardRecording: at } = Le({ onAttachAudio: j((e) => {
|
|
1615
|
+
J(q([e]));
|
|
1616
|
+
}, [J, q]) }), ot = F(null), st = F(null), { handlePaste: ct } = Te(J, ae), Z = W.trim().length > 0 || K.length > 0, lt = Z && !Qe && !ve, { shouldRender: ut, isExiting: Q, instanceKey: dt } = ke(!a && Z, kt), $ = pe || K.length > 0 || W.includes("\n") || We, ft = ce === void 0 || le != null, pt = async () => {
|
|
1617
|
+
if (ve) return;
|
|
1618
|
+
let e = W, t = K;
|
|
1619
|
+
G(""), Ve.reset();
|
|
1614
1620
|
try {
|
|
1615
1621
|
await n?.(e, t), t.forEach((e) => {
|
|
1616
1622
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl);
|
|
1617
|
-
}),
|
|
1623
|
+
}), Ke([]);
|
|
1618
1624
|
} catch {
|
|
1619
|
-
|
|
1625
|
+
G(e), Ke(t);
|
|
1620
1626
|
}
|
|
1621
|
-
},
|
|
1622
|
-
if (!e.nativeEvent.isComposing && !
|
|
1623
|
-
let t = e.currentTarget.selectionStart ?? 0, n =
|
|
1627
|
+
}, mt = (e) => {
|
|
1628
|
+
if (!e.nativeEvent.isComposing && !N && !a && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
|
|
1629
|
+
let t = e.currentTarget.selectionStart ?? 0, n = Ve.navigate(e.key === "ArrowUp" ? "up" : "down", W, t);
|
|
1624
1630
|
if (n !== null) {
|
|
1625
|
-
e.preventDefault(),
|
|
1631
|
+
e.preventDefault(), G(n);
|
|
1626
1632
|
return;
|
|
1627
1633
|
}
|
|
1628
1634
|
}
|
|
1629
|
-
e.key === "Enter" && (
|
|
1630
|
-
},
|
|
1635
|
+
e.key === "Enter" && (be === Re.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey) && (e.preventDefault(), !a && lt && ft && !N && pt());
|
|
1636
|
+
}, ht = (e) => {
|
|
1631
1637
|
let t = Array.from(e.target.files ?? []);
|
|
1632
1638
|
if (t.length === 0) return;
|
|
1633
|
-
let n =
|
|
1634
|
-
e.target.value = "",
|
|
1639
|
+
let n = q(t);
|
|
1640
|
+
e.target.value = "", J(n);
|
|
1635
1641
|
};
|
|
1636
|
-
if ($e !== "idle") return /* @__PURE__ */
|
|
1642
|
+
if ($e !== "idle") return /* @__PURE__ */ R(Ye, {
|
|
1637
1643
|
state: $e,
|
|
1638
1644
|
analyserNodeRef: et,
|
|
1639
1645
|
elapsedSeconds: tt,
|
|
@@ -1643,218 +1649,219 @@ var Ct = {
|
|
|
1643
1649
|
stopLabel: E,
|
|
1644
1650
|
discardLabel: D,
|
|
1645
1651
|
timerLabel: O,
|
|
1646
|
-
style:
|
|
1647
|
-
className:
|
|
1652
|
+
style: U,
|
|
1653
|
+
className: te
|
|
1648
1654
|
});
|
|
1649
|
-
let
|
|
1650
|
-
className: s(
|
|
1655
|
+
let gt = /* @__PURE__ */ R("textarea", {
|
|
1656
|
+
className: s(X.textarea, ee?.fontClassName, "max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent outline-none [field-sizing:content]"),
|
|
1651
1657
|
ref: Ue,
|
|
1652
|
-
autoFocus:
|
|
1653
|
-
value:
|
|
1658
|
+
autoFocus: we,
|
|
1659
|
+
value: W,
|
|
1654
1660
|
onChange: (e) => {
|
|
1655
|
-
|
|
1661
|
+
G(e.target.value), Ve.notifyChange(), u?.(e.target.value);
|
|
1656
1662
|
},
|
|
1657
|
-
onKeyDown:
|
|
1658
|
-
onPaste:
|
|
1663
|
+
onKeyDown: mt,
|
|
1664
|
+
onPaste: ct,
|
|
1659
1665
|
placeholder: p,
|
|
1660
1666
|
"aria-label": m,
|
|
1661
|
-
disabled:
|
|
1667
|
+
disabled: N,
|
|
1662
1668
|
rows: 1
|
|
1663
1669
|
});
|
|
1664
|
-
return /* @__PURE__ */
|
|
1665
|
-
ref:
|
|
1666
|
-
style:
|
|
1667
|
-
className: s(
|
|
1668
|
-
children: [(
|
|
1669
|
-
attachments: [...
|
|
1670
|
+
return /* @__PURE__ */ z("div", {
|
|
1671
|
+
ref: st,
|
|
1672
|
+
style: U,
|
|
1673
|
+
className: s(X.wrapper, N && X.wrapperDisabled, "flex min-h-[56px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border", K.length > 6 ? "py-3 ps-3" : "p-3", te),
|
|
1674
|
+
children: [(B.length > 0 || K.length > 0) && /* @__PURE__ */ R(xe, {
|
|
1675
|
+
attachments: [...B, ...K],
|
|
1670
1676
|
onRemove: (e) => {
|
|
1671
|
-
|
|
1677
|
+
B.some((t) => t.id === e) ? Se?.(e) : qe(e);
|
|
1672
1678
|
},
|
|
1673
|
-
onRetry:
|
|
1674
|
-
onExpand:
|
|
1679
|
+
onRetry: Y,
|
|
1680
|
+
onExpand: Je,
|
|
1675
1681
|
labels: {
|
|
1676
1682
|
removeLabel: x,
|
|
1677
1683
|
retryLabel: S
|
|
1678
1684
|
},
|
|
1679
|
-
onAttachmentClick:
|
|
1680
|
-
let t = [...
|
|
1681
|
-
t != null &&
|
|
1685
|
+
onAttachmentClick: Ae == null ? void 0 : (e) => {
|
|
1686
|
+
let t = [...B, ...K].find((t) => t.id === e);
|
|
1687
|
+
t != null && Ae(t);
|
|
1682
1688
|
}
|
|
1683
|
-
}),
|
|
1689
|
+
}), ge ? $ && gt : /* @__PURE__ */ z("div", {
|
|
1684
1690
|
className: s("flex items-center gap-2", $ ? "flex-wrap" : "flex-wrap desktop:flex-nowrap"),
|
|
1685
1691
|
children: [
|
|
1686
|
-
!
|
|
1692
|
+
!me && /* @__PURE__ */ z("div", {
|
|
1687
1693
|
className: s("order-2 flex", !$ && "desktop:order-1"),
|
|
1688
|
-
children: [/* @__PURE__ */
|
|
1689
|
-
ref:
|
|
1694
|
+
children: [/* @__PURE__ */ R("input", {
|
|
1695
|
+
ref: ot,
|
|
1690
1696
|
type: "file",
|
|
1691
1697
|
multiple: !0,
|
|
1692
1698
|
accept: g,
|
|
1693
1699
|
className: "sr-only",
|
|
1694
1700
|
"aria-hidden": !0,
|
|
1695
1701
|
tabIndex: -1,
|
|
1696
|
-
onChange:
|
|
1697
|
-
}), /* @__PURE__ */
|
|
1698
|
-
onAttachClick:
|
|
1702
|
+
onChange: ht
|
|
1703
|
+
}), /* @__PURE__ */ R(Ge, {
|
|
1704
|
+
onAttachClick: he ? void 0 : () => ot.current?.click(),
|
|
1699
1705
|
attachLabel: h,
|
|
1700
1706
|
addMenuTitle: _,
|
|
1701
1707
|
menuTitle: y,
|
|
1702
1708
|
menuCloseLabel: b,
|
|
1703
|
-
style:
|
|
1704
|
-
isDisabled:
|
|
1705
|
-
chatSettings:
|
|
1709
|
+
style: U,
|
|
1710
|
+
isDisabled: N,
|
|
1711
|
+
chatSettings: Ce,
|
|
1706
1712
|
extraMenuItems: He
|
|
1707
1713
|
})]
|
|
1708
1714
|
}),
|
|
1709
|
-
/* @__PURE__ */
|
|
1715
|
+
/* @__PURE__ */ R("div", {
|
|
1710
1716
|
className: s("order-1 flex w-full min-w-0 items-center self-stretch", !$ && "desktop:order-2 desktop:w-auto desktop:flex-1"),
|
|
1711
|
-
children:
|
|
1717
|
+
children: gt
|
|
1712
1718
|
}),
|
|
1713
|
-
/* @__PURE__ */
|
|
1719
|
+
/* @__PURE__ */ z("div", {
|
|
1714
1720
|
className: s("flex flex-shrink-0 items-center gap-2", "order-3 ms-auto", !$ && "desktop:ms-0"),
|
|
1715
|
-
children: [
|
|
1716
|
-
canSend:
|
|
1717
|
-
onSend:
|
|
1718
|
-
}) : /* @__PURE__ */
|
|
1719
|
-
deployments:
|
|
1720
|
-
selectedDeploymentId:
|
|
1721
|
-
onDeploymentChange:
|
|
1722
|
-
modelSelectorLabels:
|
|
1721
|
+
children: [M ? M({
|
|
1722
|
+
canSend: lt,
|
|
1723
|
+
onSend: pt
|
|
1724
|
+
}) : /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R(Ot, {
|
|
1725
|
+
deployments: ce,
|
|
1726
|
+
selectedDeploymentId: le,
|
|
1727
|
+
onDeploymentChange: ue,
|
|
1728
|
+
modelSelectorLabels: de,
|
|
1723
1729
|
isStreaming: a,
|
|
1724
|
-
isMobile:
|
|
1725
|
-
isInputDisabled:
|
|
1726
|
-
isDisabled:
|
|
1727
|
-
style:
|
|
1728
|
-
modelPickerOverlay:
|
|
1729
|
-
isPickerOpen:
|
|
1730
|
-
onPickerToggle: () =>
|
|
1731
|
-
onPickerOpenChange:
|
|
1732
|
-
}), a && i ? /* @__PURE__ */
|
|
1730
|
+
isMobile: Ie,
|
|
1731
|
+
isInputDisabled: N,
|
|
1732
|
+
isDisabled: _e,
|
|
1733
|
+
style: U,
|
|
1734
|
+
modelPickerOverlay: je,
|
|
1735
|
+
isPickerOpen: ze,
|
|
1736
|
+
onPickerToggle: () => Be((e) => !e),
|
|
1737
|
+
onPickerOpenChange: Be
|
|
1738
|
+
}), a && i ? /* @__PURE__ */ R(Ze, {
|
|
1733
1739
|
onStop: i,
|
|
1734
1740
|
ariaLabel: w
|
|
1735
|
-
}) : !a &&
|
|
1736
|
-
onSend:
|
|
1737
|
-
isDisabled: !
|
|
1741
|
+
}) : !a && ut && /* @__PURE__ */ R(Xe, {
|
|
1742
|
+
onSend: pt,
|
|
1743
|
+
isDisabled: !ft || Qe || ve,
|
|
1738
1744
|
ariaLabel: C,
|
|
1739
|
-
isExiting:
|
|
1740
|
-
},
|
|
1741
|
-
icon: /* @__PURE__ */
|
|
1745
|
+
isExiting: Q
|
|
1746
|
+
}, dt)] }), ye && !Q && /* @__PURE__ */ R(v, {
|
|
1747
|
+
icon: /* @__PURE__ */ R(se, {
|
|
1742
1748
|
size: f.LG,
|
|
1743
1749
|
"aria-hidden": !0
|
|
1744
1750
|
}),
|
|
1745
1751
|
"aria-label": T,
|
|
1746
1752
|
className: "size-8 flex-shrink-0",
|
|
1747
1753
|
onClick: rt,
|
|
1748
|
-
disabled:
|
|
1754
|
+
disabled: N || a
|
|
1749
1755
|
})]
|
|
1750
1756
|
})
|
|
1751
1757
|
]
|
|
1752
1758
|
})]
|
|
1753
1759
|
});
|
|
1754
|
-
}, jt = { welcome: "_welcome_n2ph8_1" }, Mt = ({ isStreaming: e = !1, placeholder: t = "Type a prompt or use \"/\" to select one", welcomeText: n, styles: r, className: i,
|
|
1755
|
-
let { colors:
|
|
1756
|
-
return /* @__PURE__ */
|
|
1760
|
+
}, jt = { welcome: "_welcome_n2ph8_1" }, Mt = ({ isStreaming: e = !1, placeholder: t = "Type a prompt or use \"/\" to select one", welcomeText: n, styles: r, className: i, inputClassName: a, isInputDisabled: c = !1, ...l }) => {
|
|
1761
|
+
let { colors: u, typography: d } = r ?? {};
|
|
1762
|
+
return /* @__PURE__ */ z("div", {
|
|
1757
1763
|
style: o({
|
|
1758
|
-
"--ci-root-bg":
|
|
1759
|
-
"--ci-welcome-color":
|
|
1764
|
+
"--ci-root-bg": u?.background,
|
|
1765
|
+
"--ci-welcome-color": u?.welcomeText
|
|
1760
1766
|
}),
|
|
1761
1767
|
className: s("relative flex w-full flex-col items-center gap-6 px-4 py-5 desktop:p-5", i),
|
|
1762
|
-
children: [n && /* @__PURE__ */
|
|
1763
|
-
className: s(jt.welcome, "m-0 text-center",
|
|
1768
|
+
children: [n && /* @__PURE__ */ R("h1", {
|
|
1769
|
+
className: s(jt.welcome, "m-0 text-center", d?.welcomeClassName),
|
|
1764
1770
|
children: n
|
|
1765
|
-
}), /* @__PURE__ */
|
|
1771
|
+
}), /* @__PURE__ */ R("div", {
|
|
1766
1772
|
className: "relative w-full max-w-[748px]",
|
|
1767
|
-
children: /* @__PURE__ */
|
|
1773
|
+
children: /* @__PURE__ */ R(At, {
|
|
1768
1774
|
placeholder: t,
|
|
1769
1775
|
isStreaming: e,
|
|
1770
|
-
isInputDisabled:
|
|
1771
|
-
...
|
|
1772
|
-
|
|
1773
|
-
|
|
1776
|
+
isInputDisabled: c,
|
|
1777
|
+
...l,
|
|
1778
|
+
className: a,
|
|
1779
|
+
colors: u?.input,
|
|
1780
|
+
typography: d?.input
|
|
1774
1781
|
})
|
|
1775
1782
|
})]
|
|
1776
1783
|
});
|
|
1777
1784
|
}, Nt = ({ message: e, initialAttachments: t = [], onCancel: n, onSave: r, onUploadAttachment: a, cancelLabel: o = "Cancel", saveLabel: c = "Save & Submit", ariaLabel: u, removeLabel: d, retryLabel: f, addMenuTitle: p = "Add", attachLabel: m = "Attach file", menuTitle: h = "Menu", menuCloseLabel: g = "Close", className: _, pendingDropFiles: v, onDropFilesConsumed: y, validateAttachment: b, hideAttachFile: x = !1, fileAccept: S, maximumAttachmentsAmount: C, onAttachmentsLimitExceeded: w, onDialFileSystemClick: T, dialFileSystemLabel: E, pendingAttachments: D, onPendingAttachmentsConsumed: O, onAttachmentClick: k }) => {
|
|
1778
|
-
let
|
|
1779
|
-
|
|
1780
|
-
v?.length && (
|
|
1785
|
+
let ee = F(null), [te, A] = I([]);
|
|
1786
|
+
M(() => {
|
|
1787
|
+
v?.length && (A(v), y?.());
|
|
1781
1788
|
}, [v, y]);
|
|
1782
|
-
let [
|
|
1783
|
-
|
|
1784
|
-
},
|
|
1785
|
-
r(e,
|
|
1786
|
-
}, [
|
|
1787
|
-
|
|
1788
|
-
},
|
|
1789
|
+
let [ne, re] = I(e ?? ""), [ie, ae] = I([]), [se, ce] = I(t), le = ie.some((e) => e.status === i.Loading || e.status === i.Error), ue = (ne.trim().length > 0 || ie.length > 0 || se.length > 0) && !le, de = (e) => {
|
|
1790
|
+
ce((t) => t.filter((t) => t.id !== e));
|
|
1791
|
+
}, fe = j((e, t) => {
|
|
1792
|
+
r(e, se, t);
|
|
1793
|
+
}, [se, r]), pe = () => {
|
|
1794
|
+
ue && fe(ne, ie);
|
|
1795
|
+
}, me = j(() => A([]), []), he = j((e) => {
|
|
1789
1796
|
let t = Array.from(e.target.files ?? []);
|
|
1790
|
-
t.length !== 0 && (e.target.value = "",
|
|
1791
|
-
}, []),
|
|
1797
|
+
t.length !== 0 && (e.target.value = "", A(t));
|
|
1798
|
+
}, []), ge = P(() => T ? [{
|
|
1792
1799
|
key: "dial-fs",
|
|
1793
1800
|
label: E ?? "DIAL file system",
|
|
1794
|
-
icon: /* @__PURE__ */
|
|
1801
|
+
icon: /* @__PURE__ */ R(oe, {
|
|
1795
1802
|
size: l,
|
|
1796
1803
|
"aria-hidden": !0
|
|
1797
1804
|
}),
|
|
1798
1805
|
onClick: T
|
|
1799
1806
|
}] : [], [T, E]);
|
|
1800
|
-
return /* @__PURE__ */
|
|
1807
|
+
return /* @__PURE__ */ z("div", {
|
|
1801
1808
|
className: s("flex w-full flex-col gap-2", _),
|
|
1802
|
-
children: [/* @__PURE__ */
|
|
1809
|
+
children: [/* @__PURE__ */ R(At, {
|
|
1803
1810
|
message: e,
|
|
1804
1811
|
ariaLabel: u,
|
|
1805
1812
|
isStacked: !0,
|
|
1806
1813
|
hideActionBar: !0,
|
|
1807
|
-
pendingDropFiles:
|
|
1808
|
-
onDropFilesConsumed:
|
|
1809
|
-
onSend:
|
|
1814
|
+
pendingDropFiles: te,
|
|
1815
|
+
onDropFilesConsumed: me,
|
|
1816
|
+
onSend: fe,
|
|
1810
1817
|
onUploadAttachment: a,
|
|
1811
|
-
onChange:
|
|
1812
|
-
onAttachmentsChange:
|
|
1818
|
+
onChange: re,
|
|
1819
|
+
onAttachmentsChange: ae,
|
|
1813
1820
|
removeLabel: d,
|
|
1814
1821
|
retryLabel: f,
|
|
1815
1822
|
className: "max-w-full",
|
|
1816
|
-
prefixAttachments:
|
|
1817
|
-
onRemovePrefixAttachment:
|
|
1823
|
+
prefixAttachments: se,
|
|
1824
|
+
onRemovePrefixAttachment: de,
|
|
1818
1825
|
validateAttachment: b,
|
|
1819
1826
|
maximumAttachmentsAmount: C,
|
|
1820
1827
|
onAttachmentsLimitExceeded: w,
|
|
1821
1828
|
pendingAttachments: D,
|
|
1822
1829
|
onPendingAttachmentsConsumed: O,
|
|
1823
1830
|
onAttachmentClick: k
|
|
1824
|
-
}), /* @__PURE__ */
|
|
1831
|
+
}), /* @__PURE__ */ z("div", {
|
|
1825
1832
|
className: "flex items-center justify-between",
|
|
1826
|
-
children: [/* @__PURE__ */
|
|
1833
|
+
children: [/* @__PURE__ */ R("div", {
|
|
1827
1834
|
className: "flex",
|
|
1828
|
-
children: !x && /* @__PURE__ */
|
|
1829
|
-
ref:
|
|
1835
|
+
children: !x && /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("input", {
|
|
1836
|
+
ref: ee,
|
|
1830
1837
|
type: "file",
|
|
1831
1838
|
multiple: !0,
|
|
1832
1839
|
accept: S,
|
|
1833
1840
|
className: "sr-only",
|
|
1834
1841
|
"aria-hidden": !0,
|
|
1835
1842
|
tabIndex: -1,
|
|
1836
|
-
onChange:
|
|
1837
|
-
}), /* @__PURE__ */
|
|
1838
|
-
onAttachClick: () =>
|
|
1843
|
+
onChange: he
|
|
1844
|
+
}), /* @__PURE__ */ R(Ge, {
|
|
1845
|
+
onAttachClick: () => ee.current?.click(),
|
|
1839
1846
|
attachLabel: m,
|
|
1840
1847
|
addMenuTitle: p,
|
|
1841
1848
|
menuTitle: h,
|
|
1842
1849
|
menuCloseLabel: g,
|
|
1843
|
-
extraMenuItems:
|
|
1850
|
+
extraMenuItems: ge
|
|
1844
1851
|
})] })
|
|
1845
|
-
}), /* @__PURE__ */
|
|
1852
|
+
}), /* @__PURE__ */ z("div", {
|
|
1846
1853
|
className: "flex gap-2",
|
|
1847
|
-
children: [/* @__PURE__ */
|
|
1854
|
+
children: [/* @__PURE__ */ R(W, {
|
|
1848
1855
|
label: o,
|
|
1849
1856
|
onClick: n
|
|
1850
|
-
}), /* @__PURE__ */
|
|
1857
|
+
}), /* @__PURE__ */ R(He, {
|
|
1851
1858
|
label: c,
|
|
1852
|
-
onClick:
|
|
1853
|
-
disabled: !
|
|
1859
|
+
onClick: pe,
|
|
1860
|
+
disabled: !ue
|
|
1854
1861
|
})]
|
|
1855
1862
|
})]
|
|
1856
1863
|
})]
|
|
1857
1864
|
});
|
|
1858
1865
|
};
|
|
1859
1866
|
//#endregion
|
|
1860
|
-
export {
|
|
1867
|
+
export { ve as AttachmentCard, ye as AttachmentGroup, be as AttachmentTray, H as BottomSheetShell, q as ChatSettingsModal, Mt as ConversationInput, Nt as EditMessageInput, B as FileDndOverlay, At as Input, Re as SendOnEnter, we as getAttachmentIcon };
|