@epam/ai-dial-conversation-input 1.1.0-dev.12 → 1.1.0-dev.18
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/components/VoiceBar/VoiceBar.d.ts +12 -14
- package/components/VoiceBar/VoiceBar.d.ts.map +1 -1
- package/hooks/useAttachments.d.ts.map +1 -1
- package/hooks/useVoiceRecorder.d.ts +19 -21
- package/hooks/useVoiceRecorder.d.ts.map +1 -1
- package/index.css +1 -1
- package/index.js +550 -586
- package/models/ConversationInput.d.ts +15 -14
- package/models/ConversationInput.d.ts.map +1 -1
- package/models/Input.d.ts +11 -14
- 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,
|
|
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 A, RadioGroupOrientation as ee } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { IconArrowLeft as j, IconArrowNarrowRight as te, IconCheck as ne, IconChevronDown as re, IconChevronRight as ie, IconFile as ae, IconMicrophone as oe, IconPaperclip as se, 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 V, AttachmentTray as ye, FileDndOverlay as be, 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
|
+
}, Ee = {
|
|
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
|
+
}, 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 }) => (Te(e, r), !e || typeof document > "u" ? null : pe(/* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("div", {
|
|
28
|
+
className: s(Ee.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(Ee.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(j, {
|
|
44
44
|
size: f.LG,
|
|
45
45
|
stroke: 1.5,
|
|
46
46
|
className: "rtl:scale-x-[-1]"
|
|
@@ -49,55 +49,56 @@ var Ce = (e, t) => {
|
|
|
49
49
|
onClick: i
|
|
50
50
|
})
|
|
51
51
|
}),
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
className: s(
|
|
52
|
+
/* @__PURE__ */ z("span", {
|
|
53
|
+
className: s(Ee.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)), De = 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
|
+
}, 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] = L(n), _ = I(h);
|
|
75
|
+
N(() => {
|
|
76
76
|
_.current = h;
|
|
77
|
-
}, [h]),
|
|
77
|
+
}, [h]), N(() => () => {
|
|
78
78
|
_.current.forEach((e) => {
|
|
79
|
-
e.previewUrl && URL.revokeObjectURL(e.previewUrl);
|
|
79
|
+
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
80
80
|
});
|
|
81
81
|
}, []);
|
|
82
|
-
let v =
|
|
83
|
-
let n = e.type.startsWith("image/"), r = n ? URL.createObjectURL(e) : void 0;
|
|
82
|
+
let v = M((e) => e.map((e) => {
|
|
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,
|
|
89
|
-
type: n ? t.Image : t.File,
|
|
89
|
+
type: n ? t.Image : r ? t.Audio : t.File,
|
|
90
90
|
status: i.Idle,
|
|
91
|
-
previewUrl:
|
|
91
|
+
previewUrl: a,
|
|
92
|
+
playUrl: o
|
|
92
93
|
};
|
|
93
|
-
}), []), y =
|
|
94
|
+
}), []), y = M((e) => {
|
|
94
95
|
g((t) => {
|
|
95
96
|
let n = e(t);
|
|
96
97
|
return n !== t && a?.(n), n;
|
|
97
98
|
});
|
|
98
|
-
}, [a]), b =
|
|
99
|
+
}, [a]), b = M((e) => {
|
|
99
100
|
g(e), a?.(e);
|
|
100
|
-
}, [a]), x =
|
|
101
|
+
}, [a]), x = M(async (t) => {
|
|
101
102
|
if (r) {
|
|
102
103
|
y((e) => e.map((e) => e.id === t.id ? {
|
|
103
104
|
...e,
|
|
@@ -119,34 +120,29 @@ var Ce = (e, t) => {
|
|
|
119
120
|
} : e));
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
|
-
}, [r, y]), S =
|
|
123
|
-
let n =
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
123
|
+
}, [r, y]), S = M((e, t = !0) => {
|
|
124
|
+
let n = new Set(_.current.map((e) => e.id)), r = e.filter((e) => !n.has(e.id));
|
|
125
|
+
if (r.length !== 0) {
|
|
126
|
+
if (f != null && f > 0 && Number.isFinite(f)) {
|
|
127
|
+
let e = p + _.current.length + r.length;
|
|
128
|
+
if (e > f) {
|
|
129
|
+
r.forEach((e) => {
|
|
130
|
+
e.previewUrl && URL.revokeObjectURL(e.previewUrl);
|
|
131
|
+
}), m?.(e, f);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (y((e) => [...e, ...r]), t) {
|
|
136
|
+
let e = [];
|
|
137
|
+
r.forEach((t) => {
|
|
138
|
+
let n = o?.(t);
|
|
139
|
+
n == null ? e.push(t) : y((e) => e.map((e) => e.id === t.id ? {
|
|
140
|
+
...e,
|
|
141
|
+
status: i.Error,
|
|
142
|
+
errorReason: n
|
|
143
|
+
} : e));
|
|
144
|
+
}), De(e, xe, x);
|
|
132
145
|
}
|
|
133
|
-
return [...t, ...n];
|
|
134
|
-
}), r != null) {
|
|
135
|
-
n.forEach((e) => {
|
|
136
|
-
e.previewUrl && URL.revokeObjectURL(e.previewUrl);
|
|
137
|
-
}), m?.(r.count, r.limit);
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
if (t) {
|
|
141
|
-
let e = [];
|
|
142
|
-
n.forEach((t) => {
|
|
143
|
-
let n = o?.(t);
|
|
144
|
-
n == null ? e.push(t) : y((e) => e.map((e) => e.id === t.id ? {
|
|
145
|
-
...e,
|
|
146
|
-
status: i.Error,
|
|
147
|
-
errorReason: n
|
|
148
|
-
} : e));
|
|
149
|
-
}), Te(e, ye, x);
|
|
150
146
|
}
|
|
151
147
|
}, [
|
|
152
148
|
p,
|
|
@@ -156,20 +152,20 @@ var Ce = (e, t) => {
|
|
|
156
152
|
x,
|
|
157
153
|
o
|
|
158
154
|
]);
|
|
159
|
-
|
|
155
|
+
N(() => {
|
|
160
156
|
s.length !== 0 && (S(v(s)), c?.());
|
|
161
157
|
}, [
|
|
162
158
|
S,
|
|
163
159
|
v,
|
|
164
160
|
c,
|
|
165
161
|
s
|
|
166
|
-
]),
|
|
162
|
+
]), N(() => {
|
|
167
163
|
l.length !== 0 && (S(l, !1), u?.());
|
|
168
164
|
}, [
|
|
169
165
|
S,
|
|
170
166
|
u,
|
|
171
167
|
l
|
|
172
|
-
]),
|
|
168
|
+
]), N(() => {
|
|
173
169
|
if (!o) return;
|
|
174
170
|
let t = !1, n = [], r = _.current.map((r) => {
|
|
175
171
|
if (r.status === i.Loading) return r;
|
|
@@ -196,10 +192,10 @@ var Ce = (e, t) => {
|
|
|
196
192
|
y,
|
|
197
193
|
x
|
|
198
194
|
]);
|
|
199
|
-
let C =
|
|
195
|
+
let C = M((e) => {
|
|
200
196
|
y((t) => {
|
|
201
197
|
let n = t.find((t) => t.id === e);
|
|
202
|
-
return n?.previewUrl && URL.revokeObjectURL(n.previewUrl), t.filter((t) => t.id !== e);
|
|
198
|
+
return n?.previewUrl && URL.revokeObjectURL(n.previewUrl), n?.playUrl && URL.revokeObjectURL(n.playUrl), t.filter((t) => t.id !== e);
|
|
203
199
|
});
|
|
204
200
|
}, [y]);
|
|
205
201
|
return {
|
|
@@ -208,11 +204,11 @@ var Ce = (e, t) => {
|
|
|
208
204
|
addAttachments: S,
|
|
209
205
|
resetAttachments: b,
|
|
210
206
|
handleRemove: C,
|
|
211
|
-
handleRetry:
|
|
207
|
+
handleRetry: M((e) => {
|
|
212
208
|
let t = h.find((t) => t.id === e);
|
|
213
209
|
t && x(t);
|
|
214
210
|
}, [h, x]),
|
|
215
|
-
handleExpand:
|
|
211
|
+
handleExpand: M(async (e) => {
|
|
216
212
|
let n = h.find((t) => t.id === e);
|
|
217
213
|
if (!n || n.type !== t.Pasted) return;
|
|
218
214
|
let r = await n.file.text();
|
|
@@ -224,9 +220,9 @@ var Ce = (e, t) => {
|
|
|
224
220
|
]),
|
|
225
221
|
hasBlockedAttachments: h.some((e) => e.status === i.Loading || e.status === i.Error)
|
|
226
222
|
};
|
|
227
|
-
},
|
|
228
|
-
let [n, r] =
|
|
229
|
-
return
|
|
223
|
+
}, ke = (e, t) => {
|
|
224
|
+
let [n, r] = L(e), [i, a] = L(!1), [o, s] = L(0);
|
|
225
|
+
return N(() => {
|
|
230
226
|
if (e) {
|
|
231
227
|
r(!0), a(!1), s((e) => e + 1);
|
|
232
228
|
return;
|
|
@@ -242,18 +238,18 @@ var Ce = (e, t) => {
|
|
|
242
238
|
isExiting: i,
|
|
243
239
|
instanceKey: o
|
|
244
240
|
};
|
|
245
|
-
},
|
|
246
|
-
let t =
|
|
241
|
+
}, Ae = (e, t) => !e.slice(0, t).includes("\n"), je = (e, t) => !e.slice(t).includes("\n"), Me = (e) => {
|
|
242
|
+
let t = I(e);
|
|
247
243
|
t.current = e;
|
|
248
|
-
let n =
|
|
244
|
+
let n = I(-1), r = I(""), i = M((e, i, a) => {
|
|
249
245
|
let o = t.current;
|
|
250
|
-
return !o || o.length === 0 ? null : e === "up" ? !
|
|
251
|
-
}, []), a =
|
|
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 = M(() => {
|
|
252
248
|
n.current = -1, r.current = "";
|
|
253
|
-
}, []), o =
|
|
249
|
+
}, []), o = M(() => {
|
|
254
250
|
n.current = -1, r.current = "";
|
|
255
251
|
}, []);
|
|
256
|
-
return
|
|
252
|
+
return F(() => ({
|
|
257
253
|
navigate: i,
|
|
258
254
|
notifyChange: a,
|
|
259
255
|
reset: o
|
|
@@ -262,13 +258,13 @@ var Ce = (e, t) => {
|
|
|
262
258
|
a,
|
|
263
259
|
o
|
|
264
260
|
]);
|
|
265
|
-
},
|
|
266
|
-
let [n, r] =
|
|
267
|
-
return
|
|
261
|
+
}, Ne = ({ messageProp: e, messageRevision: t }) => {
|
|
262
|
+
let [n, r] = L(e), i = I(null), a = I(0), [o, s] = L(!1);
|
|
263
|
+
return N(() => {
|
|
268
264
|
r(e);
|
|
269
|
-
}, [e, t]),
|
|
265
|
+
}, [e, t]), N(() => {
|
|
270
266
|
i.current && (a.current = i.current.offsetHeight);
|
|
271
|
-
}, []),
|
|
267
|
+
}, []), ge(() => {
|
|
272
268
|
if (!i.current || a.current === 0) return;
|
|
273
269
|
let e = i.current.offsetHeight > a.current;
|
|
274
270
|
s((t) => e ? !0 : n === "" ? !1 : t);
|
|
@@ -278,98 +274,71 @@ var Ce = (e, t) => {
|
|
|
278
274
|
textareaRef: i,
|
|
279
275
|
isMultiLine: o
|
|
280
276
|
};
|
|
281
|
-
},
|
|
282
|
-
return e.Idle = "idle", e.Recording = "recording", e.
|
|
283
|
-
}({}),
|
|
277
|
+
}, Pe = /* @__PURE__ */ function(e) {
|
|
278
|
+
return e.Idle = "idle", e.Recording = "recording", e.Error = "error", e;
|
|
279
|
+
}({}), Fe = [
|
|
284
280
|
"audio/webm;codecs=opus",
|
|
285
281
|
"audio/ogg;codecs=opus",
|
|
286
282
|
"audio/webm"
|
|
287
|
-
],
|
|
288
|
-
let [
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}, [
|
|
283
|
+
], Ie = () => Fe.find((e) => MediaRecorder.isTypeSupported(e)) ?? "", Le = ({ 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
|
+
m.current = e;
|
|
286
|
+
let h = M(() => {
|
|
287
|
+
p.current != null && (clearInterval(p.current), p.current = null);
|
|
288
|
+
}, []), g = M(() => {
|
|
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]), _ = M(() => {
|
|
293
291
|
(async () => {
|
|
294
292
|
try {
|
|
295
293
|
let e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
296
|
-
|
|
294
|
+
s.current = e;
|
|
297
295
|
let t = new AudioContext();
|
|
298
|
-
|
|
299
|
-
let
|
|
300
|
-
|
|
301
|
-
let
|
|
302
|
-
|
|
303
|
-
let a = new MediaRecorder(e,
|
|
304
|
-
|
|
305
|
-
e.data.size > 0 &&
|
|
306
|
-
}, a.start(),
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
if (!e) return;
|
|
310
|
-
let t = new Uint8Array(e.frequencyBinCount);
|
|
311
|
-
e.getByteTimeDomainData(t);
|
|
312
|
-
let n = 0;
|
|
313
|
-
for (let e = 0; e < t.length; e++) {
|
|
314
|
-
let r = (t[e] - 128) / 128;
|
|
315
|
-
n += r * r;
|
|
316
|
-
}
|
|
317
|
-
_.current.push(Math.sqrt(n / t.length)), o(new Float32Array(_.current)), h.current = requestAnimationFrame(s);
|
|
318
|
-
};
|
|
319
|
-
h.current = requestAnimationFrame(s);
|
|
296
|
+
c.current = t;
|
|
297
|
+
let r = t.createAnalyser();
|
|
298
|
+
r.fftSize = 256, l.current = r, t.createMediaStreamSource(e).connect(r);
|
|
299
|
+
let i = Ie();
|
|
300
|
+
f.current = i, d.current = [];
|
|
301
|
+
let a = new MediaRecorder(e, i ? { mimeType: i } : void 0);
|
|
302
|
+
u.current = a, a.ondataavailable = (e) => {
|
|
303
|
+
e.data.size > 0 && d.current.push(e.data);
|
|
304
|
+
}, a.start(), n("recording"), p.current = setInterval(() => {
|
|
305
|
+
o((e) => e + 1);
|
|
306
|
+
}, 1e3);
|
|
320
307
|
} catch (e) {
|
|
321
|
-
|
|
308
|
+
i(e instanceof Error ? e.message : "Microphone access denied"), n("error");
|
|
322
309
|
}
|
|
323
310
|
})();
|
|
324
|
-
}, []),
|
|
325
|
-
let e =
|
|
326
|
-
!e || e.state !== "recording" || (
|
|
327
|
-
let e =
|
|
328
|
-
|
|
311
|
+
}, []), v = M(() => {
|
|
312
|
+
let e = u.current;
|
|
313
|
+
!e || e.state !== "recording" || (h(), e.onstop = () => {
|
|
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
|
+
m.current(c), g(), o(0), i(null), n("idle");
|
|
329
316
|
}, e.stop());
|
|
330
|
-
}, [
|
|
331
|
-
let
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
}, [
|
|
345
|
-
e,
|
|
346
|
-
t,
|
|
347
|
-
n,
|
|
348
|
-
b
|
|
349
|
-
]), w = I(() => {
|
|
350
|
-
v.current = !0, b(), g.current = null, o(null), c(null), i("idle");
|
|
351
|
-
}, [b]);
|
|
352
|
-
return L(() => () => {
|
|
353
|
-
v.current = !0, b();
|
|
354
|
-
}, [b]), {
|
|
355
|
-
state: r,
|
|
356
|
-
waveformData: a,
|
|
357
|
-
errorMessage: s,
|
|
358
|
-
startRecording: x,
|
|
359
|
-
stopRecording: S,
|
|
360
|
-
confirmRecording: C,
|
|
361
|
-
discardRecording: w
|
|
317
|
+
}, [h, g]), y = M(() => {
|
|
318
|
+
let e = u.current;
|
|
319
|
+
e && e.state === "recording" && (e.ondataavailable = null, e.onstop = null, e.stop()), g(), o(0), i(null), n("idle");
|
|
320
|
+
}, [g]);
|
|
321
|
+
return N(() => () => {
|
|
322
|
+
g();
|
|
323
|
+
}, [g]), {
|
|
324
|
+
state: t,
|
|
325
|
+
analyserNodeRef: l,
|
|
326
|
+
elapsedSeconds: a,
|
|
327
|
+
errorMessage: r,
|
|
328
|
+
startRecording: _,
|
|
329
|
+
stopRecording: v,
|
|
330
|
+
discardRecording: y
|
|
362
331
|
};
|
|
363
|
-
},
|
|
332
|
+
}, Re = /* @__PURE__ */ function(e) {
|
|
364
333
|
return e.Enter = "enter", e.MetaEnter = "meta-enter", e;
|
|
365
|
-
}({}),
|
|
334
|
+
}({}), ze = {
|
|
366
335
|
item: "_item_vou13_1",
|
|
367
336
|
itemIcon: "_itemIcon_vou13_11"
|
|
368
|
-
},
|
|
337
|
+
}, Be = ({ 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 = "" }) => {
|
|
369
338
|
let d = (e) => {
|
|
370
339
|
e(), r();
|
|
371
340
|
};
|
|
372
|
-
return /* @__PURE__ */ H
|
|
341
|
+
return /* @__PURE__ */ z(H, {
|
|
373
342
|
isOpen: e,
|
|
374
343
|
title: t,
|
|
375
344
|
closeLabel: n,
|
|
@@ -377,22 +346,22 @@ var Ce = (e, t) => {
|
|
|
377
346
|
style: i,
|
|
378
347
|
className: o,
|
|
379
348
|
titleClassName: c,
|
|
380
|
-
children: /* @__PURE__ */
|
|
349
|
+
children: /* @__PURE__ */ z("ul", {
|
|
381
350
|
role: "list",
|
|
382
351
|
className: "flex flex-col",
|
|
383
|
-
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, {
|
|
384
353
|
type: "button",
|
|
385
|
-
className: s(
|
|
386
|
-
iconBefore: /* @__PURE__ */
|
|
387
|
-
className:
|
|
354
|
+
className: s(ze.item, "flex w-full items-center gap-3 px-4 py-[10px] text-start"),
|
|
355
|
+
iconBefore: /* @__PURE__ */ z("span", {
|
|
356
|
+
className: ze.itemIcon,
|
|
388
357
|
children: n
|
|
389
358
|
}),
|
|
390
|
-
iconAfter: r ? /* @__PURE__ */
|
|
359
|
+
iconAfter: r ? /* @__PURE__ */ z("span", {
|
|
391
360
|
className: "ms-auto",
|
|
392
361
|
children: r
|
|
393
362
|
}) : null,
|
|
394
363
|
textClassName: u,
|
|
395
|
-
label: /* @__PURE__ */
|
|
364
|
+
label: /* @__PURE__ */ z("span", {
|
|
396
365
|
className: l,
|
|
397
366
|
children: t
|
|
398
367
|
}),
|
|
@@ -400,62 +369,62 @@ var Ce = (e, t) => {
|
|
|
400
369
|
}) }, e))
|
|
401
370
|
})
|
|
402
371
|
});
|
|
403
|
-
},
|
|
372
|
+
}, Ve = ({ gradientId: e = "gradient-check-icon" }) => /* @__PURE__ */ B("svg", {
|
|
404
373
|
width: f.SM,
|
|
405
374
|
height: f.SM,
|
|
406
375
|
viewBox: "0 0 24 24",
|
|
407
376
|
fill: "none",
|
|
408
377
|
"aria-hidden": !0,
|
|
409
|
-
children: [/* @__PURE__ */
|
|
378
|
+
children: [/* @__PURE__ */ z("defs", { children: /* @__PURE__ */ B("linearGradient", {
|
|
410
379
|
id: e,
|
|
411
380
|
x1: "0",
|
|
412
381
|
y1: "0",
|
|
413
382
|
x2: "24",
|
|
414
383
|
y2: "24",
|
|
415
384
|
gradientUnits: "userSpaceOnUse",
|
|
416
|
-
children: [/* @__PURE__ */
|
|
385
|
+
children: [/* @__PURE__ */ z("stop", {
|
|
417
386
|
offset: "0%",
|
|
418
387
|
stopColor: "#4b7be6"
|
|
419
|
-
}), /* @__PURE__ */
|
|
388
|
+
}), /* @__PURE__ */ z("stop", {
|
|
420
389
|
offset: "100%",
|
|
421
390
|
stopColor: "#9355f4"
|
|
422
391
|
})]
|
|
423
|
-
}) }), /* @__PURE__ */
|
|
392
|
+
}) }), /* @__PURE__ */ z("path", {
|
|
424
393
|
d: "M5 12l5 5L20 7",
|
|
425
394
|
stroke: `url(#${e})`,
|
|
426
395
|
strokeWidth: "2",
|
|
427
396
|
strokeLinecap: "round",
|
|
428
397
|
strokeLinejoin: "round"
|
|
429
398
|
})]
|
|
430
|
-
}),
|
|
399
|
+
}), He = {
|
|
431
400
|
tabContainer: "_tabContainer_rzv03_1",
|
|
432
401
|
tabActive: "_tabActive_rzv03_13"
|
|
433
402
|
};
|
|
434
|
-
|
|
403
|
+
he(({ tabs: e, activeTabId: t, onTabChange: n, styles: r }) => {
|
|
435
404
|
let { tabClassName: i = "dial-tiny-semi-text" } = r?.typography ?? {};
|
|
436
|
-
return /* @__PURE__ */
|
|
405
|
+
return /* @__PURE__ */ z("div", {
|
|
437
406
|
className: "flex flex-nowrap gap-1",
|
|
438
407
|
children: e.map((e) => {
|
|
439
408
|
let r = t === e.id;
|
|
440
|
-
return /* @__PURE__ */
|
|
409
|
+
return /* @__PURE__ */ z(D, {
|
|
441
410
|
label: e.label,
|
|
442
411
|
selected: r,
|
|
443
412
|
onClick: () => n(e.id),
|
|
444
413
|
"aria-selected": r,
|
|
445
|
-
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, He.tabContainer, r && He.tabActive)
|
|
446
415
|
}, e.id);
|
|
447
416
|
})
|
|
448
417
|
});
|
|
449
418
|
});
|
|
450
419
|
//#endregion
|
|
451
420
|
//#region ../ai-dial-kit/src/components/Button/Buttons.tsx
|
|
452
|
-
var
|
|
421
|
+
var U = (e) => /* @__PURE__ */ z(x, { ...e }), W = (e) => /* @__PURE__ */ z(p, {
|
|
453
422
|
...e,
|
|
454
423
|
variant: d.Neutral,
|
|
455
424
|
appearance: u.Outlined
|
|
456
|
-
}),
|
|
457
|
-
let [s, c] =
|
|
458
|
-
|
|
425
|
+
}), Ue = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
426
|
+
let [s, c] = L(t), [l, u] = L(n), [d, f] = L(r), p = I(o);
|
|
427
|
+
N(() => {
|
|
459
428
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
460
429
|
}, [
|
|
461
430
|
o,
|
|
@@ -472,7 +441,7 @@ var K = (e) => /* @__PURE__ */ H(x, { ...e }), Be = (e) => /* @__PURE__ */ H(p,
|
|
|
472
441
|
setResponseFormat: c,
|
|
473
442
|
setSystemPrompt: u,
|
|
474
443
|
setTemperature: f,
|
|
475
|
-
handleSubmit:
|
|
444
|
+
handleSubmit: M(() => {
|
|
476
445
|
if (!m) return;
|
|
477
446
|
let t = {};
|
|
478
447
|
e.responseFormat && s != null && (t.responseFormat = s), e.systemPrompt && (t.systemPrompt = l), e.temperature && (t.temperature = d), i(t), a();
|
|
@@ -486,18 +455,18 @@ var K = (e) => /* @__PURE__ */ H(x, { ...e }), Be = (e) => /* @__PURE__ */ H(p,
|
|
|
486
455
|
a
|
|
487
456
|
])
|
|
488
457
|
};
|
|
489
|
-
},
|
|
458
|
+
}, We = "!dial-small-semi-text !text-primary gap-1", G = ({ 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 = [
|
|
490
459
|
"Precise",
|
|
491
460
|
"Neutral",
|
|
492
461
|
"Creative"
|
|
493
|
-
], temperatureHint: g }) => /* @__PURE__ */
|
|
462
|
+
], temperatureHint: g }) => /* @__PURE__ */ B("div", {
|
|
494
463
|
className: "flex flex-col gap-4 px-6 py-3",
|
|
495
464
|
children: [
|
|
496
|
-
e.responseFormat && /* @__PURE__ */
|
|
465
|
+
e.responseFormat && /* @__PURE__ */ z(S, {
|
|
497
466
|
fieldTitle: c,
|
|
498
|
-
labelClassName:
|
|
467
|
+
labelClassName: We,
|
|
499
468
|
elementId: "response-format",
|
|
500
|
-
orientation:
|
|
469
|
+
orientation: ee.Column,
|
|
501
470
|
activeRadioButton: t ?? a.Markdown,
|
|
502
471
|
labelDescription: l,
|
|
503
472
|
radioButtons: [{
|
|
@@ -509,19 +478,19 @@ var K = (e) => /* @__PURE__ */ H(x, { ...e }), Be = (e) => /* @__PURE__ */ H(p,
|
|
|
509
478
|
}],
|
|
510
479
|
onChange: (e) => i(e)
|
|
511
480
|
}),
|
|
512
|
-
e.systemPrompt && /* @__PURE__ */
|
|
481
|
+
e.systemPrompt && /* @__PURE__ */ z(y, {
|
|
513
482
|
value: n,
|
|
514
483
|
placeholder: p,
|
|
515
484
|
labelProps: {
|
|
516
|
-
className:
|
|
485
|
+
className: We,
|
|
517
486
|
label: f
|
|
518
487
|
},
|
|
519
488
|
onChange: (e) => o(e ?? "")
|
|
520
489
|
}),
|
|
521
|
-
e.temperature && /* @__PURE__ */
|
|
490
|
+
e.temperature && /* @__PURE__ */ z(E, {
|
|
522
491
|
labelProps: {
|
|
523
492
|
label: m,
|
|
524
|
-
className:
|
|
493
|
+
className: We,
|
|
525
494
|
caption: g
|
|
526
495
|
},
|
|
527
496
|
value: r,
|
|
@@ -532,8 +501,8 @@ var K = (e) => /* @__PURE__ */ H(x, { ...e }), Be = (e) => /* @__PURE__ */ H(p,
|
|
|
532
501
|
onChange: s
|
|
533
502
|
})
|
|
534
503
|
]
|
|
535
|
-
}),
|
|
536
|
-
let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: D, setResponseFormat:
|
|
504
|
+
}), Ge = ({ 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: A, setTemperature: ee, handleSubmit: j } = Ue({
|
|
537
506
|
isOpen: e,
|
|
538
507
|
features: o,
|
|
539
508
|
initialResponseFormat: c,
|
|
@@ -542,7 +511,7 @@ var K = (e) => /* @__PURE__ */ H(x, { ...e }), Be = (e) => /* @__PURE__ */ H(p,
|
|
|
542
511
|
onSave: d,
|
|
543
512
|
onClose: r
|
|
544
513
|
});
|
|
545
|
-
return /* @__PURE__ */
|
|
514
|
+
return /* @__PURE__ */ B(H, {
|
|
546
515
|
isOpen: e,
|
|
547
516
|
title: f,
|
|
548
517
|
closeLabel: i,
|
|
@@ -550,14 +519,14 @@ var K = (e) => /* @__PURE__ */ H(x, { ...e }), Be = (e) => /* @__PURE__ */ H(p,
|
|
|
550
519
|
onBack: t,
|
|
551
520
|
backLabel: n,
|
|
552
521
|
style: a,
|
|
553
|
-
children: [/* @__PURE__ */
|
|
522
|
+
children: [/* @__PURE__ */ z(G, {
|
|
554
523
|
features: o,
|
|
555
524
|
responseFormat: w,
|
|
556
525
|
systemPrompt: T,
|
|
557
526
|
temperature: E,
|
|
558
|
-
onResponseFormatChange:
|
|
559
|
-
onSystemPromptChange:
|
|
560
|
-
onTemperatureChange:
|
|
527
|
+
onResponseFormatChange: k,
|
|
528
|
+
onSystemPromptChange: A,
|
|
529
|
+
onTemperatureChange: ee,
|
|
561
530
|
responseFormatLabel: p,
|
|
562
531
|
responseFormatHint: m,
|
|
563
532
|
responseFormatMarkdownLabel: h,
|
|
@@ -567,23 +536,23 @@ var K = (e) => /* @__PURE__ */ H(x, { ...e }), Be = (e) => /* @__PURE__ */ H(p,
|
|
|
567
536
|
temperatureLabel: y,
|
|
568
537
|
temperatureLabels: b,
|
|
569
538
|
temperatureHint: x
|
|
570
|
-
}), /* @__PURE__ */
|
|
539
|
+
}), /* @__PURE__ */ z("div", {
|
|
571
540
|
className: s("px-6 py-4 mobile:pb-8"),
|
|
572
|
-
children: /* @__PURE__ */
|
|
541
|
+
children: /* @__PURE__ */ z(O, {
|
|
573
542
|
tooltip: C,
|
|
574
543
|
hideTooltip: D || !C,
|
|
575
544
|
triggerClassName: "w-full",
|
|
576
|
-
children: /* @__PURE__ */
|
|
545
|
+
children: /* @__PURE__ */ z(U, {
|
|
577
546
|
label: S,
|
|
578
|
-
onClick:
|
|
547
|
+
onClick: j,
|
|
579
548
|
disabled: !D,
|
|
580
549
|
className: "w-full"
|
|
581
550
|
})
|
|
582
551
|
})
|
|
583
552
|
})]
|
|
584
553
|
});
|
|
585
|
-
},
|
|
586
|
-
let { responseFormat: v, systemPrompt: y, temperature: x, canSubmit: S, setResponseFormat: C, setSystemPrompt: w, setTemperature: T, handleSubmit: E } =
|
|
554
|
+
}, K = ({ 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 } = Ue({
|
|
587
556
|
features: e,
|
|
588
557
|
initialResponseFormat: t,
|
|
589
558
|
initialSystemPrompt: n,
|
|
@@ -591,25 +560,25 @@ var K = (e) => /* @__PURE__ */ H(x, { ...e }), Be = (e) => /* @__PURE__ */ H(p,
|
|
|
591
560
|
onSave: i,
|
|
592
561
|
onClose: a
|
|
593
562
|
});
|
|
594
|
-
return /* @__PURE__ */
|
|
563
|
+
return /* @__PURE__ */ z(b, {
|
|
595
564
|
open: !0,
|
|
596
565
|
header: o,
|
|
597
566
|
size: A.Sm,
|
|
598
567
|
onClose: a,
|
|
599
568
|
className: "!bg-layer-2",
|
|
600
|
-
footer: /* @__PURE__ */
|
|
569
|
+
footer: /* @__PURE__ */ z("div", {
|
|
601
570
|
className: "flex justify-end px-6 py-4",
|
|
602
|
-
children: /* @__PURE__ */
|
|
571
|
+
children: /* @__PURE__ */ z(O, {
|
|
603
572
|
tooltip: _,
|
|
604
573
|
hideTooltip: S || !_,
|
|
605
|
-
children: /* @__PURE__ */
|
|
574
|
+
children: /* @__PURE__ */ z(U, {
|
|
606
575
|
label: g,
|
|
607
576
|
onClick: E,
|
|
608
577
|
disabled: !S
|
|
609
578
|
})
|
|
610
579
|
})
|
|
611
580
|
}),
|
|
612
|
-
children: /* @__PURE__ */
|
|
581
|
+
children: /* @__PURE__ */ z(G, {
|
|
613
582
|
features: e,
|
|
614
583
|
responseFormat: v,
|
|
615
584
|
systemPrompt: y,
|
|
@@ -629,15 +598,15 @@ var K = (e) => /* @__PURE__ */ H(x, { ...e }), Be = (e) => /* @__PURE__ */ H(p,
|
|
|
629
598
|
})
|
|
630
599
|
});
|
|
631
600
|
};
|
|
632
|
-
|
|
601
|
+
he(K);
|
|
633
602
|
//#endregion
|
|
634
603
|
//#region src/components/AddAttachmentButton/AddAttachmentButton.tsx
|
|
635
|
-
var
|
|
636
|
-
let g = c(), [_, y] =
|
|
604
|
+
var Ke = ({ 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] = L(!1), [b, x] = L(!1), S = F(() => [
|
|
637
606
|
...e == null ? [] : [{
|
|
638
607
|
key: "attach",
|
|
639
608
|
label: t,
|
|
640
|
-
icon: /* @__PURE__ */
|
|
609
|
+
icon: /* @__PURE__ */ z(se, {
|
|
641
610
|
size: l,
|
|
642
611
|
"aria-hidden": !0
|
|
643
612
|
}),
|
|
@@ -647,11 +616,11 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
647
616
|
...p == null ? [] : [{
|
|
648
617
|
key: "chat-settings",
|
|
649
618
|
label: p.menuItemLabel ?? "Chat settings",
|
|
650
|
-
icon: /* @__PURE__ */
|
|
619
|
+
icon: /* @__PURE__ */ z(de, {
|
|
651
620
|
size: l,
|
|
652
621
|
"aria-hidden": !0
|
|
653
622
|
}),
|
|
654
|
-
iconAfter: g ? /* @__PURE__ */
|
|
623
|
+
iconAfter: g ? /* @__PURE__ */ z(ie, {
|
|
655
624
|
size: l,
|
|
656
625
|
stroke: 1.5,
|
|
657
626
|
className: "text-secondary rtl:scale-x-[-1]",
|
|
@@ -666,9 +635,9 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
666
635
|
m,
|
|
667
636
|
g
|
|
668
637
|
]);
|
|
669
|
-
return S.length === 0 ? null : /* @__PURE__ */
|
|
670
|
-
/* @__PURE__ */
|
|
671
|
-
icon: /* @__PURE__ */
|
|
638
|
+
return S.length === 0 ? null : /* @__PURE__ */ z(R, { children: g ? /* @__PURE__ */ B(R, { children: [
|
|
639
|
+
/* @__PURE__ */ z(v, {
|
|
640
|
+
icon: /* @__PURE__ */ z(ue, {
|
|
672
641
|
size: f.LG,
|
|
673
642
|
"aria-hidden": !0
|
|
674
643
|
}),
|
|
@@ -677,7 +646,7 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
677
646
|
className: s("size-10 flex-shrink-0", d && "pointer-events-none opacity-50"),
|
|
678
647
|
onClick: () => y(!0)
|
|
679
648
|
}),
|
|
680
|
-
/* @__PURE__ */
|
|
649
|
+
/* @__PURE__ */ z(Be, {
|
|
681
650
|
isOpen: _,
|
|
682
651
|
title: r,
|
|
683
652
|
closeLabel: i,
|
|
@@ -687,7 +656,7 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
687
656
|
className: "pb-4",
|
|
688
657
|
btnTextClassName: "flex-1"
|
|
689
658
|
}),
|
|
690
|
-
p != null && /* @__PURE__ */
|
|
659
|
+
p != null && /* @__PURE__ */ z(Ge, {
|
|
691
660
|
isOpen: b,
|
|
692
661
|
onBack: () => {
|
|
693
662
|
x(!1), y(!0);
|
|
@@ -714,13 +683,13 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
714
683
|
saveLabel: p.saveLabel,
|
|
715
684
|
saveDisabledTooltip: p.saveDisabledTooltip
|
|
716
685
|
})
|
|
717
|
-
] }) : /* @__PURE__ */
|
|
686
|
+
] }) : /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(h, {
|
|
718
687
|
matchReferenceWidth: !1,
|
|
719
688
|
placement: "bottom-start",
|
|
720
689
|
listClassName: u,
|
|
721
690
|
items: S,
|
|
722
|
-
children: /* @__PURE__ */
|
|
723
|
-
icon: /* @__PURE__ */
|
|
691
|
+
children: /* @__PURE__ */ z(v, {
|
|
692
|
+
icon: /* @__PURE__ */ z(ue, {
|
|
724
693
|
size: f.LG,
|
|
725
694
|
"aria-hidden": !0
|
|
726
695
|
}),
|
|
@@ -729,7 +698,7 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
729
698
|
className: "size-10 flex-shrink-0",
|
|
730
699
|
disabled: d
|
|
731
700
|
})
|
|
732
|
-
}), p != null && b && /* @__PURE__ */
|
|
701
|
+
}), p != null && b && /* @__PURE__ */ z(K, {
|
|
733
702
|
features: p.features,
|
|
734
703
|
initialResponseFormat: p.responseFormat ?? a.Markdown,
|
|
735
704
|
initialSystemPrompt: p.systemPrompt,
|
|
@@ -749,114 +718,109 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
749
718
|
saveLabel: p.saveLabel,
|
|
750
719
|
saveDisabledTooltip: p.saveDisabledTooltip
|
|
751
720
|
})] }) });
|
|
752
|
-
},
|
|
753
|
-
container: "
|
|
754
|
-
containerError: "
|
|
755
|
-
waveformCanvas: "
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
let
|
|
762
|
-
let
|
|
763
|
-
if (!
|
|
764
|
-
e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
|
|
765
|
-
let { width: r, height: i } = e;
|
|
766
|
-
n.clearRect(0, 0, r, i), n.fillStyle = getComputedStyle(e).color;
|
|
767
|
-
let a = Math.min(1, t * 6), o = Math.max(1, Math.floor(r / 4));
|
|
768
|
-
for (let e = 0; e < o; e++) {
|
|
769
|
-
let t = e / o * qe * Math.PI, r = Math.max(Je, Math.abs(Math.sin(t)) * a), s = Math.max(3, r * i);
|
|
770
|
-
n.fillRect(e * 4, (i - s) / 2, Ke, s);
|
|
771
|
-
}
|
|
772
|
-
}, []), C = I((e, t) => {
|
|
773
|
-
let n = e.getContext("2d");
|
|
774
|
-
if (!n) return;
|
|
721
|
+
}, q = {
|
|
722
|
+
container: "_container_8j81i_1",
|
|
723
|
+
containerError: "_containerError_8j81i_14",
|
|
724
|
+
waveformCanvas: "_waveformCanvas_8j81i_18",
|
|
725
|
+
timer: "_timer_8j81i_22",
|
|
726
|
+
stopRecordingIcon: "_stopRecordingIcon_8j81i_28",
|
|
727
|
+
recordingDot: "_recordingDot_8j81i_42",
|
|
728
|
+
"recording-pulse": "_recording-pulse_8j81i_1"
|
|
729
|
+
}, qe = 3, Je = 4, J = 200, Ye = (e) => `${String(Math.floor(e / 60)).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`, Xe = ({ 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 = I(null), m = I(new Float32Array(J)), h = I(0), g = I(0), y = e === Pe.Recording, b = e === Pe.Error, x = M((e) => {
|
|
731
|
+
let t = e.getContext("2d");
|
|
732
|
+
if (!t) return;
|
|
775
733
|
e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
|
|
776
|
-
let { width:
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
for (let e = 0; e
|
|
781
|
-
let
|
|
782
|
-
|
|
734
|
+
let { width: n, height: r } = e;
|
|
735
|
+
t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
|
|
736
|
+
let i = Math.min(Math.max(1, Math.floor(n / Je)), J - 1), a = h.current, o = g.current;
|
|
737
|
+
t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
|
|
738
|
+
for (let e = 0; e <= i; e++) {
|
|
739
|
+
let n = ((a - i + e) % J + J) % J, o = m.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
|
|
740
|
+
t.fillRect(e * Je, (r - c) / 2, qe, c);
|
|
783
741
|
}
|
|
742
|
+
t.restore();
|
|
784
743
|
}, []);
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
let e =
|
|
788
|
-
|
|
744
|
+
N(() => {
|
|
745
|
+
if (!y) return;
|
|
746
|
+
let e = p.current;
|
|
747
|
+
if (!e) return;
|
|
748
|
+
m.current.fill(0), h.current = 0, g.current = 0;
|
|
749
|
+
let n, r = () => {
|
|
750
|
+
if (g.current += 1, g.current >= Je) {
|
|
751
|
+
g.current -= Je;
|
|
752
|
+
let e = t.current;
|
|
753
|
+
if (e) {
|
|
754
|
+
let t = new Uint8Array(e.frequencyBinCount);
|
|
755
|
+
e.getByteTimeDomainData(t);
|
|
756
|
+
let n = 0;
|
|
757
|
+
for (let e = 0; e < t.length; e++) {
|
|
758
|
+
let r = (t[e] - 128) / 128;
|
|
759
|
+
n += r * r;
|
|
760
|
+
}
|
|
761
|
+
m.current[h.current % J] = Math.sqrt(n / t.length), h.current++;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
x(e), n = requestAnimationFrame(r);
|
|
765
|
+
};
|
|
766
|
+
return n = requestAnimationFrame(r), () => {
|
|
767
|
+
cancelAnimationFrame(n);
|
|
768
|
+
};
|
|
789
769
|
}, [
|
|
770
|
+
y,
|
|
790
771
|
t,
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
let e = m.current;
|
|
772
|
+
x
|
|
773
|
+
]), N(() => {
|
|
774
|
+
let e = p.current;
|
|
795
775
|
if (!e) return;
|
|
796
776
|
let t = new ResizeObserver(() => {
|
|
797
|
-
|
|
798
|
-
let t = h.current;
|
|
799
|
-
S(e, t?.[t.length - 1] ?? 0);
|
|
800
|
-
} else C(e, h.current);
|
|
777
|
+
x(e);
|
|
801
778
|
});
|
|
802
779
|
return t.observe(e), () => t.disconnect();
|
|
803
|
-
}, [
|
|
804
|
-
let
|
|
780
|
+
}, [x]);
|
|
781
|
+
let S = /* @__PURE__ */ B("div", {
|
|
805
782
|
className: "flex flex-shrink-0 items-center justify-end gap-1",
|
|
806
|
-
children:
|
|
807
|
-
icon: /* @__PURE__ */
|
|
783
|
+
children: [/* @__PURE__ */ z(v, {
|
|
784
|
+
icon: /* @__PURE__ */ z(fe, {
|
|
808
785
|
size: f.LG,
|
|
809
|
-
className: J.micRecordingIcon,
|
|
810
786
|
"aria-hidden": !0
|
|
811
787
|
}),
|
|
812
|
-
"aria-label":
|
|
788
|
+
"aria-label": c,
|
|
813
789
|
className: "size-10 flex-shrink-0",
|
|
814
|
-
onClick:
|
|
815
|
-
})
|
|
816
|
-
icon: /* @__PURE__ */
|
|
790
|
+
onClick: a
|
|
791
|
+
}), y && /* @__PURE__ */ z(v, {
|
|
792
|
+
icon: /* @__PURE__ */ z(ce, {
|
|
817
793
|
size: f.LG,
|
|
794
|
+
className: q.stopRecordingIcon,
|
|
818
795
|
"aria-hidden": !0
|
|
819
796
|
}),
|
|
820
|
-
"aria-label":
|
|
821
|
-
className: "size-10 flex-shrink-0",
|
|
822
|
-
onClick: a
|
|
823
|
-
}), b ? /* @__PURE__ */ H(D, {
|
|
824
|
-
fullWidth: !1,
|
|
825
|
-
size: f.LG,
|
|
826
|
-
ariaLabel: u,
|
|
827
|
-
className: "flex size-10 flex-shrink-0 items-center justify-center"
|
|
828
|
-
}) : /* @__PURE__ */ H(v, {
|
|
829
|
-
icon: /* @__PURE__ */ H("div", {
|
|
830
|
-
className: "flex size-8 items-center justify-center rounded-full bg-controls-accent-primary",
|
|
831
|
-
children: /* @__PURE__ */ H(M, {
|
|
832
|
-
size: 24,
|
|
833
|
-
"aria-hidden": !0,
|
|
834
|
-
className: "rounded-full bg-controls-accent-primary text-control-permanent"
|
|
835
|
-
})
|
|
836
|
-
}),
|
|
837
|
-
"aria-label": c,
|
|
797
|
+
"aria-label": o,
|
|
838
798
|
className: "size-10 flex-shrink-0",
|
|
839
799
|
onClick: i
|
|
840
|
-
})]
|
|
800
|
+
})]
|
|
841
801
|
});
|
|
842
|
-
return /* @__PURE__ */
|
|
843
|
-
className:
|
|
844
|
-
children: [/* @__PURE__ */
|
|
845
|
-
style:
|
|
846
|
-
className: s(
|
|
847
|
-
children: [/* @__PURE__ */
|
|
802
|
+
return /* @__PURE__ */ B("div", {
|
|
803
|
+
className: d,
|
|
804
|
+
children: [/* @__PURE__ */ B("div", {
|
|
805
|
+
style: u,
|
|
806
|
+
className: s(q.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 && q.containerError),
|
|
807
|
+
children: [/* @__PURE__ */ B("div", {
|
|
848
808
|
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
849
|
-
children: [y && /* @__PURE__ */
|
|
850
|
-
className:
|
|
809
|
+
children: [y && /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("span", {
|
|
810
|
+
className: q.recordingDot,
|
|
851
811
|
"aria-hidden": !0
|
|
852
|
-
}), /* @__PURE__ */
|
|
853
|
-
|
|
812
|
+
}), /* @__PURE__ */ z("span", {
|
|
813
|
+
className: s(q.timer, "flex-shrink-0"),
|
|
814
|
+
"aria-label": l,
|
|
815
|
+
children: Ye(n)
|
|
816
|
+
})] }), /* @__PURE__ */ z("canvas", {
|
|
817
|
+
ref: p,
|
|
854
818
|
height: 32,
|
|
855
|
-
className: s(
|
|
819
|
+
className: s(q.waveformCanvas, "h-8 min-w-0 flex-1 desktop:h-6")
|
|
856
820
|
})]
|
|
857
|
-
}),
|
|
858
|
-
}),
|
|
859
|
-
text:
|
|
821
|
+
}), S]
|
|
822
|
+
}), b && r && /* @__PURE__ */ z(_, {
|
|
823
|
+
text: r,
|
|
860
824
|
className: "mt-1 px-1"
|
|
861
825
|
})]
|
|
862
826
|
});
|
|
@@ -872,73 +836,73 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
872
836
|
sendButtonEnter: "_sendButtonEnter_1q2nu_1",
|
|
873
837
|
sendButtonExiting: "_sendButtonExiting_1q2nu_55",
|
|
874
838
|
sendButtonExit: "_sendButtonExit_1q2nu_55"
|
|
875
|
-
},
|
|
839
|
+
}, Ze = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", title: r, isExiting: i = !1 }) => /* @__PURE__ */ z(O, {
|
|
876
840
|
tooltip: r,
|
|
877
841
|
hideTooltip: !r,
|
|
878
|
-
children: /* @__PURE__ */
|
|
842
|
+
children: /* @__PURE__ */ z("button", {
|
|
879
843
|
className: s("flex size-[32px] cursor-pointer items-center justify-center rounded-full disabled:cursor-not-allowed", Y.sendButton, i && Y.sendButtonExiting),
|
|
880
844
|
"aria-label": n,
|
|
881
845
|
onClick: () => e?.(),
|
|
882
846
|
type: "button",
|
|
883
847
|
disabled: t,
|
|
884
848
|
"aria-hidden": i,
|
|
885
|
-
children: /* @__PURE__ */
|
|
849
|
+
children: /* @__PURE__ */ z(te, {
|
|
886
850
|
size: f.LG,
|
|
887
851
|
className: "rtl:scale-x-[-1]"
|
|
888
852
|
})
|
|
889
853
|
})
|
|
890
|
-
}),
|
|
854
|
+
}), Qe = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ z("button", {
|
|
891
855
|
className: s("flex cursor-pointer items-center justify-center disabled:cursor-not-allowed"),
|
|
892
856
|
"aria-label": t,
|
|
893
857
|
onClick: () => e?.(),
|
|
894
858
|
type: "button",
|
|
895
|
-
children: /* @__PURE__ */
|
|
859
|
+
children: /* @__PURE__ */ z(le, {
|
|
896
860
|
size: f.LG,
|
|
897
861
|
className: Y.stopIcon
|
|
898
862
|
})
|
|
899
|
-
}),
|
|
863
|
+
}), $e = ({ size: e = 20 }) => /* @__PURE__ */ z(w, {
|
|
900
864
|
variant: T.Circular,
|
|
901
865
|
width: e,
|
|
902
866
|
height: e,
|
|
903
867
|
active: !0
|
|
904
|
-
}),
|
|
868
|
+
}), et = ({ loadingLabel: e }) => /* @__PURE__ */ B("span", {
|
|
905
869
|
className: "flex min-w-0 flex-1 items-center",
|
|
906
|
-
children: [/* @__PURE__ */
|
|
870
|
+
children: [/* @__PURE__ */ z(w, {
|
|
907
871
|
variant: T.Text,
|
|
908
872
|
width: "100%",
|
|
909
873
|
height: 16,
|
|
910
874
|
active: !0
|
|
911
|
-
}), e && /* @__PURE__ */
|
|
875
|
+
}), e && /* @__PURE__ */ z("span", {
|
|
912
876
|
className: "sr-only",
|
|
913
877
|
children: e
|
|
914
878
|
})]
|
|
915
|
-
}),
|
|
879
|
+
}), tt = ({ loadingLabel: e }) => /* @__PURE__ */ z("div", {
|
|
916
880
|
role: "status",
|
|
917
881
|
"aria-label": e,
|
|
918
|
-
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */
|
|
882
|
+
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ B("div", {
|
|
919
883
|
className: "flex h-11 items-center gap-3 px-4",
|
|
920
884
|
"aria-hidden": "true",
|
|
921
|
-
children: [/* @__PURE__ */
|
|
885
|
+
children: [/* @__PURE__ */ z($e, {}), /* @__PURE__ */ z(et, {})]
|
|
922
886
|
}, t))
|
|
923
|
-
}),
|
|
887
|
+
}), nt = (e) => e.displayName ?? e.id, rt = (e, t) => {
|
|
924
888
|
let n = t.trim().toLowerCase();
|
|
925
|
-
return n ? e.filter((e) =>
|
|
926
|
-
},
|
|
889
|
+
return n ? e.filter((e) => nt(e).toLowerCase().includes(n)) : e;
|
|
890
|
+
}, it = (e, t, r, i = 18, a) => /* @__PURE__ */ z(n, {
|
|
927
891
|
src: e,
|
|
928
892
|
size: i,
|
|
929
893
|
labels: { tooltip: a },
|
|
930
894
|
initialsName: r
|
|
931
|
-
}),
|
|
932
|
-
let [o, c] =
|
|
895
|
+
}), at = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: i, searchHeaderClassName: a = "bg-layer-0" }) => {
|
|
896
|
+
let [o, c] = L(""), l = F(() => e?.find((e) => e.id === t), [e, t]), u = i?.loading !== void 0, d = F(() => u ? /* @__PURE__ */ z($e, { size: f.LG }) : it(l?.iconUrl, l?.type, l?.displayName ?? l?.id ?? "", f.LG), [u, l]), p = l?.displayName ?? l?.id;
|
|
933
897
|
return {
|
|
934
898
|
selectorIcon: d,
|
|
935
899
|
selectorAriaLabel: p ? `${i?.ariaLabel ?? "Select model"}: ${p}` : i?.ariaLabel ?? "Select model",
|
|
936
900
|
selectedLabel: p,
|
|
937
|
-
menuItems:
|
|
901
|
+
menuItems: F(() => {
|
|
938
902
|
if (u) return Array.from({ length: 7 }, (e, t) => ({
|
|
939
903
|
key: `__loading-${t}`,
|
|
940
|
-
icon: /* @__PURE__ */
|
|
941
|
-
label: /* @__PURE__ */
|
|
904
|
+
icon: /* @__PURE__ */ z($e, {}),
|
|
905
|
+
label: /* @__PURE__ */ z(et, { loadingLabel: t === 0 ? i?.loading : void 0 }),
|
|
942
906
|
disabled: !0
|
|
943
907
|
}));
|
|
944
908
|
if (!e || e.length === 0) {
|
|
@@ -949,19 +913,19 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
949
913
|
disabled: !0
|
|
950
914
|
}] : [];
|
|
951
915
|
}
|
|
952
|
-
return
|
|
916
|
+
return rt(e, o).map((e) => {
|
|
953
917
|
let i = e.id === t;
|
|
954
918
|
return {
|
|
955
919
|
key: e.id,
|
|
956
|
-
label: /* @__PURE__ */
|
|
920
|
+
label: /* @__PURE__ */ B("span", {
|
|
957
921
|
className: "flex w-full items-center justify-between gap-2",
|
|
958
|
-
children: [/* @__PURE__ */
|
|
959
|
-
text:
|
|
922
|
+
children: [/* @__PURE__ */ z(r, {
|
|
923
|
+
text: nt(e),
|
|
960
924
|
query: o,
|
|
961
925
|
maxLines: 1
|
|
962
|
-
}), i && /* @__PURE__ */
|
|
926
|
+
}), i && /* @__PURE__ */ z(Ve, { gradientId: "ms-check-grad" })]
|
|
963
927
|
}),
|
|
964
|
-
icon:
|
|
928
|
+
icon: it(e.iconUrl, e.type, e.displayName ?? e.id),
|
|
965
929
|
onClick: () => n?.(e.id),
|
|
966
930
|
className: i ? "bg-accent-primary-alpha" : void 0
|
|
967
931
|
};
|
|
@@ -974,9 +938,9 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
974
938
|
i,
|
|
975
939
|
n
|
|
976
940
|
]),
|
|
977
|
-
menuHeader:
|
|
941
|
+
menuHeader: F(() => !u && e && e.length > 0 ? /* @__PURE__ */ z("div", {
|
|
978
942
|
className: s("sticky top-0 z-10 pb-1 pe-2 pt-2", a),
|
|
979
|
-
children: /* @__PURE__ */
|
|
943
|
+
children: /* @__PURE__ */ z(C, {
|
|
980
944
|
value: o,
|
|
981
945
|
placeholder: i?.searchPlaceholder ?? "Search",
|
|
982
946
|
size: k.Small,
|
|
@@ -994,8 +958,8 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
994
958
|
e || c("");
|
|
995
959
|
}
|
|
996
960
|
};
|
|
997
|
-
}, X = typeof window < "u" ?
|
|
998
|
-
function
|
|
961
|
+
}, X = typeof window < "u" ? ge : N;
|
|
962
|
+
function ot(e) {
|
|
999
963
|
if (e !== void 0) switch (typeof e) {
|
|
1000
964
|
case "number": return e;
|
|
1001
965
|
case "string":
|
|
@@ -1003,11 +967,11 @@ function at(e) {
|
|
|
1003
967
|
break;
|
|
1004
968
|
}
|
|
1005
969
|
}
|
|
1006
|
-
function
|
|
1007
|
-
let { styleHeight: s, styleWidth: c } =
|
|
1008
|
-
styleHeight:
|
|
1009
|
-
styleWidth:
|
|
1010
|
-
}), [o?.height, o?.width]), [l, u] =
|
|
970
|
+
function st({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
|
|
971
|
+
let { styleHeight: s, styleWidth: c } = F(() => ({
|
|
972
|
+
styleHeight: ot(o?.height),
|
|
973
|
+
styleWidth: ot(o?.width)
|
|
974
|
+
}), [o?.height, o?.width]), [l, u] = L({
|
|
1011
975
|
height: t,
|
|
1012
976
|
width: n
|
|
1013
977
|
}), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
|
|
@@ -1031,7 +995,7 @@ function ot({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1031
995
|
i,
|
|
1032
996
|
s,
|
|
1033
997
|
c
|
|
1034
|
-
]),
|
|
998
|
+
]), F(() => ({
|
|
1035
999
|
height: s ?? l.height,
|
|
1036
1000
|
width: c ?? l.width
|
|
1037
1001
|
}), [
|
|
@@ -1040,16 +1004,16 @@ function ot({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1040
1004
|
c
|
|
1041
1005
|
]);
|
|
1042
1006
|
}
|
|
1043
|
-
function
|
|
1044
|
-
let t =
|
|
1007
|
+
function ct(e) {
|
|
1008
|
+
let t = I(() => {
|
|
1045
1009
|
throw Error("Cannot call during render.");
|
|
1046
1010
|
});
|
|
1047
1011
|
return X(() => {
|
|
1048
1012
|
t.current = e;
|
|
1049
|
-
}, [e]),
|
|
1013
|
+
}, [e]), M((e) => t.current?.(e), [t]);
|
|
1050
1014
|
}
|
|
1051
1015
|
var Z = null;
|
|
1052
|
-
function
|
|
1016
|
+
function lt(e = !1) {
|
|
1053
1017
|
if (Z === null || e) {
|
|
1054
1018
|
let e = document.createElement("div"), t = e.style;
|
|
1055
1019
|
t.width = "50px", t.height = "50px", t.overflow = "scroll", t.direction = "rtl";
|
|
@@ -1058,8 +1022,8 @@ function ct(e = !1) {
|
|
|
1058
1022
|
}
|
|
1059
1023
|
return Z;
|
|
1060
1024
|
}
|
|
1061
|
-
function
|
|
1062
|
-
if (t === "horizontal" && n) switch (
|
|
1025
|
+
function ut({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
1026
|
+
if (t === "horizontal" && n) switch (lt()) {
|
|
1063
1027
|
case "negative": return -r;
|
|
1064
1028
|
case "positive-descending":
|
|
1065
1029
|
if (e) {
|
|
@@ -1079,7 +1043,7 @@ function $(e, t) {
|
|
|
1079
1043
|
for (let n in e) if (!Object.is(t[n], e[n])) return !1;
|
|
1080
1044
|
return !0;
|
|
1081
1045
|
}
|
|
1082
|
-
function
|
|
1046
|
+
function dt({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
1083
1047
|
if (t === 0) return 0;
|
|
1084
1048
|
if (typeof n == "number") return t * n;
|
|
1085
1049
|
{
|
|
@@ -1087,9 +1051,9 @@ function ut({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
|
1087
1051
|
return Q(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
|
|
1088
1052
|
}
|
|
1089
1053
|
}
|
|
1090
|
-
function
|
|
1054
|
+
function ft({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
|
|
1091
1055
|
if (n < 0 || n >= r) throw RangeError(`Invalid index specified: ${n}`, { cause: `Index ${n} is not within the range of 0 - ${r - 1}` });
|
|
1092
|
-
let s =
|
|
1056
|
+
let s = dt({
|
|
1093
1057
|
cachedBounds: t,
|
|
1094
1058
|
itemCount: r,
|
|
1095
1059
|
itemSize: i
|
|
@@ -1101,7 +1065,7 @@ function dt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, co
|
|
|
1101
1065
|
default: return a >= u && a <= l ? a : a < u ? u : l;
|
|
1102
1066
|
}
|
|
1103
1067
|
}
|
|
1104
|
-
function
|
|
1068
|
+
function pt({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
|
|
1105
1069
|
let a = r - 1, o = 0, s = -1, c = 0, l = -1, u = 0;
|
|
1106
1070
|
for (; u < a;) {
|
|
1107
1071
|
let n = e.get(u);
|
|
@@ -1120,7 +1084,7 @@ function ft({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemC
|
|
|
1120
1084
|
stopIndexOverscan: l
|
|
1121
1085
|
};
|
|
1122
1086
|
}
|
|
1123
|
-
function
|
|
1087
|
+
function mt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1124
1088
|
let r = /* @__PURE__ */ new Map();
|
|
1125
1089
|
return {
|
|
1126
1090
|
get(i) {
|
|
@@ -1157,8 +1121,8 @@ function pt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1157
1121
|
}
|
|
1158
1122
|
};
|
|
1159
1123
|
}
|
|
1160
|
-
function
|
|
1161
|
-
return
|
|
1124
|
+
function ht({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1125
|
+
return F(() => mt({
|
|
1162
1126
|
itemCount: e,
|
|
1163
1127
|
itemProps: t,
|
|
1164
1128
|
itemSize: n
|
|
@@ -1168,7 +1132,7 @@ function mt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1168
1132
|
n
|
|
1169
1133
|
]);
|
|
1170
1134
|
}
|
|
1171
|
-
function
|
|
1135
|
+
function gt({ containerSize: e, itemSize: t }) {
|
|
1172
1136
|
let n;
|
|
1173
1137
|
switch (typeof t) {
|
|
1174
1138
|
case "string":
|
|
@@ -1180,21 +1144,21 @@ function ht({ containerSize: e, itemSize: t }) {
|
|
|
1180
1144
|
}
|
|
1181
1145
|
return n;
|
|
1182
1146
|
}
|
|
1183
|
-
function
|
|
1184
|
-
let { height: u = n, width: d = n } =
|
|
1147
|
+
function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
|
|
1148
|
+
let { height: u = n, width: d = n } = st({
|
|
1185
1149
|
defaultHeight: r === "vertical" ? n : void 0,
|
|
1186
1150
|
defaultWidth: r === "horizontal" ? n : void 0,
|
|
1187
1151
|
element: e,
|
|
1188
1152
|
mode: r === "vertical" ? "only-height" : "only-width",
|
|
1189
1153
|
style: t
|
|
1190
|
-
}), f =
|
|
1154
|
+
}), f = I({
|
|
1191
1155
|
height: 0,
|
|
1192
1156
|
width: 0
|
|
1193
|
-
}), p = r === "vertical" ? u : d, m =
|
|
1157
|
+
}), p = r === "vertical" ? u : d, m = gt({
|
|
1194
1158
|
containerSize: p,
|
|
1195
1159
|
itemSize: s
|
|
1196
1160
|
});
|
|
1197
|
-
|
|
1161
|
+
ge(() => {
|
|
1198
1162
|
if (typeof c == "function") {
|
|
1199
1163
|
let e = f.current;
|
|
1200
1164
|
(e.height !== u || e.width !== d) && (c({
|
|
@@ -1207,11 +1171,11 @@ function gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1207
1171
|
c,
|
|
1208
1172
|
d
|
|
1209
1173
|
]);
|
|
1210
|
-
let h =
|
|
1174
|
+
let h = ht({
|
|
1211
1175
|
itemCount: a,
|
|
1212
1176
|
itemProps: o,
|
|
1213
1177
|
itemSize: m
|
|
1214
|
-
}), g =
|
|
1178
|
+
}), g = M((e) => h.get(e), [h]), [_, v] = L(() => pt({
|
|
1215
1179
|
cachedBounds: h,
|
|
1216
1180
|
containerScrollOffset: 0,
|
|
1217
1181
|
containerSize: p,
|
|
@@ -1222,7 +1186,7 @@ function gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1222
1186
|
startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
|
|
1223
1187
|
stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
|
|
1224
1188
|
stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
|
|
1225
|
-
}, C =
|
|
1189
|
+
}, C = M(() => dt({
|
|
1226
1190
|
cachedBounds: h,
|
|
1227
1191
|
itemCount: a,
|
|
1228
1192
|
itemSize: m
|
|
@@ -1230,9 +1194,9 @@ function gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1230
1194
|
h,
|
|
1231
1195
|
a,
|
|
1232
1196
|
m
|
|
1233
|
-
]), w =
|
|
1197
|
+
]), w = M((t) => pt({
|
|
1234
1198
|
cachedBounds: h,
|
|
1235
|
-
containerScrollOffset:
|
|
1199
|
+
containerScrollOffset: ut({
|
|
1236
1200
|
containerElement: e,
|
|
1237
1201
|
direction: r,
|
|
1238
1202
|
isRtl: i,
|
|
@@ -1260,9 +1224,9 @@ function gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1260
1224
|
if (!e) return;
|
|
1261
1225
|
let t = () => {
|
|
1262
1226
|
v((t) => {
|
|
1263
|
-
let { scrollLeft: n, scrollTop: o } = e, s =
|
|
1227
|
+
let { scrollLeft: n, scrollTop: o } = e, s = pt({
|
|
1264
1228
|
cachedBounds: h,
|
|
1265
|
-
containerScrollOffset:
|
|
1229
|
+
containerScrollOffset: ut({
|
|
1266
1230
|
containerElement: e,
|
|
1267
1231
|
direction: r,
|
|
1268
1232
|
isRtl: i,
|
|
@@ -1288,8 +1252,8 @@ function gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1288
1252
|
]), {
|
|
1289
1253
|
getCellBounds: g,
|
|
1290
1254
|
getEstimatedSize: C,
|
|
1291
|
-
scrollToIndex:
|
|
1292
|
-
let s =
|
|
1255
|
+
scrollToIndex: ct(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
|
|
1256
|
+
let s = ft({
|
|
1293
1257
|
align: t,
|
|
1294
1258
|
cachedBounds: h,
|
|
1295
1259
|
containerScrollOffset: n,
|
|
@@ -1299,7 +1263,7 @@ function gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1299
1263
|
itemSize: m
|
|
1300
1264
|
});
|
|
1301
1265
|
if (e) {
|
|
1302
|
-
if (s =
|
|
1266
|
+
if (s = ut({
|
|
1303
1267
|
containerElement: e,
|
|
1304
1268
|
direction: r,
|
|
1305
1269
|
isRtl: i,
|
|
@@ -1317,30 +1281,30 @@ function gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1317
1281
|
stopIndexVisible: x
|
|
1318
1282
|
};
|
|
1319
1283
|
}
|
|
1320
|
-
function
|
|
1321
|
-
return
|
|
1284
|
+
function vt(e) {
|
|
1285
|
+
return F(() => e, Object.values(e));
|
|
1322
1286
|
}
|
|
1323
|
-
function
|
|
1287
|
+
function yt(e, t) {
|
|
1324
1288
|
let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
|
|
1325
1289
|
return $(n, a) && $(r, o) && $(i, s);
|
|
1326
1290
|
}
|
|
1327
|
-
function
|
|
1291
|
+
function bt(e) {
|
|
1328
1292
|
return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
|
|
1329
1293
|
}
|
|
1330
|
-
var
|
|
1331
|
-
function
|
|
1332
|
-
let m =
|
|
1294
|
+
var xt = "data-react-window-index";
|
|
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 = 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({
|
|
1333
1297
|
containerElement: g,
|
|
1334
1298
|
containerStyle: f,
|
|
1335
1299
|
defaultContainerSize: n,
|
|
1336
1300
|
direction: "vertical",
|
|
1337
1301
|
itemCount: c,
|
|
1338
1302
|
itemProps: m,
|
|
1339
|
-
itemSize:
|
|
1303
|
+
itemSize: F(() => v ? (e) => l.getRowHeight(e) ?? l.getAverageRowHeight() : l, [v, l]),
|
|
1340
1304
|
onResize: i,
|
|
1341
1305
|
overscanCount: o
|
|
1342
1306
|
});
|
|
1343
|
-
|
|
1307
|
+
P(r, () => ({
|
|
1344
1308
|
get element() {
|
|
1345
1309
|
return g;
|
|
1346
1310
|
},
|
|
@@ -1360,7 +1324,7 @@ function xt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1360
1324
|
let e = Array.from(g.children).filter((e, t) => {
|
|
1361
1325
|
if (e.hasAttribute("aria-hidden")) return !1;
|
|
1362
1326
|
let n = `${S + t}`;
|
|
1363
|
-
return e.setAttribute(
|
|
1327
|
+
return e.setAttribute(xt, n), !0;
|
|
1364
1328
|
});
|
|
1365
1329
|
if (v) return l.observeRowElements(e);
|
|
1366
1330
|
}, [
|
|
@@ -1369,7 +1333,7 @@ function xt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1369
1333
|
l,
|
|
1370
1334
|
S,
|
|
1371
1335
|
w
|
|
1372
|
-
]),
|
|
1336
|
+
]), N(() => {
|
|
1373
1337
|
S >= 0 && w >= 0 && a && a({
|
|
1374
1338
|
startIndex: C,
|
|
1375
1339
|
stopIndex: T
|
|
@@ -1384,11 +1348,11 @@ function xt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1384
1348
|
w,
|
|
1385
1349
|
T
|
|
1386
1350
|
]);
|
|
1387
|
-
let E =
|
|
1351
|
+
let E = F(() => {
|
|
1388
1352
|
let e = [];
|
|
1389
1353
|
if (c > 0) for (let t = S; t <= w; t++) {
|
|
1390
1354
|
let n = y(t);
|
|
1391
|
-
e.push(/* @__PURE__ */
|
|
1355
|
+
e.push(/* @__PURE__ */ me(h, {
|
|
1392
1356
|
...m,
|
|
1393
1357
|
ariaAttributes: {
|
|
1394
1358
|
"aria-posinset": t + 1,
|
|
@@ -1415,7 +1379,7 @@ function xt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1415
1379
|
m,
|
|
1416
1380
|
S,
|
|
1417
1381
|
w
|
|
1418
|
-
]), D = /* @__PURE__ */
|
|
1382
|
+
]), D = /* @__PURE__ */ z("div", {
|
|
1419
1383
|
"aria-hidden": !0,
|
|
1420
1384
|
style: {
|
|
1421
1385
|
height: b(),
|
|
@@ -1423,7 +1387,7 @@ function xt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1423
1387
|
zIndex: -1
|
|
1424
1388
|
}
|
|
1425
1389
|
});
|
|
1426
|
-
return
|
|
1390
|
+
return me(d, {
|
|
1427
1391
|
role: "list",
|
|
1428
1392
|
...p,
|
|
1429
1393
|
className: t,
|
|
@@ -1437,47 +1401,47 @@ function xt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1437
1401
|
}
|
|
1438
1402
|
}, E, e, D);
|
|
1439
1403
|
}
|
|
1440
|
-
var
|
|
1404
|
+
var Ct = {
|
|
1441
1405
|
divider: "_divider_3wv6u_1",
|
|
1442
1406
|
item: "_item_3wv6u_5",
|
|
1443
1407
|
itemIcon: "_itemIcon_3wv6u_15",
|
|
1444
1408
|
checkIcon: "_checkIcon_3wv6u_19",
|
|
1445
1409
|
stateLabel: "_stateLabel_3wv6u_23"
|
|
1446
|
-
},
|
|
1447
|
-
let u = i[e], d =
|
|
1448
|
-
return /* @__PURE__ */
|
|
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 = it(u.iconUrl, u.type, u.displayName ?? u.id, f.SM), m = u.id === a;
|
|
1412
|
+
return /* @__PURE__ */ z("div", {
|
|
1449
1413
|
style: t,
|
|
1450
1414
|
...n,
|
|
1451
|
-
children: /* @__PURE__ */
|
|
1415
|
+
children: /* @__PURE__ */ z(p, {
|
|
1452
1416
|
type: "button",
|
|
1453
|
-
className: s(
|
|
1454
|
-
iconBefore: /* @__PURE__ */
|
|
1455
|
-
className:
|
|
1417
|
+
className: s(Ct.item, "flex h-full w-full items-center gap-3 px-4"),
|
|
1418
|
+
iconBefore: /* @__PURE__ */ z("span", {
|
|
1419
|
+
className: Ct.itemIcon,
|
|
1456
1420
|
children: d
|
|
1457
1421
|
}),
|
|
1458
|
-
label: /* @__PURE__ */
|
|
1422
|
+
label: /* @__PURE__ */ B("span", {
|
|
1459
1423
|
className: "flex flex-1 items-center justify-between gap-2",
|
|
1460
|
-
children: [/* @__PURE__ */
|
|
1424
|
+
children: [/* @__PURE__ */ z(r, {
|
|
1461
1425
|
text: u.displayName ?? u.id,
|
|
1462
1426
|
query: c,
|
|
1463
1427
|
maxLines: 1,
|
|
1464
1428
|
className: s(o, "min-w-0 flex-1 text-start")
|
|
1465
|
-
}), m && /* @__PURE__ */
|
|
1429
|
+
}), m && /* @__PURE__ */ z(ne, {
|
|
1466
1430
|
size: f.SM,
|
|
1467
|
-
className:
|
|
1431
|
+
className: Ct.checkIcon,
|
|
1468
1432
|
"aria-hidden": !0
|
|
1469
1433
|
})]
|
|
1470
1434
|
}),
|
|
1471
1435
|
onClick: () => l(u.id)
|
|
1472
1436
|
})
|
|
1473
1437
|
});
|
|
1474
|
-
},
|
|
1475
|
-
let [h, g] =
|
|
1476
|
-
|
|
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] = L("");
|
|
1440
|
+
N(() => {
|
|
1477
1441
|
e || g("");
|
|
1478
1442
|
}, [e]);
|
|
1479
|
-
let _ = a && a.length > 0, v = l !== void 0, y = !_ && !v ? u ?? d : void 0, b = _ ?
|
|
1480
|
-
return /* @__PURE__ */
|
|
1443
|
+
let _ = a && a.length > 0, v = l !== void 0, y = !_ && !v ? u ?? d : void 0, b = _ ? rt(a, h) : [];
|
|
1444
|
+
return /* @__PURE__ */ B(H, {
|
|
1481
1445
|
isOpen: e,
|
|
1482
1446
|
title: t,
|
|
1483
1447
|
closeLabel: n,
|
|
@@ -1485,25 +1449,25 @@ var St = {
|
|
|
1485
1449
|
style: f,
|
|
1486
1450
|
titleClassName: p,
|
|
1487
1451
|
className: "max-h-[80dvh]",
|
|
1488
|
-
children: [_ && !v && /* @__PURE__ */
|
|
1452
|
+
children: [_ && !v && /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("div", {
|
|
1489
1453
|
className: "flex-shrink-0 px-4 py-[10px]",
|
|
1490
|
-
children: /* @__PURE__ */
|
|
1454
|
+
children: /* @__PURE__ */ z(C, {
|
|
1491
1455
|
value: h,
|
|
1492
1456
|
placeholder: r,
|
|
1493
1457
|
size: k.Standard,
|
|
1494
1458
|
onChange: g
|
|
1495
1459
|
})
|
|
1496
|
-
}), /* @__PURE__ */
|
|
1460
|
+
}), /* @__PURE__ */ z("div", { className: s(Ct.divider, "h-px flex-shrink-0") })] }), v ? /* @__PURE__ */ z(tt, { loadingLabel: l }) : y ? /* @__PURE__ */ z("div", {
|
|
1497
1461
|
role: "list",
|
|
1498
|
-
className: s(
|
|
1462
|
+
className: s(Ct.stateLabel, m, "px-4 py-4"),
|
|
1499
1463
|
children: y
|
|
1500
|
-
}) : /* @__PURE__ */
|
|
1464
|
+
}) : /* @__PURE__ */ z(St, {
|
|
1501
1465
|
role: "list",
|
|
1502
1466
|
className: "overflow-y-auto",
|
|
1503
|
-
style: { height: Math.min(b.length,
|
|
1504
|
-
rowComponent:
|
|
1467
|
+
style: { height: Math.min(b.length, Tt) * wt },
|
|
1468
|
+
rowComponent: Et,
|
|
1505
1469
|
rowCount: b.length,
|
|
1506
|
-
rowHeight:
|
|
1470
|
+
rowHeight: wt,
|
|
1507
1471
|
rowProps: {
|
|
1508
1472
|
items: b,
|
|
1509
1473
|
selectedDeploymentId: o,
|
|
@@ -1515,23 +1479,23 @@ var St = {
|
|
|
1515
1479
|
}
|
|
1516
1480
|
})]
|
|
1517
1481
|
});
|
|
1518
|
-
},
|
|
1519
|
-
let [_, y] =
|
|
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] = L(!1), { selectorIcon: b, selectorAriaLabel: x, selectedLabel: S, menuItems: C, menuHeader: w, onOpenChange: T } = at({
|
|
1520
1484
|
deployments: e,
|
|
1521
1485
|
selectedDeploymentId: t,
|
|
1522
1486
|
onDeploymentChange: n,
|
|
1523
1487
|
modelSelectorLabels: r
|
|
1524
1488
|
});
|
|
1525
1489
|
if (!e) return null;
|
|
1526
|
-
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__ */ z(re, {
|
|
1527
1491
|
size: f.SM,
|
|
1528
1492
|
className: Y.modelSelectorCaret,
|
|
1529
1493
|
"aria-hidden": !0
|
|
1530
1494
|
});
|
|
1531
|
-
return a ? /* @__PURE__ */
|
|
1495
|
+
return a ? /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(O, {
|
|
1532
1496
|
tooltip: S,
|
|
1533
|
-
children: /* @__PURE__ */
|
|
1534
|
-
icon: /* @__PURE__ */
|
|
1497
|
+
children: /* @__PURE__ */ z(v, {
|
|
1498
|
+
icon: /* @__PURE__ */ B("div", {
|
|
1535
1499
|
className: "flex items-center gap-1",
|
|
1536
1500
|
children: [b, D]
|
|
1537
1501
|
}),
|
|
@@ -1541,14 +1505,14 @@ var St = {
|
|
|
1541
1505
|
},
|
|
1542
1506
|
className: s(Y.modelSelectorButton, E)
|
|
1543
1507
|
})
|
|
1544
|
-
}), u ? /* @__PURE__ */ H
|
|
1508
|
+
}), u ? /* @__PURE__ */ z(H, {
|
|
1545
1509
|
isOpen: _,
|
|
1546
1510
|
title: r?.ariaLabel ?? "Select model",
|
|
1547
1511
|
closeLabel: r?.closeLabel ?? "Close",
|
|
1548
1512
|
onClose: () => y(!1),
|
|
1549
1513
|
style: l,
|
|
1550
1514
|
children: u(() => y(!1))
|
|
1551
|
-
}) : /* @__PURE__ */
|
|
1515
|
+
}) : /* @__PURE__ */ z(Dt, {
|
|
1552
1516
|
isOpen: _,
|
|
1553
1517
|
title: r?.ariaLabel ?? "Select model",
|
|
1554
1518
|
closeLabel: r?.closeLabel ?? "Close",
|
|
@@ -1561,7 +1525,7 @@ var St = {
|
|
|
1561
1525
|
errorLabel: r?.error,
|
|
1562
1526
|
emptyLabel: r?.empty,
|
|
1563
1527
|
style: l
|
|
1564
|
-
})] }) : u ? /* @__PURE__ */
|
|
1528
|
+
})] }) : u ? /* @__PURE__ */ z(h, {
|
|
1565
1529
|
placement: "top-end",
|
|
1566
1530
|
matchReferenceWidth: !1,
|
|
1567
1531
|
open: d,
|
|
@@ -1570,9 +1534,9 @@ var St = {
|
|
|
1570
1534
|
outsideClosable: !0,
|
|
1571
1535
|
renderOverlay: () => u(() => m?.(!1)),
|
|
1572
1536
|
listClassName: "cp-dropdown-overlay !w-[320px]",
|
|
1573
|
-
children: /* @__PURE__ */
|
|
1537
|
+
children: /* @__PURE__ */ z(O, {
|
|
1574
1538
|
tooltip: S,
|
|
1575
|
-
children: /* @__PURE__ */
|
|
1539
|
+
children: /* @__PURE__ */ B("button", {
|
|
1576
1540
|
type: "button",
|
|
1577
1541
|
"aria-label": x,
|
|
1578
1542
|
className: s("flex items-center justify-center gap-1 rounded-md p-2", Y.modelSelectorButton, o || i || c ? E : void 0, (o || c) && Y.modelSelectorButtonDisabled),
|
|
@@ -1582,12 +1546,12 @@ var St = {
|
|
|
1582
1546
|
children: [b, D]
|
|
1583
1547
|
})
|
|
1584
1548
|
})
|
|
1585
|
-
}) : /* @__PURE__ */
|
|
1549
|
+
}) : /* @__PURE__ */ z("div", {
|
|
1586
1550
|
className: s(c && E),
|
|
1587
1551
|
"aria-disabled": c || void 0,
|
|
1588
|
-
children: /* @__PURE__ */
|
|
1552
|
+
children: /* @__PURE__ */ z(O, {
|
|
1589
1553
|
tooltip: S,
|
|
1590
|
-
children: /* @__PURE__ */
|
|
1554
|
+
children: /* @__PURE__ */ z(g, {
|
|
1591
1555
|
icon: b,
|
|
1592
1556
|
ariaLabel: x,
|
|
1593
1557
|
items: C,
|
|
@@ -1603,126 +1567,125 @@ var St = {
|
|
|
1603
1567
|
})
|
|
1604
1568
|
})
|
|
1605
1569
|
});
|
|
1606
|
-
},
|
|
1607
|
-
let
|
|
1608
|
-
"--ci-bg":
|
|
1609
|
-
"--ci-text":
|
|
1610
|
-
"--ci-border":
|
|
1611
|
-
"--ci-border-hover":
|
|
1612
|
-
"--ci-border-focus":
|
|
1613
|
-
"--ci-placeholder":
|
|
1614
|
-
"--ci-shadow":
|
|
1615
|
-
"--ci-shadow-focus":
|
|
1616
|
-
"--ci-send-bg":
|
|
1617
|
-
"--ci-send-text":
|
|
1618
|
-
"--ci-stop-color":
|
|
1619
|
-
}), [
|
|
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: A, className: ee, pendingDropFiles: j = [], onDropFilesConsumed: te, pendingAttachments: ne = [], onPendingAttachmentsConsumed: re, pasteTextThreshold: ie = 4e3, deployments: se, 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, isAudioMessageSupported: _e = !1, sendOnEnter: ve = Re.Enter, prefixAttachments: V = [], onRemovePrefixAttachment: be, chatSettings: xe, autoFocus: Se = !1, messageHistory: Ce, onDialFileSystemClick: Te, dialFileSystemLabel: Ee, validateAttachment: H, onAttachmentClick: De, modelPickerOverlay: Ae, maximumAttachmentsAmount: je, onAttachmentsLimitExceeded: Pe }) => {
|
|
1571
|
+
let Fe = c(), [Ie, ze] = L(!1), Be = Me(Ce), Ve = F(() => o({
|
|
1572
|
+
"--ci-bg": k?.background,
|
|
1573
|
+
"--ci-text": k?.text,
|
|
1574
|
+
"--ci-border": k?.border,
|
|
1575
|
+
"--ci-border-hover": k?.borderHover,
|
|
1576
|
+
"--ci-border-focus": k?.borderFocus,
|
|
1577
|
+
"--ci-placeholder": k?.placeholder,
|
|
1578
|
+
"--ci-shadow": k?.shadow,
|
|
1579
|
+
"--ci-shadow-focus": k?.shadowFocus,
|
|
1580
|
+
"--ci-send-bg": k?.sendBackground,
|
|
1581
|
+
"--ci-send-text": k?.sendText,
|
|
1582
|
+
"--ci-stop-color": k?.stopColor
|
|
1583
|
+
}), [k]), He = F(() => Te ? [{
|
|
1620
1584
|
key: "dial-fs",
|
|
1621
|
-
label:
|
|
1622
|
-
icon: /* @__PURE__ */
|
|
1585
|
+
label: Ee ?? "DIAL file system",
|
|
1586
|
+
icon: /* @__PURE__ */ z(ae, {
|
|
1623
1587
|
size: l,
|
|
1624
1588
|
"aria-hidden": !0
|
|
1625
1589
|
}),
|
|
1626
|
-
onClick:
|
|
1627
|
-
}] : [], [
|
|
1590
|
+
onClick: Te
|
|
1591
|
+
}] : [], [Te, Ee]), { message: U, setMessage: W, textareaRef: Ue, isMultiLine: We } = Ne({
|
|
1628
1592
|
messageProp: e,
|
|
1629
1593
|
messageRevision: t
|
|
1630
|
-
}), { attachments:
|
|
1631
|
-
initialAttachments:
|
|
1594
|
+
}), { attachments: G, buildAttachments: Ge, addAttachments: K, resetAttachments: q, handleRemove: qe, handleRetry: Je, handleExpand: J, hasBlockedAttachments: Ye } = Oe({
|
|
1595
|
+
initialAttachments: de,
|
|
1632
1596
|
onUploadAttachment: r,
|
|
1633
1597
|
onAttachmentsChange: d,
|
|
1634
|
-
validateAttachment:
|
|
1635
|
-
pendingDropFiles:
|
|
1636
|
-
onDropFilesConsumed:
|
|
1637
|
-
pendingAttachments:
|
|
1638
|
-
onPendingAttachmentsConsumed:
|
|
1639
|
-
onExpandPastedText:
|
|
1640
|
-
|
|
1641
|
-
}, [
|
|
1642
|
-
maximumAttachmentsAmount:
|
|
1643
|
-
baseAttachmentsAmount:
|
|
1644
|
-
onAttachmentsLimitExceeded:
|
|
1645
|
-
}), { state:
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
}, [u, K])
|
|
1651
|
-
}), X = z(null), at = z(null), { handlePaste: ot } = Se(Ue, ne), st = G.trim().length > 0 || q.length > 0, Z = st && !Je, { shouldRender: ct, isExiting: lt, instanceKey: Q } = De(!a && st, Ot), $ = se || q.length > 0 || G.includes("\n") || Ve, ut = j === void 0 || M != null, dt = async () => {
|
|
1652
|
-
let e = G, t = q;
|
|
1653
|
-
K(""), Le.reset();
|
|
1598
|
+
validateAttachment: H,
|
|
1599
|
+
pendingDropFiles: j,
|
|
1600
|
+
onDropFilesConsumed: te,
|
|
1601
|
+
pendingAttachments: ne,
|
|
1602
|
+
onPendingAttachmentsConsumed: re,
|
|
1603
|
+
onExpandPastedText: M((e) => {
|
|
1604
|
+
W((t) => t ? `${t}\n${e}` : e);
|
|
1605
|
+
}, [W]),
|
|
1606
|
+
maximumAttachmentsAmount: je,
|
|
1607
|
+
baseAttachmentsAmount: V.length,
|
|
1608
|
+
onAttachmentsLimitExceeded: Pe
|
|
1609
|
+
}), { state: $e, analyserNodeRef: et, elapsedSeconds: tt, errorMessage: nt, startRecording: rt, stopRecording: it, discardRecording: at } = Le({ onAttachAudio: M((e) => {
|
|
1610
|
+
K(Ge([e]));
|
|
1611
|
+
}, [K, Ge]) }), X = I(null), ot = I(null), { handlePaste: st } = we(K, ie), ct = U.trim().length > 0 || G.length > 0, Z = ct && !Ye, { shouldRender: lt, isExiting: ut, instanceKey: Q } = ke(!a && ct, kt), $ = fe || G.length > 0 || U.includes("\n") || We, dt = se === void 0 || ce != null, ft = async () => {
|
|
1612
|
+
let e = U, t = G;
|
|
1613
|
+
W(""), Be.reset();
|
|
1654
1614
|
try {
|
|
1655
1615
|
await n?.(e, t), t.forEach((e) => {
|
|
1656
1616
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl);
|
|
1657
|
-
}),
|
|
1617
|
+
}), q([]);
|
|
1658
1618
|
} catch {
|
|
1659
|
-
|
|
1619
|
+
W(e), q(t);
|
|
1660
1620
|
}
|
|
1661
|
-
},
|
|
1662
|
-
if (!e.nativeEvent.isComposing && !
|
|
1663
|
-
let t = e.currentTarget.selectionStart ?? 0, n =
|
|
1621
|
+
}, pt = (e) => {
|
|
1622
|
+
if (!e.nativeEvent.isComposing && !P && !a && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
|
|
1623
|
+
let t = e.currentTarget.selectionStart ?? 0, n = Be.navigate(e.key === "ArrowUp" ? "up" : "down", U, t);
|
|
1664
1624
|
if (n !== null) {
|
|
1665
|
-
e.preventDefault(),
|
|
1625
|
+
e.preventDefault(), W(n);
|
|
1666
1626
|
return;
|
|
1667
1627
|
}
|
|
1668
1628
|
}
|
|
1669
|
-
e.key === "Enter" && (
|
|
1670
|
-
},
|
|
1629
|
+
e.key === "Enter" && (ve === Re.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey) && (e.preventDefault(), !a && Z && dt && !P && ft());
|
|
1630
|
+
}, mt = (e) => {
|
|
1671
1631
|
let t = Array.from(e.target.files ?? []);
|
|
1672
1632
|
if (t.length === 0) return;
|
|
1673
|
-
let n =
|
|
1674
|
-
e.target.value = "",
|
|
1633
|
+
let n = Ge(t);
|
|
1634
|
+
e.target.value = "", K(n);
|
|
1675
1635
|
};
|
|
1676
|
-
if (
|
|
1677
|
-
state:
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
onDiscard:
|
|
1683
|
-
|
|
1636
|
+
if ($e !== "idle") return /* @__PURE__ */ z(Xe, {
|
|
1637
|
+
state: $e,
|
|
1638
|
+
analyserNodeRef: et,
|
|
1639
|
+
elapsedSeconds: tt,
|
|
1640
|
+
errorMessage: nt,
|
|
1641
|
+
onStop: it,
|
|
1642
|
+
onDiscard: at,
|
|
1643
|
+
stopLabel: E,
|
|
1644
|
+
discardLabel: D,
|
|
1645
|
+
timerLabel: O,
|
|
1646
|
+
style: Ve,
|
|
1684
1647
|
className: ee
|
|
1685
1648
|
});
|
|
1686
|
-
let
|
|
1687
|
-
className: s(Y.textarea,
|
|
1688
|
-
ref:
|
|
1689
|
-
autoFocus:
|
|
1690
|
-
value:
|
|
1649
|
+
let ht = /* @__PURE__ */ z("textarea", {
|
|
1650
|
+
className: s(Y.textarea, A?.fontClassName, "max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent outline-none [field-sizing:content]"),
|
|
1651
|
+
ref: Ue,
|
|
1652
|
+
autoFocus: Se,
|
|
1653
|
+
value: U,
|
|
1691
1654
|
onChange: (e) => {
|
|
1692
|
-
|
|
1655
|
+
W(e.target.value), Be.notifyChange(), u?.(e.target.value);
|
|
1693
1656
|
},
|
|
1694
|
-
onKeyDown:
|
|
1695
|
-
onPaste:
|
|
1657
|
+
onKeyDown: pt,
|
|
1658
|
+
onPaste: st,
|
|
1696
1659
|
placeholder: p,
|
|
1697
1660
|
"aria-label": m,
|
|
1698
|
-
disabled:
|
|
1661
|
+
disabled: P,
|
|
1699
1662
|
rows: 1
|
|
1700
1663
|
});
|
|
1701
|
-
return /* @__PURE__ */
|
|
1702
|
-
ref:
|
|
1703
|
-
style:
|
|
1704
|
-
className: s(Y.wrapper,
|
|
1705
|
-
children: [(
|
|
1706
|
-
attachments: [...
|
|
1664
|
+
return /* @__PURE__ */ B("div", {
|
|
1665
|
+
ref: ot,
|
|
1666
|
+
style: Ve,
|
|
1667
|
+
className: s(Y.wrapper, P && Y.wrapperDisabled, "flex min-h-[56px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border", G.length > 6 ? "py-3 ps-3" : "p-3", ee),
|
|
1668
|
+
children: [(V.length > 0 || G.length > 0) && /* @__PURE__ */ z(ye, {
|
|
1669
|
+
attachments: [...V, ...G],
|
|
1707
1670
|
onRemove: (e) => {
|
|
1708
|
-
|
|
1671
|
+
V.some((t) => t.id === e) ? be?.(e) : qe(e);
|
|
1709
1672
|
},
|
|
1710
|
-
onRetry:
|
|
1711
|
-
onExpand:
|
|
1673
|
+
onRetry: Je,
|
|
1674
|
+
onExpand: J,
|
|
1712
1675
|
labels: {
|
|
1713
1676
|
removeLabel: x,
|
|
1714
1677
|
retryLabel: S
|
|
1715
1678
|
},
|
|
1716
|
-
onAttachmentClick:
|
|
1717
|
-
let t =
|
|
1718
|
-
t != null &&
|
|
1679
|
+
onAttachmentClick: De == null ? void 0 : (e) => {
|
|
1680
|
+
let t = [...V, ...G].find((t) => t.id === e);
|
|
1681
|
+
t != null && De(t);
|
|
1719
1682
|
}
|
|
1720
|
-
}),
|
|
1683
|
+
}), he ? $ && ht : /* @__PURE__ */ B("div", {
|
|
1721
1684
|
className: s("flex items-center gap-2", $ ? "flex-wrap" : "flex-wrap desktop:flex-nowrap"),
|
|
1722
1685
|
children: [
|
|
1723
|
-
!
|
|
1686
|
+
!pe && /* @__PURE__ */ B("div", {
|
|
1724
1687
|
className: s("order-2 flex", !$ && "desktop:order-1"),
|
|
1725
|
-
children: [/* @__PURE__ */
|
|
1688
|
+
children: [/* @__PURE__ */ z("input", {
|
|
1726
1689
|
ref: X,
|
|
1727
1690
|
type: "file",
|
|
1728
1691
|
multiple: !0,
|
|
@@ -1730,78 +1693,78 @@ var St = {
|
|
|
1730
1693
|
className: "sr-only",
|
|
1731
1694
|
"aria-hidden": !0,
|
|
1732
1695
|
tabIndex: -1,
|
|
1733
|
-
onChange:
|
|
1734
|
-
}), /* @__PURE__ */
|
|
1735
|
-
onAttachClick:
|
|
1696
|
+
onChange: mt
|
|
1697
|
+
}), /* @__PURE__ */ z(Ke, {
|
|
1698
|
+
onAttachClick: me ? void 0 : () => X.current?.click(),
|
|
1736
1699
|
attachLabel: h,
|
|
1737
1700
|
addMenuTitle: _,
|
|
1738
1701
|
menuTitle: y,
|
|
1739
1702
|
menuCloseLabel: b,
|
|
1740
|
-
style:
|
|
1741
|
-
isDisabled:
|
|
1742
|
-
chatSettings:
|
|
1743
|
-
extraMenuItems:
|
|
1703
|
+
style: Ve,
|
|
1704
|
+
isDisabled: P,
|
|
1705
|
+
chatSettings: xe,
|
|
1706
|
+
extraMenuItems: He
|
|
1744
1707
|
})]
|
|
1745
1708
|
}),
|
|
1746
|
-
/* @__PURE__ */
|
|
1709
|
+
/* @__PURE__ */ z("div", {
|
|
1747
1710
|
className: s("order-1 flex w-full min-w-0 items-center self-stretch", !$ && "desktop:order-2 desktop:w-auto desktop:flex-1"),
|
|
1748
|
-
children:
|
|
1711
|
+
children: ht
|
|
1749
1712
|
}),
|
|
1750
|
-
/* @__PURE__ */
|
|
1713
|
+
/* @__PURE__ */ B("div", {
|
|
1751
1714
|
className: s("flex flex-shrink-0 items-center gap-2", "order-3 ms-auto", !$ && "desktop:ms-0"),
|
|
1752
|
-
children: [
|
|
1715
|
+
children: [N ? N({
|
|
1753
1716
|
canSend: Z,
|
|
1754
|
-
onSend:
|
|
1755
|
-
}) : /* @__PURE__ */
|
|
1756
|
-
deployments:
|
|
1757
|
-
selectedDeploymentId:
|
|
1758
|
-
onDeploymentChange:
|
|
1759
|
-
modelSelectorLabels:
|
|
1717
|
+
onSend: ft
|
|
1718
|
+
}) : /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(Ot, {
|
|
1719
|
+
deployments: se,
|
|
1720
|
+
selectedDeploymentId: ce,
|
|
1721
|
+
onDeploymentChange: le,
|
|
1722
|
+
modelSelectorLabels: ue,
|
|
1760
1723
|
isStreaming: a,
|
|
1761
|
-
isMobile:
|
|
1762
|
-
isInputDisabled:
|
|
1763
|
-
isDisabled:
|
|
1764
|
-
style:
|
|
1765
|
-
modelPickerOverlay:
|
|
1766
|
-
isPickerOpen:
|
|
1767
|
-
onPickerToggle: () =>
|
|
1768
|
-
onPickerOpenChange:
|
|
1769
|
-
}), a && i ? /* @__PURE__ */
|
|
1724
|
+
isMobile: Fe,
|
|
1725
|
+
isInputDisabled: P,
|
|
1726
|
+
isDisabled: ge,
|
|
1727
|
+
style: Ve,
|
|
1728
|
+
modelPickerOverlay: Ae,
|
|
1729
|
+
isPickerOpen: Ie,
|
|
1730
|
+
onPickerToggle: () => ze((e) => !e),
|
|
1731
|
+
onPickerOpenChange: ze
|
|
1732
|
+
}), a && i ? /* @__PURE__ */ z(Qe, {
|
|
1770
1733
|
onStop: i,
|
|
1771
1734
|
ariaLabel: w
|
|
1772
|
-
}) : !a &&
|
|
1773
|
-
onSend:
|
|
1774
|
-
isDisabled: !
|
|
1735
|
+
}) : !a && lt && /* @__PURE__ */ z(Ze, {
|
|
1736
|
+
onSend: ft,
|
|
1737
|
+
isDisabled: !dt || Ye,
|
|
1775
1738
|
ariaLabel: C,
|
|
1776
|
-
isExiting:
|
|
1777
|
-
}, Q)] }),
|
|
1778
|
-
icon: /* @__PURE__ */
|
|
1739
|
+
isExiting: ut
|
|
1740
|
+
}, Q)] }), _e && !ut && /* @__PURE__ */ z(v, {
|
|
1741
|
+
icon: /* @__PURE__ */ z(oe, {
|
|
1779
1742
|
size: f.LG,
|
|
1780
1743
|
"aria-hidden": !0
|
|
1781
1744
|
}),
|
|
1782
1745
|
"aria-label": T,
|
|
1783
1746
|
className: "size-8 flex-shrink-0",
|
|
1784
|
-
onClick:
|
|
1785
|
-
disabled:
|
|
1747
|
+
onClick: rt,
|
|
1748
|
+
disabled: P || a
|
|
1786
1749
|
})]
|
|
1787
1750
|
})
|
|
1788
1751
|
]
|
|
1789
1752
|
})]
|
|
1790
1753
|
});
|
|
1791
|
-
},
|
|
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, isInputDisabled: a = !1, ...c }) => {
|
|
1792
1755
|
let { colors: l, typography: u } = r ?? {};
|
|
1793
|
-
return /* @__PURE__ */
|
|
1756
|
+
return /* @__PURE__ */ B("div", {
|
|
1794
1757
|
style: o({
|
|
1795
1758
|
"--ci-root-bg": l?.background,
|
|
1796
1759
|
"--ci-welcome-color": l?.welcomeText
|
|
1797
1760
|
}),
|
|
1798
1761
|
className: s("relative flex w-full flex-col items-center gap-6 px-4 py-5 desktop:p-5", i),
|
|
1799
|
-
children: [n && /* @__PURE__ */
|
|
1800
|
-
className: s(
|
|
1762
|
+
children: [n && /* @__PURE__ */ z("h1", {
|
|
1763
|
+
className: s(jt.welcome, "m-0 text-center", u?.welcomeClassName),
|
|
1801
1764
|
children: n
|
|
1802
|
-
}), /* @__PURE__ */
|
|
1765
|
+
}), /* @__PURE__ */ z("div", {
|
|
1803
1766
|
className: "relative w-full max-w-[748px]",
|
|
1804
|
-
children: /* @__PURE__ */
|
|
1767
|
+
children: /* @__PURE__ */ z(At, {
|
|
1805
1768
|
placeholder: t,
|
|
1806
1769
|
isStreaming: e,
|
|
1807
1770
|
isInputDisabled: a,
|
|
@@ -1811,86 +1774,87 @@ var St = {
|
|
|
1811
1774
|
})
|
|
1812
1775
|
})]
|
|
1813
1776
|
});
|
|
1814
|
-
},
|
|
1815
|
-
let
|
|
1816
|
-
|
|
1817
|
-
v?.length && (
|
|
1777
|
+
}, 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 A = I(null), [ee, j] = L([]);
|
|
1779
|
+
N(() => {
|
|
1780
|
+
v?.length && (j(v), y?.());
|
|
1818
1781
|
}, [v, y]);
|
|
1819
|
-
let [te, ne] =
|
|
1820
|
-
|
|
1821
|
-
},
|
|
1822
|
-
r(e,
|
|
1823
|
-
}, [
|
|
1824
|
-
|
|
1825
|
-
},
|
|
1782
|
+
let [te, ne] = L(e ?? ""), [re, ie] = L([]), [oe, se] = L(t), ce = re.some((e) => e.status === i.Loading || e.status === i.Error), le = (te.trim().length > 0 || re.length > 0 || oe.length > 0) && !ce, ue = (e) => {
|
|
1783
|
+
se((t) => t.filter((t) => t.id !== e));
|
|
1784
|
+
}, de = M((e, t) => {
|
|
1785
|
+
r(e, oe, t);
|
|
1786
|
+
}, [oe, r]), fe = () => {
|
|
1787
|
+
le && de(te, re);
|
|
1788
|
+
}, pe = M(() => j([]), []), me = M((e) => {
|
|
1826
1789
|
let t = Array.from(e.target.files ?? []);
|
|
1827
|
-
t.length !== 0 && (e.target.value = "",
|
|
1828
|
-
}, []),
|
|
1790
|
+
t.length !== 0 && (e.target.value = "", j(t));
|
|
1791
|
+
}, []), he = F(() => T ? [{
|
|
1829
1792
|
key: "dial-fs",
|
|
1830
1793
|
label: E ?? "DIAL file system",
|
|
1831
|
-
icon: /* @__PURE__ */
|
|
1794
|
+
icon: /* @__PURE__ */ z(ae, {
|
|
1832
1795
|
size: l,
|
|
1833
1796
|
"aria-hidden": !0
|
|
1834
1797
|
}),
|
|
1835
1798
|
onClick: T
|
|
1836
1799
|
}] : [], [T, E]);
|
|
1837
|
-
return /* @__PURE__ */
|
|
1800
|
+
return /* @__PURE__ */ B("div", {
|
|
1838
1801
|
className: s("flex w-full flex-col gap-2", _),
|
|
1839
|
-
children: [/* @__PURE__ */
|
|
1802
|
+
children: [/* @__PURE__ */ z(At, {
|
|
1840
1803
|
message: e,
|
|
1841
1804
|
ariaLabel: u,
|
|
1842
1805
|
isStacked: !0,
|
|
1843
1806
|
hideActionBar: !0,
|
|
1844
|
-
pendingDropFiles:
|
|
1845
|
-
onDropFilesConsumed:
|
|
1846
|
-
onSend:
|
|
1807
|
+
pendingDropFiles: ee,
|
|
1808
|
+
onDropFilesConsumed: pe,
|
|
1809
|
+
onSend: de,
|
|
1847
1810
|
onUploadAttachment: a,
|
|
1848
1811
|
onChange: ne,
|
|
1849
|
-
onAttachmentsChange:
|
|
1812
|
+
onAttachmentsChange: ie,
|
|
1850
1813
|
removeLabel: d,
|
|
1851
1814
|
retryLabel: f,
|
|
1852
1815
|
className: "max-w-full",
|
|
1853
|
-
prefixAttachments:
|
|
1854
|
-
onRemovePrefixAttachment:
|
|
1816
|
+
prefixAttachments: oe,
|
|
1817
|
+
onRemovePrefixAttachment: ue,
|
|
1855
1818
|
validateAttachment: b,
|
|
1856
1819
|
maximumAttachmentsAmount: C,
|
|
1857
1820
|
onAttachmentsLimitExceeded: w,
|
|
1858
1821
|
pendingAttachments: D,
|
|
1859
|
-
onPendingAttachmentsConsumed:
|
|
1860
|
-
|
|
1822
|
+
onPendingAttachmentsConsumed: O,
|
|
1823
|
+
onAttachmentClick: k
|
|
1824
|
+
}), /* @__PURE__ */ B("div", {
|
|
1861
1825
|
className: "flex items-center justify-between",
|
|
1862
|
-
children: [/* @__PURE__ */
|
|
1826
|
+
children: [/* @__PURE__ */ z("div", {
|
|
1863
1827
|
className: "flex",
|
|
1864
|
-
children: !x && /* @__PURE__ */
|
|
1865
|
-
ref:
|
|
1828
|
+
children: !x && /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("input", {
|
|
1829
|
+
ref: A,
|
|
1866
1830
|
type: "file",
|
|
1867
1831
|
multiple: !0,
|
|
1868
1832
|
accept: S,
|
|
1869
1833
|
className: "sr-only",
|
|
1870
1834
|
"aria-hidden": !0,
|
|
1871
1835
|
tabIndex: -1,
|
|
1872
|
-
onChange:
|
|
1873
|
-
}), /* @__PURE__ */
|
|
1874
|
-
onAttachClick: () =>
|
|
1836
|
+
onChange: me
|
|
1837
|
+
}), /* @__PURE__ */ z(Ke, {
|
|
1838
|
+
onAttachClick: () => A.current?.click(),
|
|
1875
1839
|
attachLabel: m,
|
|
1876
1840
|
addMenuTitle: p,
|
|
1877
1841
|
menuTitle: h,
|
|
1878
1842
|
menuCloseLabel: g,
|
|
1879
|
-
extraMenuItems:
|
|
1843
|
+
extraMenuItems: he
|
|
1880
1844
|
})] })
|
|
1881
|
-
}), /* @__PURE__ */
|
|
1845
|
+
}), /* @__PURE__ */ B("div", {
|
|
1882
1846
|
className: "flex gap-2",
|
|
1883
|
-
children: [/* @__PURE__ */
|
|
1847
|
+
children: [/* @__PURE__ */ z(W, {
|
|
1884
1848
|
label: o,
|
|
1885
1849
|
onClick: n
|
|
1886
|
-
}), /* @__PURE__ */
|
|
1850
|
+
}), /* @__PURE__ */ z(U, {
|
|
1887
1851
|
label: c,
|
|
1888
|
-
onClick:
|
|
1889
|
-
disabled: !
|
|
1852
|
+
onClick: fe,
|
|
1853
|
+
disabled: !le
|
|
1890
1854
|
})]
|
|
1891
1855
|
})]
|
|
1892
1856
|
})]
|
|
1893
1857
|
});
|
|
1894
1858
|
};
|
|
1895
1859
|
//#endregion
|
|
1896
|
-
export {
|
|
1860
|
+
export { _e as AttachmentCard, ve as AttachmentGroup, V as AttachmentTray, H as BottomSheetShell, K as ChatSettingsModal, Mt as ConversationInput, Nt as EditMessageInput, be as FileDndOverlay, At as Input, Re as SendOnEnter, Ce as getAttachmentIcon };
|