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