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