@epam/ai-dial-conversation-input 1.1.0-dev.43 → 1.1.0-dev.44
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 +390 -388
- 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,62 @@ 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
407
|
children: e.map((e) => {
|
|
408
408
|
let r = t === e.id;
|
|
409
|
-
return /* @__PURE__ */
|
|
409
|
+
return /* @__PURE__ */ R(D, {
|
|
410
410
|
label: e.label,
|
|
411
411
|
selected: r,
|
|
412
412
|
onClick: () => n(e.id),
|
|
413
413
|
"aria-selected": r,
|
|
414
|
-
className: s("box-border h-auto shrink-0 justify-center rounded-full p-2 text-center", i,
|
|
414
|
+
className: s("box-border h-auto shrink-0 justify-center rounded-full p-2 text-center", i, U.tabContainer, r && U.tabActive)
|
|
415
415
|
}, e.id);
|
|
416
416
|
})
|
|
417
417
|
});
|
|
418
418
|
});
|
|
419
419
|
//#endregion
|
|
420
420
|
//#region ../ai-dial-kit/src/components/Button/Buttons.tsx
|
|
421
|
-
var
|
|
421
|
+
var He = (e) => /* @__PURE__ */ R(x, { ...e }), W = (e) => /* @__PURE__ */ R(p, {
|
|
422
422
|
...e,
|
|
423
423
|
variant: d.Neutral,
|
|
424
424
|
appearance: u.Outlined
|
|
425
|
-
}),
|
|
426
|
-
let [s, c] =
|
|
427
|
-
|
|
425
|
+
}), G = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
426
|
+
let [s, c] = I(t), [l, u] = I(n), [d, f] = I(r), p = F(o);
|
|
427
|
+
M(() => {
|
|
428
428
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
429
429
|
}, [
|
|
430
430
|
o,
|
|
@@ -441,7 +441,7 @@ var U = (e) => /* @__PURE__ */ z(x, { ...e }), W = (e) => /* @__PURE__ */ z(p, {
|
|
|
441
441
|
setResponseFormat: c,
|
|
442
442
|
setSystemPrompt: u,
|
|
443
443
|
setTemperature: f,
|
|
444
|
-
handleSubmit:
|
|
444
|
+
handleSubmit: j(() => {
|
|
445
445
|
if (!m) return;
|
|
446
446
|
let t = {};
|
|
447
447
|
e.responseFormat && s != null && (t.responseFormat = s), e.systemPrompt && (t.systemPrompt = l), e.temperature && (t.temperature = d), i(t), a();
|
|
@@ -455,18 +455,18 @@ var U = (e) => /* @__PURE__ */ z(x, { ...e }), W = (e) => /* @__PURE__ */ z(p, {
|
|
|
455
455
|
a
|
|
456
456
|
])
|
|
457
457
|
};
|
|
458
|
-
},
|
|
458
|
+
}, 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
459
|
"Precise",
|
|
460
460
|
"Neutral",
|
|
461
461
|
"Creative"
|
|
462
|
-
], temperatureHint: g }) => /* @__PURE__ */
|
|
462
|
+
], temperatureHint: g }) => /* @__PURE__ */ z("div", {
|
|
463
463
|
className: "flex flex-col gap-4 px-6 py-3",
|
|
464
464
|
children: [
|
|
465
|
-
e.responseFormat && /* @__PURE__ */
|
|
465
|
+
e.responseFormat && /* @__PURE__ */ R(S, {
|
|
466
466
|
fieldTitle: c,
|
|
467
|
-
labelClassName:
|
|
467
|
+
labelClassName: Ue,
|
|
468
468
|
elementId: "response-format",
|
|
469
|
-
orientation:
|
|
469
|
+
orientation: te.Column,
|
|
470
470
|
activeRadioButton: t ?? a.Markdown,
|
|
471
471
|
labelDescription: l,
|
|
472
472
|
radioButtons: [{
|
|
@@ -478,19 +478,19 @@ var U = (e) => /* @__PURE__ */ z(x, { ...e }), W = (e) => /* @__PURE__ */ z(p, {
|
|
|
478
478
|
}],
|
|
479
479
|
onChange: (e) => i(e)
|
|
480
480
|
}),
|
|
481
|
-
e.systemPrompt && /* @__PURE__ */
|
|
481
|
+
e.systemPrompt && /* @__PURE__ */ R(y, {
|
|
482
482
|
value: n,
|
|
483
483
|
placeholder: p,
|
|
484
484
|
labelProps: {
|
|
485
|
-
className:
|
|
485
|
+
className: Ue,
|
|
486
486
|
label: f
|
|
487
487
|
},
|
|
488
488
|
onChange: (e) => o(e ?? "")
|
|
489
489
|
}),
|
|
490
|
-
e.temperature && /* @__PURE__ */
|
|
490
|
+
e.temperature && /* @__PURE__ */ R(E, {
|
|
491
491
|
labelProps: {
|
|
492
492
|
label: m,
|
|
493
|
-
className:
|
|
493
|
+
className: Ue,
|
|
494
494
|
caption: g
|
|
495
495
|
},
|
|
496
496
|
value: r,
|
|
@@ -501,8 +501,8 @@ var U = (e) => /* @__PURE__ */ z(x, { ...e }), W = (e) => /* @__PURE__ */ z(p, {
|
|
|
501
501
|
onChange: s
|
|
502
502
|
})
|
|
503
503
|
]
|
|
504
|
-
}),
|
|
505
|
-
let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: D, setResponseFormat: k, setSystemPrompt:
|
|
504
|
+
}), 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 }) => {
|
|
505
|
+
let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: D, setResponseFormat: k, setSystemPrompt: ee, setTemperature: te, handleSubmit: A } = G({
|
|
506
506
|
isOpen: e,
|
|
507
507
|
features: o,
|
|
508
508
|
initialResponseFormat: c,
|
|
@@ -511,7 +511,7 @@ var U = (e) => /* @__PURE__ */ z(x, { ...e }), W = (e) => /* @__PURE__ */ z(p, {
|
|
|
511
511
|
onSave: d,
|
|
512
512
|
onClose: r
|
|
513
513
|
});
|
|
514
|
-
return /* @__PURE__ */
|
|
514
|
+
return /* @__PURE__ */ z(H, {
|
|
515
515
|
isOpen: e,
|
|
516
516
|
title: f,
|
|
517
517
|
closeLabel: i,
|
|
@@ -519,14 +519,14 @@ var U = (e) => /* @__PURE__ */ z(x, { ...e }), W = (e) => /* @__PURE__ */ z(p, {
|
|
|
519
519
|
onBack: t,
|
|
520
520
|
backLabel: n,
|
|
521
521
|
style: a,
|
|
522
|
-
children: [/* @__PURE__ */
|
|
522
|
+
children: [/* @__PURE__ */ R(We, {
|
|
523
523
|
features: o,
|
|
524
524
|
responseFormat: w,
|
|
525
525
|
systemPrompt: T,
|
|
526
526
|
temperature: E,
|
|
527
527
|
onResponseFormatChange: k,
|
|
528
|
-
onSystemPromptChange:
|
|
529
|
-
onTemperatureChange:
|
|
528
|
+
onSystemPromptChange: ee,
|
|
529
|
+
onTemperatureChange: te,
|
|
530
530
|
responseFormatLabel: p,
|
|
531
531
|
responseFormatHint: m,
|
|
532
532
|
responseFormatMarkdownLabel: h,
|
|
@@ -536,23 +536,23 @@ var U = (e) => /* @__PURE__ */ z(x, { ...e }), W = (e) => /* @__PURE__ */ z(p, {
|
|
|
536
536
|
temperatureLabel: y,
|
|
537
537
|
temperatureLabels: b,
|
|
538
538
|
temperatureHint: x
|
|
539
|
-
}), /* @__PURE__ */
|
|
539
|
+
}), /* @__PURE__ */ R("div", {
|
|
540
540
|
className: s("px-6 py-4 mobile:pb-8"),
|
|
541
|
-
children: /* @__PURE__ */
|
|
541
|
+
children: /* @__PURE__ */ R(O, {
|
|
542
542
|
tooltip: C,
|
|
543
543
|
hideTooltip: D || !C,
|
|
544
544
|
triggerClassName: "w-full",
|
|
545
|
-
children: /* @__PURE__ */
|
|
545
|
+
children: /* @__PURE__ */ R(He, {
|
|
546
546
|
label: S,
|
|
547
|
-
onClick:
|
|
547
|
+
onClick: A,
|
|
548
548
|
disabled: !D,
|
|
549
549
|
className: "w-full"
|
|
550
550
|
})
|
|
551
551
|
})
|
|
552
552
|
})]
|
|
553
553
|
});
|
|
554
|
-
},
|
|
555
|
-
let { responseFormat: v, systemPrompt: y, temperature: x, canSubmit: S, setResponseFormat: C, setSystemPrompt: w, setTemperature: T, handleSubmit: E } =
|
|
554
|
+
}, 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: _ }) => {
|
|
555
|
+
let { responseFormat: v, systemPrompt: y, temperature: x, canSubmit: S, setResponseFormat: C, setSystemPrompt: w, setTemperature: T, handleSubmit: E } = G({
|
|
556
556
|
features: e,
|
|
557
557
|
initialResponseFormat: t,
|
|
558
558
|
initialSystemPrompt: n,
|
|
@@ -560,25 +560,25 @@ var U = (e) => /* @__PURE__ */ z(x, { ...e }), W = (e) => /* @__PURE__ */ z(p, {
|
|
|
560
560
|
onSave: i,
|
|
561
561
|
onClose: a
|
|
562
562
|
});
|
|
563
|
-
return /* @__PURE__ */
|
|
563
|
+
return /* @__PURE__ */ R(b, {
|
|
564
564
|
open: !0,
|
|
565
565
|
header: o,
|
|
566
|
-
size:
|
|
566
|
+
size: ee.Sm,
|
|
567
567
|
onClose: a,
|
|
568
568
|
className: "!bg-layer-2",
|
|
569
|
-
footer: /* @__PURE__ */
|
|
569
|
+
footer: /* @__PURE__ */ R("div", {
|
|
570
570
|
className: "flex justify-end px-6 py-4",
|
|
571
|
-
children: /* @__PURE__ */
|
|
571
|
+
children: /* @__PURE__ */ R(O, {
|
|
572
572
|
tooltip: _,
|
|
573
573
|
hideTooltip: S || !_,
|
|
574
|
-
children: /* @__PURE__ */
|
|
574
|
+
children: /* @__PURE__ */ R(He, {
|
|
575
575
|
label: g,
|
|
576
576
|
onClick: E,
|
|
577
577
|
disabled: !S
|
|
578
578
|
})
|
|
579
579
|
})
|
|
580
580
|
}),
|
|
581
|
-
children: /* @__PURE__ */
|
|
581
|
+
children: /* @__PURE__ */ R(We, {
|
|
582
582
|
features: e,
|
|
583
583
|
responseFormat: v,
|
|
584
584
|
systemPrompt: y,
|
|
@@ -598,15 +598,15 @@ var U = (e) => /* @__PURE__ */ z(x, { ...e }), W = (e) => /* @__PURE__ */ z(p, {
|
|
|
598
598
|
})
|
|
599
599
|
});
|
|
600
600
|
};
|
|
601
|
-
|
|
601
|
+
ge(q);
|
|
602
602
|
//#endregion
|
|
603
603
|
//#region src/components/AddAttachmentButton/AddAttachmentButton.tsx
|
|
604
|
-
var
|
|
605
|
-
let g = c(), [_, y] =
|
|
604
|
+
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 }) => {
|
|
605
|
+
let g = c(), [_, y] = I(!1), [b, x] = I(!1), S = P(() => [
|
|
606
606
|
...e == null ? [] : [{
|
|
607
607
|
key: "attach",
|
|
608
608
|
label: t,
|
|
609
|
-
icon: /* @__PURE__ */
|
|
609
|
+
icon: /* @__PURE__ */ R(ce, {
|
|
610
610
|
size: l,
|
|
611
611
|
"aria-hidden": !0
|
|
612
612
|
}),
|
|
@@ -616,11 +616,11 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
616
616
|
...p == null ? [] : [{
|
|
617
617
|
key: "chat-settings",
|
|
618
618
|
label: p.menuItemLabel ?? "Chat settings",
|
|
619
|
-
icon: /* @__PURE__ */
|
|
619
|
+
icon: /* @__PURE__ */ R(fe, {
|
|
620
620
|
size: l,
|
|
621
621
|
"aria-hidden": !0
|
|
622
622
|
}),
|
|
623
|
-
iconAfter: g ? /* @__PURE__ */
|
|
623
|
+
iconAfter: g ? /* @__PURE__ */ R(ae, {
|
|
624
624
|
size: l,
|
|
625
625
|
stroke: 1.5,
|
|
626
626
|
className: "text-secondary rtl:scale-x-[-1]",
|
|
@@ -635,9 +635,9 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
635
635
|
m,
|
|
636
636
|
g
|
|
637
637
|
]);
|
|
638
|
-
return S.length === 0 ? null : /* @__PURE__ */
|
|
639
|
-
/* @__PURE__ */
|
|
640
|
-
icon: /* @__PURE__ */
|
|
638
|
+
return S.length === 0 ? null : /* @__PURE__ */ R(L, { children: g ? /* @__PURE__ */ z(L, { children: [
|
|
639
|
+
/* @__PURE__ */ R(v, {
|
|
640
|
+
icon: /* @__PURE__ */ R(de, {
|
|
641
641
|
size: f.LG,
|
|
642
642
|
"aria-hidden": !0
|
|
643
643
|
}),
|
|
@@ -646,7 +646,7 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
646
646
|
className: s("size-10 flex-shrink-0", d && "pointer-events-none opacity-50"),
|
|
647
647
|
onClick: () => y(!0)
|
|
648
648
|
}),
|
|
649
|
-
/* @__PURE__ */
|
|
649
|
+
/* @__PURE__ */ R(Be, {
|
|
650
650
|
isOpen: _,
|
|
651
651
|
title: r,
|
|
652
652
|
closeLabel: i,
|
|
@@ -656,7 +656,7 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
656
656
|
className: "pb-4",
|
|
657
657
|
btnTextClassName: "flex-1"
|
|
658
658
|
}),
|
|
659
|
-
p != null && /* @__PURE__ */
|
|
659
|
+
p != null && /* @__PURE__ */ R(K, {
|
|
660
660
|
isOpen: b,
|
|
661
661
|
onBack: () => {
|
|
662
662
|
x(!1), y(!0);
|
|
@@ -683,13 +683,13 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
683
683
|
saveLabel: p.saveLabel,
|
|
684
684
|
saveDisabledTooltip: p.saveDisabledTooltip
|
|
685
685
|
})
|
|
686
|
-
] }) : /* @__PURE__ */
|
|
686
|
+
] }) : /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R(h, {
|
|
687
687
|
matchReferenceWidth: !1,
|
|
688
688
|
placement: "bottom-start",
|
|
689
689
|
listClassName: u,
|
|
690
690
|
items: S,
|
|
691
|
-
children: /* @__PURE__ */
|
|
692
|
-
icon: /* @__PURE__ */
|
|
691
|
+
children: /* @__PURE__ */ R(v, {
|
|
692
|
+
icon: /* @__PURE__ */ R(de, {
|
|
693
693
|
size: f.LG,
|
|
694
694
|
"aria-hidden": !0
|
|
695
695
|
}),
|
|
@@ -698,7 +698,7 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
698
698
|
className: "size-10 flex-shrink-0",
|
|
699
699
|
disabled: d
|
|
700
700
|
})
|
|
701
|
-
}), p != null && b && /* @__PURE__ */
|
|
701
|
+
}), p != null && b && /* @__PURE__ */ R(q, {
|
|
702
702
|
features: p.features,
|
|
703
703
|
initialResponseFormat: p.responseFormat ?? a.Markdown,
|
|
704
704
|
initialSystemPrompt: p.systemPrompt,
|
|
@@ -718,7 +718,7 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
718
718
|
saveLabel: p.saveLabel,
|
|
719
719
|
saveDisabledTooltip: p.saveDisabledTooltip
|
|
720
720
|
})] }) });
|
|
721
|
-
},
|
|
721
|
+
}, J = {
|
|
722
722
|
container: "_container_8j81i_1",
|
|
723
723
|
containerError: "_containerError_8j81i_14",
|
|
724
724
|
waveformCanvas: "_waveformCanvas_8j81i_18",
|
|
@@ -726,29 +726,29 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
726
726
|
stopRecordingIcon: "_stopRecordingIcon_8j81i_28",
|
|
727
727
|
recordingDot: "_recordingDot_8j81i_42",
|
|
728
728
|
"recording-pulse": "_recording-pulse_8j81i_1"
|
|
729
|
-
},
|
|
730
|
-
let p =
|
|
729
|
+
}, 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 }) => {
|
|
730
|
+
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
731
|
let t = e.getContext("2d");
|
|
732
732
|
if (!t) return;
|
|
733
733
|
e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
|
|
734
734
|
let { width: n, height: r } = e;
|
|
735
735
|
t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
|
|
736
|
-
let i = Math.min(Math.max(1, Math.floor(n /
|
|
736
|
+
let i = Math.min(Math.max(1, Math.floor(n / qe)), Y - 1), a = h.current, o = g.current;
|
|
737
737
|
t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
|
|
738
738
|
for (let e = 0; e <= i; e++) {
|
|
739
|
-
let n = ((a - i + e) %
|
|
740
|
-
t.fillRect(e *
|
|
739
|
+
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);
|
|
740
|
+
t.fillRect(e * qe, (r - c) / 2, Ke, c);
|
|
741
741
|
}
|
|
742
742
|
t.restore();
|
|
743
743
|
}, []);
|
|
744
|
-
|
|
744
|
+
M(() => {
|
|
745
745
|
if (!y) return;
|
|
746
746
|
let e = p.current;
|
|
747
747
|
if (!e) return;
|
|
748
748
|
m.current.fill(0), h.current = 0, g.current = 0;
|
|
749
749
|
let n, r = () => {
|
|
750
|
-
if (g.current += 1, g.current >=
|
|
751
|
-
g.current -=
|
|
750
|
+
if (g.current += 1, g.current >= qe) {
|
|
751
|
+
g.current -= qe;
|
|
752
752
|
let e = t.current;
|
|
753
753
|
if (e) {
|
|
754
754
|
let t = new Uint8Array(e.frequencyBinCount);
|
|
@@ -758,7 +758,7 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
758
758
|
let r = (t[e] - 128) / 128;
|
|
759
759
|
n += r * r;
|
|
760
760
|
}
|
|
761
|
-
m.current[h.current %
|
|
761
|
+
m.current[h.current % Y] = Math.sqrt(n / t.length), h.current++;
|
|
762
762
|
}
|
|
763
763
|
}
|
|
764
764
|
x(e), n = requestAnimationFrame(r);
|
|
@@ -770,7 +770,7 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
770
770
|
y,
|
|
771
771
|
t,
|
|
772
772
|
x
|
|
773
|
-
]),
|
|
773
|
+
]), M(() => {
|
|
774
774
|
let e = p.current;
|
|
775
775
|
if (!e) return;
|
|
776
776
|
let t = new ResizeObserver(() => {
|
|
@@ -778,20 +778,20 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
778
778
|
});
|
|
779
779
|
return t.observe(e), () => t.disconnect();
|
|
780
780
|
}, [x]);
|
|
781
|
-
let S = /* @__PURE__ */
|
|
781
|
+
let S = /* @__PURE__ */ z("div", {
|
|
782
782
|
className: "flex flex-shrink-0 items-center justify-end gap-1",
|
|
783
|
-
children: [/* @__PURE__ */
|
|
784
|
-
icon: /* @__PURE__ */
|
|
783
|
+
children: [/* @__PURE__ */ R(v, {
|
|
784
|
+
icon: /* @__PURE__ */ R(pe, {
|
|
785
785
|
size: f.LG,
|
|
786
786
|
"aria-hidden": !0
|
|
787
787
|
}),
|
|
788
788
|
"aria-label": c,
|
|
789
789
|
className: "size-10 flex-shrink-0",
|
|
790
790
|
onClick: a
|
|
791
|
-
}), y && /* @__PURE__ */
|
|
792
|
-
icon: /* @__PURE__ */
|
|
791
|
+
}), y && /* @__PURE__ */ R(v, {
|
|
792
|
+
icon: /* @__PURE__ */ R(le, {
|
|
793
793
|
size: f.LG,
|
|
794
|
-
className:
|
|
794
|
+
className: J.stopRecordingIcon,
|
|
795
795
|
"aria-hidden": !0
|
|
796
796
|
}),
|
|
797
797
|
"aria-label": o,
|
|
@@ -799,32 +799,32 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
799
799
|
onClick: i
|
|
800
800
|
})]
|
|
801
801
|
});
|
|
802
|
-
return /* @__PURE__ */
|
|
802
|
+
return /* @__PURE__ */ z("div", {
|
|
803
803
|
className: d,
|
|
804
|
-
children: [/* @__PURE__ */
|
|
804
|
+
children: [/* @__PURE__ */ z("div", {
|
|
805
805
|
style: u,
|
|
806
|
-
className: s(
|
|
807
|
-
children: [/* @__PURE__ */
|
|
806
|
+
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),
|
|
807
|
+
children: [/* @__PURE__ */ z("div", {
|
|
808
808
|
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
809
|
-
children: [y && /* @__PURE__ */
|
|
810
|
-
className:
|
|
809
|
+
children: [y && /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("span", {
|
|
810
|
+
className: J.recordingDot,
|
|
811
811
|
"aria-hidden": !0
|
|
812
|
-
}), /* @__PURE__ */
|
|
813
|
-
className: s(
|
|
812
|
+
}), /* @__PURE__ */ R("span", {
|
|
813
|
+
className: s(J.timer, "flex-shrink-0"),
|
|
814
814
|
"aria-label": l,
|
|
815
|
-
children:
|
|
816
|
-
})] }), /* @__PURE__ */
|
|
815
|
+
children: Je(n)
|
|
816
|
+
})] }), /* @__PURE__ */ R("canvas", {
|
|
817
817
|
ref: p,
|
|
818
818
|
height: 32,
|
|
819
|
-
className: s(
|
|
819
|
+
className: s(J.waveformCanvas, "h-8 min-w-0 flex-1 desktop:h-6")
|
|
820
820
|
})]
|
|
821
821
|
}), S]
|
|
822
|
-
}), b && r && /* @__PURE__ */
|
|
822
|
+
}), b && r && /* @__PURE__ */ R(_, {
|
|
823
823
|
text: r,
|
|
824
824
|
className: "mt-1 px-1"
|
|
825
825
|
})]
|
|
826
826
|
});
|
|
827
|
-
},
|
|
827
|
+
}, X = {
|
|
828
828
|
wrapper: "_wrapper_1q2nu_2",
|
|
829
829
|
wrapperDisabled: "_wrapperDisabled_1q2nu_15",
|
|
830
830
|
textarea: "_textarea_1q2nu_20",
|
|
@@ -836,73 +836,73 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
836
836
|
sendButtonEnter: "_sendButtonEnter_1q2nu_1",
|
|
837
837
|
sendButtonExiting: "_sendButtonExiting_1q2nu_55",
|
|
838
838
|
sendButtonExit: "_sendButtonExit_1q2nu_55"
|
|
839
|
-
},
|
|
839
|
+
}, Xe = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", title: r, isExiting: i = !1 }) => /* @__PURE__ */ R(O, {
|
|
840
840
|
tooltip: r,
|
|
841
841
|
hideTooltip: !r,
|
|
842
|
-
children: /* @__PURE__ */
|
|
843
|
-
className: s("flex size-[32px] cursor-pointer items-center justify-center rounded-full disabled:cursor-not-allowed",
|
|
842
|
+
children: /* @__PURE__ */ R("button", {
|
|
843
|
+
className: s("flex size-[32px] cursor-pointer items-center justify-center rounded-full disabled:cursor-not-allowed", X.sendButton, i && X.sendButtonExiting),
|
|
844
844
|
"aria-label": n,
|
|
845
845
|
onClick: () => e?.(),
|
|
846
846
|
type: "button",
|
|
847
847
|
disabled: t,
|
|
848
848
|
"aria-hidden": i,
|
|
849
|
-
children: /* @__PURE__ */
|
|
849
|
+
children: /* @__PURE__ */ R(ne, {
|
|
850
850
|
size: f.LG,
|
|
851
851
|
className: "rtl:scale-x-[-1]"
|
|
852
852
|
})
|
|
853
853
|
})
|
|
854
|
-
}),
|
|
854
|
+
}), Ze = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ R("button", {
|
|
855
855
|
className: s("flex cursor-pointer items-center justify-center disabled:cursor-not-allowed"),
|
|
856
856
|
"aria-label": t,
|
|
857
857
|
onClick: () => e?.(),
|
|
858
858
|
type: "button",
|
|
859
|
-
children: /* @__PURE__ */
|
|
859
|
+
children: /* @__PURE__ */ R(ue, {
|
|
860
860
|
size: f.LG,
|
|
861
|
-
className:
|
|
861
|
+
className: X.stopIcon
|
|
862
862
|
})
|
|
863
|
-
}),
|
|
863
|
+
}), Qe = ({ size: e = 20 }) => /* @__PURE__ */ R(w, {
|
|
864
864
|
variant: T.Circular,
|
|
865
865
|
width: e,
|
|
866
866
|
height: e,
|
|
867
867
|
active: !0
|
|
868
|
-
}),
|
|
868
|
+
}), $e = ({ loadingLabel: e }) => /* @__PURE__ */ z("span", {
|
|
869
869
|
className: "flex min-w-0 flex-1 items-center",
|
|
870
|
-
children: [/* @__PURE__ */
|
|
870
|
+
children: [/* @__PURE__ */ R(w, {
|
|
871
871
|
variant: T.Text,
|
|
872
872
|
width: "100%",
|
|
873
873
|
height: 16,
|
|
874
874
|
active: !0
|
|
875
|
-
}), e && /* @__PURE__ */
|
|
875
|
+
}), e && /* @__PURE__ */ R("span", {
|
|
876
876
|
className: "sr-only",
|
|
877
877
|
children: e
|
|
878
878
|
})]
|
|
879
|
-
}),
|
|
879
|
+
}), et = ({ loadingLabel: e }) => /* @__PURE__ */ R("div", {
|
|
880
880
|
role: "status",
|
|
881
881
|
"aria-label": e,
|
|
882
|
-
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */
|
|
882
|
+
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ z("div", {
|
|
883
883
|
className: "flex h-11 items-center gap-3 px-4",
|
|
884
884
|
"aria-hidden": "true",
|
|
885
|
-
children: [/* @__PURE__ */
|
|
885
|
+
children: [/* @__PURE__ */ R(Qe, {}), /* @__PURE__ */ R($e, {})]
|
|
886
886
|
}, t))
|
|
887
|
-
}),
|
|
887
|
+
}), tt = (e) => e.displayName ?? e.id, nt = (e, t) => {
|
|
888
888
|
let n = t.trim().toLowerCase();
|
|
889
|
-
return n ? e.filter((e) =>
|
|
890
|
-
},
|
|
889
|
+
return n ? e.filter((e) => tt(e).toLowerCase().includes(n)) : e;
|
|
890
|
+
}, rt = (e, t, r, i = 18, a) => /* @__PURE__ */ R(n, {
|
|
891
891
|
src: e,
|
|
892
892
|
size: i,
|
|
893
893
|
labels: { tooltip: a },
|
|
894
894
|
initialsName: r
|
|
895
|
-
}),
|
|
896
|
-
let [o, c] =
|
|
895
|
+
}), it = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: i, searchHeaderClassName: a = "bg-layer-0" }) => {
|
|
896
|
+
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
897
|
return {
|
|
898
898
|
selectorIcon: d,
|
|
899
899
|
selectorAriaLabel: p ? `${i?.ariaLabel ?? "Select model"}: ${p}` : i?.ariaLabel ?? "Select model",
|
|
900
900
|
selectedLabel: p,
|
|
901
|
-
menuItems:
|
|
901
|
+
menuItems: P(() => {
|
|
902
902
|
if (u) return Array.from({ length: 7 }, (e, t) => ({
|
|
903
903
|
key: `__loading-${t}`,
|
|
904
|
-
icon: /* @__PURE__ */
|
|
905
|
-
label: /* @__PURE__ */
|
|
904
|
+
icon: /* @__PURE__ */ R(Qe, {}),
|
|
905
|
+
label: /* @__PURE__ */ R($e, { loadingLabel: t === 0 ? i?.loading : void 0 }),
|
|
906
906
|
disabled: !0
|
|
907
907
|
}));
|
|
908
908
|
if (!e || e.length === 0) {
|
|
@@ -913,19 +913,19 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
913
913
|
disabled: !0
|
|
914
914
|
}] : [];
|
|
915
915
|
}
|
|
916
|
-
return
|
|
916
|
+
return nt(e, o).map((e) => {
|
|
917
917
|
let i = e.id === t;
|
|
918
918
|
return {
|
|
919
919
|
key: e.id,
|
|
920
|
-
label: /* @__PURE__ */
|
|
920
|
+
label: /* @__PURE__ */ z("span", {
|
|
921
921
|
className: "flex w-full items-center justify-between gap-2",
|
|
922
|
-
children: [/* @__PURE__ */
|
|
923
|
-
text:
|
|
922
|
+
children: [/* @__PURE__ */ R(r, {
|
|
923
|
+
text: tt(e),
|
|
924
924
|
query: o,
|
|
925
925
|
maxLines: 1
|
|
926
|
-
}), i && /* @__PURE__ */
|
|
926
|
+
}), i && /* @__PURE__ */ R(Ve, { gradientId: "ms-check-grad" })]
|
|
927
927
|
}),
|
|
928
|
-
icon:
|
|
928
|
+
icon: rt(e.iconUrl, e.type, e.displayName ?? e.id),
|
|
929
929
|
onClick: () => n?.(e.id),
|
|
930
930
|
className: i ? "bg-accent-primary-alpha" : void 0
|
|
931
931
|
};
|
|
@@ -938,9 +938,9 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
938
938
|
i,
|
|
939
939
|
n
|
|
940
940
|
]),
|
|
941
|
-
menuHeader:
|
|
941
|
+
menuHeader: P(() => !u && e && e.length > 0 ? /* @__PURE__ */ R("div", {
|
|
942
942
|
className: s("sticky top-0 z-10 pb-1 pe-2 pt-2", a),
|
|
943
|
-
children: /* @__PURE__ */
|
|
943
|
+
children: /* @__PURE__ */ R(C, {
|
|
944
944
|
value: o,
|
|
945
945
|
placeholder: i?.searchPlaceholder ?? "Search",
|
|
946
946
|
size: k.Small,
|
|
@@ -958,7 +958,7 @@ var Ke = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
958
958
|
e || c("");
|
|
959
959
|
}
|
|
960
960
|
};
|
|
961
|
-
},
|
|
961
|
+
}, at = typeof window < "u" ? _e : M;
|
|
962
962
|
function ot(e) {
|
|
963
963
|
if (e !== void 0) switch (typeof e) {
|
|
964
964
|
case "number": return e;
|
|
@@ -968,14 +968,14 @@ function ot(e) {
|
|
|
968
968
|
}
|
|
969
969
|
}
|
|
970
970
|
function st({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
|
|
971
|
-
let { styleHeight: s, styleWidth: c } =
|
|
971
|
+
let { styleHeight: s, styleWidth: c } = P(() => ({
|
|
972
972
|
styleHeight: ot(o?.height),
|
|
973
973
|
styleWidth: ot(o?.width)
|
|
974
|
-
}), [o?.height, o?.width]), [l, u] =
|
|
974
|
+
}), [o?.height, o?.width]), [l, u] = I({
|
|
975
975
|
height: t,
|
|
976
976
|
width: n
|
|
977
977
|
}), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
|
|
978
|
-
return
|
|
978
|
+
return at(() => {
|
|
979
979
|
if (i === null || d) return;
|
|
980
980
|
let t = new ResizeObserver((e) => {
|
|
981
981
|
for (let t of e) {
|
|
@@ -995,7 +995,7 @@ function st({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
995
995
|
i,
|
|
996
996
|
s,
|
|
997
997
|
c
|
|
998
|
-
]),
|
|
998
|
+
]), P(() => ({
|
|
999
999
|
height: s ?? l.height,
|
|
1000
1000
|
width: c ?? l.width
|
|
1001
1001
|
}), [
|
|
@@ -1005,12 +1005,12 @@ function st({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1005
1005
|
]);
|
|
1006
1006
|
}
|
|
1007
1007
|
function ct(e) {
|
|
1008
|
-
let t =
|
|
1008
|
+
let t = F(() => {
|
|
1009
1009
|
throw Error("Cannot call during render.");
|
|
1010
1010
|
});
|
|
1011
|
-
return
|
|
1011
|
+
return at(() => {
|
|
1012
1012
|
t.current = e;
|
|
1013
|
-
}, [e]),
|
|
1013
|
+
}, [e]), j((e) => t.current?.(e), [t]);
|
|
1014
1014
|
}
|
|
1015
1015
|
var Z = null;
|
|
1016
1016
|
function lt(e = !1) {
|
|
@@ -1037,13 +1037,13 @@ function ut({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
|
1037
1037
|
function Q(e, t = "Assertion error") {
|
|
1038
1038
|
if (!e) throw console.error(t), Error(t);
|
|
1039
1039
|
}
|
|
1040
|
-
function
|
|
1040
|
+
function dt(e, t) {
|
|
1041
1041
|
if (e === t) return !0;
|
|
1042
1042
|
if (!!e != !!t || (Q(e !== void 0), Q(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
|
|
1043
1043
|
for (let n in e) if (!Object.is(t[n], e[n])) return !1;
|
|
1044
1044
|
return !0;
|
|
1045
1045
|
}
|
|
1046
|
-
function
|
|
1046
|
+
function $({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
1047
1047
|
if (t === 0) return 0;
|
|
1048
1048
|
if (typeof n == "number") return t * n;
|
|
1049
1049
|
{
|
|
@@ -1053,7 +1053,7 @@ function dt({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
|
1053
1053
|
}
|
|
1054
1054
|
function ft({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
|
|
1055
1055
|
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 =
|
|
1056
|
+
let s = $({
|
|
1057
1057
|
cachedBounds: t,
|
|
1058
1058
|
itemCount: r,
|
|
1059
1059
|
itemSize: i
|
|
@@ -1122,7 +1122,7 @@ function mt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1122
1122
|
};
|
|
1123
1123
|
}
|
|
1124
1124
|
function ht({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1125
|
-
return
|
|
1125
|
+
return P(() => mt({
|
|
1126
1126
|
itemCount: e,
|
|
1127
1127
|
itemProps: t,
|
|
1128
1128
|
itemSize: n
|
|
@@ -1151,14 +1151,14 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1151
1151
|
element: e,
|
|
1152
1152
|
mode: r === "vertical" ? "only-height" : "only-width",
|
|
1153
1153
|
style: t
|
|
1154
|
-
}), f =
|
|
1154
|
+
}), f = F({
|
|
1155
1155
|
height: 0,
|
|
1156
1156
|
width: 0
|
|
1157
1157
|
}), p = r === "vertical" ? u : d, m = gt({
|
|
1158
1158
|
containerSize: p,
|
|
1159
1159
|
itemSize: s
|
|
1160
1160
|
});
|
|
1161
|
-
|
|
1161
|
+
_e(() => {
|
|
1162
1162
|
if (typeof c == "function") {
|
|
1163
1163
|
let e = f.current;
|
|
1164
1164
|
(e.height !== u || e.width !== d) && (c({
|
|
@@ -1175,7 +1175,7 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1175
1175
|
itemCount: a,
|
|
1176
1176
|
itemProps: o,
|
|
1177
1177
|
itemSize: m
|
|
1178
|
-
}), g =
|
|
1178
|
+
}), g = j((e) => h.get(e), [h]), [_, v] = I(() => pt({
|
|
1179
1179
|
cachedBounds: h,
|
|
1180
1180
|
containerScrollOffset: 0,
|
|
1181
1181
|
containerSize: p,
|
|
@@ -1186,7 +1186,7 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1186
1186
|
startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
|
|
1187
1187
|
stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
|
|
1188
1188
|
stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
|
|
1189
|
-
}, C =
|
|
1189
|
+
}, C = j(() => $({
|
|
1190
1190
|
cachedBounds: h,
|
|
1191
1191
|
itemCount: a,
|
|
1192
1192
|
itemSize: m
|
|
@@ -1194,7 +1194,7 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1194
1194
|
h,
|
|
1195
1195
|
a,
|
|
1196
1196
|
m
|
|
1197
|
-
]), w =
|
|
1197
|
+
]), w = j((t) => pt({
|
|
1198
1198
|
cachedBounds: h,
|
|
1199
1199
|
containerScrollOffset: ut({
|
|
1200
1200
|
containerElement: e,
|
|
@@ -1214,13 +1214,13 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1214
1214
|
a,
|
|
1215
1215
|
l
|
|
1216
1216
|
]);
|
|
1217
|
-
return
|
|
1217
|
+
return at(() => {
|
|
1218
1218
|
v(w((r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0));
|
|
1219
1219
|
}, [
|
|
1220
1220
|
e,
|
|
1221
1221
|
r,
|
|
1222
1222
|
w
|
|
1223
|
-
]),
|
|
1223
|
+
]), at(() => {
|
|
1224
1224
|
if (!e) return;
|
|
1225
1225
|
let t = () => {
|
|
1226
1226
|
v((t) => {
|
|
@@ -1236,7 +1236,7 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1236
1236
|
itemCount: a,
|
|
1237
1237
|
overscanCount: l
|
|
1238
1238
|
});
|
|
1239
|
-
return
|
|
1239
|
+
return dt(s, t) ? t : s;
|
|
1240
1240
|
});
|
|
1241
1241
|
};
|
|
1242
1242
|
return e.addEventListener("scroll", t), () => {
|
|
@@ -1270,7 +1270,7 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1270
1270
|
scrollOffset: s
|
|
1271
1271
|
}), typeof e.scrollTo != "function") {
|
|
1272
1272
|
let e = w(s);
|
|
1273
|
-
|
|
1273
|
+
dt(_, e) || v(e);
|
|
1274
1274
|
}
|
|
1275
1275
|
return s;
|
|
1276
1276
|
}
|
|
@@ -1282,29 +1282,29 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1282
1282
|
};
|
|
1283
1283
|
}
|
|
1284
1284
|
function vt(e) {
|
|
1285
|
-
return
|
|
1285
|
+
return P(() => e, Object.values(e));
|
|
1286
1286
|
}
|
|
1287
1287
|
function yt(e, t) {
|
|
1288
1288
|
let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
|
|
1289
|
-
return
|
|
1289
|
+
return dt(n, a) && dt(r, o) && dt(i, s);
|
|
1290
1290
|
}
|
|
1291
1291
|
function bt(e) {
|
|
1292
1292
|
return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
|
|
1293
1293
|
}
|
|
1294
1294
|
var xt = "data-react-window-index";
|
|
1295
1295
|
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 =
|
|
1296
|
+
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
1297
|
containerElement: g,
|
|
1298
1298
|
containerStyle: f,
|
|
1299
1299
|
defaultContainerSize: n,
|
|
1300
1300
|
direction: "vertical",
|
|
1301
1301
|
itemCount: c,
|
|
1302
1302
|
itemProps: m,
|
|
1303
|
-
itemSize:
|
|
1303
|
+
itemSize: P(() => v ? (e) => l.getRowHeight(e) ?? l.getAverageRowHeight() : l, [v, l]),
|
|
1304
1304
|
onResize: i,
|
|
1305
1305
|
overscanCount: o
|
|
1306
1306
|
});
|
|
1307
|
-
|
|
1307
|
+
N(r, () => ({
|
|
1308
1308
|
get element() {
|
|
1309
1309
|
return g;
|
|
1310
1310
|
},
|
|
@@ -1319,7 +1319,7 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1319
1319
|
top: r
|
|
1320
1320
|
});
|
|
1321
1321
|
}
|
|
1322
|
-
}), [g, x]),
|
|
1322
|
+
}), [g, x]), at(() => {
|
|
1323
1323
|
if (!g) return;
|
|
1324
1324
|
let e = Array.from(g.children).filter((e, t) => {
|
|
1325
1325
|
if (e.hasAttribute("aria-hidden")) return !1;
|
|
@@ -1333,7 +1333,7 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1333
1333
|
l,
|
|
1334
1334
|
S,
|
|
1335
1335
|
w
|
|
1336
|
-
]),
|
|
1336
|
+
]), M(() => {
|
|
1337
1337
|
S >= 0 && w >= 0 && a && a({
|
|
1338
1338
|
startIndex: C,
|
|
1339
1339
|
stopIndex: T
|
|
@@ -1348,11 +1348,11 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1348
1348
|
w,
|
|
1349
1349
|
T
|
|
1350
1350
|
]);
|
|
1351
|
-
let E =
|
|
1351
|
+
let E = P(() => {
|
|
1352
1352
|
let e = [];
|
|
1353
1353
|
if (c > 0) for (let t = S; t <= w; t++) {
|
|
1354
1354
|
let n = y(t);
|
|
1355
|
-
e.push(/* @__PURE__ */
|
|
1355
|
+
e.push(/* @__PURE__ */ he(h, {
|
|
1356
1356
|
...m,
|
|
1357
1357
|
ariaAttributes: {
|
|
1358
1358
|
"aria-posinset": t + 1,
|
|
@@ -1379,7 +1379,7 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1379
1379
|
m,
|
|
1380
1380
|
S,
|
|
1381
1381
|
w
|
|
1382
|
-
]), D = /* @__PURE__ */
|
|
1382
|
+
]), D = /* @__PURE__ */ R("div", {
|
|
1383
1383
|
"aria-hidden": !0,
|
|
1384
1384
|
style: {
|
|
1385
1385
|
height: b(),
|
|
@@ -1387,7 +1387,7 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1387
1387
|
zIndex: -1
|
|
1388
1388
|
}
|
|
1389
1389
|
});
|
|
1390
|
-
return
|
|
1390
|
+
return he(d, {
|
|
1391
1391
|
role: "list",
|
|
1392
1392
|
...p,
|
|
1393
1393
|
className: t,
|
|
@@ -1408,25 +1408,25 @@ var Ct = {
|
|
|
1408
1408
|
checkIcon: "_checkIcon_3wv6u_19",
|
|
1409
1409
|
stateLabel: "_stateLabel_3wv6u_23"
|
|
1410
1410
|
}, 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__ */
|
|
1411
|
+
let u = i[e], d = rt(u.iconUrl, u.type, u.displayName ?? u.id, f.SM), m = u.id === a;
|
|
1412
|
+
return /* @__PURE__ */ R("div", {
|
|
1413
1413
|
style: t,
|
|
1414
1414
|
...n,
|
|
1415
|
-
children: /* @__PURE__ */
|
|
1415
|
+
children: /* @__PURE__ */ R(p, {
|
|
1416
1416
|
type: "button",
|
|
1417
1417
|
className: s(Ct.item, "flex h-full w-full items-center gap-3 px-4"),
|
|
1418
|
-
iconBefore: /* @__PURE__ */
|
|
1418
|
+
iconBefore: /* @__PURE__ */ R("span", {
|
|
1419
1419
|
className: Ct.itemIcon,
|
|
1420
1420
|
children: d
|
|
1421
1421
|
}),
|
|
1422
|
-
label: /* @__PURE__ */
|
|
1422
|
+
label: /* @__PURE__ */ z("span", {
|
|
1423
1423
|
className: "flex flex-1 items-center justify-between gap-2",
|
|
1424
|
-
children: [/* @__PURE__ */
|
|
1424
|
+
children: [/* @__PURE__ */ R(r, {
|
|
1425
1425
|
text: u.displayName ?? u.id,
|
|
1426
1426
|
query: c,
|
|
1427
1427
|
maxLines: 1,
|
|
1428
1428
|
className: s(o, "min-w-0 flex-1 text-start")
|
|
1429
|
-
}), m && /* @__PURE__ */
|
|
1429
|
+
}), m && /* @__PURE__ */ R(re, {
|
|
1430
1430
|
size: f.SM,
|
|
1431
1431
|
className: Ct.checkIcon,
|
|
1432
1432
|
"aria-hidden": !0
|
|
@@ -1436,12 +1436,12 @@ var Ct = {
|
|
|
1436
1436
|
})
|
|
1437
1437
|
});
|
|
1438
1438
|
}, 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
|
-
|
|
1439
|
+
let [h, g] = I("");
|
|
1440
|
+
M(() => {
|
|
1441
1441
|
e || g("");
|
|
1442
1442
|
}, [e]);
|
|
1443
|
-
let _ = a && a.length > 0, v = l !== void 0, y = !_ && !v ? u ?? d : void 0, b = _ ?
|
|
1444
|
-
return /* @__PURE__ */
|
|
1443
|
+
let _ = a && a.length > 0, v = l !== void 0, y = !_ && !v ? u ?? d : void 0, b = _ ? nt(a, h) : [];
|
|
1444
|
+
return /* @__PURE__ */ z(H, {
|
|
1445
1445
|
isOpen: e,
|
|
1446
1446
|
title: t,
|
|
1447
1447
|
closeLabel: n,
|
|
@@ -1449,19 +1449,19 @@ var Ct = {
|
|
|
1449
1449
|
style: f,
|
|
1450
1450
|
titleClassName: p,
|
|
1451
1451
|
className: "max-h-[80dvh]",
|
|
1452
|
-
children: [_ && !v && /* @__PURE__ */
|
|
1452
|
+
children: [_ && !v && /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("div", {
|
|
1453
1453
|
className: "flex-shrink-0 px-4 py-[10px]",
|
|
1454
|
-
children: /* @__PURE__ */
|
|
1454
|
+
children: /* @__PURE__ */ R(C, {
|
|
1455
1455
|
value: h,
|
|
1456
1456
|
placeholder: r,
|
|
1457
1457
|
size: k.Standard,
|
|
1458
1458
|
onChange: g
|
|
1459
1459
|
})
|
|
1460
|
-
}), /* @__PURE__ */
|
|
1460
|
+
}), /* @__PURE__ */ R("div", { className: s(Ct.divider, "h-px flex-shrink-0") })] }), v ? /* @__PURE__ */ R(et, { loadingLabel: l }) : y ? /* @__PURE__ */ R("div", {
|
|
1461
1461
|
role: "list",
|
|
1462
1462
|
className: s(Ct.stateLabel, m, "px-4 py-4"),
|
|
1463
1463
|
children: y
|
|
1464
|
-
}) : /* @__PURE__ */
|
|
1464
|
+
}) : /* @__PURE__ */ R(St, {
|
|
1465
1465
|
role: "list",
|
|
1466
1466
|
className: "overflow-y-auto",
|
|
1467
1467
|
style: { height: Math.min(b.length, Tt) * wt },
|
|
@@ -1480,22 +1480,22 @@ var Ct = {
|
|
|
1480
1480
|
})]
|
|
1481
1481
|
});
|
|
1482
1482
|
}, 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] =
|
|
1483
|
+
let [_, y] = I(!1), { selectorIcon: b, selectorAriaLabel: x, selectedLabel: S, menuItems: C, menuHeader: w, onOpenChange: T } = it({
|
|
1484
1484
|
deployments: e,
|
|
1485
1485
|
selectedDeploymentId: t,
|
|
1486
1486
|
onDeploymentChange: n,
|
|
1487
1487
|
modelSelectorLabels: r
|
|
1488
1488
|
});
|
|
1489
1489
|
if (!e) return null;
|
|
1490
|
-
let E = i || c ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, D = /* @__PURE__ */
|
|
1490
|
+
let E = i || c ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, D = /* @__PURE__ */ R(ie, {
|
|
1491
1491
|
size: f.SM,
|
|
1492
|
-
className:
|
|
1492
|
+
className: X.modelSelectorCaret,
|
|
1493
1493
|
"aria-hidden": !0
|
|
1494
1494
|
});
|
|
1495
|
-
return a ? /* @__PURE__ */
|
|
1495
|
+
return a ? /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R(O, {
|
|
1496
1496
|
tooltip: S,
|
|
1497
|
-
children: /* @__PURE__ */
|
|
1498
|
-
icon: /* @__PURE__ */
|
|
1497
|
+
children: /* @__PURE__ */ R(v, {
|
|
1498
|
+
icon: /* @__PURE__ */ z("div", {
|
|
1499
1499
|
className: "flex items-center gap-1",
|
|
1500
1500
|
children: [b, D]
|
|
1501
1501
|
}),
|
|
@@ -1503,16 +1503,16 @@ var Ct = {
|
|
|
1503
1503
|
onClick: () => {
|
|
1504
1504
|
c || y(!0);
|
|
1505
1505
|
},
|
|
1506
|
-
className: s(
|
|
1506
|
+
className: s(X.modelSelectorButton, E)
|
|
1507
1507
|
})
|
|
1508
|
-
}), u ? /* @__PURE__ */
|
|
1508
|
+
}), u ? /* @__PURE__ */ R(H, {
|
|
1509
1509
|
isOpen: _,
|
|
1510
1510
|
title: r?.ariaLabel ?? "Select model",
|
|
1511
1511
|
closeLabel: r?.closeLabel ?? "Close",
|
|
1512
1512
|
onClose: () => y(!1),
|
|
1513
1513
|
style: l,
|
|
1514
1514
|
children: u(() => y(!1))
|
|
1515
|
-
}) : /* @__PURE__ */
|
|
1515
|
+
}) : /* @__PURE__ */ R(Dt, {
|
|
1516
1516
|
isOpen: _,
|
|
1517
1517
|
title: r?.ariaLabel ?? "Select model",
|
|
1518
1518
|
closeLabel: r?.closeLabel ?? "Close",
|
|
@@ -1525,7 +1525,7 @@ var Ct = {
|
|
|
1525
1525
|
errorLabel: r?.error,
|
|
1526
1526
|
emptyLabel: r?.empty,
|
|
1527
1527
|
style: l
|
|
1528
|
-
})] }) : u ? /* @__PURE__ */
|
|
1528
|
+
})] }) : u ? /* @__PURE__ */ R(h, {
|
|
1529
1529
|
placement: "top-end",
|
|
1530
1530
|
matchReferenceWidth: !1,
|
|
1531
1531
|
open: d,
|
|
@@ -1534,24 +1534,24 @@ var Ct = {
|
|
|
1534
1534
|
outsideClosable: !0,
|
|
1535
1535
|
renderOverlay: () => u(() => m?.(!1)),
|
|
1536
1536
|
listClassName: "cp-dropdown-overlay !w-[320px]",
|
|
1537
|
-
children: /* @__PURE__ */
|
|
1537
|
+
children: /* @__PURE__ */ R(O, {
|
|
1538
1538
|
tooltip: S,
|
|
1539
|
-
children: /* @__PURE__ */
|
|
1539
|
+
children: /* @__PURE__ */ z("button", {
|
|
1540
1540
|
type: "button",
|
|
1541
1541
|
"aria-label": x,
|
|
1542
|
-
className: s("flex items-center justify-center gap-1 rounded-md p-2",
|
|
1542
|
+
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
1543
|
onClick: () => {
|
|
1544
1544
|
!o && !i && !c && p?.();
|
|
1545
1545
|
},
|
|
1546
1546
|
children: [b, D]
|
|
1547
1547
|
})
|
|
1548
1548
|
})
|
|
1549
|
-
}) : /* @__PURE__ */
|
|
1549
|
+
}) : /* @__PURE__ */ R("div", {
|
|
1550
1550
|
className: s(c && E),
|
|
1551
1551
|
"aria-disabled": c || void 0,
|
|
1552
|
-
children: /* @__PURE__ */
|
|
1552
|
+
children: /* @__PURE__ */ R(O, {
|
|
1553
1553
|
tooltip: S,
|
|
1554
|
-
children: /* @__PURE__ */
|
|
1554
|
+
children: /* @__PURE__ */ R(g, {
|
|
1555
1555
|
icon: b,
|
|
1556
1556
|
ariaLabel: x,
|
|
1557
1557
|
items: C,
|
|
@@ -1563,12 +1563,12 @@ var Ct = {
|
|
|
1563
1563
|
size: k.Standard,
|
|
1564
1564
|
caretIcon: D,
|
|
1565
1565
|
iconClassName: o || c ? E : void 0,
|
|
1566
|
-
buttonClassName: s("bg-transparent",
|
|
1566
|
+
buttonClassName: s("bg-transparent", X.modelSelectorButton, (o || c) && E && X.modelSelectorButtonDisabled)
|
|
1567
1567
|
})
|
|
1568
1568
|
})
|
|
1569
1569
|
});
|
|
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
|
|
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: 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 }) => {
|
|
1571
|
+
let Ie = c(), [ze, Be] = I(!1), Ve = Me(Ee), U = P(() => o({
|
|
1572
1572
|
"--ci-bg": k?.background,
|
|
1573
1573
|
"--ci-text": k?.text,
|
|
1574
1574
|
"--ci-border": k?.border,
|
|
@@ -1580,60 +1580,61 @@ var Ct = {
|
|
|
1580
1580
|
"--ci-send-bg": k?.sendBackground,
|
|
1581
1581
|
"--ci-send-text": k?.sendText,
|
|
1582
1582
|
"--ci-stop-color": k?.stopColor
|
|
1583
|
-
}), [k]), He =
|
|
1583
|
+
}), [k]), He = P(() => V ? [{
|
|
1584
1584
|
key: "dial-fs",
|
|
1585
|
-
label:
|
|
1586
|
-
icon: /* @__PURE__ */
|
|
1585
|
+
label: H ?? "DIAL file system",
|
|
1586
|
+
icon: /* @__PURE__ */ R(oe, {
|
|
1587
1587
|
size: l,
|
|
1588
1588
|
"aria-hidden": !0
|
|
1589
1589
|
}),
|
|
1590
|
-
onClick:
|
|
1591
|
-
}] : [], [
|
|
1590
|
+
onClick: V
|
|
1591
|
+
}] : [], [V, H]), { message: W, setMessage: G, textareaRef: Ue, isMultiLine: We } = Ne({
|
|
1592
1592
|
messageProp: e,
|
|
1593
1593
|
messageRevision: t
|
|
1594
|
-
}), { attachments:
|
|
1595
|
-
initialAttachments:
|
|
1594
|
+
}), { attachments: K, buildAttachments: q, addAttachments: J, resetAttachments: Ke, handleRemove: qe, handleRetry: Y, handleExpand: Je, hasBlockedAttachments: Qe } = Oe({
|
|
1595
|
+
initialAttachments: fe,
|
|
1596
1596
|
onUploadAttachment: r,
|
|
1597
1597
|
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
|
|
1598
|
+
validateAttachment: De,
|
|
1599
|
+
pendingDropFiles: A,
|
|
1600
|
+
onDropFilesConsumed: ne,
|
|
1601
|
+
pendingAttachments: re,
|
|
1602
|
+
onPendingAttachmentsConsumed: ie,
|
|
1603
|
+
onExpandPastedText: j((e) => {
|
|
1604
|
+
G((t) => t ? `${t}\n${e}` : e);
|
|
1605
|
+
}, [G]),
|
|
1606
|
+
maximumAttachmentsAmount: Pe,
|
|
1607
|
+
baseAttachmentsAmount: B.length,
|
|
1608
|
+
onAttachmentsLimitExceeded: Fe
|
|
1609
|
+
}), { state: $e, analyserNodeRef: et, elapsedSeconds: tt, errorMessage: nt, startRecording: rt, stopRecording: it, discardRecording: at } = Le({ onAttachAudio: j((e) => {
|
|
1610
|
+
J(q([e]));
|
|
1611
|
+
}, [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 () => {
|
|
1612
|
+
if (ve) return;
|
|
1613
|
+
let e = W, t = K;
|
|
1614
|
+
G(""), Ve.reset();
|
|
1614
1615
|
try {
|
|
1615
1616
|
await n?.(e, t), t.forEach((e) => {
|
|
1616
1617
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl);
|
|
1617
|
-
}),
|
|
1618
|
+
}), Ke([]);
|
|
1618
1619
|
} catch {
|
|
1619
|
-
|
|
1620
|
+
G(e), Ke(t);
|
|
1620
1621
|
}
|
|
1621
|
-
},
|
|
1622
|
-
if (!e.nativeEvent.isComposing && !
|
|
1623
|
-
let t = e.currentTarget.selectionStart ?? 0, n =
|
|
1622
|
+
}, mt = (e) => {
|
|
1623
|
+
if (!e.nativeEvent.isComposing && !N && !a && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
|
|
1624
|
+
let t = e.currentTarget.selectionStart ?? 0, n = Ve.navigate(e.key === "ArrowUp" ? "up" : "down", W, t);
|
|
1624
1625
|
if (n !== null) {
|
|
1625
|
-
e.preventDefault(),
|
|
1626
|
+
e.preventDefault(), G(n);
|
|
1626
1627
|
return;
|
|
1627
1628
|
}
|
|
1628
1629
|
}
|
|
1629
|
-
e.key === "Enter" && (
|
|
1630
|
-
},
|
|
1630
|
+
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());
|
|
1631
|
+
}, ht = (e) => {
|
|
1631
1632
|
let t = Array.from(e.target.files ?? []);
|
|
1632
1633
|
if (t.length === 0) return;
|
|
1633
|
-
let n =
|
|
1634
|
-
e.target.value = "",
|
|
1634
|
+
let n = q(t);
|
|
1635
|
+
e.target.value = "", J(n);
|
|
1635
1636
|
};
|
|
1636
|
-
if ($e !== "idle") return /* @__PURE__ */
|
|
1637
|
+
if ($e !== "idle") return /* @__PURE__ */ R(Ye, {
|
|
1637
1638
|
state: $e,
|
|
1638
1639
|
analyserNodeRef: et,
|
|
1639
1640
|
elapsedSeconds: tt,
|
|
@@ -1643,218 +1644,219 @@ var Ct = {
|
|
|
1643
1644
|
stopLabel: E,
|
|
1644
1645
|
discardLabel: D,
|
|
1645
1646
|
timerLabel: O,
|
|
1646
|
-
style:
|
|
1647
|
-
className:
|
|
1647
|
+
style: U,
|
|
1648
|
+
className: te
|
|
1648
1649
|
});
|
|
1649
|
-
let
|
|
1650
|
-
className: s(
|
|
1650
|
+
let gt = /* @__PURE__ */ R("textarea", {
|
|
1651
|
+
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
1652
|
ref: Ue,
|
|
1652
|
-
autoFocus:
|
|
1653
|
-
value:
|
|
1653
|
+
autoFocus: we,
|
|
1654
|
+
value: W,
|
|
1654
1655
|
onChange: (e) => {
|
|
1655
|
-
|
|
1656
|
+
G(e.target.value), Ve.notifyChange(), u?.(e.target.value);
|
|
1656
1657
|
},
|
|
1657
|
-
onKeyDown:
|
|
1658
|
-
onPaste:
|
|
1658
|
+
onKeyDown: mt,
|
|
1659
|
+
onPaste: ct,
|
|
1659
1660
|
placeholder: p,
|
|
1660
1661
|
"aria-label": m,
|
|
1661
|
-
disabled:
|
|
1662
|
+
disabled: N,
|
|
1662
1663
|
rows: 1
|
|
1663
1664
|
});
|
|
1664
|
-
return /* @__PURE__ */
|
|
1665
|
-
ref:
|
|
1666
|
-
style:
|
|
1667
|
-
className: s(
|
|
1668
|
-
children: [(
|
|
1669
|
-
attachments: [...
|
|
1665
|
+
return /* @__PURE__ */ z("div", {
|
|
1666
|
+
ref: st,
|
|
1667
|
+
style: U,
|
|
1668
|
+
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),
|
|
1669
|
+
children: [(B.length > 0 || K.length > 0) && /* @__PURE__ */ R(xe, {
|
|
1670
|
+
attachments: [...B, ...K],
|
|
1670
1671
|
onRemove: (e) => {
|
|
1671
|
-
|
|
1672
|
+
B.some((t) => t.id === e) ? Se?.(e) : qe(e);
|
|
1672
1673
|
},
|
|
1673
|
-
onRetry:
|
|
1674
|
-
onExpand:
|
|
1674
|
+
onRetry: Y,
|
|
1675
|
+
onExpand: Je,
|
|
1675
1676
|
labels: {
|
|
1676
1677
|
removeLabel: x,
|
|
1677
1678
|
retryLabel: S
|
|
1678
1679
|
},
|
|
1679
|
-
onAttachmentClick:
|
|
1680
|
-
let t = [...
|
|
1681
|
-
t != null &&
|
|
1680
|
+
onAttachmentClick: Ae == null ? void 0 : (e) => {
|
|
1681
|
+
let t = [...B, ...K].find((t) => t.id === e);
|
|
1682
|
+
t != null && Ae(t);
|
|
1682
1683
|
}
|
|
1683
|
-
}),
|
|
1684
|
+
}), ge ? $ && gt : /* @__PURE__ */ z("div", {
|
|
1684
1685
|
className: s("flex items-center gap-2", $ ? "flex-wrap" : "flex-wrap desktop:flex-nowrap"),
|
|
1685
1686
|
children: [
|
|
1686
|
-
!
|
|
1687
|
+
!me && /* @__PURE__ */ z("div", {
|
|
1687
1688
|
className: s("order-2 flex", !$ && "desktop:order-1"),
|
|
1688
|
-
children: [/* @__PURE__ */
|
|
1689
|
-
ref:
|
|
1689
|
+
children: [/* @__PURE__ */ R("input", {
|
|
1690
|
+
ref: ot,
|
|
1690
1691
|
type: "file",
|
|
1691
1692
|
multiple: !0,
|
|
1692
1693
|
accept: g,
|
|
1693
1694
|
className: "sr-only",
|
|
1694
1695
|
"aria-hidden": !0,
|
|
1695
1696
|
tabIndex: -1,
|
|
1696
|
-
onChange:
|
|
1697
|
-
}), /* @__PURE__ */
|
|
1698
|
-
onAttachClick:
|
|
1697
|
+
onChange: ht
|
|
1698
|
+
}), /* @__PURE__ */ R(Ge, {
|
|
1699
|
+
onAttachClick: he ? void 0 : () => ot.current?.click(),
|
|
1699
1700
|
attachLabel: h,
|
|
1700
1701
|
addMenuTitle: _,
|
|
1701
1702
|
menuTitle: y,
|
|
1702
1703
|
menuCloseLabel: b,
|
|
1703
|
-
style:
|
|
1704
|
-
isDisabled:
|
|
1705
|
-
chatSettings:
|
|
1704
|
+
style: U,
|
|
1705
|
+
isDisabled: N,
|
|
1706
|
+
chatSettings: Ce,
|
|
1706
1707
|
extraMenuItems: He
|
|
1707
1708
|
})]
|
|
1708
1709
|
}),
|
|
1709
|
-
/* @__PURE__ */
|
|
1710
|
+
/* @__PURE__ */ R("div", {
|
|
1710
1711
|
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:
|
|
1712
|
+
children: gt
|
|
1712
1713
|
}),
|
|
1713
|
-
/* @__PURE__ */
|
|
1714
|
+
/* @__PURE__ */ z("div", {
|
|
1714
1715
|
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:
|
|
1716
|
+
children: [M ? M({
|
|
1717
|
+
canSend: lt,
|
|
1718
|
+
onSend: pt
|
|
1719
|
+
}) : /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R(Ot, {
|
|
1720
|
+
deployments: ce,
|
|
1721
|
+
selectedDeploymentId: le,
|
|
1722
|
+
onDeploymentChange: ue,
|
|
1723
|
+
modelSelectorLabels: de,
|
|
1723
1724
|
isStreaming: a,
|
|
1724
|
-
isMobile:
|
|
1725
|
-
isInputDisabled:
|
|
1726
|
-
isDisabled:
|
|
1727
|
-
style:
|
|
1728
|
-
modelPickerOverlay:
|
|
1729
|
-
isPickerOpen:
|
|
1730
|
-
onPickerToggle: () =>
|
|
1731
|
-
onPickerOpenChange:
|
|
1732
|
-
}), a && i ? /* @__PURE__ */
|
|
1725
|
+
isMobile: Ie,
|
|
1726
|
+
isInputDisabled: N,
|
|
1727
|
+
isDisabled: _e,
|
|
1728
|
+
style: U,
|
|
1729
|
+
modelPickerOverlay: je,
|
|
1730
|
+
isPickerOpen: ze,
|
|
1731
|
+
onPickerToggle: () => Be((e) => !e),
|
|
1732
|
+
onPickerOpenChange: Be
|
|
1733
|
+
}), a && i ? /* @__PURE__ */ R(Ze, {
|
|
1733
1734
|
onStop: i,
|
|
1734
1735
|
ariaLabel: w
|
|
1735
|
-
}) : !a &&
|
|
1736
|
-
onSend:
|
|
1737
|
-
isDisabled: !
|
|
1736
|
+
}) : !a && ut && /* @__PURE__ */ R(Xe, {
|
|
1737
|
+
onSend: pt,
|
|
1738
|
+
isDisabled: !ft || Qe || ve,
|
|
1738
1739
|
ariaLabel: C,
|
|
1739
|
-
isExiting:
|
|
1740
|
-
},
|
|
1741
|
-
icon: /* @__PURE__ */
|
|
1740
|
+
isExiting: Q
|
|
1741
|
+
}, dt)] }), ye && !Q && /* @__PURE__ */ R(v, {
|
|
1742
|
+
icon: /* @__PURE__ */ R(se, {
|
|
1742
1743
|
size: f.LG,
|
|
1743
1744
|
"aria-hidden": !0
|
|
1744
1745
|
}),
|
|
1745
1746
|
"aria-label": T,
|
|
1746
1747
|
className: "size-8 flex-shrink-0",
|
|
1747
1748
|
onClick: rt,
|
|
1748
|
-
disabled:
|
|
1749
|
+
disabled: N || a
|
|
1749
1750
|
})]
|
|
1750
1751
|
})
|
|
1751
1752
|
]
|
|
1752
1753
|
})]
|
|
1753
1754
|
});
|
|
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__ */
|
|
1755
|
+
}, 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 }) => {
|
|
1756
|
+
let { colors: u, typography: d } = r ?? {};
|
|
1757
|
+
return /* @__PURE__ */ z("div", {
|
|
1757
1758
|
style: o({
|
|
1758
|
-
"--ci-root-bg":
|
|
1759
|
-
"--ci-welcome-color":
|
|
1759
|
+
"--ci-root-bg": u?.background,
|
|
1760
|
+
"--ci-welcome-color": u?.welcomeText
|
|
1760
1761
|
}),
|
|
1761
1762
|
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",
|
|
1763
|
+
children: [n && /* @__PURE__ */ R("h1", {
|
|
1764
|
+
className: s(jt.welcome, "m-0 text-center", d?.welcomeClassName),
|
|
1764
1765
|
children: n
|
|
1765
|
-
}), /* @__PURE__ */
|
|
1766
|
+
}), /* @__PURE__ */ R("div", {
|
|
1766
1767
|
className: "relative w-full max-w-[748px]",
|
|
1767
|
-
children: /* @__PURE__ */
|
|
1768
|
+
children: /* @__PURE__ */ R(At, {
|
|
1768
1769
|
placeholder: t,
|
|
1769
1770
|
isStreaming: e,
|
|
1770
|
-
isInputDisabled:
|
|
1771
|
-
...
|
|
1772
|
-
|
|
1773
|
-
|
|
1771
|
+
isInputDisabled: c,
|
|
1772
|
+
...l,
|
|
1773
|
+
className: a,
|
|
1774
|
+
colors: u?.input,
|
|
1775
|
+
typography: d?.input
|
|
1774
1776
|
})
|
|
1775
1777
|
})]
|
|
1776
1778
|
});
|
|
1777
1779
|
}, 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 && (
|
|
1780
|
+
let ee = F(null), [te, A] = I([]);
|
|
1781
|
+
M(() => {
|
|
1782
|
+
v?.length && (A(v), y?.());
|
|
1781
1783
|
}, [v, y]);
|
|
1782
|
-
let [
|
|
1783
|
-
|
|
1784
|
-
},
|
|
1785
|
-
r(e,
|
|
1786
|
-
}, [
|
|
1787
|
-
|
|
1788
|
-
},
|
|
1784
|
+
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) => {
|
|
1785
|
+
ce((t) => t.filter((t) => t.id !== e));
|
|
1786
|
+
}, fe = j((e, t) => {
|
|
1787
|
+
r(e, se, t);
|
|
1788
|
+
}, [se, r]), pe = () => {
|
|
1789
|
+
ue && fe(ne, ie);
|
|
1790
|
+
}, me = j(() => A([]), []), he = j((e) => {
|
|
1789
1791
|
let t = Array.from(e.target.files ?? []);
|
|
1790
|
-
t.length !== 0 && (e.target.value = "",
|
|
1791
|
-
}, []),
|
|
1792
|
+
t.length !== 0 && (e.target.value = "", A(t));
|
|
1793
|
+
}, []), ge = P(() => T ? [{
|
|
1792
1794
|
key: "dial-fs",
|
|
1793
1795
|
label: E ?? "DIAL file system",
|
|
1794
|
-
icon: /* @__PURE__ */
|
|
1796
|
+
icon: /* @__PURE__ */ R(oe, {
|
|
1795
1797
|
size: l,
|
|
1796
1798
|
"aria-hidden": !0
|
|
1797
1799
|
}),
|
|
1798
1800
|
onClick: T
|
|
1799
1801
|
}] : [], [T, E]);
|
|
1800
|
-
return /* @__PURE__ */
|
|
1802
|
+
return /* @__PURE__ */ z("div", {
|
|
1801
1803
|
className: s("flex w-full flex-col gap-2", _),
|
|
1802
|
-
children: [/* @__PURE__ */
|
|
1804
|
+
children: [/* @__PURE__ */ R(At, {
|
|
1803
1805
|
message: e,
|
|
1804
1806
|
ariaLabel: u,
|
|
1805
1807
|
isStacked: !0,
|
|
1806
1808
|
hideActionBar: !0,
|
|
1807
|
-
pendingDropFiles:
|
|
1808
|
-
onDropFilesConsumed:
|
|
1809
|
-
onSend:
|
|
1809
|
+
pendingDropFiles: te,
|
|
1810
|
+
onDropFilesConsumed: me,
|
|
1811
|
+
onSend: fe,
|
|
1810
1812
|
onUploadAttachment: a,
|
|
1811
|
-
onChange:
|
|
1812
|
-
onAttachmentsChange:
|
|
1813
|
+
onChange: re,
|
|
1814
|
+
onAttachmentsChange: ae,
|
|
1813
1815
|
removeLabel: d,
|
|
1814
1816
|
retryLabel: f,
|
|
1815
1817
|
className: "max-w-full",
|
|
1816
|
-
prefixAttachments:
|
|
1817
|
-
onRemovePrefixAttachment:
|
|
1818
|
+
prefixAttachments: se,
|
|
1819
|
+
onRemovePrefixAttachment: de,
|
|
1818
1820
|
validateAttachment: b,
|
|
1819
1821
|
maximumAttachmentsAmount: C,
|
|
1820
1822
|
onAttachmentsLimitExceeded: w,
|
|
1821
1823
|
pendingAttachments: D,
|
|
1822
1824
|
onPendingAttachmentsConsumed: O,
|
|
1823
1825
|
onAttachmentClick: k
|
|
1824
|
-
}), /* @__PURE__ */
|
|
1826
|
+
}), /* @__PURE__ */ z("div", {
|
|
1825
1827
|
className: "flex items-center justify-between",
|
|
1826
|
-
children: [/* @__PURE__ */
|
|
1828
|
+
children: [/* @__PURE__ */ R("div", {
|
|
1827
1829
|
className: "flex",
|
|
1828
|
-
children: !x && /* @__PURE__ */
|
|
1829
|
-
ref:
|
|
1830
|
+
children: !x && /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("input", {
|
|
1831
|
+
ref: ee,
|
|
1830
1832
|
type: "file",
|
|
1831
1833
|
multiple: !0,
|
|
1832
1834
|
accept: S,
|
|
1833
1835
|
className: "sr-only",
|
|
1834
1836
|
"aria-hidden": !0,
|
|
1835
1837
|
tabIndex: -1,
|
|
1836
|
-
onChange:
|
|
1837
|
-
}), /* @__PURE__ */
|
|
1838
|
-
onAttachClick: () =>
|
|
1838
|
+
onChange: he
|
|
1839
|
+
}), /* @__PURE__ */ R(Ge, {
|
|
1840
|
+
onAttachClick: () => ee.current?.click(),
|
|
1839
1841
|
attachLabel: m,
|
|
1840
1842
|
addMenuTitle: p,
|
|
1841
1843
|
menuTitle: h,
|
|
1842
1844
|
menuCloseLabel: g,
|
|
1843
|
-
extraMenuItems:
|
|
1845
|
+
extraMenuItems: ge
|
|
1844
1846
|
})] })
|
|
1845
|
-
}), /* @__PURE__ */
|
|
1847
|
+
}), /* @__PURE__ */ z("div", {
|
|
1846
1848
|
className: "flex gap-2",
|
|
1847
|
-
children: [/* @__PURE__ */
|
|
1849
|
+
children: [/* @__PURE__ */ R(W, {
|
|
1848
1850
|
label: o,
|
|
1849
1851
|
onClick: n
|
|
1850
|
-
}), /* @__PURE__ */
|
|
1852
|
+
}), /* @__PURE__ */ R(He, {
|
|
1851
1853
|
label: c,
|
|
1852
|
-
onClick:
|
|
1853
|
-
disabled: !
|
|
1854
|
+
onClick: pe,
|
|
1855
|
+
disabled: !ue
|
|
1854
1856
|
})]
|
|
1855
1857
|
})]
|
|
1856
1858
|
})]
|
|
1857
1859
|
});
|
|
1858
1860
|
};
|
|
1859
1861
|
//#endregion
|
|
1860
|
-
export {
|
|
1862
|
+
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 };
|