@epam/ai-dial-conversation-input 1.1.0-dev.51 → 1.1.0-dev.53
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/EditMessageInput/EditMessageInput.d.ts.map +1 -1
- package/components/Input/Input.d.ts.map +1 -1
- package/index.js +393 -392
- package/models/ConversationInput.d.ts +12 -0
- package/models/ConversationInput.d.ts.map +1 -1
- package/models/Input.d.ts +7 -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 ee, RadioGroupOrientation 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 A } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { IconArrowLeft as te, IconArrowNarrowRight as ne, IconCheck as re, IconChevronDown as ie, IconChevronRight as ae, IconFile as oe, IconMicrophone as se, IconPaperclip as j, IconPlayerStopFilled as ce, IconPlaystationSquare as le, IconPlus as ue, IconSettings as de, IconX as fe } from "@tabler/icons-react";
|
|
4
|
+
import { createPortal as pe } from "react-dom";
|
|
5
|
+
import { createElement as me, memo as he, useCallback as M, useEffect as N, useImperativeHandle as P, useLayoutEffect as ge, useMemo as F, useRef as I, useState as L } from "react";
|
|
6
|
+
import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
7
|
+
import { AttachmentCard as _e, AttachmentGroup as ve, AttachmentTray as ye, AttachmentTray as be, FileDndOverlay as V, MAX_UPLOADS_PER_MINUTE as xe, generateAttachmentId as Se, getAttachmentIcon as Ce, useClipboardPaste as we } from "@epam/ai-dial-attachment-input";
|
|
8
8
|
//#region src/hooks/useBottomSheet.ts
|
|
9
|
-
var
|
|
10
|
-
|
|
9
|
+
var Te = (e, t) => {
|
|
10
|
+
N(() => {
|
|
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]), N(() => {
|
|
17
17
|
if (e) return document.body.style.overflow = "hidden", () => {
|
|
18
18
|
document.body.style.overflow = "";
|
|
19
19
|
};
|
|
20
20
|
}, [e]);
|
|
21
|
-
},
|
|
21
|
+
}, H = {
|
|
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
|
-
},
|
|
28
|
-
className: s(
|
|
27
|
+
}, U = ({ 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 }) => (Te(e, r), !e || typeof document > "u" ? null : pe(/* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("div", {
|
|
28
|
+
className: s(H.backdrop, "fixed inset-0 z-[55]"),
|
|
29
29
|
onPointerDown: r,
|
|
30
30
|
"aria-hidden": !0
|
|
31
|
-
}), /* @__PURE__ */
|
|
31
|
+
}), /* @__PURE__ */ B("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(H.sheet, "fixed inset-x-0 bottom-0 z-[60] flex max-h-[85dvh] flex-col", u),
|
|
37
|
+
children: [t != null && /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ B("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__ */ z("div", {
|
|
41
41
|
className: "absolute start-4",
|
|
42
|
-
children: /* @__PURE__ */
|
|
43
|
-
icon: /* @__PURE__ */
|
|
42
|
+
children: /* @__PURE__ */ z(v, {
|
|
43
|
+
icon: /* @__PURE__ */ z(te, {
|
|
44
44
|
size: f.LG,
|
|
45
45
|
stroke: 1.5,
|
|
46
46
|
className: "rtl:scale-x-[-1]"
|
|
@@ -49,40 +49,40 @@ var Ee = (e, t) => {
|
|
|
49
49
|
onClick: i
|
|
50
50
|
})
|
|
51
51
|
}),
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
className: s(
|
|
52
|
+
/* @__PURE__ */ z("span", {
|
|
53
|
+
className: s(H.title, l),
|
|
54
54
|
children: t
|
|
55
55
|
}),
|
|
56
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ z("div", {
|
|
57
57
|
className: "absolute end-4 m-2",
|
|
58
|
-
children: /* @__PURE__ */
|
|
58
|
+
children: /* @__PURE__ */ z(m, {
|
|
59
59
|
ariaLabel: n,
|
|
60
60
|
size: f.LG,
|
|
61
61
|
onClose: r
|
|
62
62
|
})
|
|
63
63
|
})
|
|
64
64
|
]
|
|
65
|
-
}), /* @__PURE__ */
|
|
65
|
+
}), /* @__PURE__ */ z("div", { className: "h-px flex-shrink-0" })] }), /* @__PURE__ */ z("div", {
|
|
66
66
|
className: "overflow-y-auto",
|
|
67
67
|
children: d
|
|
68
68
|
})]
|
|
69
|
-
})] }), document.body)),
|
|
69
|
+
})] }), document.body)), Ee = async (e, t, n) => {
|
|
70
70
|
let r = 6e4 / t, i = [];
|
|
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
|
-
},
|
|
74
|
-
let [h, g] =
|
|
75
|
-
|
|
73
|
+
}, De = ({ 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] = L(n), _ = I(h);
|
|
75
|
+
N(() => {
|
|
76
76
|
_.current = h;
|
|
77
|
-
}, [h]),
|
|
77
|
+
}, [h]), N(() => () => {
|
|
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 = M((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: Se(),
|
|
86
86
|
name: e.name,
|
|
87
87
|
contentType: e.type,
|
|
88
88
|
file: e,
|
|
@@ -91,14 +91,14 @@ var Ee = (e, t) => {
|
|
|
91
91
|
previewUrl: a,
|
|
92
92
|
playUrl: o
|
|
93
93
|
};
|
|
94
|
-
}), []), y =
|
|
94
|
+
}), []), y = M((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 = M((e) => {
|
|
100
100
|
g(e), a?.(e);
|
|
101
|
-
}, [a]), x =
|
|
101
|
+
}, [a]), x = M(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 Ee = (e, t) => {
|
|
|
120
120
|
} : e));
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
}, [r, y]), S =
|
|
123
|
+
}, [r, y]), S = M((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 Ee = (e, t) => {
|
|
|
141
141
|
status: i.Error,
|
|
142
142
|
errorReason: n
|
|
143
143
|
} : e));
|
|
144
|
-
}),
|
|
144
|
+
}), Ee(e, xe, x);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
}, [
|
|
@@ -152,20 +152,20 @@ var Ee = (e, t) => {
|
|
|
152
152
|
x,
|
|
153
153
|
o
|
|
154
154
|
]);
|
|
155
|
-
|
|
155
|
+
N(() => {
|
|
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
|
+
]), N(() => {
|
|
163
163
|
l.length !== 0 && (S(l, !1), u?.());
|
|
164
164
|
}, [
|
|
165
165
|
S,
|
|
166
166
|
u,
|
|
167
167
|
l
|
|
168
|
-
]),
|
|
168
|
+
]), N(() => {
|
|
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 Ee = (e, t) => {
|
|
|
192
192
|
y,
|
|
193
193
|
x
|
|
194
194
|
]);
|
|
195
|
-
let C =
|
|
195
|
+
let C = M((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 Ee = (e, t) => {
|
|
|
204
204
|
addAttachments: S,
|
|
205
205
|
resetAttachments: b,
|
|
206
206
|
handleRemove: C,
|
|
207
|
-
handleRetry:
|
|
207
|
+
handleRetry: M((e) => {
|
|
208
208
|
let t = h.find((t) => t.id === e);
|
|
209
209
|
t && x(t);
|
|
210
210
|
}, [h, x]),
|
|
211
|
-
handleExpand:
|
|
211
|
+
handleExpand: M(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();
|
|
@@ -220,9 +220,9 @@ var Ee = (e, t) => {
|
|
|
220
220
|
]),
|
|
221
221
|
hasBlockedAttachments: h.some((e) => e.status === i.Loading || e.status === i.Error)
|
|
222
222
|
};
|
|
223
|
-
},
|
|
224
|
-
let [n, r] =
|
|
225
|
-
return
|
|
223
|
+
}, Oe = (e, t) => {
|
|
224
|
+
let [n, r] = L(e), [i, a] = L(!1), [o, s] = L(0);
|
|
225
|
+
return N(() => {
|
|
226
226
|
if (e) {
|
|
227
227
|
r(!0), a(!1), s((e) => e + 1);
|
|
228
228
|
return;
|
|
@@ -238,18 +238,18 @@ var Ee = (e, t) => {
|
|
|
238
238
|
isExiting: i,
|
|
239
239
|
instanceKey: o
|
|
240
240
|
};
|
|
241
|
-
},
|
|
242
|
-
let t =
|
|
241
|
+
}, ke = (e, t) => !e.slice(0, t).includes("\n"), Ae = (e, t) => !e.slice(t).includes("\n"), je = (e) => {
|
|
242
|
+
let t = I(e);
|
|
243
243
|
t.current = e;
|
|
244
|
-
let n =
|
|
244
|
+
let n = I(-1), r = I(""), i = M((e, i, a) => {
|
|
245
245
|
let o = t.current;
|
|
246
|
-
return !o || o.length === 0 ? null : e === "up" ? !
|
|
247
|
-
}, []), a =
|
|
246
|
+
return !o || o.length === 0 ? null : e === "up" ? !ke(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 || !Ae(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
|
|
247
|
+
}, []), a = M(() => {
|
|
248
248
|
n.current = -1, r.current = "";
|
|
249
|
-
}, []), o =
|
|
249
|
+
}, []), o = M(() => {
|
|
250
250
|
n.current = -1, r.current = "";
|
|
251
251
|
}, []);
|
|
252
|
-
return
|
|
252
|
+
return F(() => ({
|
|
253
253
|
navigate: i,
|
|
254
254
|
notifyChange: a,
|
|
255
255
|
reset: o
|
|
@@ -258,13 +258,13 @@ var Ee = (e, t) => {
|
|
|
258
258
|
a,
|
|
259
259
|
o
|
|
260
260
|
]);
|
|
261
|
-
},
|
|
262
|
-
let [n, r] =
|
|
263
|
-
return
|
|
261
|
+
}, Me = ({ messageProp: e, messageRevision: t }) => {
|
|
262
|
+
let [n, r] = L(e), i = I(null), a = I(0), [o, s] = L(!1);
|
|
263
|
+
return N(() => {
|
|
264
264
|
r(e);
|
|
265
|
-
}, [e, t]),
|
|
265
|
+
}, [e, t]), N(() => {
|
|
266
266
|
i.current && (a.current = i.current.offsetHeight);
|
|
267
|
-
}, []),
|
|
267
|
+
}, []), ge(() => {
|
|
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);
|
|
@@ -274,20 +274,20 @@ var Ee = (e, t) => {
|
|
|
274
274
|
textareaRef: i,
|
|
275
275
|
isMultiLine: o
|
|
276
276
|
};
|
|
277
|
-
},
|
|
277
|
+
}, Ne = /* @__PURE__ */ function(e) {
|
|
278
278
|
return e.Idle = "idle", e.Recording = "recording", e.Error = "error", e;
|
|
279
|
-
}({}),
|
|
279
|
+
}({}), Pe = [
|
|
280
280
|
"audio/webm;codecs=opus",
|
|
281
281
|
"audio/ogg;codecs=opus",
|
|
282
282
|
"audio/webm"
|
|
283
|
-
],
|
|
284
|
-
let [t, n] =
|
|
283
|
+
], Fe = () => Pe.find((e) => MediaRecorder.isTypeSupported(e)) ?? "", Ie = ({ onAttachAudio: e }) => {
|
|
284
|
+
let [t, n] = L("idle"), [r, i] = L(null), [a, o] = L(0), s = I(null), c = I(null), l = I(null), u = I(null), d = I([]), f = I(""), p = I(null), m = I(e);
|
|
285
285
|
m.current = e;
|
|
286
|
-
let h =
|
|
286
|
+
let h = M(() => {
|
|
287
287
|
p.current != null && (clearInterval(p.current), p.current = null);
|
|
288
|
-
}, []), g =
|
|
288
|
+
}, []), g = M(() => {
|
|
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]), _ = M(() => {
|
|
291
291
|
(async () => {
|
|
292
292
|
try {
|
|
293
293
|
let e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
@@ -296,7 +296,7 @@ var Ee = (e, t) => {
|
|
|
296
296
|
c.current = t;
|
|
297
297
|
let r = t.createAnalyser();
|
|
298
298
|
r.fftSize = 256, l.current = r, t.createMediaStreamSource(e).connect(r);
|
|
299
|
-
let i =
|
|
299
|
+
let i = Fe();
|
|
300
300
|
f.current = i, d.current = [];
|
|
301
301
|
let a = new MediaRecorder(e, i ? { mimeType: i } : void 0);
|
|
302
302
|
u.current = a, a.ondataavailable = (e) => {
|
|
@@ -308,17 +308,17 @@ var Ee = (e, t) => {
|
|
|
308
308
|
i(e instanceof Error ? e.message : "Microphone access denied"), n("error");
|
|
309
309
|
}
|
|
310
310
|
})();
|
|
311
|
-
}, []), v =
|
|
311
|
+
}, []), v = M(() => {
|
|
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 = M(() => {
|
|
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 N(() => () => {
|
|
322
322
|
g();
|
|
323
323
|
}, [g]), {
|
|
324
324
|
state: t,
|
|
@@ -329,16 +329,16 @@ var Ee = (e, t) => {
|
|
|
329
329
|
stopRecording: v,
|
|
330
330
|
discardRecording: y
|
|
331
331
|
};
|
|
332
|
-
},
|
|
332
|
+
}, Le = /* @__PURE__ */ function(e) {
|
|
333
333
|
return e.Enter = "enter", e.MetaEnter = "meta-enter", e;
|
|
334
|
-
}({}),
|
|
334
|
+
}({}), Re = {
|
|
335
335
|
item: "_item_vou13_1",
|
|
336
336
|
itemIcon: "_itemIcon_vou13_11"
|
|
337
|
-
},
|
|
337
|
+
}, ze = ({ isOpen: e, title: t, closeLabel: n, onClose: r, style: i, items: a, className: o, titleClassName: c = "dial-body-semi-text", itemLabelClassName: l = "dial-small-text", btnTextClassName: u = "" }) => {
|
|
338
338
|
let d = (e) => {
|
|
339
339
|
e(), r();
|
|
340
340
|
};
|
|
341
|
-
return /* @__PURE__ */
|
|
341
|
+
return /* @__PURE__ */ z(U, {
|
|
342
342
|
isOpen: e,
|
|
343
343
|
title: t,
|
|
344
344
|
closeLabel: n,
|
|
@@ -346,22 +346,22 @@ var Ee = (e, t) => {
|
|
|
346
346
|
style: i,
|
|
347
347
|
className: o,
|
|
348
348
|
titleClassName: c,
|
|
349
|
-
children: /* @__PURE__ */
|
|
349
|
+
children: /* @__PURE__ */ z("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__ */ z("li", { children: /* @__PURE__ */ z(p, {
|
|
353
353
|
type: "button",
|
|
354
|
-
className: s(
|
|
355
|
-
iconBefore: /* @__PURE__ */
|
|
356
|
-
className:
|
|
354
|
+
className: s(Re.item, "flex w-full items-center gap-3 px-4 py-[10px] text-start"),
|
|
355
|
+
iconBefore: /* @__PURE__ */ z("span", {
|
|
356
|
+
className: Re.itemIcon,
|
|
357
357
|
children: n
|
|
358
358
|
}),
|
|
359
|
-
iconAfter: r ? /* @__PURE__ */
|
|
359
|
+
iconAfter: r ? /* @__PURE__ */ z("span", {
|
|
360
360
|
className: "ms-auto",
|
|
361
361
|
children: r
|
|
362
362
|
}) : null,
|
|
363
363
|
textClassName: u,
|
|
364
|
-
label: /* @__PURE__ */
|
|
364
|
+
label: /* @__PURE__ */ z("span", {
|
|
365
365
|
className: l,
|
|
366
366
|
children: t
|
|
367
367
|
}),
|
|
@@ -369,53 +369,53 @@ var Ee = (e, t) => {
|
|
|
369
369
|
}) }, e))
|
|
370
370
|
})
|
|
371
371
|
});
|
|
372
|
-
},
|
|
372
|
+
}, Be = ({ gradientId: e = "gradient-check-icon" }) => /* @__PURE__ */ B("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__ */ z("defs", { children: /* @__PURE__ */ B("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__ */ z("stop", {
|
|
386
386
|
offset: "0%",
|
|
387
387
|
stopColor: "#4b7be6"
|
|
388
|
-
}), /* @__PURE__ */
|
|
388
|
+
}), /* @__PURE__ */ z("stop", {
|
|
389
389
|
offset: "100%",
|
|
390
390
|
stopColor: "#9355f4"
|
|
391
391
|
})]
|
|
392
|
-
}) }), /* @__PURE__ */
|
|
392
|
+
}) }), /* @__PURE__ */ z("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
|
+
}), Ve = {
|
|
400
400
|
tabContainer: "_tabContainer_rzv03_1",
|
|
401
401
|
tabActive: "_tabActive_rzv03_13"
|
|
402
402
|
};
|
|
403
|
-
|
|
403
|
+
he(({ 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__ */ z("div", {
|
|
406
406
|
className: "flex flex-nowrap gap-1",
|
|
407
407
|
role: "tablist",
|
|
408
408
|
children: e.map((e) => {
|
|
409
409
|
let r = t === e.id;
|
|
410
|
-
return /* @__PURE__ */
|
|
410
|
+
return /* @__PURE__ */ z("div", {
|
|
411
411
|
role: "tab",
|
|
412
412
|
"aria-selected": r,
|
|
413
413
|
className: "contents",
|
|
414
|
-
children: /* @__PURE__ */
|
|
414
|
+
children: /* @__PURE__ */ z(D, {
|
|
415
415
|
label: e.label,
|
|
416
416
|
selected: r,
|
|
417
417
|
onClick: () => n(e.id),
|
|
418
|
-
className: s("box-border h-auto shrink-0 justify-center rounded-full p-2 text-center", i,
|
|
418
|
+
className: s("box-border h-auto shrink-0 justify-center rounded-full p-2 text-center", i, Ve.tabContainer, r && Ve.tabActive)
|
|
419
419
|
})
|
|
420
420
|
}, e.id);
|
|
421
421
|
})
|
|
@@ -423,13 +423,13 @@ ge(({ tabs: e, activeTabId: t, onTabChange: n, styles: r }) => {
|
|
|
423
423
|
});
|
|
424
424
|
//#endregion
|
|
425
425
|
//#region ../ai-dial-kit/src/components/Button/Buttons.tsx
|
|
426
|
-
var
|
|
426
|
+
var W = (e) => /* @__PURE__ */ z(x, { ...e }), He = (e) => /* @__PURE__ */ z(p, {
|
|
427
427
|
...e,
|
|
428
428
|
variant: d.Neutral,
|
|
429
429
|
appearance: u.Outlined
|
|
430
430
|
}), G = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
431
|
-
let [s, c] =
|
|
432
|
-
|
|
431
|
+
let [s, c] = L(t), [l, u] = L(n), [d, f] = L(r), p = I(o);
|
|
432
|
+
N(() => {
|
|
433
433
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
434
434
|
}, [
|
|
435
435
|
o,
|
|
@@ -446,7 +446,7 @@ var He = (e) => /* @__PURE__ */ R(x, { ...e }), W = (e) => /* @__PURE__ */ R(p,
|
|
|
446
446
|
setResponseFormat: c,
|
|
447
447
|
setSystemPrompt: u,
|
|
448
448
|
setTemperature: f,
|
|
449
|
-
handleSubmit:
|
|
449
|
+
handleSubmit: M(() => {
|
|
450
450
|
if (!m) return;
|
|
451
451
|
let t = {};
|
|
452
452
|
e.responseFormat && s != null && (t.responseFormat = s), e.systemPrompt && (t.systemPrompt = l), e.temperature && (t.temperature = d), i(t), a();
|
|
@@ -460,18 +460,18 @@ var He = (e) => /* @__PURE__ */ R(x, { ...e }), W = (e) => /* @__PURE__ */ R(p,
|
|
|
460
460
|
a
|
|
461
461
|
])
|
|
462
462
|
};
|
|
463
|
-
},
|
|
463
|
+
}, K = "!dial-small-semi-text !text-primary gap-1", Ue = ({ 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 = [
|
|
464
464
|
"Precise",
|
|
465
465
|
"Neutral",
|
|
466
466
|
"Creative"
|
|
467
|
-
], temperatureHint: g }) => /* @__PURE__ */
|
|
467
|
+
], temperatureHint: g }) => /* @__PURE__ */ B("div", {
|
|
468
468
|
className: "flex flex-col gap-4 px-6 py-3",
|
|
469
469
|
children: [
|
|
470
|
-
e.responseFormat && /* @__PURE__ */
|
|
470
|
+
e.responseFormat && /* @__PURE__ */ z(S, {
|
|
471
471
|
fieldTitle: c,
|
|
472
|
-
labelClassName:
|
|
472
|
+
labelClassName: K,
|
|
473
473
|
elementId: "response-format",
|
|
474
|
-
orientation:
|
|
474
|
+
orientation: A.Column,
|
|
475
475
|
activeRadioButton: t ?? a.Markdown,
|
|
476
476
|
labelDescription: l,
|
|
477
477
|
radioButtons: [{
|
|
@@ -483,19 +483,19 @@ var He = (e) => /* @__PURE__ */ R(x, { ...e }), W = (e) => /* @__PURE__ */ R(p,
|
|
|
483
483
|
}],
|
|
484
484
|
onChange: (e) => i(e)
|
|
485
485
|
}),
|
|
486
|
-
e.systemPrompt && /* @__PURE__ */
|
|
486
|
+
e.systemPrompt && /* @__PURE__ */ z(y, {
|
|
487
487
|
value: n,
|
|
488
488
|
placeholder: p,
|
|
489
489
|
labelProps: {
|
|
490
|
-
className:
|
|
490
|
+
className: K,
|
|
491
491
|
label: f
|
|
492
492
|
},
|
|
493
493
|
onChange: (e) => o(e ?? "")
|
|
494
494
|
}),
|
|
495
|
-
e.temperature && /* @__PURE__ */
|
|
495
|
+
e.temperature && /* @__PURE__ */ z(E, {
|
|
496
496
|
labelProps: {
|
|
497
497
|
label: m,
|
|
498
|
-
className:
|
|
498
|
+
className: K,
|
|
499
499
|
caption: g
|
|
500
500
|
},
|
|
501
501
|
value: r,
|
|
@@ -506,8 +506,8 @@ var He = (e) => /* @__PURE__ */ R(x, { ...e }), W = (e) => /* @__PURE__ */ R(p,
|
|
|
506
506
|
onChange: s
|
|
507
507
|
})
|
|
508
508
|
]
|
|
509
|
-
}),
|
|
510
|
-
let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: D, setResponseFormat: k, setSystemPrompt: ee, setTemperature:
|
|
509
|
+
}), We = ({ 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: A, handleSubmit: te } = G({
|
|
511
511
|
isOpen: e,
|
|
512
512
|
features: o,
|
|
513
513
|
initialResponseFormat: c,
|
|
@@ -516,7 +516,7 @@ var He = (e) => /* @__PURE__ */ R(x, { ...e }), W = (e) => /* @__PURE__ */ R(p,
|
|
|
516
516
|
onSave: d,
|
|
517
517
|
onClose: r
|
|
518
518
|
});
|
|
519
|
-
return /* @__PURE__ */
|
|
519
|
+
return /* @__PURE__ */ B(U, {
|
|
520
520
|
isOpen: e,
|
|
521
521
|
title: f,
|
|
522
522
|
closeLabel: i,
|
|
@@ -524,14 +524,14 @@ var He = (e) => /* @__PURE__ */ R(x, { ...e }), W = (e) => /* @__PURE__ */ R(p,
|
|
|
524
524
|
onBack: t,
|
|
525
525
|
backLabel: n,
|
|
526
526
|
style: a,
|
|
527
|
-
children: [/* @__PURE__ */
|
|
527
|
+
children: [/* @__PURE__ */ z(Ue, {
|
|
528
528
|
features: o,
|
|
529
529
|
responseFormat: w,
|
|
530
530
|
systemPrompt: T,
|
|
531
531
|
temperature: E,
|
|
532
532
|
onResponseFormatChange: k,
|
|
533
533
|
onSystemPromptChange: ee,
|
|
534
|
-
onTemperatureChange:
|
|
534
|
+
onTemperatureChange: A,
|
|
535
535
|
responseFormatLabel: p,
|
|
536
536
|
responseFormatHint: m,
|
|
537
537
|
responseFormatMarkdownLabel: h,
|
|
@@ -541,15 +541,15 @@ var He = (e) => /* @__PURE__ */ R(x, { ...e }), W = (e) => /* @__PURE__ */ R(p,
|
|
|
541
541
|
temperatureLabel: y,
|
|
542
542
|
temperatureLabels: b,
|
|
543
543
|
temperatureHint: x
|
|
544
|
-
}), /* @__PURE__ */
|
|
544
|
+
}), /* @__PURE__ */ z("div", {
|
|
545
545
|
className: s("px-6 py-4 mobile:pb-8"),
|
|
546
|
-
children: /* @__PURE__ */
|
|
546
|
+
children: /* @__PURE__ */ z(O, {
|
|
547
547
|
tooltip: C,
|
|
548
548
|
hideTooltip: D || !C,
|
|
549
549
|
triggerClassName: "w-full",
|
|
550
|
-
children: /* @__PURE__ */
|
|
550
|
+
children: /* @__PURE__ */ z(W, {
|
|
551
551
|
label: S,
|
|
552
|
-
onClick:
|
|
552
|
+
onClick: te,
|
|
553
553
|
disabled: !D,
|
|
554
554
|
className: "w-full"
|
|
555
555
|
})
|
|
@@ -565,25 +565,25 @@ var He = (e) => /* @__PURE__ */ R(x, { ...e }), W = (e) => /* @__PURE__ */ R(p,
|
|
|
565
565
|
onSave: i,
|
|
566
566
|
onClose: a
|
|
567
567
|
});
|
|
568
|
-
return /* @__PURE__ */
|
|
568
|
+
return /* @__PURE__ */ z(b, {
|
|
569
569
|
open: !0,
|
|
570
570
|
header: o,
|
|
571
571
|
size: ee.Sm,
|
|
572
572
|
onClose: a,
|
|
573
573
|
className: "!bg-layer-2",
|
|
574
|
-
footer: /* @__PURE__ */
|
|
574
|
+
footer: /* @__PURE__ */ z("div", {
|
|
575
575
|
className: "flex justify-end px-6 py-4",
|
|
576
|
-
children: /* @__PURE__ */
|
|
576
|
+
children: /* @__PURE__ */ z(O, {
|
|
577
577
|
tooltip: _,
|
|
578
578
|
hideTooltip: S || !_,
|
|
579
|
-
children: /* @__PURE__ */
|
|
579
|
+
children: /* @__PURE__ */ z(W, {
|
|
580
580
|
label: g,
|
|
581
581
|
onClick: E,
|
|
582
582
|
disabled: !S
|
|
583
583
|
})
|
|
584
584
|
})
|
|
585
585
|
}),
|
|
586
|
-
children: /* @__PURE__ */
|
|
586
|
+
children: /* @__PURE__ */ z(Ue, {
|
|
587
587
|
features: e,
|
|
588
588
|
responseFormat: v,
|
|
589
589
|
systemPrompt: y,
|
|
@@ -603,15 +603,15 @@ var He = (e) => /* @__PURE__ */ R(x, { ...e }), W = (e) => /* @__PURE__ */ R(p,
|
|
|
603
603
|
})
|
|
604
604
|
});
|
|
605
605
|
};
|
|
606
|
-
|
|
606
|
+
he(q);
|
|
607
607
|
//#endregion
|
|
608
608
|
//#region src/components/AddAttachmentButton/AddAttachmentButton.tsx
|
|
609
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] =
|
|
610
|
+
let g = c(), [_, y] = L(!1), [b, x] = L(!1), S = F(() => [
|
|
611
611
|
...e == null ? [] : [{
|
|
612
612
|
key: "attach",
|
|
613
613
|
label: t,
|
|
614
|
-
icon: /* @__PURE__ */
|
|
614
|
+
icon: /* @__PURE__ */ z(j, {
|
|
615
615
|
size: l,
|
|
616
616
|
"aria-hidden": !0
|
|
617
617
|
}),
|
|
@@ -621,11 +621,11 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
621
621
|
...p == null ? [] : [{
|
|
622
622
|
key: "chat-settings",
|
|
623
623
|
label: p.menuItemLabel ?? "Chat settings",
|
|
624
|
-
icon: /* @__PURE__ */
|
|
624
|
+
icon: /* @__PURE__ */ z(de, {
|
|
625
625
|
size: l,
|
|
626
626
|
"aria-hidden": !0
|
|
627
627
|
}),
|
|
628
|
-
iconAfter: g ? /* @__PURE__ */
|
|
628
|
+
iconAfter: g ? /* @__PURE__ */ z(ae, {
|
|
629
629
|
size: l,
|
|
630
630
|
stroke: 1.5,
|
|
631
631
|
className: "text-secondary rtl:scale-x-[-1]",
|
|
@@ -640,9 +640,9 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
640
640
|
m,
|
|
641
641
|
g
|
|
642
642
|
]);
|
|
643
|
-
return S.length === 0 ? null : /* @__PURE__ */ R
|
|
644
|
-
/* @__PURE__ */
|
|
645
|
-
icon: /* @__PURE__ */
|
|
643
|
+
return S.length === 0 ? null : /* @__PURE__ */ z(R, { children: g ? /* @__PURE__ */ B(R, { children: [
|
|
644
|
+
/* @__PURE__ */ z(v, {
|
|
645
|
+
icon: /* @__PURE__ */ z(ue, {
|
|
646
646
|
size: f.LG,
|
|
647
647
|
"aria-hidden": !0
|
|
648
648
|
}),
|
|
@@ -651,7 +651,7 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
651
651
|
className: s("size-10 flex-shrink-0", d && "pointer-events-none opacity-50"),
|
|
652
652
|
onClick: () => y(!0)
|
|
653
653
|
}),
|
|
654
|
-
/* @__PURE__ */
|
|
654
|
+
/* @__PURE__ */ z(ze, {
|
|
655
655
|
isOpen: _,
|
|
656
656
|
title: r,
|
|
657
657
|
closeLabel: i,
|
|
@@ -661,7 +661,7 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
661
661
|
className: "pb-4",
|
|
662
662
|
btnTextClassName: "flex-1"
|
|
663
663
|
}),
|
|
664
|
-
p != null && /* @__PURE__ */
|
|
664
|
+
p != null && /* @__PURE__ */ z(We, {
|
|
665
665
|
isOpen: b,
|
|
666
666
|
onBack: () => {
|
|
667
667
|
x(!1), y(!0);
|
|
@@ -688,13 +688,13 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
688
688
|
saveLabel: p.saveLabel,
|
|
689
689
|
saveDisabledTooltip: p.saveDisabledTooltip
|
|
690
690
|
})
|
|
691
|
-
] }) : /* @__PURE__ */
|
|
691
|
+
] }) : /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(h, {
|
|
692
692
|
matchReferenceWidth: !1,
|
|
693
693
|
placement: "bottom-start",
|
|
694
694
|
listClassName: u,
|
|
695
695
|
items: S,
|
|
696
|
-
children: /* @__PURE__ */
|
|
697
|
-
icon: /* @__PURE__ */
|
|
696
|
+
children: /* @__PURE__ */ z(v, {
|
|
697
|
+
icon: /* @__PURE__ */ z(ue, {
|
|
698
698
|
size: f.LG,
|
|
699
699
|
"aria-hidden": !0
|
|
700
700
|
}),
|
|
@@ -703,7 +703,7 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
703
703
|
className: "size-10 flex-shrink-0",
|
|
704
704
|
disabled: d
|
|
705
705
|
})
|
|
706
|
-
}), p != null && b && /* @__PURE__ */
|
|
706
|
+
}), p != null && b && /* @__PURE__ */ z(q, {
|
|
707
707
|
features: p.features,
|
|
708
708
|
initialResponseFormat: p.responseFormat ?? a.Markdown,
|
|
709
709
|
initialSystemPrompt: p.systemPrompt,
|
|
@@ -731,29 +731,29 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
731
731
|
stopRecordingIcon: "_stopRecordingIcon_8j81i_28",
|
|
732
732
|
recordingDot: "_recordingDot_8j81i_42",
|
|
733
733
|
"recording-pulse": "_recording-pulse_8j81i_1"
|
|
734
|
-
}, Ke = 3,
|
|
735
|
-
let p =
|
|
734
|
+
}, Ke = 3, Y = 4, X = 200, qe = (e) => `${String(Math.floor(e / 60)).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`, Je = ({ 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 = I(null), m = I(new Float32Array(X)), h = I(0), g = I(0), y = e === Ne.Recording, b = e === Ne.Error, x = M((e) => {
|
|
736
736
|
let t = e.getContext("2d");
|
|
737
737
|
if (!t) return;
|
|
738
738
|
e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
|
|
739
739
|
let { width: n, height: r } = e;
|
|
740
740
|
t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
|
|
741
|
-
let i = Math.min(Math.max(1, Math.floor(n /
|
|
741
|
+
let i = Math.min(Math.max(1, Math.floor(n / Y)), X - 1), a = h.current, o = g.current;
|
|
742
742
|
t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
|
|
743
743
|
for (let e = 0; e <= i; e++) {
|
|
744
|
-
let n = ((a - i + e) %
|
|
745
|
-
t.fillRect(e *
|
|
744
|
+
let n = ((a - i + e) % X + X) % X, o = m.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
|
|
745
|
+
t.fillRect(e * Y, (r - c) / 2, Ke, c);
|
|
746
746
|
}
|
|
747
747
|
t.restore();
|
|
748
748
|
}, []);
|
|
749
|
-
|
|
749
|
+
N(() => {
|
|
750
750
|
if (!y) return;
|
|
751
751
|
let e = p.current;
|
|
752
752
|
if (!e) return;
|
|
753
753
|
m.current.fill(0), h.current = 0, g.current = 0;
|
|
754
754
|
let n, r = () => {
|
|
755
|
-
if (g.current += 1, g.current >=
|
|
756
|
-
g.current -=
|
|
755
|
+
if (g.current += 1, g.current >= Y) {
|
|
756
|
+
g.current -= Y;
|
|
757
757
|
let e = t.current;
|
|
758
758
|
if (e) {
|
|
759
759
|
let t = new Uint8Array(e.frequencyBinCount);
|
|
@@ -763,7 +763,7 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
763
763
|
let r = (t[e] - 128) / 128;
|
|
764
764
|
n += r * r;
|
|
765
765
|
}
|
|
766
|
-
m.current[h.current %
|
|
766
|
+
m.current[h.current % X] = Math.sqrt(n / t.length), h.current++;
|
|
767
767
|
}
|
|
768
768
|
}
|
|
769
769
|
x(e), n = requestAnimationFrame(r);
|
|
@@ -775,7 +775,7 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
775
775
|
y,
|
|
776
776
|
t,
|
|
777
777
|
x
|
|
778
|
-
]),
|
|
778
|
+
]), N(() => {
|
|
779
779
|
let e = p.current;
|
|
780
780
|
if (!e) return;
|
|
781
781
|
let t = new ResizeObserver(() => {
|
|
@@ -783,18 +783,18 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
783
783
|
});
|
|
784
784
|
return t.observe(e), () => t.disconnect();
|
|
785
785
|
}, [x]);
|
|
786
|
-
let S = /* @__PURE__ */
|
|
786
|
+
let S = /* @__PURE__ */ B("div", {
|
|
787
787
|
className: "flex flex-shrink-0 items-center justify-end gap-1",
|
|
788
|
-
children: [/* @__PURE__ */
|
|
789
|
-
icon: /* @__PURE__ */
|
|
788
|
+
children: [/* @__PURE__ */ z(v, {
|
|
789
|
+
icon: /* @__PURE__ */ z(fe, {
|
|
790
790
|
size: f.LG,
|
|
791
791
|
"aria-hidden": !0
|
|
792
792
|
}),
|
|
793
793
|
"aria-label": c,
|
|
794
794
|
className: "size-10 flex-shrink-0",
|
|
795
795
|
onClick: a
|
|
796
|
-
}), y && /* @__PURE__ */
|
|
797
|
-
icon: /* @__PURE__ */
|
|
796
|
+
}), y && /* @__PURE__ */ z(v, {
|
|
797
|
+
icon: /* @__PURE__ */ z(ce, {
|
|
798
798
|
size: f.LG,
|
|
799
799
|
className: J.stopRecordingIcon,
|
|
800
800
|
"aria-hidden": !0
|
|
@@ -804,32 +804,32 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
804
804
|
onClick: i
|
|
805
805
|
})]
|
|
806
806
|
});
|
|
807
|
-
return /* @__PURE__ */
|
|
807
|
+
return /* @__PURE__ */ B("div", {
|
|
808
808
|
className: d,
|
|
809
|
-
children: [/* @__PURE__ */
|
|
809
|
+
children: [/* @__PURE__ */ B("div", {
|
|
810
810
|
style: u,
|
|
811
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__ */
|
|
812
|
+
children: [/* @__PURE__ */ B("div", {
|
|
813
813
|
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
814
|
-
children: [y && /* @__PURE__ */
|
|
814
|
+
children: [y && /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("span", {
|
|
815
815
|
className: J.recordingDot,
|
|
816
816
|
"aria-hidden": !0
|
|
817
|
-
}), /* @__PURE__ */
|
|
817
|
+
}), /* @__PURE__ */ z("span", {
|
|
818
818
|
className: s(J.timer, "flex-shrink-0"),
|
|
819
819
|
"aria-label": l,
|
|
820
|
-
children:
|
|
821
|
-
})] }), /* @__PURE__ */
|
|
820
|
+
children: qe(n)
|
|
821
|
+
})] }), /* @__PURE__ */ z("canvas", {
|
|
822
822
|
ref: p,
|
|
823
823
|
height: 32,
|
|
824
824
|
className: s(J.waveformCanvas, "h-8 min-w-0 flex-1 desktop:h-6")
|
|
825
825
|
})]
|
|
826
826
|
}), S]
|
|
827
|
-
}), b && r && /* @__PURE__ */
|
|
827
|
+
}), b && r && /* @__PURE__ */ z(_, {
|
|
828
828
|
text: r,
|
|
829
829
|
className: "mt-1 px-1"
|
|
830
830
|
})]
|
|
831
831
|
});
|
|
832
|
-
},
|
|
832
|
+
}, Z = {
|
|
833
833
|
wrapper: "_wrapper_1q2nu_2",
|
|
834
834
|
wrapperDisabled: "_wrapperDisabled_1q2nu_15",
|
|
835
835
|
textarea: "_textarea_1q2nu_20",
|
|
@@ -841,73 +841,73 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
841
841
|
sendButtonEnter: "_sendButtonEnter_1q2nu_1",
|
|
842
842
|
sendButtonExiting: "_sendButtonExiting_1q2nu_55",
|
|
843
843
|
sendButtonExit: "_sendButtonExit_1q2nu_55"
|
|
844
|
-
},
|
|
844
|
+
}, Ye = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", title: r, isExiting: i = !1 }) => /* @__PURE__ */ z(O, {
|
|
845
845
|
tooltip: r,
|
|
846
846
|
hideTooltip: !r,
|
|
847
|
-
children: /* @__PURE__ */
|
|
848
|
-
className: s("flex size-[32px] cursor-pointer items-center justify-center rounded-full disabled:cursor-not-allowed",
|
|
847
|
+
children: /* @__PURE__ */ z("button", {
|
|
848
|
+
className: s("flex size-[32px] cursor-pointer items-center justify-center rounded-full disabled:cursor-not-allowed", Z.sendButton, i && Z.sendButtonExiting),
|
|
849
849
|
"aria-label": n,
|
|
850
850
|
onClick: () => e?.(),
|
|
851
851
|
type: "button",
|
|
852
852
|
disabled: t,
|
|
853
853
|
"aria-hidden": i,
|
|
854
|
-
children: /* @__PURE__ */
|
|
854
|
+
children: /* @__PURE__ */ z(ne, {
|
|
855
855
|
size: f.LG,
|
|
856
856
|
className: "rtl:scale-x-[-1]"
|
|
857
857
|
})
|
|
858
858
|
})
|
|
859
|
-
}),
|
|
859
|
+
}), Xe = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ z("button", {
|
|
860
860
|
className: s("flex cursor-pointer items-center justify-center disabled:cursor-not-allowed"),
|
|
861
861
|
"aria-label": t,
|
|
862
862
|
onClick: () => e?.(),
|
|
863
863
|
type: "button",
|
|
864
|
-
children: /* @__PURE__ */
|
|
864
|
+
children: /* @__PURE__ */ z(le, {
|
|
865
865
|
size: f.LG,
|
|
866
|
-
className:
|
|
866
|
+
className: Z.stopIcon
|
|
867
867
|
})
|
|
868
|
-
}),
|
|
868
|
+
}), Ze = ({ size: e = 20 }) => /* @__PURE__ */ z(w, {
|
|
869
869
|
variant: T.Circular,
|
|
870
870
|
width: e,
|
|
871
871
|
height: e,
|
|
872
872
|
active: !0
|
|
873
|
-
}),
|
|
873
|
+
}), Qe = ({ loadingLabel: e }) => /* @__PURE__ */ B("span", {
|
|
874
874
|
className: "flex min-w-0 flex-1 items-center",
|
|
875
|
-
children: [/* @__PURE__ */
|
|
875
|
+
children: [/* @__PURE__ */ z(w, {
|
|
876
876
|
variant: T.Text,
|
|
877
877
|
width: "100%",
|
|
878
878
|
height: 16,
|
|
879
879
|
active: !0
|
|
880
|
-
}), e && /* @__PURE__ */
|
|
880
|
+
}), e && /* @__PURE__ */ z("span", {
|
|
881
881
|
className: "sr-only",
|
|
882
882
|
children: e
|
|
883
883
|
})]
|
|
884
|
-
}),
|
|
884
|
+
}), $e = ({ loadingLabel: e }) => /* @__PURE__ */ z("div", {
|
|
885
885
|
role: "status",
|
|
886
886
|
"aria-label": e,
|
|
887
|
-
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */
|
|
887
|
+
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ B("div", {
|
|
888
888
|
className: "flex h-11 items-center gap-3 px-4",
|
|
889
889
|
"aria-hidden": "true",
|
|
890
|
-
children: [/* @__PURE__ */
|
|
890
|
+
children: [/* @__PURE__ */ z(Ze, {}), /* @__PURE__ */ z(Qe, {})]
|
|
891
891
|
}, t))
|
|
892
|
-
}),
|
|
892
|
+
}), et = (e) => e.displayName ?? e.id, tt = (e, t) => {
|
|
893
893
|
let n = t.trim().toLowerCase();
|
|
894
|
-
return n ? e.filter((e) =>
|
|
895
|
-
},
|
|
894
|
+
return n ? e.filter((e) => et(e).toLowerCase().includes(n)) : e;
|
|
895
|
+
}, nt = (e, t, r, i = 18, a) => /* @__PURE__ */ z(n, {
|
|
896
896
|
src: e,
|
|
897
897
|
size: i,
|
|
898
898
|
labels: { tooltip: a },
|
|
899
899
|
initialsName: r
|
|
900
|
-
}),
|
|
901
|
-
let [o, c] =
|
|
900
|
+
}), rt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: i, searchHeaderClassName: a = "bg-layer-0" }) => {
|
|
901
|
+
let [o, c] = L(""), l = F(() => e?.find((e) => e.id === t), [e, t]), u = i?.loading !== void 0, d = F(() => u ? /* @__PURE__ */ z(Ze, { size: f.LG }) : nt(l?.iconUrl, l?.type, l?.displayName ?? l?.id ?? "", f.LG), [u, l]), p = l?.displayName ?? l?.id;
|
|
902
902
|
return {
|
|
903
903
|
selectorIcon: d,
|
|
904
904
|
selectorAriaLabel: p ? `${i?.ariaLabel ?? "Select model"}: ${p}` : i?.ariaLabel ?? "Select model",
|
|
905
905
|
selectedLabel: p,
|
|
906
|
-
menuItems:
|
|
906
|
+
menuItems: F(() => {
|
|
907
907
|
if (u) return Array.from({ length: 7 }, (e, t) => ({
|
|
908
908
|
key: `__loading-${t}`,
|
|
909
|
-
icon: /* @__PURE__ */
|
|
910
|
-
label: /* @__PURE__ */
|
|
909
|
+
icon: /* @__PURE__ */ z(Ze, {}),
|
|
910
|
+
label: /* @__PURE__ */ z(Qe, { loadingLabel: t === 0 ? i?.loading : void 0 }),
|
|
911
911
|
disabled: !0
|
|
912
912
|
}));
|
|
913
913
|
if (!e || e.length === 0) {
|
|
@@ -918,19 +918,19 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
918
918
|
disabled: !0
|
|
919
919
|
}] : [];
|
|
920
920
|
}
|
|
921
|
-
return
|
|
921
|
+
return tt(e, o).map((e) => {
|
|
922
922
|
let i = e.id === t;
|
|
923
923
|
return {
|
|
924
924
|
key: e.id,
|
|
925
|
-
label: /* @__PURE__ */
|
|
925
|
+
label: /* @__PURE__ */ B("span", {
|
|
926
926
|
className: "flex w-full items-center justify-between gap-2",
|
|
927
|
-
children: [/* @__PURE__ */
|
|
928
|
-
text:
|
|
927
|
+
children: [/* @__PURE__ */ z(r, {
|
|
928
|
+
text: et(e),
|
|
929
929
|
query: o,
|
|
930
930
|
maxLines: 1
|
|
931
|
-
}), i && /* @__PURE__ */
|
|
931
|
+
}), i && /* @__PURE__ */ z(Be, { gradientId: "ms-check-grad" })]
|
|
932
932
|
}),
|
|
933
|
-
icon:
|
|
933
|
+
icon: nt(e.iconUrl, e.type, e.displayName ?? e.id),
|
|
934
934
|
onClick: () => n?.(e.id),
|
|
935
935
|
className: i ? "bg-accent-primary-alpha" : void 0
|
|
936
936
|
};
|
|
@@ -943,9 +943,9 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
943
943
|
i,
|
|
944
944
|
n
|
|
945
945
|
]),
|
|
946
|
-
menuHeader:
|
|
946
|
+
menuHeader: F(() => !u && e && e.length > 0 ? /* @__PURE__ */ z("div", {
|
|
947
947
|
className: s("sticky top-0 z-10 pb-1 pe-2 pt-2", a),
|
|
948
|
-
children: /* @__PURE__ */
|
|
948
|
+
children: /* @__PURE__ */ z(C, {
|
|
949
949
|
value: o,
|
|
950
950
|
placeholder: i?.searchPlaceholder ?? "Search",
|
|
951
951
|
size: k.Small,
|
|
@@ -963,8 +963,8 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
963
963
|
e || c("");
|
|
964
964
|
}
|
|
965
965
|
};
|
|
966
|
-
},
|
|
967
|
-
function
|
|
966
|
+
}, it = typeof window < "u" ? ge : N;
|
|
967
|
+
function at(e) {
|
|
968
968
|
if (e !== void 0) switch (typeof e) {
|
|
969
969
|
case "number": return e;
|
|
970
970
|
case "string":
|
|
@@ -972,15 +972,15 @@ function ot(e) {
|
|
|
972
972
|
break;
|
|
973
973
|
}
|
|
974
974
|
}
|
|
975
|
-
function
|
|
976
|
-
let { styleHeight: s, styleWidth: c } =
|
|
977
|
-
styleHeight:
|
|
978
|
-
styleWidth:
|
|
979
|
-
}), [o?.height, o?.width]), [l, u] =
|
|
975
|
+
function ot({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
|
|
976
|
+
let { styleHeight: s, styleWidth: c } = F(() => ({
|
|
977
|
+
styleHeight: at(o?.height),
|
|
978
|
+
styleWidth: at(o?.width)
|
|
979
|
+
}), [o?.height, o?.width]), [l, u] = L({
|
|
980
980
|
height: t,
|
|
981
981
|
width: n
|
|
982
982
|
}), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
|
|
983
|
-
return
|
|
983
|
+
return it(() => {
|
|
984
984
|
if (i === null || d) return;
|
|
985
985
|
let t = new ResizeObserver((e) => {
|
|
986
986
|
for (let t of e) {
|
|
@@ -1000,7 +1000,7 @@ function st({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1000
1000
|
i,
|
|
1001
1001
|
s,
|
|
1002
1002
|
c
|
|
1003
|
-
]),
|
|
1003
|
+
]), F(() => ({
|
|
1004
1004
|
height: s ?? l.height,
|
|
1005
1005
|
width: c ?? l.width
|
|
1006
1006
|
}), [
|
|
@@ -1009,23 +1009,23 @@ function st({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1009
1009
|
c
|
|
1010
1010
|
]);
|
|
1011
1011
|
}
|
|
1012
|
-
function
|
|
1013
|
-
let t =
|
|
1012
|
+
function st(e) {
|
|
1013
|
+
let t = I(() => {
|
|
1014
1014
|
throw Error("Cannot call during render.");
|
|
1015
1015
|
});
|
|
1016
|
-
return
|
|
1016
|
+
return it(() => {
|
|
1017
1017
|
t.current = e;
|
|
1018
|
-
}, [e]),
|
|
1018
|
+
}, [e]), M((e) => t.current?.(e), [t]);
|
|
1019
1019
|
}
|
|
1020
|
-
var
|
|
1020
|
+
var ct = null;
|
|
1021
1021
|
function lt(e = !1) {
|
|
1022
|
-
if (
|
|
1022
|
+
if (ct === null || e) {
|
|
1023
1023
|
let e = document.createElement("div"), t = e.style;
|
|
1024
1024
|
t.width = "50px", t.height = "50px", t.overflow = "scroll", t.direction = "rtl";
|
|
1025
1025
|
let n = document.createElement("div"), r = n.style;
|
|
1026
|
-
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ?
|
|
1026
|
+
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? ct = "positive-descending" : (e.scrollLeft = 1, ct = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), ct;
|
|
1027
1027
|
}
|
|
1028
|
-
return
|
|
1028
|
+
return ct;
|
|
1029
1029
|
}
|
|
1030
1030
|
function ut({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
1031
1031
|
if (t === "horizontal" && n) switch (lt()) {
|
|
@@ -1042,13 +1042,13 @@ function ut({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
|
1042
1042
|
function Q(e, t = "Assertion error") {
|
|
1043
1043
|
if (!e) throw console.error(t), Error(t);
|
|
1044
1044
|
}
|
|
1045
|
-
function
|
|
1045
|
+
function $(e, t) {
|
|
1046
1046
|
if (e === t) return !0;
|
|
1047
1047
|
if (!!e != !!t || (Q(e !== void 0), Q(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
|
|
1048
1048
|
for (let n in e) if (!Object.is(t[n], e[n])) return !1;
|
|
1049
1049
|
return !0;
|
|
1050
1050
|
}
|
|
1051
|
-
function
|
|
1051
|
+
function dt({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
1052
1052
|
if (t === 0) return 0;
|
|
1053
1053
|
if (typeof n == "number") return t * n;
|
|
1054
1054
|
{
|
|
@@ -1058,7 +1058,7 @@ function $({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
|
1058
1058
|
}
|
|
1059
1059
|
function ft({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
|
|
1060
1060
|
if (n < 0 || n >= r) throw RangeError(`Invalid index specified: ${n}`, { cause: `Index ${n} is not within the range of 0 - ${r - 1}` });
|
|
1061
|
-
let s =
|
|
1061
|
+
let s = dt({
|
|
1062
1062
|
cachedBounds: t,
|
|
1063
1063
|
itemCount: r,
|
|
1064
1064
|
itemSize: i
|
|
@@ -1127,7 +1127,7 @@ function mt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1127
1127
|
};
|
|
1128
1128
|
}
|
|
1129
1129
|
function ht({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1130
|
-
return
|
|
1130
|
+
return F(() => mt({
|
|
1131
1131
|
itemCount: e,
|
|
1132
1132
|
itemProps: t,
|
|
1133
1133
|
itemSize: n
|
|
@@ -1150,20 +1150,20 @@ function gt({ containerSize: e, itemSize: t }) {
|
|
|
1150
1150
|
return n;
|
|
1151
1151
|
}
|
|
1152
1152
|
function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
|
|
1153
|
-
let { height: u = n, width: d = n } =
|
|
1153
|
+
let { height: u = n, width: d = n } = ot({
|
|
1154
1154
|
defaultHeight: r === "vertical" ? n : void 0,
|
|
1155
1155
|
defaultWidth: r === "horizontal" ? n : void 0,
|
|
1156
1156
|
element: e,
|
|
1157
1157
|
mode: r === "vertical" ? "only-height" : "only-width",
|
|
1158
1158
|
style: t
|
|
1159
|
-
}), f =
|
|
1159
|
+
}), f = I({
|
|
1160
1160
|
height: 0,
|
|
1161
1161
|
width: 0
|
|
1162
1162
|
}), p = r === "vertical" ? u : d, m = gt({
|
|
1163
1163
|
containerSize: p,
|
|
1164
1164
|
itemSize: s
|
|
1165
1165
|
});
|
|
1166
|
-
|
|
1166
|
+
ge(() => {
|
|
1167
1167
|
if (typeof c == "function") {
|
|
1168
1168
|
let e = f.current;
|
|
1169
1169
|
(e.height !== u || e.width !== d) && (c({
|
|
@@ -1180,7 +1180,7 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1180
1180
|
itemCount: a,
|
|
1181
1181
|
itemProps: o,
|
|
1182
1182
|
itemSize: m
|
|
1183
|
-
}), g =
|
|
1183
|
+
}), g = M((e) => h.get(e), [h]), [_, v] = L(() => pt({
|
|
1184
1184
|
cachedBounds: h,
|
|
1185
1185
|
containerScrollOffset: 0,
|
|
1186
1186
|
containerSize: p,
|
|
@@ -1191,7 +1191,7 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1191
1191
|
startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
|
|
1192
1192
|
stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
|
|
1193
1193
|
stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
|
|
1194
|
-
}, C =
|
|
1194
|
+
}, C = M(() => dt({
|
|
1195
1195
|
cachedBounds: h,
|
|
1196
1196
|
itemCount: a,
|
|
1197
1197
|
itemSize: m
|
|
@@ -1199,7 +1199,7 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1199
1199
|
h,
|
|
1200
1200
|
a,
|
|
1201
1201
|
m
|
|
1202
|
-
]), w =
|
|
1202
|
+
]), w = M((t) => pt({
|
|
1203
1203
|
cachedBounds: h,
|
|
1204
1204
|
containerScrollOffset: ut({
|
|
1205
1205
|
containerElement: e,
|
|
@@ -1219,13 +1219,13 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1219
1219
|
a,
|
|
1220
1220
|
l
|
|
1221
1221
|
]);
|
|
1222
|
-
return
|
|
1222
|
+
return it(() => {
|
|
1223
1223
|
v(w((r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0));
|
|
1224
1224
|
}, [
|
|
1225
1225
|
e,
|
|
1226
1226
|
r,
|
|
1227
1227
|
w
|
|
1228
|
-
]),
|
|
1228
|
+
]), it(() => {
|
|
1229
1229
|
if (!e) return;
|
|
1230
1230
|
let t = () => {
|
|
1231
1231
|
v((t) => {
|
|
@@ -1241,7 +1241,7 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1241
1241
|
itemCount: a,
|
|
1242
1242
|
overscanCount: l
|
|
1243
1243
|
});
|
|
1244
|
-
return
|
|
1244
|
+
return $(s, t) ? t : s;
|
|
1245
1245
|
});
|
|
1246
1246
|
};
|
|
1247
1247
|
return e.addEventListener("scroll", t), () => {
|
|
@@ -1257,7 +1257,7 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1257
1257
|
]), {
|
|
1258
1258
|
getCellBounds: g,
|
|
1259
1259
|
getEstimatedSize: C,
|
|
1260
|
-
scrollToIndex:
|
|
1260
|
+
scrollToIndex: st(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
|
|
1261
1261
|
let s = ft({
|
|
1262
1262
|
align: t,
|
|
1263
1263
|
cachedBounds: h,
|
|
@@ -1275,7 +1275,7 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1275
1275
|
scrollOffset: s
|
|
1276
1276
|
}), typeof e.scrollTo != "function") {
|
|
1277
1277
|
let e = w(s);
|
|
1278
|
-
|
|
1278
|
+
$(_, e) || v(e);
|
|
1279
1279
|
}
|
|
1280
1280
|
return s;
|
|
1281
1281
|
}
|
|
@@ -1287,29 +1287,29 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1287
1287
|
};
|
|
1288
1288
|
}
|
|
1289
1289
|
function vt(e) {
|
|
1290
|
-
return
|
|
1290
|
+
return F(() => e, Object.values(e));
|
|
1291
1291
|
}
|
|
1292
1292
|
function yt(e, t) {
|
|
1293
1293
|
let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
|
|
1294
|
-
return
|
|
1294
|
+
return $(n, a) && $(r, o) && $(i, s);
|
|
1295
1295
|
}
|
|
1296
1296
|
function bt(e) {
|
|
1297
1297
|
return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
|
|
1298
1298
|
}
|
|
1299
1299
|
var xt = "data-react-window-index";
|
|
1300
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 }) {
|
|
1301
|
-
let m = vt(u), h =
|
|
1301
|
+
let m = vt(u), h = F(() => he(s, yt), [s]), [g, _] = L(null), v = bt(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = _t({
|
|
1302
1302
|
containerElement: g,
|
|
1303
1303
|
containerStyle: f,
|
|
1304
1304
|
defaultContainerSize: n,
|
|
1305
1305
|
direction: "vertical",
|
|
1306
1306
|
itemCount: c,
|
|
1307
1307
|
itemProps: m,
|
|
1308
|
-
itemSize:
|
|
1308
|
+
itemSize: F(() => v ? (e) => l.getRowHeight(e) ?? l.getAverageRowHeight() : l, [v, l]),
|
|
1309
1309
|
onResize: i,
|
|
1310
1310
|
overscanCount: o
|
|
1311
1311
|
});
|
|
1312
|
-
|
|
1312
|
+
P(r, () => ({
|
|
1313
1313
|
get element() {
|
|
1314
1314
|
return g;
|
|
1315
1315
|
},
|
|
@@ -1324,7 +1324,7 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1324
1324
|
top: r
|
|
1325
1325
|
});
|
|
1326
1326
|
}
|
|
1327
|
-
}), [g, x]),
|
|
1327
|
+
}), [g, x]), it(() => {
|
|
1328
1328
|
if (!g) return;
|
|
1329
1329
|
let e = Array.from(g.children).filter((e, t) => {
|
|
1330
1330
|
if (e.hasAttribute("aria-hidden")) return !1;
|
|
@@ -1338,7 +1338,7 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1338
1338
|
l,
|
|
1339
1339
|
S,
|
|
1340
1340
|
w
|
|
1341
|
-
]),
|
|
1341
|
+
]), N(() => {
|
|
1342
1342
|
S >= 0 && w >= 0 && a && a({
|
|
1343
1343
|
startIndex: C,
|
|
1344
1344
|
stopIndex: T
|
|
@@ -1353,11 +1353,11 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1353
1353
|
w,
|
|
1354
1354
|
T
|
|
1355
1355
|
]);
|
|
1356
|
-
let E =
|
|
1356
|
+
let E = F(() => {
|
|
1357
1357
|
let e = [];
|
|
1358
1358
|
if (c > 0) for (let t = S; t <= w; t++) {
|
|
1359
1359
|
let n = y(t);
|
|
1360
|
-
e.push(/* @__PURE__ */
|
|
1360
|
+
e.push(/* @__PURE__ */ me(h, {
|
|
1361
1361
|
...m,
|
|
1362
1362
|
ariaAttributes: {
|
|
1363
1363
|
"aria-posinset": t + 1,
|
|
@@ -1384,7 +1384,7 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1384
1384
|
m,
|
|
1385
1385
|
S,
|
|
1386
1386
|
w
|
|
1387
|
-
]), D = /* @__PURE__ */
|
|
1387
|
+
]), D = /* @__PURE__ */ z("div", {
|
|
1388
1388
|
"aria-hidden": !0,
|
|
1389
1389
|
style: {
|
|
1390
1390
|
height: b(),
|
|
@@ -1392,7 +1392,7 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1392
1392
|
zIndex: -1
|
|
1393
1393
|
}
|
|
1394
1394
|
});
|
|
1395
|
-
return
|
|
1395
|
+
return me(d, {
|
|
1396
1396
|
role: "list",
|
|
1397
1397
|
...p,
|
|
1398
1398
|
className: t,
|
|
@@ -1413,25 +1413,25 @@ var Ct = {
|
|
|
1413
1413
|
checkIcon: "_checkIcon_3wv6u_19",
|
|
1414
1414
|
stateLabel: "_stateLabel_3wv6u_23"
|
|
1415
1415
|
}, wt = 44, Tt = 8, Et = ({ index: e, style: t, ariaAttributes: n, items: i, selectedDeploymentId: a, labelClassName: o, query: c, onSelect: l }) => {
|
|
1416
|
-
let u = i[e], d =
|
|
1417
|
-
return /* @__PURE__ */
|
|
1416
|
+
let u = i[e], d = nt(u.iconUrl, u.type, u.displayName ?? u.id, f.SM), m = u.id === a;
|
|
1417
|
+
return /* @__PURE__ */ z("div", {
|
|
1418
1418
|
style: t,
|
|
1419
1419
|
...n,
|
|
1420
|
-
children: /* @__PURE__ */
|
|
1420
|
+
children: /* @__PURE__ */ z(p, {
|
|
1421
1421
|
type: "button",
|
|
1422
1422
|
className: s(Ct.item, "flex h-full w-full items-center gap-3 px-4"),
|
|
1423
|
-
iconBefore: /* @__PURE__ */
|
|
1423
|
+
iconBefore: /* @__PURE__ */ z("span", {
|
|
1424
1424
|
className: Ct.itemIcon,
|
|
1425
1425
|
children: d
|
|
1426
1426
|
}),
|
|
1427
|
-
label: /* @__PURE__ */
|
|
1427
|
+
label: /* @__PURE__ */ B("span", {
|
|
1428
1428
|
className: "flex flex-1 items-center justify-between gap-2",
|
|
1429
|
-
children: [/* @__PURE__ */
|
|
1429
|
+
children: [/* @__PURE__ */ z(r, {
|
|
1430
1430
|
text: u.displayName ?? u.id,
|
|
1431
1431
|
query: c,
|
|
1432
1432
|
maxLines: 1,
|
|
1433
1433
|
className: s(o, "min-w-0 flex-1 text-start")
|
|
1434
|
-
}), m && /* @__PURE__ */
|
|
1434
|
+
}), m && /* @__PURE__ */ z(re, {
|
|
1435
1435
|
size: f.SM,
|
|
1436
1436
|
className: Ct.checkIcon,
|
|
1437
1437
|
"aria-hidden": !0
|
|
@@ -1441,12 +1441,12 @@ var Ct = {
|
|
|
1441
1441
|
})
|
|
1442
1442
|
});
|
|
1443
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" }) => {
|
|
1444
|
-
let [h, g] =
|
|
1445
|
-
|
|
1444
|
+
let [h, g] = L("");
|
|
1445
|
+
N(() => {
|
|
1446
1446
|
e || g("");
|
|
1447
1447
|
}, [e]);
|
|
1448
|
-
let _ = a && a.length > 0, v = l !== void 0, y = !_ && !v ? u ?? d : void 0, b = _ ?
|
|
1449
|
-
return /* @__PURE__ */
|
|
1448
|
+
let _ = a && a.length > 0, v = l !== void 0, y = !_ && !v ? u ?? d : void 0, b = _ ? tt(a, h) : [];
|
|
1449
|
+
return /* @__PURE__ */ B(U, {
|
|
1450
1450
|
isOpen: e,
|
|
1451
1451
|
title: t,
|
|
1452
1452
|
closeLabel: n,
|
|
@@ -1454,19 +1454,19 @@ var Ct = {
|
|
|
1454
1454
|
style: f,
|
|
1455
1455
|
titleClassName: p,
|
|
1456
1456
|
className: "max-h-[80dvh]",
|
|
1457
|
-
children: [_ && !v && /* @__PURE__ */
|
|
1457
|
+
children: [_ && !v && /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("div", {
|
|
1458
1458
|
className: "flex-shrink-0 px-4 py-[10px]",
|
|
1459
|
-
children: /* @__PURE__ */
|
|
1459
|
+
children: /* @__PURE__ */ z(C, {
|
|
1460
1460
|
value: h,
|
|
1461
1461
|
placeholder: r,
|
|
1462
1462
|
size: k.Standard,
|
|
1463
1463
|
onChange: g
|
|
1464
1464
|
})
|
|
1465
|
-
}), /* @__PURE__ */
|
|
1465
|
+
}), /* @__PURE__ */ z("div", { className: s(Ct.divider, "h-px flex-shrink-0") })] }), v ? /* @__PURE__ */ z($e, { loadingLabel: l }) : y ? /* @__PURE__ */ z("div", {
|
|
1466
1466
|
role: "list",
|
|
1467
1467
|
className: s(Ct.stateLabel, m, "px-4 py-4"),
|
|
1468
1468
|
children: y
|
|
1469
|
-
}) : /* @__PURE__ */
|
|
1469
|
+
}) : /* @__PURE__ */ z(St, {
|
|
1470
1470
|
role: "list",
|
|
1471
1471
|
className: "overflow-y-auto",
|
|
1472
1472
|
style: { height: Math.min(b.length, Tt) * wt },
|
|
@@ -1485,22 +1485,22 @@ var Ct = {
|
|
|
1485
1485
|
})]
|
|
1486
1486
|
});
|
|
1487
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 }) => {
|
|
1488
|
-
let [_, y] =
|
|
1488
|
+
let [_, y] = L(!1), { selectorIcon: b, selectorAriaLabel: x, selectedLabel: S, menuItems: C, menuHeader: w, onOpenChange: T } = rt({
|
|
1489
1489
|
deployments: e,
|
|
1490
1490
|
selectedDeploymentId: t,
|
|
1491
1491
|
onDeploymentChange: n,
|
|
1492
1492
|
modelSelectorLabels: r
|
|
1493
1493
|
});
|
|
1494
1494
|
if (!e) return null;
|
|
1495
|
-
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__ */ z(ie, {
|
|
1496
1496
|
size: f.SM,
|
|
1497
|
-
className:
|
|
1497
|
+
className: Z.modelSelectorCaret,
|
|
1498
1498
|
"aria-hidden": !0
|
|
1499
1499
|
});
|
|
1500
|
-
return a ? /* @__PURE__ */
|
|
1500
|
+
return a ? /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(O, {
|
|
1501
1501
|
tooltip: S,
|
|
1502
|
-
children: /* @__PURE__ */
|
|
1503
|
-
icon: /* @__PURE__ */
|
|
1502
|
+
children: /* @__PURE__ */ z(v, {
|
|
1503
|
+
icon: /* @__PURE__ */ B("div", {
|
|
1504
1504
|
className: "flex items-center gap-1",
|
|
1505
1505
|
children: [b, D]
|
|
1506
1506
|
}),
|
|
@@ -1508,16 +1508,16 @@ var Ct = {
|
|
|
1508
1508
|
onClick: () => {
|
|
1509
1509
|
c || y(!0);
|
|
1510
1510
|
},
|
|
1511
|
-
className: s(
|
|
1511
|
+
className: s(Z.modelSelectorButton, E)
|
|
1512
1512
|
})
|
|
1513
|
-
}), u ? /* @__PURE__ */
|
|
1513
|
+
}), u ? /* @__PURE__ */ z(U, {
|
|
1514
1514
|
isOpen: _,
|
|
1515
1515
|
title: r?.ariaLabel ?? "Select model",
|
|
1516
1516
|
closeLabel: r?.closeLabel ?? "Close",
|
|
1517
1517
|
onClose: () => y(!1),
|
|
1518
1518
|
style: l,
|
|
1519
1519
|
children: u(() => y(!1))
|
|
1520
|
-
}) : /* @__PURE__ */
|
|
1520
|
+
}) : /* @__PURE__ */ z(Dt, {
|
|
1521
1521
|
isOpen: _,
|
|
1522
1522
|
title: r?.ariaLabel ?? "Select model",
|
|
1523
1523
|
closeLabel: r?.closeLabel ?? "Close",
|
|
@@ -1530,7 +1530,7 @@ var Ct = {
|
|
|
1530
1530
|
errorLabel: r?.error,
|
|
1531
1531
|
emptyLabel: r?.empty,
|
|
1532
1532
|
style: l
|
|
1533
|
-
})] }) : u ? /* @__PURE__ */
|
|
1533
|
+
})] }) : u ? /* @__PURE__ */ z(h, {
|
|
1534
1534
|
placement: "top-end",
|
|
1535
1535
|
matchReferenceWidth: !1,
|
|
1536
1536
|
open: d,
|
|
@@ -1539,24 +1539,24 @@ var Ct = {
|
|
|
1539
1539
|
outsideClosable: !0,
|
|
1540
1540
|
renderOverlay: () => u(() => m?.(!1)),
|
|
1541
1541
|
listClassName: "cp-dropdown-overlay !w-[320px]",
|
|
1542
|
-
children: /* @__PURE__ */
|
|
1542
|
+
children: /* @__PURE__ */ z(O, {
|
|
1543
1543
|
tooltip: S,
|
|
1544
|
-
children: /* @__PURE__ */
|
|
1544
|
+
children: /* @__PURE__ */ B("button", {
|
|
1545
1545
|
type: "button",
|
|
1546
1546
|
"aria-label": x,
|
|
1547
|
-
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", Z.modelSelectorButton, o || i || c ? E : void 0, (o || c) && Z.modelSelectorButtonDisabled),
|
|
1548
1548
|
onClick: () => {
|
|
1549
1549
|
!o && !i && !c && p?.();
|
|
1550
1550
|
},
|
|
1551
1551
|
children: [b, D]
|
|
1552
1552
|
})
|
|
1553
1553
|
})
|
|
1554
|
-
}) : /* @__PURE__ */
|
|
1554
|
+
}) : /* @__PURE__ */ z("div", {
|
|
1555
1555
|
className: s(c && E),
|
|
1556
1556
|
"aria-disabled": c || void 0,
|
|
1557
|
-
children: /* @__PURE__ */
|
|
1557
|
+
children: /* @__PURE__ */ z(O, {
|
|
1558
1558
|
tooltip: S,
|
|
1559
|
-
children: /* @__PURE__ */
|
|
1559
|
+
children: /* @__PURE__ */ z(g, {
|
|
1560
1560
|
icon: b,
|
|
1561
1561
|
ariaLabel: x,
|
|
1562
1562
|
items: C,
|
|
@@ -1568,12 +1568,12 @@ var Ct = {
|
|
|
1568
1568
|
size: k.Standard,
|
|
1569
1569
|
caretIcon: D,
|
|
1570
1570
|
iconClassName: o || c ? E : void 0,
|
|
1571
|
-
buttonClassName: s("bg-transparent",
|
|
1571
|
+
buttonClassName: s("bg-transparent", Z.modelSelectorButton, (o || c) && E && Z.modelSelectorButtonDisabled)
|
|
1572
1572
|
})
|
|
1573
1573
|
})
|
|
1574
1574
|
});
|
|
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:
|
|
1576
|
-
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: A, pendingDropFiles: te = [], onDropFilesConsumed: ne, pendingAttachments: re = [], onPendingAttachmentsConsumed: ie, pasteTextThreshold: ae = 4e3, deployments: j, selectedDeploymentId: ce, onDeploymentChange: le, modelSelectorLabels: ue, initialAttachments: de = [], isStacked: fe = !1, hideAddButton: pe = !1, hideAttachFile: me = !1, hideActionBar: he = !1, renderFooterActions: N, isInputDisabled: P = !1, isModelSelectorDisabled: ge = !1, isSendDisabled: _e = !1, isAudioMessageSupported: ve = !1, sendOnEnter: ye = Le.Enter, prefixAttachments: V = [], onRemovePrefixAttachment: xe, chatSettings: Se, autoFocus: Ce = !1, messageHistory: Te, onDialFileSystemClick: H, dialFileSystemLabel: U, validateAttachment: Ee, onAttachmentClick: ke, modelPickerOverlay: Ae, maximumAttachmentsAmount: Ne, onAttachmentsLimitExceeded: Pe, isAttachmentsEnabled: Fe = !0 }) => {
|
|
1576
|
+
let Re = c(), [ze, Be] = L(!1), Ve = je(Te), W = F(() => o({
|
|
1577
1577
|
"--ci-bg": k?.background,
|
|
1578
1578
|
"--ci-text": k?.text,
|
|
1579
1579
|
"--ci-border": k?.border,
|
|
@@ -1585,61 +1585,61 @@ var Ct = {
|
|
|
1585
1585
|
"--ci-send-bg": k?.sendBackground,
|
|
1586
1586
|
"--ci-send-text": k?.sendText,
|
|
1587
1587
|
"--ci-stop-color": k?.stopColor
|
|
1588
|
-
}), [k]), He =
|
|
1588
|
+
}), [k]), He = F(() => H ? [{
|
|
1589
1589
|
key: "dial-fs",
|
|
1590
|
-
label:
|
|
1591
|
-
icon: /* @__PURE__ */
|
|
1590
|
+
label: U ?? "DIAL file system",
|
|
1591
|
+
icon: /* @__PURE__ */ z(oe, {
|
|
1592
1592
|
size: l,
|
|
1593
1593
|
"aria-hidden": !0
|
|
1594
1594
|
}),
|
|
1595
|
-
onClick:
|
|
1596
|
-
}] : [], [
|
|
1595
|
+
onClick: H
|
|
1596
|
+
}] : [], [H, U]), { message: G, setMessage: K, textareaRef: Ue, isMultiLine: We } = Me({
|
|
1597
1597
|
messageProp: e,
|
|
1598
1598
|
messageRevision: t
|
|
1599
|
-
}), { attachments:
|
|
1600
|
-
initialAttachments:
|
|
1599
|
+
}), { attachments: q, buildAttachments: J, addAttachments: Ke, resetAttachments: Y, handleRemove: X, handleRetry: qe, handleExpand: Ze, hasBlockedAttachments: Qe } = De({
|
|
1600
|
+
initialAttachments: de,
|
|
1601
1601
|
onUploadAttachment: r,
|
|
1602
1602
|
onAttachmentsChange: d,
|
|
1603
|
-
validateAttachment:
|
|
1604
|
-
pendingDropFiles:
|
|
1603
|
+
validateAttachment: Ee,
|
|
1604
|
+
pendingDropFiles: te,
|
|
1605
1605
|
onDropFilesConsumed: ne,
|
|
1606
1606
|
pendingAttachments: re,
|
|
1607
1607
|
onPendingAttachmentsConsumed: ie,
|
|
1608
|
-
onExpandPastedText:
|
|
1609
|
-
|
|
1610
|
-
}, [
|
|
1611
|
-
maximumAttachmentsAmount:
|
|
1612
|
-
baseAttachmentsAmount:
|
|
1613
|
-
onAttachmentsLimitExceeded:
|
|
1614
|
-
}), { state: $e, analyserNodeRef: et, elapsedSeconds: tt, errorMessage: nt, startRecording: rt, stopRecording: it, discardRecording: at } =
|
|
1615
|
-
J(
|
|
1616
|
-
}, [
|
|
1617
|
-
if (
|
|
1618
|
-
let e =
|
|
1619
|
-
|
|
1608
|
+
onExpandPastedText: M((e) => {
|
|
1609
|
+
K((t) => t ? `${t}\n${e}` : e);
|
|
1610
|
+
}, [K]),
|
|
1611
|
+
maximumAttachmentsAmount: Ne,
|
|
1612
|
+
baseAttachmentsAmount: V.length,
|
|
1613
|
+
onAttachmentsLimitExceeded: Pe
|
|
1614
|
+
}), { state: $e, analyserNodeRef: et, elapsedSeconds: tt, errorMessage: nt, startRecording: rt, stopRecording: it, discardRecording: at } = Ie({ onAttachAudio: M((e) => {
|
|
1615
|
+
Ke(J([e]));
|
|
1616
|
+
}, [Ke, J]) }), ot = I(null), st = I(null), { handlePaste: ct } = we(Ke, Fe ? ae : Infinity), lt = G.trim().length > 0 || q.length > 0, ut = lt && !Qe && !_e, { shouldRender: Q, isExiting: $, instanceKey: dt } = Oe(!a && lt, kt), ft = fe || q.length > 0 || G.includes("\n") || We, pt = j === void 0 || ce != null, mt = async () => {
|
|
1617
|
+
if (_e) return;
|
|
1618
|
+
let e = G, t = q;
|
|
1619
|
+
K(""), Ve.reset();
|
|
1620
1620
|
try {
|
|
1621
1621
|
await n?.(e, t), t.forEach((e) => {
|
|
1622
1622
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl);
|
|
1623
|
-
}),
|
|
1623
|
+
}), Y([]);
|
|
1624
1624
|
} catch {
|
|
1625
|
-
|
|
1625
|
+
K(e), Y(t);
|
|
1626
1626
|
}
|
|
1627
|
-
},
|
|
1628
|
-
if (!e.nativeEvent.isComposing && !
|
|
1629
|
-
let t = e.currentTarget.selectionStart ?? 0, n = Ve.navigate(e.key === "ArrowUp" ? "up" : "down",
|
|
1627
|
+
}, ht = (e) => {
|
|
1628
|
+
if (!e.nativeEvent.isComposing && !P && !a && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
|
|
1629
|
+
let t = e.currentTarget.selectionStart ?? 0, n = Ve.navigate(e.key === "ArrowUp" ? "up" : "down", G, t);
|
|
1630
1630
|
if (n !== null) {
|
|
1631
|
-
e.preventDefault(),
|
|
1631
|
+
e.preventDefault(), K(n);
|
|
1632
1632
|
return;
|
|
1633
1633
|
}
|
|
1634
1634
|
}
|
|
1635
|
-
e.key === "Enter" && (
|
|
1636
|
-
},
|
|
1635
|
+
e.key === "Enter" && (ye === Le.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey) && (e.preventDefault(), !a && ut && pt && !P && mt());
|
|
1636
|
+
}, gt = (e) => {
|
|
1637
1637
|
let t = Array.from(e.target.files ?? []);
|
|
1638
1638
|
if (t.length === 0) return;
|
|
1639
|
-
let n =
|
|
1640
|
-
e.target.value = "",
|
|
1639
|
+
let n = J(t);
|
|
1640
|
+
e.target.value = "", Ke(n);
|
|
1641
1641
|
};
|
|
1642
|
-
if ($e !== "idle") return /* @__PURE__ */
|
|
1642
|
+
if ($e !== "idle") return /* @__PURE__ */ z(Je, {
|
|
1643
1643
|
state: $e,
|
|
1644
1644
|
analyserNodeRef: et,
|
|
1645
1645
|
elapsedSeconds: tt,
|
|
@@ -1649,49 +1649,49 @@ var Ct = {
|
|
|
1649
1649
|
stopLabel: E,
|
|
1650
1650
|
discardLabel: D,
|
|
1651
1651
|
timerLabel: O,
|
|
1652
|
-
style:
|
|
1653
|
-
className:
|
|
1652
|
+
style: W,
|
|
1653
|
+
className: A
|
|
1654
1654
|
});
|
|
1655
|
-
let
|
|
1656
|
-
className: s(
|
|
1655
|
+
let _t = /* @__PURE__ */ z("textarea", {
|
|
1656
|
+
className: s(Z.textarea, ee?.fontClassName, "max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent outline-none [field-sizing:content]"),
|
|
1657
1657
|
ref: Ue,
|
|
1658
|
-
autoFocus:
|
|
1659
|
-
value:
|
|
1658
|
+
autoFocus: Ce,
|
|
1659
|
+
value: G,
|
|
1660
1660
|
onChange: (e) => {
|
|
1661
|
-
|
|
1661
|
+
K(e.target.value), Ve.notifyChange(), u?.(e.target.value);
|
|
1662
1662
|
},
|
|
1663
|
-
onKeyDown:
|
|
1663
|
+
onKeyDown: ht,
|
|
1664
1664
|
onPaste: ct,
|
|
1665
1665
|
placeholder: p,
|
|
1666
1666
|
"aria-label": m,
|
|
1667
|
-
disabled:
|
|
1667
|
+
disabled: P,
|
|
1668
1668
|
rows: 1
|
|
1669
1669
|
});
|
|
1670
|
-
return /* @__PURE__ */
|
|
1670
|
+
return /* @__PURE__ */ B("div", {
|
|
1671
1671
|
ref: st,
|
|
1672
|
-
style:
|
|
1673
|
-
className: s(
|
|
1674
|
-
children: [(
|
|
1675
|
-
attachments: [...
|
|
1672
|
+
style: W,
|
|
1673
|
+
className: s(Z.wrapper, P && Z.wrapperDisabled, "flex min-h-[56px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border", q.length > 6 ? "py-3 ps-3" : "p-3", A),
|
|
1674
|
+
children: [(V.length > 0 || q.length > 0) && /* @__PURE__ */ z(be, {
|
|
1675
|
+
attachments: [...V, ...q],
|
|
1676
1676
|
onRemove: (e) => {
|
|
1677
|
-
|
|
1677
|
+
V.some((t) => t.id === e) ? xe?.(e) : X(e);
|
|
1678
1678
|
},
|
|
1679
|
-
onRetry:
|
|
1680
|
-
onExpand:
|
|
1679
|
+
onRetry: qe,
|
|
1680
|
+
onExpand: Ze,
|
|
1681
1681
|
labels: {
|
|
1682
1682
|
removeLabel: x,
|
|
1683
1683
|
retryLabel: S
|
|
1684
1684
|
},
|
|
1685
|
-
onAttachmentClick:
|
|
1686
|
-
let t = [...
|
|
1687
|
-
t != null &&
|
|
1685
|
+
onAttachmentClick: ke == null ? void 0 : (e) => {
|
|
1686
|
+
let t = [...V, ...q].find((t) => t.id === e);
|
|
1687
|
+
t != null && ke(t);
|
|
1688
1688
|
}
|
|
1689
|
-
}),
|
|
1690
|
-
className: s("flex items-center gap-2",
|
|
1689
|
+
}), he ? ft && _t : /* @__PURE__ */ B("div", {
|
|
1690
|
+
className: s("flex items-center gap-2", ft ? "flex-wrap" : "flex-wrap desktop:flex-nowrap"),
|
|
1691
1691
|
children: [
|
|
1692
|
-
!
|
|
1693
|
-
className: s("order-2 flex",
|
|
1694
|
-
children: [/* @__PURE__ */
|
|
1692
|
+
!pe && /* @__PURE__ */ B("div", {
|
|
1693
|
+
className: s("order-2 flex", !ft && "desktop:order-1"),
|
|
1694
|
+
children: [/* @__PURE__ */ z("input", {
|
|
1695
1695
|
ref: ot,
|
|
1696
1696
|
type: "file",
|
|
1697
1697
|
multiple: !0,
|
|
@@ -1699,59 +1699,59 @@ var Ct = {
|
|
|
1699
1699
|
className: "sr-only",
|
|
1700
1700
|
"aria-hidden": !0,
|
|
1701
1701
|
tabIndex: -1,
|
|
1702
|
-
onChange:
|
|
1703
|
-
}), /* @__PURE__ */
|
|
1704
|
-
onAttachClick:
|
|
1702
|
+
onChange: gt
|
|
1703
|
+
}), /* @__PURE__ */ z(Ge, {
|
|
1704
|
+
onAttachClick: me ? void 0 : () => ot.current?.click(),
|
|
1705
1705
|
attachLabel: h,
|
|
1706
1706
|
addMenuTitle: _,
|
|
1707
1707
|
menuTitle: y,
|
|
1708
1708
|
menuCloseLabel: b,
|
|
1709
|
-
style:
|
|
1710
|
-
isDisabled:
|
|
1711
|
-
chatSettings:
|
|
1709
|
+
style: W,
|
|
1710
|
+
isDisabled: P,
|
|
1711
|
+
chatSettings: Se,
|
|
1712
1712
|
extraMenuItems: He
|
|
1713
1713
|
})]
|
|
1714
1714
|
}),
|
|
1715
|
-
/* @__PURE__ */ R("div", {
|
|
1716
|
-
className: s("order-1 flex w-full min-w-0 items-center self-stretch", !$ && "desktop:order-2 desktop:w-auto desktop:flex-1"),
|
|
1717
|
-
children: gt
|
|
1718
|
-
}),
|
|
1719
1715
|
/* @__PURE__ */ z("div", {
|
|
1720
|
-
className: s("flex
|
|
1721
|
-
children:
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1716
|
+
className: s("order-1 flex w-full min-w-0 items-center self-stretch", !ft && "desktop:order-2 desktop:w-auto desktop:flex-1"),
|
|
1717
|
+
children: _t
|
|
1718
|
+
}),
|
|
1719
|
+
/* @__PURE__ */ B("div", {
|
|
1720
|
+
className: s("flex flex-shrink-0 items-center gap-2", "order-3 ms-auto", !ft && "desktop:ms-0"),
|
|
1721
|
+
children: [N ? N({
|
|
1722
|
+
canSend: ut,
|
|
1723
|
+
onSend: mt
|
|
1724
|
+
}) : /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(Ot, {
|
|
1725
|
+
deployments: j,
|
|
1726
|
+
selectedDeploymentId: ce,
|
|
1727
|
+
onDeploymentChange: le,
|
|
1728
|
+
modelSelectorLabels: ue,
|
|
1729
1729
|
isStreaming: a,
|
|
1730
|
-
isMobile:
|
|
1731
|
-
isInputDisabled:
|
|
1732
|
-
isDisabled:
|
|
1733
|
-
style:
|
|
1734
|
-
modelPickerOverlay:
|
|
1730
|
+
isMobile: Re,
|
|
1731
|
+
isInputDisabled: P,
|
|
1732
|
+
isDisabled: ge,
|
|
1733
|
+
style: W,
|
|
1734
|
+
modelPickerOverlay: Ae,
|
|
1735
1735
|
isPickerOpen: ze,
|
|
1736
1736
|
onPickerToggle: () => Be((e) => !e),
|
|
1737
1737
|
onPickerOpenChange: Be
|
|
1738
|
-
}), a && i ? /* @__PURE__ */
|
|
1738
|
+
}), a && i ? /* @__PURE__ */ z(Xe, {
|
|
1739
1739
|
onStop: i,
|
|
1740
1740
|
ariaLabel: w
|
|
1741
|
-
}) : !a &&
|
|
1742
|
-
onSend:
|
|
1743
|
-
isDisabled: !
|
|
1741
|
+
}) : !a && Q && /* @__PURE__ */ z(Ye, {
|
|
1742
|
+
onSend: mt,
|
|
1743
|
+
isDisabled: !pt || Qe || _e,
|
|
1744
1744
|
ariaLabel: C,
|
|
1745
|
-
isExiting:
|
|
1746
|
-
}, dt)] }),
|
|
1747
|
-
icon: /* @__PURE__ */
|
|
1745
|
+
isExiting: $
|
|
1746
|
+
}, dt)] }), ve && !$ && /* @__PURE__ */ z(v, {
|
|
1747
|
+
icon: /* @__PURE__ */ z(se, {
|
|
1748
1748
|
size: f.LG,
|
|
1749
1749
|
"aria-hidden": !0
|
|
1750
1750
|
}),
|
|
1751
1751
|
"aria-label": T,
|
|
1752
1752
|
className: "size-8 flex-shrink-0",
|
|
1753
1753
|
onClick: rt,
|
|
1754
|
-
disabled:
|
|
1754
|
+
disabled: P || a
|
|
1755
1755
|
})]
|
|
1756
1756
|
})
|
|
1757
1757
|
]
|
|
@@ -1759,18 +1759,18 @@ var Ct = {
|
|
|
1759
1759
|
});
|
|
1760
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
1761
|
let { colors: u, typography: d } = r ?? {};
|
|
1762
|
-
return /* @__PURE__ */
|
|
1762
|
+
return /* @__PURE__ */ B("div", {
|
|
1763
1763
|
style: o({
|
|
1764
1764
|
"--ci-root-bg": u?.background,
|
|
1765
1765
|
"--ci-welcome-color": u?.welcomeText
|
|
1766
1766
|
}),
|
|
1767
1767
|
className: s("relative flex w-full flex-col items-center gap-6 px-4 py-5 desktop:p-5", i),
|
|
1768
|
-
children: [n && /* @__PURE__ */
|
|
1768
|
+
children: [n && /* @__PURE__ */ z("h1", {
|
|
1769
1769
|
className: s(jt.welcome, "m-0 text-center", d?.welcomeClassName),
|
|
1770
1770
|
children: n
|
|
1771
|
-
}), /* @__PURE__ */
|
|
1771
|
+
}), /* @__PURE__ */ z("div", {
|
|
1772
1772
|
className: "relative w-full max-w-[748px]",
|
|
1773
|
-
children: /* @__PURE__ */
|
|
1773
|
+
children: /* @__PURE__ */ z(At, {
|
|
1774
1774
|
placeholder: t,
|
|
1775
1775
|
isStreaming: e,
|
|
1776
1776
|
isInputDisabled: c,
|
|
@@ -1781,32 +1781,32 @@ var Ct = {
|
|
|
1781
1781
|
})
|
|
1782
1782
|
})]
|
|
1783
1783
|
});
|
|
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,
|
|
1785
|
-
let
|
|
1786
|
-
|
|
1787
|
-
v?.length && (
|
|
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, isAttachmentsEnabled: x, hideAttachFile: S = !1, fileAccept: C, maximumAttachmentsAmount: w, onAttachmentsLimitExceeded: T, onDialFileSystemClick: E, dialFileSystemLabel: D, pendingAttachments: O, onPendingAttachmentsConsumed: k, onAttachmentClick: ee }) => {
|
|
1785
|
+
let A = I(null), [te, ne] = L([]);
|
|
1786
|
+
N(() => {
|
|
1787
|
+
v?.length && (ne(v), y?.());
|
|
1788
1788
|
}, [v, y]);
|
|
1789
|
-
let [
|
|
1789
|
+
let [re, ie] = L(e ?? ""), [ae, se] = L([]), [j, ce] = L(t), le = ae.some((e) => e.status === i.Loading || e.status === i.Error), ue = (re.trim().length > 0 || ae.length > 0 || j.length > 0) && !le, de = (e) => {
|
|
1790
1790
|
ce((t) => t.filter((t) => t.id !== e));
|
|
1791
|
-
}, fe =
|
|
1792
|
-
r(e,
|
|
1793
|
-
}, [
|
|
1794
|
-
ue && fe(
|
|
1795
|
-
}, me =
|
|
1791
|
+
}, fe = M((e, t) => {
|
|
1792
|
+
r(e, j, t);
|
|
1793
|
+
}, [j, r]), pe = () => {
|
|
1794
|
+
ue && fe(re, ae);
|
|
1795
|
+
}, me = M(() => ne([]), []), he = M((e) => {
|
|
1796
1796
|
let t = Array.from(e.target.files ?? []);
|
|
1797
|
-
t.length !== 0 && (e.target.value = "",
|
|
1798
|
-
}, []),
|
|
1797
|
+
t.length !== 0 && (e.target.value = "", ne(t));
|
|
1798
|
+
}, []), P = F(() => E ? [{
|
|
1799
1799
|
key: "dial-fs",
|
|
1800
|
-
label:
|
|
1801
|
-
icon: /* @__PURE__ */
|
|
1800
|
+
label: D ?? "DIAL file system",
|
|
1801
|
+
icon: /* @__PURE__ */ z(oe, {
|
|
1802
1802
|
size: l,
|
|
1803
1803
|
"aria-hidden": !0
|
|
1804
1804
|
}),
|
|
1805
|
-
onClick:
|
|
1806
|
-
}] : [], [
|
|
1807
|
-
return /* @__PURE__ */
|
|
1805
|
+
onClick: E
|
|
1806
|
+
}] : [], [E, D]);
|
|
1807
|
+
return /* @__PURE__ */ B("div", {
|
|
1808
1808
|
className: s("flex w-full flex-col gap-2", _),
|
|
1809
|
-
children: [/* @__PURE__ */
|
|
1809
|
+
children: [/* @__PURE__ */ z(At, {
|
|
1810
1810
|
message: e,
|
|
1811
1811
|
ariaLabel: u,
|
|
1812
1812
|
isStacked: !0,
|
|
@@ -1815,46 +1815,47 @@ var Ct = {
|
|
|
1815
1815
|
onDropFilesConsumed: me,
|
|
1816
1816
|
onSend: fe,
|
|
1817
1817
|
onUploadAttachment: a,
|
|
1818
|
-
onChange:
|
|
1819
|
-
onAttachmentsChange:
|
|
1818
|
+
onChange: ie,
|
|
1819
|
+
onAttachmentsChange: se,
|
|
1820
1820
|
removeLabel: d,
|
|
1821
1821
|
retryLabel: f,
|
|
1822
1822
|
className: "max-w-full",
|
|
1823
|
-
prefixAttachments:
|
|
1823
|
+
prefixAttachments: j,
|
|
1824
1824
|
onRemovePrefixAttachment: de,
|
|
1825
1825
|
validateAttachment: b,
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1826
|
+
isAttachmentsEnabled: x,
|
|
1827
|
+
maximumAttachmentsAmount: w,
|
|
1828
|
+
onAttachmentsLimitExceeded: T,
|
|
1829
|
+
pendingAttachments: O,
|
|
1830
|
+
onPendingAttachmentsConsumed: k,
|
|
1831
|
+
onAttachmentClick: ee
|
|
1832
|
+
}), /* @__PURE__ */ B("div", {
|
|
1832
1833
|
className: "flex items-center justify-between",
|
|
1833
|
-
children: [/* @__PURE__ */
|
|
1834
|
+
children: [/* @__PURE__ */ z("div", {
|
|
1834
1835
|
className: "flex",
|
|
1835
|
-
children: !
|
|
1836
|
-
ref:
|
|
1836
|
+
children: !S && /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("input", {
|
|
1837
|
+
ref: A,
|
|
1837
1838
|
type: "file",
|
|
1838
1839
|
multiple: !0,
|
|
1839
|
-
accept:
|
|
1840
|
+
accept: C,
|
|
1840
1841
|
className: "sr-only",
|
|
1841
1842
|
"aria-hidden": !0,
|
|
1842
1843
|
tabIndex: -1,
|
|
1843
1844
|
onChange: he
|
|
1844
|
-
}), /* @__PURE__ */
|
|
1845
|
-
onAttachClick: () =>
|
|
1845
|
+
}), /* @__PURE__ */ z(Ge, {
|
|
1846
|
+
onAttachClick: () => A.current?.click(),
|
|
1846
1847
|
attachLabel: m,
|
|
1847
1848
|
addMenuTitle: p,
|
|
1848
1849
|
menuTitle: h,
|
|
1849
1850
|
menuCloseLabel: g,
|
|
1850
|
-
extraMenuItems:
|
|
1851
|
+
extraMenuItems: P
|
|
1851
1852
|
})] })
|
|
1852
|
-
}), /* @__PURE__ */
|
|
1853
|
+
}), /* @__PURE__ */ B("div", {
|
|
1853
1854
|
className: "flex gap-2",
|
|
1854
|
-
children: [/* @__PURE__ */
|
|
1855
|
+
children: [/* @__PURE__ */ z(He, {
|
|
1855
1856
|
label: o,
|
|
1856
1857
|
onClick: n
|
|
1857
|
-
}), /* @__PURE__ */
|
|
1858
|
+
}), /* @__PURE__ */ z(W, {
|
|
1858
1859
|
label: c,
|
|
1859
1860
|
onClick: pe,
|
|
1860
1861
|
disabled: !ue
|
|
@@ -1864,4 +1865,4 @@ var Ct = {
|
|
|
1864
1865
|
});
|
|
1865
1866
|
};
|
|
1866
1867
|
//#endregion
|
|
1867
|
-
export {
|
|
1868
|
+
export { _e as AttachmentCard, ve as AttachmentGroup, ye as AttachmentTray, U as BottomSheetShell, q as ChatSettingsModal, Mt as ConversationInput, Nt as EditMessageInput, V as FileDndOverlay, At as Input, Le as SendOnEnter, Ce as getAttachmentIcon };
|